2015-01-07 17:59:56 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
2017-10-05 15:45:43 +02:00
|
|
|
* Leaflet maps for Contao CMS.
|
|
|
|
|
*
|
2016-10-11 10:40:15 +02:00
|
|
|
* @package contao-leaflet-maps
|
2015-01-07 17:59:56 +01:00
|
|
|
* @author David Molineus <david.molineus@netzmacht.de>
|
2017-10-05 15:45:43 +02:00
|
|
|
* @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
|
|
|
|
|
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
|
2015-01-07 17:59:56 +01:00
|
|
|
* @filesource
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
|
|
|
|
|
2015-01-24 21:37:25 +01:00
|
|
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
2015-01-07 17:59:56 +01:00
|
|
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
|
|
|
|
use Netzmacht\LeafletPHP\Definition;
|
2016-10-05 10:54:05 +02:00
|
|
|
use Netzmacht\LeafletPHP\Definition\Vector\Polygon;
|
2015-01-07 17:59:56 +01:00
|
|
|
|
2015-01-12 19:03:29 +01:00
|
|
|
/**
|
|
|
|
|
* Class MultiPolygonMapper maps the multi polygon database model to its definition.
|
|
|
|
|
*
|
|
|
|
|
* @package Netzmacht\Contao\Leaflet\Mapper\Vector
|
|
|
|
|
*/
|
2015-01-07 17:59:56 +01:00
|
|
|
class MultiPolygonMapper extends MultiPolylineMapper
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Class of the definition being created.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
2016-10-05 10:54:05 +02:00
|
|
|
protected static $definitionClass = 'Netzmacht\LeafletPHP\Definition\Vector\Polygon';
|
2015-01-07 17:59:56 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Layer type.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
protected static $type = 'multiPolygon';
|
|
|
|
|
|
2015-01-12 19:03:29 +01:00
|
|
|
/**
|
|
|
|
|
* {@inheritdoc}
|
|
|
|
|
*/
|
2015-01-08 09:51:43 +01:00
|
|
|
protected function build(
|
2015-01-07 17:59:56 +01:00
|
|
|
Definition $definition,
|
|
|
|
|
\Model $model,
|
2015-01-20 16:38:23 +01:00
|
|
|
DefinitionMapper $mapper,
|
2015-01-24 21:37:25 +01:00
|
|
|
Filter $filter = null,
|
2015-01-20 16:38:23 +01:00
|
|
|
Definition $parent = null
|
2015-01-07 17:59:56 +01:00
|
|
|
) {
|
2015-01-24 21:37:25 +01:00
|
|
|
parent::build($definition, $model, $mapper, $filter);
|
2015-01-07 17:59:56 +01:00
|
|
|
|
2016-10-05 10:54:05 +02:00
|
|
|
if ($definition instanceof Polygon) {
|
2015-01-12 19:03:29 +01:00
|
|
|
$this->createLatLngs($definition, $model);
|
2015-01-07 17:59:56 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|