forked from Snck3rs/contao-leaflet-maps
Refactor the mappers to use the filters.
This commit is contained in:
@@ -11,8 +11,8 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper;
|
namespace Netzmacht\Contao\Leaflet\Mapper;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AbstractMapper is made for mapping Contao models to the definition.
|
* Class AbstractMapper is made for mapping Contao models to the definition.
|
||||||
@@ -62,14 +62,14 @@ abstract class AbstractMapper implements Mapper
|
|||||||
public function handle(
|
public function handle(
|
||||||
$model,
|
$model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
$elementId = null,
|
$elementId = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
$definition = $this->createInstance($model, $mapper, $bounds, $elementId);
|
$definition = $this->createInstance($model, $mapper, $filter, $elementId);
|
||||||
|
|
||||||
$this->optionsBuilder->build($definition, $model);
|
$this->optionsBuilder->build($definition, $model);
|
||||||
$this->build($definition, $model, $mapper, $bounds, $parent);
|
$this->build($definition, $model, $mapper, $filter, $parent);
|
||||||
|
|
||||||
return $definition;
|
return $definition;
|
||||||
}
|
}
|
||||||
@@ -77,7 +77,7 @@ abstract class AbstractMapper implements Mapper
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function match($model, LatLngBounds $bounds = null)
|
public function match($model, Filter $filter = null)
|
||||||
{
|
{
|
||||||
$modelClass = static::$modelClass;
|
$modelClass = static::$modelClass;
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ abstract class AbstractMapper implements Mapper
|
|||||||
* @param Definition $definition The definition being built.
|
* @param Definition $definition The definition being built.
|
||||||
* @param \Model $model The model.
|
* @param \Model $model The model.
|
||||||
* @param DefinitionMapper $mapper The definition mapper.
|
* @param DefinitionMapper $mapper The definition mapper.
|
||||||
* @param LatLngBounds $bounds Optional bounds where elements should be in.
|
* @param Filter|null $filter Optional request filter.
|
||||||
* @param Definition|null $parent The parent object.
|
* @param Definition|null $parent The parent object.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
@@ -110,7 +110,7 @@ abstract class AbstractMapper implements Mapper
|
|||||||
Definition $definition,
|
Definition $definition,
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ abstract class AbstractMapper implements Mapper
|
|||||||
*
|
*
|
||||||
* @param \Model $model The model.
|
* @param \Model $model The model.
|
||||||
* @param DefinitionMapper $mapper The definition mapper.
|
* @param DefinitionMapper $mapper The definition mapper.
|
||||||
* @param LatLngBounds $bounds Optional bounds where elements should be in.
|
* @param Filter $filter Optional request filter.
|
||||||
* @param string|null $elementId Optional element id.
|
* @param string|null $elementId Optional element id.
|
||||||
*
|
*
|
||||||
* @return Definition
|
* @return Definition
|
||||||
@@ -128,11 +128,11 @@ abstract class AbstractMapper implements Mapper
|
|||||||
protected function createInstance(
|
protected function createInstance(
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
$elementId = null
|
$elementId = null
|
||||||
) {
|
) {
|
||||||
$reflector = new \ReflectionClass($this->getClassName($model, $mapper, $bounds));
|
$reflector = new \ReflectionClass($this->getClassName($model, $mapper, $filter));
|
||||||
$instance = $reflector->newInstanceArgs($this->buildConstructArguments($model, $mapper, $bounds, $elementId));
|
$instance = $reflector->newInstanceArgs($this->buildConstructArguments($model, $mapper, $filter, $elementId));
|
||||||
|
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
@@ -142,7 +142,7 @@ abstract class AbstractMapper implements Mapper
|
|||||||
*
|
*
|
||||||
* @param \Model $model The model.
|
* @param \Model $model The model.
|
||||||
* @param DefinitionMapper $mapper The definition mapper.
|
* @param DefinitionMapper $mapper The definition mapper.
|
||||||
* @param LatLngBounds $bounds Optional bounds where elements should be in.
|
* @param Filter $filter Optional request filter.
|
||||||
* @param string|null $elementId Optional element id.
|
* @param string|null $elementId Optional element id.
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
@@ -152,7 +152,7 @@ abstract class AbstractMapper implements Mapper
|
|||||||
protected function buildConstructArguments(
|
protected function buildConstructArguments(
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
$elementId = null
|
$elementId = null
|
||||||
) {
|
) {
|
||||||
return array(
|
return array(
|
||||||
@@ -165,13 +165,13 @@ abstract class AbstractMapper implements Mapper
|
|||||||
*
|
*
|
||||||
* @param \Model $model The model.
|
* @param \Model $model The model.
|
||||||
* @param DefinitionMapper $mapper The definition mapper.
|
* @param DefinitionMapper $mapper The definition mapper.
|
||||||
* @param LatLngBounds $bounds Optional bounds where elements should be in.
|
* @param Filter $filter Optional request filter.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
*/
|
*/
|
||||||
protected function getClassName(\Model $model, DefinitionMapper $mapper, LatLngBounds $bounds = null)
|
protected function getClassName(\Model $model, DefinitionMapper $mapper, Filter $filter = null)
|
||||||
{
|
{
|
||||||
return static::$definitionClass;
|
return static::$definitionClass;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper;
|
namespace Netzmacht\Contao\Leaflet\Mapper;
|
||||||
|
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AbstractTypeMapper is the base mapper for tables containing different types of definitins.
|
* Class AbstractTypeMapper is the base mapper for tables containing different types of definitins.
|
||||||
@@ -30,7 +30,7 @@ abstract class AbstractTypeMapper extends AbstractMapper
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function match($model, LatLngBounds $bounds = null)
|
public function match($model, Filter $filter = null)
|
||||||
{
|
{
|
||||||
return parent::match($model) && $model->type === static::$type;
|
return parent::match($model) && $model->type === static::$type;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,11 +11,11 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper\Control;
|
namespace Netzmacht\Contao\Leaflet\Mapper\Control;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Control\Attribution;
|
use Netzmacht\LeafletPHP\Definition\Control\Attribution;
|
||||||
use Netzmacht\LeafletPHP\Definition\Map;
|
use Netzmacht\LeafletPHP\Definition\Map;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AttributionControlMapper maps the the attribution database definition to the definition class.
|
* AttributionControlMapper maps the the attribution database definition to the definition class.
|
||||||
@@ -55,7 +55,7 @@ class AttributionControlMapper extends AbstractControlMapper
|
|||||||
Definition $definition,
|
Definition $definition,
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
if (!$definition instanceof Attribution) {
|
if (!$definition instanceof Attribution) {
|
||||||
|
|||||||
@@ -11,10 +11,9 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper\Control;
|
namespace Netzmacht\Contao\Leaflet\Mapper\Control;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Model\ControlModel;
|
use Netzmacht\Contao\Leaflet\Model\ControlModel;
|
||||||
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class LayersControlMapper maps the control model to the layers control definition.
|
* Class LayersControlMapper maps the control model to the layers control definition.
|
||||||
@@ -43,10 +42,10 @@ class LayersControlMapper extends AbstractControlMapper
|
|||||||
protected function buildConstructArguments(
|
protected function buildConstructArguments(
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
$elementId = null
|
$elementId = null
|
||||||
) {
|
) {
|
||||||
$arguments = parent::buildConstructArguments($model, $mapper, $bounds, $elementId);
|
$arguments = parent::buildConstructArguments($model, $mapper, $filter, $elementId);
|
||||||
$arguments[1] = array();
|
$arguments[1] = array();
|
||||||
$arguments[2] = array();
|
$arguments[2] = array();
|
||||||
|
|
||||||
@@ -57,7 +56,7 @@ class LayersControlMapper extends AbstractControlMapper
|
|||||||
foreach ($collection as $layer) {
|
foreach ($collection as $layer) {
|
||||||
$argument = ($layer->controlMode === 'overlay') ? 2 : 1;
|
$argument = ($layer->controlMode === 'overlay') ? 2 : 1;
|
||||||
|
|
||||||
$arguments[$argument][] = $mapper->handle($layer, $bounds);
|
$arguments[$argument][] = $mapper->handle($layer, $filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,11 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper\Control;
|
namespace Netzmacht\Contao\Leaflet\Mapper\Control;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Model\ControlModel;
|
use Netzmacht\Contao\Leaflet\Model\ControlModel;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Control\Zoom;
|
use Netzmacht\LeafletPHP\Definition\Control\Zoom;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
use Netzmacht\LeafletPHP\Plugins\Loading\LoadingControl;
|
use Netzmacht\LeafletPHP\Plugins\Loading\LoadingControl;
|
||||||
use Netzmacht\LeafletPHP\Plugins\Loading\SpinJsLoadingControl;
|
use Netzmacht\LeafletPHP\Plugins\Loading\SpinJsLoadingControl;
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ class LoadingControlMapper extends AbstractControlMapper
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function getClassName(\Model $model, DefinitionMapper $mapper, LatLngBounds $bounds = null)
|
protected function getClassName(\Model $model, DefinitionMapper $mapper, Filter $filter = null)
|
||||||
{
|
{
|
||||||
if ($model->spinjs) {
|
if ($model->spinjs) {
|
||||||
return 'Netzmacht\LeafletPHP\Plugins\Loading\SpinJsLoadingControl';
|
return 'Netzmacht\LeafletPHP\Plugins\Loading\SpinJsLoadingControl';
|
||||||
@@ -62,10 +62,10 @@ class LoadingControlMapper extends AbstractControlMapper
|
|||||||
Definition $definition,
|
Definition $definition,
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
parent::build($definition, $model, $mapper, $bounds);
|
parent::build($definition, $model, $mapper, $filter);
|
||||||
|
|
||||||
if ($definition instanceof SpinJsLoadingControl && $model->spin) {
|
if ($definition instanceof SpinJsLoadingControl && $model->spin) {
|
||||||
$config = json_decode($model->spin, true);
|
$config = json_decode($model->spin, true);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace Netzmacht\Contao\Leaflet\Mapper;
|
|||||||
use Netzmacht\Contao\Leaflet\Event\BuildDefinitionEvent;
|
use Netzmacht\Contao\Leaflet\Event\BuildDefinitionEvent;
|
||||||
use Netzmacht\Contao\Leaflet\Event\ConvertToGeoJsonEvent;
|
use Netzmacht\Contao\Leaflet\Event\ConvertToGeoJsonEvent;
|
||||||
use Netzmacht\Contao\Leaflet\Event\GetHashEvent;
|
use Netzmacht\Contao\Leaflet\Event\GetHashEvent;
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\GeoJson\ConvertsToGeoJsonFeature;
|
use Netzmacht\LeafletPHP\Definition\GeoJson\ConvertsToGeoJsonFeature;
|
||||||
use Netzmacht\LeafletPHP\Definition\GeoJson\Feature;
|
use Netzmacht\LeafletPHP\Definition\GeoJson\Feature;
|
||||||
@@ -81,7 +82,7 @@ class DefinitionMapper
|
|||||||
* Build a model.
|
* Build a model.
|
||||||
*
|
*
|
||||||
* @param mixed $model The definition model.
|
* @param mixed $model The definition model.
|
||||||
* @param LatLngBounds $bounds Optional bounds where elements should be in.
|
* @param Filter $filter Optional request filter.
|
||||||
* @param string $elementId Optional element id. If none given the mapId or alias is used.
|
* @param string $elementId Optional element id. If none given the mapId or alias is used.
|
||||||
* @param Definition|null $parent Optional pass the parent object.
|
* @param Definition|null $parent Optional pass the parent object.
|
||||||
*
|
*
|
||||||
@@ -89,16 +90,16 @@ class DefinitionMapper
|
|||||||
*
|
*
|
||||||
* @throws \RuntimeException If model could not be mapped to a definition.
|
* @throws \RuntimeException If model could not be mapped to a definition.
|
||||||
*/
|
*/
|
||||||
public function handle($model, LatLngBounds $bounds = null, $elementId = null, $parent = null)
|
public function handle($model, Filter $filter = null, $elementId = null, $parent = null)
|
||||||
{
|
{
|
||||||
$hash = $this->hash($model, $elementId);
|
$hash = $this->hash($model, $elementId);
|
||||||
|
|
||||||
if (!isset($this->mapped[$hash])) {
|
if (!isset($this->mapped[$hash])) {
|
||||||
$mapper = $this->getMapper($model);
|
$mapper = $this->getMapper($model);
|
||||||
$definition = $mapper->handle($model, $this, $bounds, $elementId, $parent);
|
$definition = $mapper->handle($model, $this, $filter, $elementId, $parent);
|
||||||
|
|
||||||
if ($definition) {
|
if ($definition) {
|
||||||
$event = new BuildDefinitionEvent($definition, $model, $bounds);
|
$event = new BuildDefinitionEvent($definition, $model, $filter);
|
||||||
$this->eventDispatcher->dispatch($event::NAME, $event);
|
$this->eventDispatcher->dispatch($event::NAME, $event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,18 +113,18 @@ class DefinitionMapper
|
|||||||
* Build a model.
|
* Build a model.
|
||||||
*
|
*
|
||||||
* @param mixed $model The definition model.
|
* @param mixed $model The definition model.
|
||||||
* @param LatLngBounds $bounds Optional bounds where elements should be in.
|
* @param Filter $filter Optional request filter.
|
||||||
*
|
*
|
||||||
* @return FeatureCollection|Feature|null
|
* @return FeatureCollection|Feature|null
|
||||||
*
|
*
|
||||||
* @throws \RuntimeException If a model could not be mapped to the GeoJSON representation.
|
* @throws \RuntimeException If a model could not be mapped to the GeoJSON representation.
|
||||||
*/
|
*/
|
||||||
public function handleGeoJson($model, LatLngBounds $bounds = null)
|
public function handleGeoJson($model, Filter $filter = null)
|
||||||
{
|
{
|
||||||
$mapper = $this->getMapper($model);
|
$mapper = $this->getMapper($model);
|
||||||
|
|
||||||
if ($mapper instanceof GeoJsonMapper) {
|
if ($mapper instanceof GeoJsonMapper) {
|
||||||
return $mapper->handleGeoJson($model, $this, $bounds);
|
return $mapper->handleGeoJson($model, $this, $filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new \RuntimeException(
|
throw new \RuntimeException(
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper;
|
namespace Netzmacht\Contao\Leaflet\Mapper;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\LeafletPHP\Definition\GeoJson\GeoJsonFeature;
|
use Netzmacht\LeafletPHP\Definition\GeoJson\GeoJsonFeature;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface GeoJsonMapper describes mappers which can convert their definition to a GeoJSON representation.
|
* Interface GeoJsonMapper describes mappers which can convert their definition to a GeoJSON representation.
|
||||||
@@ -26,9 +26,9 @@ interface GeoJsonMapper
|
|||||||
*
|
*
|
||||||
* @param \Model $model The model being mapped.
|
* @param \Model $model The model being mapped.
|
||||||
* @param DefinitionMapper $mapper The definition mapper.
|
* @param DefinitionMapper $mapper The definition mapper.
|
||||||
* @param LatLngBounds $bounds The requested bounds.
|
* @param Filter $filter Optional request filter.
|
||||||
*
|
*
|
||||||
* @return GeoJsonFeature|null
|
* @return GeoJsonFeature|null
|
||||||
*/
|
*/
|
||||||
public function handleGeoJson(\Model $model, DefinitionMapper $mapper, LatLngBounds $bounds = null);
|
public function handleGeoJson(\Model $model, DefinitionMapper $mapper, Filter $filter = null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,12 +11,12 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
|
namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Group\LayerGroup;
|
use Netzmacht\LeafletPHP\Definition\Group\LayerGroup;
|
||||||
use Netzmacht\LeafletPHP\Definition\Layer;
|
use Netzmacht\LeafletPHP\Definition\Layer;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class GroupLayerMapper maps the layer model to the group layer definition.
|
* Class GroupLayerMapper maps the layer model to the group layer definition.
|
||||||
@@ -35,7 +35,7 @@ class GroupLayerMapper extends AbstractLayerMapper
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function getClassName(\Model $model, DefinitionMapper $mapper, LatLngBounds $bounds = null)
|
protected function getClassName(\Model $model, DefinitionMapper $mapper, Filter $filter = null)
|
||||||
{
|
{
|
||||||
if ($model->groupType === 'feature') {
|
if ($model->groupType === 'feature') {
|
||||||
return 'Netzmacht\LeafletPHP\Definition\Group\FeatureGroup';
|
return 'Netzmacht\LeafletPHP\Definition\Group\FeatureGroup';
|
||||||
@@ -51,7 +51,7 @@ class GroupLayerMapper extends AbstractLayerMapper
|
|||||||
Definition $definition,
|
Definition $definition,
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
if (!$definition instanceof LayerGroup) {
|
if (!$definition instanceof LayerGroup) {
|
||||||
|
|||||||
@@ -11,13 +11,13 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
|
namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
||||||
use Netzmacht\JavascriptBuilder\Type\AnonymousFunction;
|
use Netzmacht\JavascriptBuilder\Type\AnonymousFunction;
|
||||||
use Netzmacht\JavascriptBuilder\Type\Expression;
|
use Netzmacht\JavascriptBuilder\Type\Expression;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Layer;
|
use Netzmacht\LeafletPHP\Definition\Layer;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
use Netzmacht\LeafletPHP\Plugins\MarkerCluster\MarkerClusterGroup;
|
use Netzmacht\LeafletPHP\Plugins\MarkerCluster\MarkerClusterGroup;
|
||||||
use Netzmacht\LeafletPHP\Plugins\Omnivore\OmnivoreLayer;
|
use Netzmacht\LeafletPHP\Plugins\Omnivore\OmnivoreLayer;
|
||||||
|
|
||||||
@@ -67,10 +67,10 @@ class MarkerClusterLayerMapper extends AbstractLayerMapper
|
|||||||
Definition $definition,
|
Definition $definition,
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
parent::build($definition, $model, $mapper, $bounds, $parent);
|
parent::build($definition, $model, $mapper, $filter, $parent);
|
||||||
|
|
||||||
/** @var MarkerClusterGroup $definition */
|
/** @var MarkerClusterGroup $definition */
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
|
namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\GeoJsonMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\GeoJsonMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Model\MarkerModel;
|
use Netzmacht\Contao\Leaflet\Model\MarkerModel;
|
||||||
@@ -19,8 +20,6 @@ use Netzmacht\JavascriptBuilder\Type\Expression;
|
|||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\GeoJson\FeatureCollection;
|
use Netzmacht\LeafletPHP\Definition\GeoJson\FeatureCollection;
|
||||||
use Netzmacht\LeafletPHP\Definition\Group\GeoJson;
|
use Netzmacht\LeafletPHP\Definition\Group\GeoJson;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
use Netzmacht\LeafletPHP\Definition\UI\Marker;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MarkersLayerMapper maps the layer model to the markers definition.
|
* Class MarkersLayerMapper maps the layer model to the markers definition.
|
||||||
@@ -39,7 +38,7 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function getClassName(\Model $model, DefinitionMapper $mapper, LatLngBounds $bounds = null)
|
protected function getClassName(\Model $model, DefinitionMapper $mapper, Filter $filter = null)
|
||||||
{
|
{
|
||||||
if ($model->deferred) {
|
if ($model->deferred) {
|
||||||
return 'Netzmacht\LeafletPHP\Plugins\Omnivore\GeoJson';
|
return 'Netzmacht\LeafletPHP\Plugins\Omnivore\GeoJson';
|
||||||
@@ -54,7 +53,7 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
protected function buildConstructArguments(
|
protected function buildConstructArguments(
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
$elementId = null
|
$elementId = null
|
||||||
) {
|
) {
|
||||||
if ($model->deferred) {
|
if ($model->deferred) {
|
||||||
@@ -75,7 +74,7 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
return array($this->getElementId($model, $elementId), RequestUrl::create($model->id));
|
return array($this->getElementId($model, $elementId), RequestUrl::create($model->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::buildConstructArguments($model, $mapper, $bounds, $elementId);
|
return parent::buildConstructArguments($model, $mapper, $filter, $elementId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,7 +84,7 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
Definition $definition,
|
Definition $definition,
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
if ($definition instanceof GeoJson) {
|
if ($definition instanceof GeoJson) {
|
||||||
@@ -115,7 +114,7 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function handleGeoJson(\Model $model, DefinitionMapper $mapper, LatLngBounds $bounds = null)
|
public function handleGeoJson(\Model $model, DefinitionMapper $mapper, Filter $filter = null)
|
||||||
{
|
{
|
||||||
$feature = new FeatureCollection();
|
$feature = new FeatureCollection();
|
||||||
$collection = $this->loadMarkerModels($model);
|
$collection = $this->loadMarkerModels($model);
|
||||||
|
|||||||
@@ -11,10 +11,10 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
|
namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\OptionsBuilder;
|
use Netzmacht\Contao\Leaflet\Mapper\OptionsBuilder;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ProviderLayerMapper maps the layer model to the tile provider definition.
|
* Class ProviderLayerMapper maps the layer model to the tile provider definition.
|
||||||
@@ -52,7 +52,7 @@ class ProviderLayerMapper extends AbstractLayerMapper
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function getClassName(\Model $model, DefinitionMapper $mapper, LatLngBounds $bounds = null)
|
protected function getClassName(\Model $model, DefinitionMapper $mapper, Filter $filter = null)
|
||||||
{
|
{
|
||||||
if (isset($this->providers[$model->tile_provider]['class'])) {
|
if (isset($this->providers[$model->tile_provider]['class'])) {
|
||||||
return $this->providers[$model->tile_provider]['class'];
|
return $this->providers[$model->tile_provider]['class'];
|
||||||
@@ -68,7 +68,7 @@ class ProviderLayerMapper extends AbstractLayerMapper
|
|||||||
Definition $definition,
|
Definition $definition,
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
if (!empty($this->providers[$model->tile_provider]['options'])) {
|
if (!empty($this->providers[$model->tile_provider]['options'])) {
|
||||||
@@ -86,7 +86,7 @@ class ProviderLayerMapper extends AbstractLayerMapper
|
|||||||
protected function buildConstructArguments(
|
protected function buildConstructArguments(
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
$elementId = null
|
$elementId = null
|
||||||
) {
|
) {
|
||||||
return array(
|
return array(
|
||||||
|
|||||||
@@ -11,10 +11,10 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
|
namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ReferenceLayerMapper maps an reference layer to another layer.
|
* Class ReferenceLayerMapper maps an reference layer to another layer.
|
||||||
@@ -36,7 +36,7 @@ class ReferenceLayerMapper extends AbstractLayerMapper
|
|||||||
public function handle(
|
public function handle(
|
||||||
$model,
|
$model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
$elementId = null,
|
$elementId = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
@@ -48,6 +48,6 @@ class ReferenceLayerMapper extends AbstractLayerMapper
|
|||||||
|
|
||||||
$elementId = $model->standalone ? $this->getElementId($model, $elementId) : null;
|
$elementId = $model->standalone ? $this->getElementId($model, $elementId) : null;
|
||||||
|
|
||||||
return $mapper->handle($reference, $bounds, $elementId);
|
return $mapper->handle($reference, $filter, $elementId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
|
namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Raster\TileLayer;
|
use Netzmacht\LeafletPHP\Definition\Raster\TileLayer;
|
||||||
@@ -64,10 +65,10 @@ class TileLayerMapper extends AbstractLayerMapper
|
|||||||
protected function buildConstructArguments(
|
protected function buildConstructArguments(
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
$elementId = null
|
$elementId = null
|
||||||
) {
|
) {
|
||||||
$arguments = parent::buildConstructArguments($model, $mapper, $bounds, $elementId);
|
$arguments = parent::buildConstructArguments($model, $mapper, $filter, $elementId);
|
||||||
|
|
||||||
$arguments[] = $model->tileUrl;
|
$arguments[] = $model->tileUrl;
|
||||||
|
|
||||||
@@ -81,24 +82,24 @@ class TileLayerMapper extends AbstractLayerMapper
|
|||||||
Definition $definition,
|
Definition $definition,
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
parent::build($definition, $model, $mapper, $bounds, $parent);
|
parent::build($definition, $model, $mapper, $filter, $parent);
|
||||||
|
|
||||||
/** @var TileLayer $definition */
|
/** @var TileLayer $definition */
|
||||||
$bounds = deserialize($model->bounds);
|
$filter = deserialize($model->bounds);
|
||||||
|
|
||||||
if ($bounds[0] && $bounds[1]) {
|
if ($filter[0] && $filter[1]) {
|
||||||
$bounds = array_map(
|
$filter = array_map(
|
||||||
function ($value) {
|
function ($value) {
|
||||||
return explode(',', $value, 3);
|
return explode(',', $value, 3);
|
||||||
},
|
},
|
||||||
$bounds
|
$filter
|
||||||
);
|
);
|
||||||
|
|
||||||
$bounds = LatLngBounds::fromArray($bounds);
|
$filter = LatLngBounds::fromArray($filter);
|
||||||
$definition->setBounds($bounds);
|
$definition->setBounds($filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,18 +11,15 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
|
namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\GeoJsonMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\GeoJsonMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Model\VectorModel;
|
use Netzmacht\Contao\Leaflet\Model\VectorModel;
|
||||||
use Netzmacht\Contao\Leaflet\Frontend\RequestUrl;
|
use Netzmacht\Contao\Leaflet\Frontend\RequestUrl;
|
||||||
use Netzmacht\JavascriptBuilder\Type\Expression;
|
use Netzmacht\JavascriptBuilder\Type\Expression;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\GeoJson\ConvertsToGeoJsonFeature;
|
|
||||||
use Netzmacht\LeafletPHP\Definition\GeoJson\Feature;
|
|
||||||
use Netzmacht\LeafletPHP\Definition\GeoJson\FeatureCollection;
|
use Netzmacht\LeafletPHP\Definition\GeoJson\FeatureCollection;
|
||||||
use Netzmacht\LeafletPHP\Definition\GeoJson\GeoJsonFeature;
|
|
||||||
use Netzmacht\LeafletPHP\Definition\Group\GeoJson;
|
use Netzmacht\LeafletPHP\Definition\Group\GeoJson;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
use Netzmacht\LeafletPHP\Definition\Vector;
|
use Netzmacht\LeafletPHP\Definition\Vector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,7 +39,7 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function getClassName(\Model $model, DefinitionMapper $mapper, LatLngBounds $bounds = null)
|
protected function getClassName(\Model $model, DefinitionMapper $mapper, Filter $filter = null)
|
||||||
{
|
{
|
||||||
if ($model->deferred) {
|
if ($model->deferred) {
|
||||||
return 'Netzmacht\LeafletPHP\Plugins\Omnivore\GeoJson';
|
return 'Netzmacht\LeafletPHP\Plugins\Omnivore\GeoJson';
|
||||||
@@ -57,7 +54,7 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
protected function buildConstructArguments(
|
protected function buildConstructArguments(
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
$elementId = null
|
$elementId = null
|
||||||
) {
|
) {
|
||||||
if ($model->deferred) {
|
if ($model->deferred) {
|
||||||
@@ -85,7 +82,7 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
return array($this->getElementId($model, $elementId), RequestUrl::create($model->id));
|
return array($this->getElementId($model, $elementId), RequestUrl::create($model->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::buildConstructArguments($model, $mapper, $bounds, $elementId);
|
return parent::buildConstructArguments($model, $mapper, $filter, $elementId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -95,7 +92,7 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
Definition $definition,
|
Definition $definition,
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
if ($definition instanceof GeoJson) {
|
if ($definition instanceof GeoJson) {
|
||||||
@@ -123,7 +120,7 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function handleGeoJson(\Model $model, DefinitionMapper $mapper, LatLngBounds $bounds = null)
|
public function handleGeoJson(\Model $model, DefinitionMapper $mapper, Filter $filter = null)
|
||||||
{
|
{
|
||||||
$definition = new FeatureCollection();
|
$definition = new FeatureCollection();
|
||||||
$collection = $this->loadVectorModels($model);
|
$collection = $this->loadVectorModels($model);
|
||||||
|
|||||||
@@ -11,15 +11,13 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper;
|
namespace Netzmacht\Contao\Leaflet\Mapper;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\Contao\Leaflet\Model\ControlModel;
|
use Netzmacht\Contao\Leaflet\Model\ControlModel;
|
||||||
use Netzmacht\Contao\Leaflet\Model\MapModel;
|
use Netzmacht\Contao\Leaflet\Model\MapModel;
|
||||||
use Netzmacht\JavascriptBuilder\Type\AnonymousFunction;
|
|
||||||
use Netzmacht\JavascriptBuilder\Type\Expression;
|
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Control;
|
use Netzmacht\LeafletPHP\Definition\Control;
|
||||||
use Netzmacht\LeafletPHP\Definition\Layer;
|
use Netzmacht\LeafletPHP\Definition\Layer;
|
||||||
use Netzmacht\LeafletPHP\Definition\Map;
|
use Netzmacht\LeafletPHP\Definition\Map;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MapMapper maps the database map model to the leaflet definition.
|
* Class MapMapper maps the database map model to the leaflet definition.
|
||||||
@@ -62,13 +60,13 @@ class MapMapper extends AbstractMapper
|
|||||||
Definition $map,
|
Definition $map,
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
if ($map instanceof Map && $model instanceof MapModel) {
|
if ($map instanceof Map && $model instanceof MapModel) {
|
||||||
$this->buildCustomOptions($map, $model);
|
$this->buildCustomOptions($map, $model);
|
||||||
$this->buildControls($map, $model, $mapper, $bounds);
|
$this->buildControls($map, $model, $mapper, $filter);
|
||||||
$this->buildLayers($map, $model, $mapper, $bounds);
|
$this->buildLayers($map, $model, $mapper, $filter);
|
||||||
$this->buildBoundsCalculation($map, $model);
|
$this->buildBoundsCalculation($map, $model);
|
||||||
$this->buildLocate($map, $model);
|
$this->buildLocate($map, $model);
|
||||||
}
|
}
|
||||||
@@ -80,7 +78,7 @@ class MapMapper extends AbstractMapper
|
|||||||
protected function buildConstructArguments(
|
protected function buildConstructArguments(
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
$elementId = null
|
$elementId = null
|
||||||
) {
|
) {
|
||||||
return array(
|
return array(
|
||||||
@@ -110,11 +108,11 @@ class MapMapper extends AbstractMapper
|
|||||||
* @param Map $map The map being built.
|
* @param Map $map The map being built.
|
||||||
* @param MapModel $model The map model.
|
* @param MapModel $model The map model.
|
||||||
* @param DefinitionMapper $mapper The definition mapper.
|
* @param DefinitionMapper $mapper The definition mapper.
|
||||||
* @param LatLngBounds $bounds Optional bounds.
|
* @param Filter $filter Optional request filter.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function buildControls(Map $map, MapModel $model, DefinitionMapper $mapper, LatLngBounds $bounds = null)
|
private function buildControls(Map $map, MapModel $model, DefinitionMapper $mapper, Filter $filter = null)
|
||||||
{
|
{
|
||||||
$collection = ControlModel::findActiveBy('pid', $model->id, array('order' => 'sorting'));
|
$collection = ControlModel::findActiveBy('pid', $model->id, array('order' => 'sorting'));
|
||||||
|
|
||||||
@@ -123,7 +121,7 @@ class MapMapper extends AbstractMapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($collection as $control) {
|
foreach ($collection as $control) {
|
||||||
$control = $mapper->handle($control, $bounds, null, $map);
|
$control = $mapper->handle($control, $filter, null, $map);
|
||||||
|
|
||||||
if ($control instanceof Control) {
|
if ($control instanceof Control) {
|
||||||
$control->addTo($map);
|
$control->addTo($map);
|
||||||
@@ -137,11 +135,11 @@ class MapMapper extends AbstractMapper
|
|||||||
* @param Map $map The map being built.
|
* @param Map $map The map being built.
|
||||||
* @param MapModel $model The map model.
|
* @param MapModel $model The map model.
|
||||||
* @param DefinitionMapper $mapper Definition mapper.
|
* @param DefinitionMapper $mapper Definition mapper.
|
||||||
* @param LatLngBounds $bounds Optional bounds.
|
* @param Filter $filter Optional request filter.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function buildLayers(Map $map, MapModel $model, DefinitionMapper $mapper, LatLngBounds $bounds = null)
|
private function buildLayers(Map $map, MapModel $model, DefinitionMapper $mapper, Filter $filter = null)
|
||||||
{
|
{
|
||||||
$collection = $model->findActiveLayers();
|
$collection = $model->findActiveLayers();
|
||||||
|
|
||||||
@@ -151,7 +149,7 @@ class MapMapper extends AbstractMapper
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$layer = $mapper->handle($layer, $bounds, null, $map);
|
$layer = $mapper->handle($layer, $filter, null, $map);
|
||||||
if ($layer instanceof Layer) {
|
if ($layer instanceof Layer) {
|
||||||
$layer->addTo($map);
|
$layer->addTo($map);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper;
|
namespace Netzmacht\Contao\Leaflet\Mapper;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface Mapper describes the Mapper which translates a given configuration to the Leaflet definition.
|
* Interface Mapper describes the Mapper which translates a given configuration to the Leaflet definition.
|
||||||
@@ -26,7 +26,7 @@ interface Mapper
|
|||||||
*
|
*
|
||||||
* @param \Model|mixed $model The model being built. Usually a contao model, but can be anything.
|
* @param \Model|mixed $model The model being built. Usually a contao model, but can be anything.
|
||||||
* @param DefinitionMapper $mapper The definition builder.
|
* @param DefinitionMapper $mapper The definition builder.
|
||||||
* @param LatLngBounds $bounds Optional bounds where elements should be in.
|
* @param Filter $filter Optional filter bounds.
|
||||||
* @param string $elementId Optional element.
|
* @param string $elementId Optional element.
|
||||||
* @param Definition|null $parent Optional passed parent.
|
* @param Definition|null $parent Optional passed parent.
|
||||||
*
|
*
|
||||||
@@ -35,7 +35,7 @@ interface Mapper
|
|||||||
public function handle(
|
public function handle(
|
||||||
$model,
|
$model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
$elementId = null,
|
$elementId = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
);
|
);
|
||||||
@@ -44,9 +44,9 @@ interface Mapper
|
|||||||
* Check if mapper is responsible for the model.
|
* Check if mapper is responsible for the model.
|
||||||
*
|
*
|
||||||
* @param \Model $model The model being build.
|
* @param \Model $model The model being build.
|
||||||
* @param LatLngBounds $bounds Optional bounds where elements should be in.
|
* @param Filter $filter Optional filter bounds.
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function match($model, LatLngBounds $bounds = null);
|
public function match($model, Filter $filter = null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,10 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper\Type;
|
namespace Netzmacht\Contao\Leaflet\Mapper\Type;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\DivIcon;
|
use Netzmacht\LeafletPHP\Definition\Type\DivIcon;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class DivIconMapper maps the icon model to the div icon definition.
|
* Class DivIconMapper maps the icon model to the div icon definition.
|
||||||
@@ -54,10 +54,10 @@ class DivIconMapper extends AbstractIconMapper
|
|||||||
Definition $definition,
|
Definition $definition,
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
parent::build($definition, $model, $mapper, $bounds);
|
parent::build($definition, $model, $mapper, $filter);
|
||||||
|
|
||||||
if ($definition instanceof DivIcon && $model->iconSize) {
|
if ($definition instanceof DivIcon && $model->iconSize) {
|
||||||
$definition->setIconSize(explode(',', $model->iconSize, 2));
|
$definition->setIconSize(explode(',', $model->iconSize, 2));
|
||||||
|
|||||||
@@ -11,11 +11,11 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper\Type;
|
namespace Netzmacht\Contao\Leaflet\Mapper\Type;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Model\IconModel;
|
use Netzmacht\Contao\Leaflet\Model\IconModel;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\ImageIcon;
|
use Netzmacht\LeafletPHP\Definition\Type\ImageIcon;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ImageIconMapper maps the icon model to the image icon definition.
|
* Class ImageIconMapper maps the icon model to the image icon definition.
|
||||||
@@ -44,10 +44,10 @@ class ImageIconMapper extends AbstractIconMapper
|
|||||||
protected function buildConstructArguments(
|
protected function buildConstructArguments(
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
$elementId = null
|
$elementId = null
|
||||||
) {
|
) {
|
||||||
$arguments = parent::buildConstructArguments($model, $mapper, $bounds, $elementId);
|
$arguments = parent::buildConstructArguments($model, $mapper, $filter, $elementId);
|
||||||
|
|
||||||
if ($model->iconImage) {
|
if ($model->iconImage) {
|
||||||
$file = \FilesModel::findByUuid($model->iconImage);
|
$file = \FilesModel::findByUuid($model->iconImage);
|
||||||
@@ -67,7 +67,7 @@ class ImageIconMapper extends AbstractIconMapper
|
|||||||
Definition $definition,
|
Definition $definition,
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
if ($definition instanceof ImageIcon) {
|
if ($definition instanceof ImageIcon) {
|
||||||
|
|||||||
@@ -11,13 +11,13 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper\UI;
|
namespace Netzmacht\Contao\Leaflet\Mapper\UI;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\AbstractMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\AbstractMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Model\IconModel;
|
use Netzmacht\Contao\Leaflet\Model\IconModel;
|
||||||
use Netzmacht\Contao\Leaflet\ServiceContainerTrait;
|
use Netzmacht\Contao\Leaflet\ServiceContainerTrait;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\ImageIcon;
|
use Netzmacht\LeafletPHP\Definition\Type\ImageIcon;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
use Netzmacht\LeafletPHP\Definition\UI\Marker;
|
use Netzmacht\LeafletPHP\Definition\UI\Marker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,10 +49,10 @@ class MarkerMapper extends AbstractMapper
|
|||||||
protected function buildConstructArguments(
|
protected function buildConstructArguments(
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
$elementId = null
|
$elementId = null
|
||||||
) {
|
) {
|
||||||
$arguments = parent::buildConstructArguments($model, $mapper, $bounds, $elementId);
|
$arguments = parent::buildConstructArguments($model, $mapper, $filter, $elementId);
|
||||||
$arguments[] = $model->coordinates ?: null;
|
$arguments[] = $model->coordinates ?: null;
|
||||||
|
|
||||||
return $arguments;
|
return $arguments;
|
||||||
@@ -77,7 +77,7 @@ class MarkerMapper extends AbstractMapper
|
|||||||
Definition $definition,
|
Definition $definition,
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
if ($definition instanceof Marker) {
|
if ($definition instanceof Marker) {
|
||||||
|
|||||||
@@ -12,13 +12,13 @@
|
|||||||
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
||||||
|
|
||||||
use Netzmacht\Contao\Leaflet\Definition\Style;
|
use Netzmacht\Contao\Leaflet\Definition\Style;
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\AbstractTypeMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\AbstractTypeMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\Contao\Leaflet\Model\StyleModel;
|
use Netzmacht\Contao\Leaflet\Model\StyleModel;
|
||||||
use Netzmacht\Contao\Leaflet\ServiceContainerTrait;
|
use Netzmacht\Contao\Leaflet\ServiceContainerTrait;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\HasPopup;
|
use Netzmacht\LeafletPHP\Definition\HasPopup;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
use Netzmacht\LeafletPHP\Definition\Vector\Path;
|
use Netzmacht\LeafletPHP\Definition\Vector\Path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,10 +44,10 @@ class AbstractVectorMapper extends AbstractTypeMapper
|
|||||||
Definition $definition,
|
Definition $definition,
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
parent::build($definition, $model, $mapper, $bounds);
|
parent::build($definition, $model, $mapper, $filter);
|
||||||
|
|
||||||
if ($definition instanceof Path && $model->style) {
|
if ($definition instanceof Path && $model->style) {
|
||||||
$styleModel = StyleModel::findActiveByPk($model->style);
|
$styleModel = StyleModel::findActiveByPk($model->style);
|
||||||
|
|||||||
@@ -11,10 +11,10 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLng;
|
use Netzmacht\LeafletPHP\Definition\Type\LatLng;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
use Netzmacht\LeafletPHP\Definition\Vector\Circle;
|
use Netzmacht\LeafletPHP\Definition\Vector\Circle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,10 +55,10 @@ class CircleMapper extends AbstractVectorMapper
|
|||||||
Definition $definition,
|
Definition $definition,
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
parent::build($definition, $model, $mapper, $bounds);
|
parent::build($definition, $model, $mapper, $filter);
|
||||||
|
|
||||||
if ($definition instanceof Circle) {
|
if ($definition instanceof Circle) {
|
||||||
$definition->setLatLng(LatLng::fromString($model->coordinates));
|
$definition->setLatLng(LatLng::fromString($model->coordinates));
|
||||||
|
|||||||
@@ -11,11 +11,7 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
||||||
|
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLng;
|
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
use Netzmacht\LeafletPHP\Definition\Vector\Circle;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CircleMarkerMapper maps the database model to the circle marker definition.
|
* Class CircleMarkerMapper maps the database model to the circle marker definition.
|
||||||
|
|||||||
@@ -11,10 +11,9 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLng;
|
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
use Netzmacht\LeafletPHP\Definition\Vector\MultiPolygon;
|
use Netzmacht\LeafletPHP\Definition\Vector\MultiPolygon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,10 +44,10 @@ class MultiPolygonMapper extends MultiPolylineMapper
|
|||||||
Definition $definition,
|
Definition $definition,
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
parent::build($definition, $model, $mapper, $bounds);
|
parent::build($definition, $model, $mapper, $filter);
|
||||||
|
|
||||||
if ($definition instanceof MultiPolygon) {
|
if ($definition instanceof MultiPolygon) {
|
||||||
$this->createLatLngs($definition, $model);
|
$this->createLatLngs($definition, $model);
|
||||||
|
|||||||
@@ -11,12 +11,11 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLng;
|
use Netzmacht\LeafletPHP\Definition\Type\LatLng;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
use Netzmacht\LeafletPHP\Definition\Vector\MultiPolyline;
|
use Netzmacht\LeafletPHP\Definition\Vector\MultiPolyline;
|
||||||
use Netzmacht\LeafletPHP\Definition\Vector\Polyline;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MultiPolylineMapper maps the databse model it the multi polyline definition.
|
* Class MultiPolylineMapper maps the databse model it the multi polyline definition.
|
||||||
@@ -46,10 +45,10 @@ class MultiPolylineMapper extends AbstractVectorMapper
|
|||||||
Definition $definition,
|
Definition $definition,
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
parent::build($definition, $model, $mapper, $bounds);
|
parent::build($definition, $model, $mapper, $filter);
|
||||||
|
|
||||||
if ($definition instanceof MultiPolyline) {
|
if ($definition instanceof MultiPolyline) {
|
||||||
$this->createLatLngs($definition, $model);
|
$this->createLatLngs($definition, $model);
|
||||||
|
|||||||
@@ -11,10 +11,10 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLng;
|
use Netzmacht\LeafletPHP\Definition\Type\LatLng;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
|
||||||
use Netzmacht\LeafletPHP\Definition\Vector\Polyline;
|
use Netzmacht\LeafletPHP\Definition\Vector\Polyline;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,10 +45,10 @@ class PolylineMapper extends AbstractVectorMapper
|
|||||||
Definition $definition,
|
Definition $definition,
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
Definition $parent = null
|
Definition $parent = null
|
||||||
) {
|
) {
|
||||||
parent::build($definition, $model, $mapper, $bounds);
|
parent::build($definition, $model, $mapper, $filter);
|
||||||
|
|
||||||
if ($definition instanceof Polyline) {
|
if ($definition instanceof Polyline) {
|
||||||
array_map(
|
array_map(
|
||||||
|
|||||||
@@ -11,12 +11,11 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\LeafletPHP\Definition;
|
use Netzmacht\LeafletPHP\Definition;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLng;
|
use Netzmacht\LeafletPHP\Definition\Type\LatLng;
|
||||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
||||||
use Netzmacht\LeafletPHP\Definition\Vector\Circle;
|
|
||||||
use Netzmacht\LeafletPHP\Definition\Vector\Rectangle;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class RectangleMapper maps a database model to its rectangle vector definition.
|
* Class RectangleMapper maps a database model to its rectangle vector definition.
|
||||||
@@ -45,7 +44,7 @@ class RectangleMapper extends AbstractVectorMapper
|
|||||||
protected function buildConstructArguments(
|
protected function buildConstructArguments(
|
||||||
\Model $model,
|
\Model $model,
|
||||||
DefinitionMapper $mapper,
|
DefinitionMapper $mapper,
|
||||||
LatLngBounds $bounds = null,
|
Filter $filter = null,
|
||||||
$elementId = null
|
$elementId = null
|
||||||
) {
|
) {
|
||||||
$latLngs = array_map(
|
$latLngs = array_map(
|
||||||
@@ -55,7 +54,7 @@ class RectangleMapper extends AbstractVectorMapper
|
|||||||
deserialize($model->bounds, true)
|
deserialize($model->bounds, true)
|
||||||
);
|
);
|
||||||
|
|
||||||
$arguments = parent::buildConstructArguments($model, $mapper, $bounds, $elementId);
|
$arguments = parent::buildConstructArguments($model, $mapper, $filter, $elementId);
|
||||||
$arguments[] = new LatLngBounds($latLngs[0], $latLngs[1]);
|
$arguments[] = new LatLngBounds($latLngs[0], $latLngs[1]);
|
||||||
|
|
||||||
return $arguments;
|
return $arguments;
|
||||||
|
|||||||
Reference in New Issue
Block a user