/**
  * {@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}
  */
 public function loadLayers(Item $item, GeoJson $dataLayer, DefinitionMapper $mapper, Filter $filter = null)
 {
     if ($this->model->referenceType !== 'reflayer' && $this->model->deferred) {
         return;
     }
     $definition = $this->buildDefinition($item);
     if (!$definition) {
         return;
     }
     if ($definition instanceof ConvertsToGeoJsonFeature && $definition->convertsFullyToGeoJson()) {
         $feature = $mapper->convertToGeoJsonFeature($definition, $this->model);
         if ($feature) {
             $dataLayer->addData($feature);
         }
     } else {
         $dataLayer->addLayer($definition);
     }
 }
 /**
  * Add javascript callbacks.
  *
  * @param GeoJson $definition The definition.
  * @param \Model  $model      The database model.
  *
  * @return void
  */
 protected function addCallbacks(GeoJson $definition, \Model $model)
 {
     if ($model->pointToLayer) {
         $definition->setPointToLayer(new Expression($model->pointToLayer));
     }
     if ($model->onEachFeature) {
         $definition->setOnEachFeature(new Expression($model->onEachFeature));
     }
 }