Example #1
0
 /**
  * @return array
  */
 public function getGeometry()
 {
     $geometry = parent::getGeometry();
     if (isset($geometry['coordinates'])) {
         $geometry = $geometry['coordinates'];
     }
     return $geometry;
 }
Example #2
0
 /**
  * @return array
  */
 public function getGeometry()
 {
     $geometry = parent::getGeometry();
     if (isset($geometry['coordinates'])) {
         $geometry = $geometry['coordinates'];
     }
     $content = '';
     if (is_array($geometry)) {
         foreach ($geometry as $_points) {
             $point = [$_points->latitude, $_points->longitude];
             $points[] = $point;
         }
         if (isset($points)) {
             $content = [$points];
         }
     } else {
         $content = $geometry;
     }
     return $content;
 }
Example #3
0
 /**
  * @param Point|string $point Point or name of the place. If null, then placemark will be at the map center
  * @param array $properties
  * @param array $options
  */
 public function __construct(Point $point = null, array $properties = [], array $options = [])
 {
     $geometry = new Geometry(Geometry::TYPE_POINT, [$point]);
     parent::__construct($geometry, $properties, $options);
 }
Example #4
0
 /**
  * Bind event to the item
  */
 private function makeBindEventsScript($var, GeoObject $object)
 {
     if (!count($object->getEvents())) {
         return null;
     }
     $events = ["{$var}.events"];
     foreach ($object->getEvents() as $event => $handle) {
         $event = Json::encode($event);
         if (is_string($handle) && strpos($handle, 'js:') === 0) {
             $handle = substr($handle, 3);
         } else {
             $handle = Json::encode($handle);
         }
         $events[] = ".add({$event}, {$handle})";
     }
     return implode($events);
 }