mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-12-06 23:08:36 +01:00
Refactor the mappers to use the filters.
This commit is contained in:
@@ -12,13 +12,13 @@
|
||||
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
||||
|
||||
use Netzmacht\Contao\Leaflet\Definition\Style;
|
||||
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||
use Netzmacht\Contao\Leaflet\Mapper\AbstractTypeMapper;
|
||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||
use Netzmacht\Contao\Leaflet\Model\StyleModel;
|
||||
use Netzmacht\Contao\Leaflet\ServiceContainerTrait;
|
||||
use Netzmacht\LeafletPHP\Definition;
|
||||
use Netzmacht\LeafletPHP\Definition\HasPopup;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
||||
use Netzmacht\LeafletPHP\Definition\Vector\Path;
|
||||
|
||||
/**
|
||||
@@ -44,10 +44,10 @@ class AbstractVectorMapper extends AbstractTypeMapper
|
||||
Definition $definition,
|
||||
\Model $model,
|
||||
DefinitionMapper $mapper,
|
||||
LatLngBounds $bounds = null,
|
||||
Filter $filter = null,
|
||||
Definition $parent = null
|
||||
) {
|
||||
parent::build($definition, $model, $mapper, $bounds);
|
||||
parent::build($definition, $model, $mapper, $filter);
|
||||
|
||||
if ($definition instanceof Path && $model->style) {
|
||||
$styleModel = StyleModel::findActiveByPk($model->style);
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
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\Type\LatLng;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
||||
use Netzmacht\LeafletPHP\Definition\Vector\Circle;
|
||||
|
||||
/**
|
||||
@@ -55,10 +55,10 @@ class CircleMapper extends AbstractVectorMapper
|
||||
Definition $definition,
|
||||
\Model $model,
|
||||
DefinitionMapper $mapper,
|
||||
LatLngBounds $bounds = null,
|
||||
Filter $filter = null,
|
||||
Definition $parent = null
|
||||
) {
|
||||
parent::build($definition, $model, $mapper, $bounds);
|
||||
parent::build($definition, $model, $mapper, $filter);
|
||||
|
||||
if ($definition instanceof Circle) {
|
||||
$definition->setLatLng(LatLng::fromString($model->coordinates));
|
||||
|
||||
@@ -11,11 +11,7 @@
|
||||
|
||||
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 CircleMarkerMapper maps the database model to the circle marker definition.
|
||||
|
||||
@@ -11,10 +11,9 @@
|
||||
|
||||
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\Type\LatLng;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
||||
use Netzmacht\LeafletPHP\Definition\Vector\MultiPolygon;
|
||||
|
||||
/**
|
||||
@@ -45,10 +44,10 @@ class MultiPolygonMapper extends MultiPolylineMapper
|
||||
Definition $definition,
|
||||
\Model $model,
|
||||
DefinitionMapper $mapper,
|
||||
LatLngBounds $bounds = null,
|
||||
Filter $filter = null,
|
||||
Definition $parent = null
|
||||
) {
|
||||
parent::build($definition, $model, $mapper, $bounds);
|
||||
parent::build($definition, $model, $mapper, $filter);
|
||||
|
||||
if ($definition instanceof MultiPolygon) {
|
||||
$this->createLatLngs($definition, $model);
|
||||
|
||||
@@ -11,12 +11,11 @@
|
||||
|
||||
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\Type\LatLng;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
||||
use Netzmacht\LeafletPHP\Definition\Vector\MultiPolyline;
|
||||
use Netzmacht\LeafletPHP\Definition\Vector\Polyline;
|
||||
|
||||
/**
|
||||
* Class MultiPolylineMapper maps the databse model it the multi polyline definition.
|
||||
@@ -46,10 +45,10 @@ class MultiPolylineMapper extends AbstractVectorMapper
|
||||
Definition $definition,
|
||||
\Model $model,
|
||||
DefinitionMapper $mapper,
|
||||
LatLngBounds $bounds = null,
|
||||
Filter $filter = null,
|
||||
Definition $parent = null
|
||||
) {
|
||||
parent::build($definition, $model, $mapper, $bounds);
|
||||
parent::build($definition, $model, $mapper, $filter);
|
||||
|
||||
if ($definition instanceof MultiPolyline) {
|
||||
$this->createLatLngs($definition, $model);
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
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\Type\LatLng;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
||||
use Netzmacht\LeafletPHP\Definition\Vector\Polyline;
|
||||
|
||||
/**
|
||||
@@ -45,10 +45,10 @@ class PolylineMapper extends AbstractVectorMapper
|
||||
Definition $definition,
|
||||
\Model $model,
|
||||
DefinitionMapper $mapper,
|
||||
LatLngBounds $bounds = null,
|
||||
Filter $filter = null,
|
||||
Definition $parent = null
|
||||
) {
|
||||
parent::build($definition, $model, $mapper, $bounds);
|
||||
parent::build($definition, $model, $mapper, $filter);
|
||||
|
||||
if ($definition instanceof Polyline) {
|
||||
array_map(
|
||||
|
||||
@@ -11,12 +11,11 @@
|
||||
|
||||
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\Type\LatLng;
|
||||
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.
|
||||
@@ -45,7 +44,7 @@ class RectangleMapper extends AbstractVectorMapper
|
||||
protected function buildConstructArguments(
|
||||
\Model $model,
|
||||
DefinitionMapper $mapper,
|
||||
LatLngBounds $bounds = null,
|
||||
Filter $filter = null,
|
||||
$elementId = null
|
||||
) {
|
||||
$latLngs = array_map(
|
||||
@@ -55,7 +54,7 @@ class RectangleMapper extends AbstractVectorMapper
|
||||
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]);
|
||||
|
||||
return $arguments;
|
||||
|
||||
Reference in New Issue
Block a user