2014-12-29 12:17:40 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
2016-10-11 10:40:15 +02:00
|
|
|
* @package contao-leaflet-maps
|
2014-12-29 12:17:40 +01:00
|
|
|
* @author David Molineus <david.molineus@netzmacht.de>
|
2016-10-11 10:40:15 +02:00
|
|
|
* @copyright 2014-2016 netzmacht David Molineus
|
2014-12-29 12:17:40 +01:00
|
|
|
* @license LGPL 3.0
|
|
|
|
|
* @filesource
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace Netzmacht\Contao\Leaflet\Event;
|
|
|
|
|
|
|
|
|
|
use Netzmacht\LeafletPHP\Definition;
|
2015-01-27 12:41:11 +01:00
|
|
|
use Netzmacht\LeafletPHP\Value\LatLngBounds;
|
2014-12-29 12:17:40 +01:00
|
|
|
use Symfony\Component\EventDispatcher\Event;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class BuildDefinitionEvent is emitted when the mapper maps between the model and the definition.
|
|
|
|
|
*
|
|
|
|
|
* @package Netzmacht\Contao\Leaflet\Event
|
|
|
|
|
*/
|
|
|
|
|
class BuildDefinitionEvent extends Event
|
|
|
|
|
{
|
|
|
|
|
const NAME = 'leaflet.mapper.definition';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The leaflet object definition.
|
|
|
|
|
*
|
|
|
|
|
* @var Definition
|
|
|
|
|
*/
|
|
|
|
|
private $definition;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The model.
|
|
|
|
|
*
|
|
|
|
|
* @var \Model
|
|
|
|
|
*/
|
|
|
|
|
private $model;
|
|
|
|
|
|
2015-01-06 14:55:53 +01:00
|
|
|
/**
|
|
|
|
|
* Optional bounds where elements should be in.
|
|
|
|
|
*
|
|
|
|
|
* @var LatLngBounds
|
|
|
|
|
*/
|
|
|
|
|
private $bounds;
|
|
|
|
|
|
2014-12-29 12:17:40 +01:00
|
|
|
/**
|
|
|
|
|
* Construct.
|
|
|
|
|
*
|
2015-01-06 14:55:53 +01:00
|
|
|
* @param Definition $definition The leaflet definition.
|
|
|
|
|
* @param \Model $model The definition model.
|
|
|
|
|
* @param LatLngBounds $bounds Optional bounds where elements should be in.
|
2014-12-29 12:17:40 +01:00
|
|
|
*/
|
2015-01-12 19:03:29 +01:00
|
|
|
public function __construct(Definition $definition, \Model $model, LatLngBounds $bounds = null)
|
2014-12-29 12:17:40 +01:00
|
|
|
{
|
|
|
|
|
$this->definition = $definition;
|
2015-01-06 14:55:53 +01:00
|
|
|
$this->model = $model;
|
|
|
|
|
$this->bounds = $bounds;
|
2014-12-29 12:17:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the definition.
|
|
|
|
|
*
|
|
|
|
|
* @return Definition
|
|
|
|
|
*/
|
|
|
|
|
public function getDefinition()
|
|
|
|
|
{
|
|
|
|
|
return $this->definition;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the model.
|
|
|
|
|
*
|
|
|
|
|
* @return \Model
|
|
|
|
|
*/
|
|
|
|
|
public function getModel()
|
|
|
|
|
{
|
|
|
|
|
return $this->model;
|
|
|
|
|
}
|
2015-01-06 14:55:53 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the bounds.
|
|
|
|
|
*
|
|
|
|
|
* @return LatLngBounds|null
|
|
|
|
|
*/
|
|
|
|
|
public function getBounds()
|
|
|
|
|
{
|
|
|
|
|
return $this->bounds;
|
|
|
|
|
}
|
2014-12-29 12:17:40 +01:00
|
|
|
}
|