locomotivemtl/charcoal-geolocation

Charcoal geolocation tools

dev-master / 0.1.x-dev 2022-04-07 21:23 UTC

This package is auto-updated.

Last update: 2024-04-08 02:26:42 UTC


README

License Latest Stable Version Code Quality Coverage Status Build Status

A Charcoal service provider my cool feature.

Table of Contents

Installation

The preferred (and only supported) method is with Composer:

$ composer require locomotivemtl/charcoal-geolocation

Dependencies

Required

Configuration

Add the views and the metadata paths to the config file.

"metadata": {
       "paths": [
           "...",
           "vendor/locomotivemtl/charcoal-geolocation/metadata/"
       ]
   },
   "view": {
       "paths": [
           "...",
           "vendor/locomotivemtl/charcoal-geolocation/views/"
       ]
   }

Usage

The module is basically a collection of properties, inputs and widgets. All you have to do is use them.

  • GeolocationCollection widget implementation example for an object's dashboard :
"map": {
    "type": "charcoal/geolocation/widget/geolocation-collection",
    "geometry_property": "geometry",
    "infobox_template": "project/widget/example-infobox",
    "priority": 10
}

To use the properties provided by this Module, you have to refer to them with their full PHP path from the object metadata : Charcoal\\Geolocation\\Property\\MapStructureProperty Charcoal\\Geolocation\\Property\\PointProperty Charcoal\\Geolocation\\Property\\PolylineProperty Charcoal\\Geolocation\\Property\\PolygonProperty

Widgets

The following base widgets are available to build the various admin templates:

  • GeolocationCollection
    • Widget That can show a collection of object that has a property that implements GeolocationInterface
    • Specify the property ident to use
    • Specify a template to show the

Property Inputs

The following property inputs are available to build forms in the admin module:

  • MapStructure

    • A specialized widget to add and edit geolocation data on a map.
      • Supported geolocation types:
        • Point
        • Polyline
        • Polygon
    • Cannot be multiple
    • Requires google-map.
    • Requires gmap.
    • Extends StructureProperty from charcoal-property.
    • Implements GeolocationInterface.
  • AbstractGeolocation

    • Base property for:
      • Point
      • Polyline
      • Polygon
    • Extends AbstractProperty from charcoal-property.
    • Implements GeolocationInterface.
  • Point

    • A specialized widget to add and edit Point geolocation data on a map.
    • Requires google-map.
    • Requires gmap.
  • Polyline

    • A specialized widget to add and edit Polyline geolocation data on a map.
    • Requires google-map.
    • Requires gmap.
  • Polygon

    • A specialized widget to add and edit Polygon geolocation data on a map.
    • Requires google-map.
    • Requires gmap.

Development

To install the development environment:

$ composer install

To run the scripts (phplint, phpcs, and phpunit):

$ composer test

API Documentation

Development Dependencies

  • [php-coveralls/php-coveralls][phpcov]
  • [phpunit/phpunit][phpunit]
  • [squizlabs/php_codesniffer][phpcs]
  • [seld/jsonlint][jsonlint]

Coding Style

The charcoal-geolocation module follows the Charcoal coding-style:

Coding style validation / enforcement can be performed with composer phpcs. An auto-fixer is also available with composer phpcbf.

Credits

License

Charcoal is licensed under the MIT license. See LICENSE for details.