mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-12-06 23:08:36 +01:00
Work on vectors integration.
This commit is contained in:
56
src/Netzmacht/Contao/Leaflet/Mapper/Vector/CircleMapper.php
Normal file
56
src/Netzmacht/Contao/Leaflet/Mapper/Vector/CircleMapper.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package dev
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @copyright 2015 netzmacht creative David Molineus
|
||||
* @license LGPL 3.0
|
||||
* @filesource
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
||||
|
||||
|
||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||
use Netzmacht\LeafletPHP\Definition;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\LatLng;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
||||
use Netzmacht\LeafletPHP\Definition\Vector\Circle;
|
||||
|
||||
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';
|
||||
|
||||
protected function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
|
||||
$this->addOption('radius');
|
||||
}
|
||||
|
||||
protected function doBuild(
|
||||
Definition $definition,
|
||||
\Model $model,
|
||||
DefinitionMapper $builder,
|
||||
LatLngBounds $bounds = null
|
||||
) {
|
||||
parent::doBuild($definition, $model, $builder, $bounds);
|
||||
|
||||
if ($definition instanceof Circle) {
|
||||
$definition->setLatLng(LatLng::fromString($model->coordinates));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user