forked from Snck3rs/contao-leaflet-maps
Switch to PSR-4.
This commit is contained in:
68
src/Mapper/Vector/CircleMapper.php
Normal file
68
src/Mapper/Vector/CircleMapper.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @copyright 2014-2016 netzmacht David Molineus
|
||||
* @license LGPL 3.0
|
||||
* @filesource
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
||||
|
||||
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||
use Netzmacht\LeafletPHP\Definition;
|
||||
use Netzmacht\LeafletPHP\Definition\Vector\CircleMarker;
|
||||
use Netzmacht\LeafletPHP\Value\LatLng;
|
||||
use Netzmacht\LeafletPHP\Definition\Vector\Circle;
|
||||
|
||||
/**
|
||||
* Class CircleMapper maps the database model to the circle definition.
|
||||
*
|
||||
* @package Netzmacht\Contao\Leaflet\Mapper\Vector
|
||||
*/
|
||||
class CircleMapper extends AbstractVectorMapper
|
||||
{
|
||||
/**
|
||||
* Class of the definition being created.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $definitionClass = 'Netzmacht\LeafletPHP\Definition\Vector\Circle';
|
||||
|
||||
/**
|
||||
* Layer type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $type = 'circle';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
|
||||
$this->optionsBuilder->addOption('radius');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function build(
|
||||
Definition $definition,
|
||||
\Model $model,
|
||||
DefinitionMapper $mapper,
|
||||
Filter $filter = null,
|
||||
Definition $parent = null
|
||||
) {
|
||||
parent::build($definition, $model, $mapper, $filter);
|
||||
|
||||
if ($definition instanceof CircleMarker) {
|
||||
$definition->setLatLng(LatLng::fromString($model->coordinates));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user