Files
contao-leaflet-maps/src/Mapper/Vector/MultiPolygonMapper.php

57 lines
1.3 KiB
PHP
Raw Normal View History

2015-01-07 17:59:56 +01:00
<?php
/**
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>
2016-10-11 10:40:15 +02:00
* @copyright 2014-2016 netzmacht David Molineus
2015-01-07 17:59:56 +01:00
* @license LGPL 3.0
* @filesource
*
*/
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
use Netzmacht\Contao\Leaflet\Filter\Filter;
2015-01-07 17:59:56 +01:00
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
use Netzmacht\LeafletPHP\Definition;
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
*/
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}
*/
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,
Filter $filter = null,
2015-01-20 16:38:23 +01:00
Definition $parent = null
2015-01-07 17:59:56 +01:00
) {
parent::build($definition, $model, $mapper, $filter);
2015-01-07 17:59:56 +01: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
}
}
}