mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-12-06 23:08:36 +01:00
Fix code style.
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
||||
|
||||
|
||||
use Netzmacht\Contao\Leaflet\Definition\Style;
|
||||
use Netzmacht\Contao\Leaflet\Mapper\AbstractTypeMapper;
|
||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||
@@ -21,6 +20,11 @@ use Netzmacht\LeafletPHP\Definition\HasPopup;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
||||
use Netzmacht\LeafletPHP\Definition\Vector\Path;
|
||||
|
||||
/**
|
||||
* Class AbstractVectorMapper is the base class for the vector model definition mapping.
|
||||
*
|
||||
* @package Netzmacht\Contao\Leaflet\Mapper\Vector
|
||||
*/
|
||||
class AbstractVectorMapper extends AbstractTypeMapper
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -11,13 +11,17 @@
|
||||
|
||||
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 maps the database model to the circle definition.
|
||||
*
|
||||
* @package Netzmacht\Contao\Leaflet\Mapper\Vector
|
||||
*/
|
||||
class CircleMapper extends AbstractVectorMapper
|
||||
{
|
||||
/**
|
||||
@@ -34,6 +38,9 @@ class CircleMapper extends AbstractVectorMapper
|
||||
*/
|
||||
protected static $type = 'circle';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
@@ -41,6 +48,9 @@ class CircleMapper extends AbstractVectorMapper
|
||||
$this->addOption('radius');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function build(
|
||||
Definition $definition,
|
||||
\Model $model,
|
||||
|
||||
@@ -11,13 +11,17 @@
|
||||
|
||||
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.
|
||||
*
|
||||
* @package Netzmacht\Contao\Leaflet\Mapper\Vector
|
||||
*/
|
||||
class CircleMarkerMapper extends CircleMapper
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -11,13 +11,17 @@
|
||||
|
||||
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\MultiPolygon;
|
||||
|
||||
/**
|
||||
* Class MultiPolygonMapper maps the multi polygon database model to its definition.
|
||||
*
|
||||
* @package Netzmacht\Contao\Leaflet\Mapper\Vector
|
||||
*/
|
||||
class MultiPolygonMapper extends MultiPolylineMapper
|
||||
{
|
||||
/**
|
||||
@@ -34,6 +38,9 @@ class MultiPolygonMapper extends MultiPolylineMapper
|
||||
*/
|
||||
protected static $type = 'multiPolygon';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function build(
|
||||
Definition $definition,
|
||||
\Model $model,
|
||||
@@ -43,18 +50,7 @@ class MultiPolygonMapper extends MultiPolylineMapper
|
||||
parent::build($definition, $model, $builder, $bounds);
|
||||
|
||||
if ($definition instanceof MultiPolygon) {
|
||||
$latLngs = array();
|
||||
|
||||
foreach (deserialize($model->multiData, true) as $data) {
|
||||
$latLngs[] = array_map(
|
||||
function ($row) {
|
||||
return LatLng::fromString($row);
|
||||
},
|
||||
explode("\n", $data)
|
||||
);
|
||||
}
|
||||
|
||||
$definition->setLatLngs($latLngs);
|
||||
$this->createLatLngs($definition, $model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
||||
|
||||
|
||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||
use Netzmacht\LeafletPHP\Definition;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\LatLng;
|
||||
@@ -19,6 +18,11 @@ 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.
|
||||
*
|
||||
* @package Netzmacht\Contao\Leaflet\Mapper\Vector
|
||||
*/
|
||||
class MultiPolylineMapper extends AbstractVectorMapper
|
||||
{
|
||||
/**
|
||||
@@ -35,7 +39,9 @@ class MultiPolylineMapper extends AbstractVectorMapper
|
||||
*/
|
||||
protected static $type = 'multiPolyline';
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function build(
|
||||
Definition $definition,
|
||||
\Model $model,
|
||||
@@ -45,18 +51,31 @@ class MultiPolylineMapper extends AbstractVectorMapper
|
||||
parent::build($definition, $model, $builder, $bounds);
|
||||
|
||||
if ($definition instanceof MultiPolyline) {
|
||||
$latLngs = array();
|
||||
|
||||
foreach (deserialize($model->multiData, true) as $data) {
|
||||
$latLngs[] = array_map(
|
||||
function ($row) {
|
||||
return LatLng::fromString($row);
|
||||
},
|
||||
explode("\n", $data)
|
||||
);
|
||||
}
|
||||
|
||||
$definition->setLatLngs($latLngs);
|
||||
$this->createLatLngs($definition, $model);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create lat lngs for the definition.
|
||||
*
|
||||
* @param MultiPolyline $definition The multi polyline.
|
||||
* @param \Model $model The definition model.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function createLatLngs(MultiPolyline $definition, \Model $model)
|
||||
{
|
||||
$latLngs = array();
|
||||
|
||||
foreach (deserialize($model->multiData, true) as $data) {
|
||||
$latLngs[] = array_map(
|
||||
function ($row) {
|
||||
return LatLng::fromString($row);
|
||||
},
|
||||
explode("\n", $data)
|
||||
);
|
||||
}
|
||||
|
||||
$definition->setLatLngs($latLngs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,11 @@
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
||||
|
||||
/**
|
||||
* Class PolygonMapper maps the database model to the polygon definition.
|
||||
*
|
||||
* @package Netzmacht\Contao\Leaflet\Mapper\Vector
|
||||
*/
|
||||
class PolygonMapper extends PolylineMapper
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -11,13 +11,17 @@
|
||||
|
||||
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\Polyline;
|
||||
|
||||
/**
|
||||
* Class PolylineMapper maps the database model to the polyline definition.
|
||||
*
|
||||
* @package Netzmacht\Contao\Leaflet\Mapper\Vector
|
||||
*/
|
||||
class PolylineMapper extends AbstractVectorMapper
|
||||
{
|
||||
/**
|
||||
@@ -34,7 +38,9 @@ class PolylineMapper extends AbstractVectorMapper
|
||||
*/
|
||||
protected static $type = 'polyline';
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function build(
|
||||
Definition $definition,
|
||||
\Model $model,
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
||||
|
||||
|
||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||
use Netzmacht\LeafletPHP\Definition;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\LatLng;
|
||||
@@ -19,6 +18,11 @@ 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.
|
||||
*
|
||||
* @package Netzmacht\Contao\Leaflet\Mapper\Vector
|
||||
*/
|
||||
class RectangleMapper extends AbstractVectorMapper
|
||||
{
|
||||
/**
|
||||
@@ -35,11 +39,9 @@ class RectangleMapper extends AbstractVectorMapper
|
||||
*/
|
||||
protected static $type = 'rectangle';
|
||||
|
||||
protected function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function buildConstructArguments(
|
||||
\Model $model,
|
||||
DefinitionMapper $mapper,
|
||||
@@ -47,7 +49,7 @@ class RectangleMapper extends AbstractVectorMapper
|
||||
$elementId = null
|
||||
) {
|
||||
$latLngs = array_map(
|
||||
function($latLng) {
|
||||
function ($latLng) {
|
||||
return LatLng::fromString($latLng);
|
||||
},
|
||||
deserialize($model->bounds, true)
|
||||
|
||||
Reference in New Issue
Block a user