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

59 lines
1.5 KiB
PHP

<?php
/**
* Leaflet maps for Contao CMS.
*
* @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource
*/
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
use Contao\Model;
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
use Netzmacht\Contao\Leaflet\Request\Request;
use Netzmacht\LeafletPHP\Definition;
use Netzmacht\LeafletPHP\Definition\Vector\Polygon;
/**
* Class MultiPolygonMapper maps the multi polygon database model to its definition.
*
* @package Netzmacht\Contao\Leaflet\Mapper\Vector
*/
class MultiPolygonMapper extends MultiPolylineMapper
{
/**
* Class of the definition being created.
*
* @var string
*/
protected static $definitionClass = 'Netzmacht\LeafletPHP\Definition\Vector\Polygon';
/**
* Layer type.
*
* @var string
*/
protected static $type = 'multiPolygon';
/**
* {@inheritdoc}
*/
protected function build(
Definition $definition,
Model $model,
DefinitionMapper $mapper,
Request $request = null,
Definition $parent = null
) {
parent::build($definition, $model, $mapper, $request);
if ($definition instanceof Polygon) {
$this->createLatLngs($definition, $model);
}
}
}