Пример #1
0
 /**
  * it draws object on map
  *
  * @param Map $map
  */
 public function draw(Map $map)
 {
     parent::draw($map);
     if (sizeof($this->_points) > 0) {
         $firstPoint = reset($this->_points);
         $lastPoint = $this->_points[sizeof($this->_points) - 1];
         $this->_drawLineBetweenPoints($map, $firstPoint, $lastPoint);
     }
 }
 /**
  * return array of drawing paths
  *
  * @return array
  */
 public function getPaths()
 {
     $paths = array();
     $string = $this->_mapRequest->getPathPoints();
     if (is_null($string)) {
         return array();
     }
     $coordinatesStrings = explode(self::$drawObjectDelimeter, $string);
     foreach ($coordinatesStrings as $coordinatesString) {
         $coordinates = explode(self::$paramDelimeter, $coordinatesString);
         $path = new DrawPath();
         $i = 0;
         foreach ($coordinates as $coordinate) {
             if ($i == 0 && is_numeric($coordinate)) {
                 $lon = $coordinate;
                 $i++;
             } else {
                 if (is_numeric($coordinate)) {
                     $addPoint = new DrawMarkPoint($lon, $coordinate);
                     $path->addPoint($addPoint);
                     $i = 0;
                 } else {
                     $param = ParamFactory::create($coordinate);
                     $path->setParam($param);
                 }
             }
         }
         $paths[] = $path;
     }
     return $paths;
 }