/** * {@inheritdoc} */ protected function build(Definition $definition, \Model $model, DefinitionMapper $mapper, Filter $filter = null, Definition $parent = null) { parent::build($definition, $model, $mapper, $filter, $parent); /** @var TileLayer $definition */ $filter = deserialize($model->bounds); if ($filter[0] && $filter[1]) { $filter = array_map(function ($value) { return explode(',', $value, 3); }, $filter); $filter = LatLngBounds::fromArray($filter); $definition->setBounds($filter); } }
/** * {@inheritdoc} */ public function getLatLngs() { return array($this->bounds->getSouthWest(), $this->bounds->getNorthEast()); }
/** * Set max bounds option. * * @param LatLngBounds|array $bounds Max bounds. * * @return $this * @see http://leafletjs.com/reference.html#map-maxbounds * * @throws InvalidArgumentException If invalid bounds given. */ public function setMaxBounds($bounds) { if (is_array($bounds)) { $bounds = LatLngBounds::fromArray($bounds); } Assertion::isInstanceOf($bounds, 'Netzmacht/LeafletPHP/Type/LatLngBounds'); return $this->setOption('maxBounds', $bounds); }
/** * {@inheritdoc} */ public function toRequest() { return $this->bounds->toString(true); }