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

59 lines
1.5 KiB
PHP
Raw Normal View History

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;
use Contao\Model;
2015-01-07 17:59:56 +01:00
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
use Netzmacht\Contao\Leaflet\Request\Request;
2015-01-07 17:59:56 +01:00
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,
Request $request = 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, $request);
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
}
}
}