Exemplo n.º 1
0
 /**
  * Create openOn map method.
  *
  * @param Map $map The map.
  *
  * @return $this
  */
 public function openOn(Map $map)
 {
     $this->map = $map;
     $map->addLayer($this);
     return $this->addMethod('openOn', array($map));
 }
Exemplo n.º 2
0
 /**
  * Add control to the map.
  *
  * @param Map $map The leaflet map.
  *
  * @return $this
  */
 public function addTo(Map $map)
 {
     $map->addControl($this);
     return $this->addMethod('addTo', array($map));
 }
Exemplo n.º 3
0
 /**
  * Build map bounds calculations.
  *
  * @param Map      $map   The map being built.
  * @param MapModel $model The map model.
  *
  * @return void
  */
 private function buildLocate(Map $map, MapModel $model)
 {
     if ($model->locate) {
         $options = array();
         $mapping = array('setView' => 'locateSetView', 'watch' => 'locateWatch', 'enableHighAccuracy' => 'enableHighAccuracy');
         foreach ($mapping as $option => $property) {
             if ($model->{$property}) {
                 $options[$option] = (bool) $model->{$property};
             }
         }
         $mapping = array('maxZoom' => 'locateMaxZoom', 'timeout' => 'locateTimeout', 'maximumAge' => 'locateMaximumAge');
         foreach ($mapping as $option => $property) {
             if ($model->{$property}) {
                 $options[$option] = (int) $model->{$property};
             }
         }
         $map->locate($options);
     }
 }