/** * {@inheritdoc} */ protected function buildConstructArguments(\Model $model, DefinitionMapper $mapper, Filter $filter = null, $elementId = null) { $layer = new GeoJson($this->getElementId($model, $elementId)); $layer->setOptions($this->getLayerOptions($model)); $request = RequestUrl::create($model->id); $elementId = $this->getElementId($model, $elementId); $arguments = array($elementId, $request, array(), $layer); return $arguments; }
/** * {@inheritdoc} */ protected function buildConstructArguments(\Model $model, DefinitionMapper $mapper, Filter $filter = null, $elementId = null) { if ($model->deferred) { if ($model->pointToLayer || $model->boundsMode) { $layer = new GeoJson($this->getElementId($model, $elementId)); if ($model->pointToLayer) { $layer->setPointToLayer(new Expression($model->pointToLayer)); } if ($model->boundsMode) { $layer->setOption('boundsMode', $model->boundsMode); } return array($this->getElementId($model, $elementId), RequestUrl::create($model->id, null, null, $filter), array(), $layer); } return array($this->getElementId($model, $elementId), RequestUrl::create($model->id, null, null, $filter)); } return parent::buildConstructArguments($model, $mapper, $filter, $elementId); }
/** * {@inheritdoc} */ protected function buildConstructArguments(\Model $model, DefinitionMapper $mapper, Filter $filter = null, $elementId = null) { if ($model->deferred) { $options = array(); if ($model->pointToLayer) { $options['pointToLayer'] = new Expression($model->pointToLayer); } if ($model->onEachFeature) { $options['onEachFeature'] = new Expression($model->onEachFeature); } if ($model->boundsMode) { $options['boundsMode'] = $model->boundsMode; } if (!empty($options)) { $layer = new GeoJson($this->getElementId($model, $elementId)); $layer->setOptions($options); return array($this->getElementId($model, $elementId), RequestUrl::create($model->id, null, null, $filter), array(), $layer); } return array($this->getElementId($model, $elementId), RequestUrl::create($model->id, null, null, $filter)); } return parent::buildConstructArguments($model, $mapper, $filter, $elementId); }
/** * Get map definition. * * @param MapModel|int $mapId The map database id. MapModel accepted as well. * @param Filter $filter Optional request filter. * @param string $elementId Optional element id. If none given the mapId or alias is used. * * @return Map */ public function getDefinition($mapId, Filter $filter = null, $elementId = null) { if ($mapId instanceof MapModel) { $model = $mapId; $mapId = $model->id; } else { $model = $this->getModel($mapId); } RequestUrl::setFor($elementId ?: $mapId); $definition = $this->mapper->reset()->handle($model, $filter, $elementId); RequestUrl::setFor(null); return $definition; }