Ejemplo n.º 1
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);
     }
 }