Пример #1
0
 public function addPath($placemark)
 {
     parent::addPath($placemark);
     $pointArr = array();
     foreach ($placemark->getGeometry()->getPoints() as $point) {
         $pointArr[] = array($point['lat'], $point['lon']);
     }
     $polyline = Polyline::encodeFromArray($pointArr);
     $style = $placemark->getStyle();
     if ($style === null) {
         // color can be 0xRRGGBB or
         // {black, brown, green, purple, yellow, blue, gray, orange, red, white}
         $styleArgs = array('color:red');
     } else {
         $styleArgs = array();
         $color = $style->getStyleForTypeAndParam(MapStyle::LINE, MapStyle::COLOR);
         if ($color) {
             $styleArgs[] = 'color:0x' . htmlColorForColorString($color);
         }
         $weight = $style->getStyleForTypeAndParam(MapStyle::LINE, MapStyle::WEIGHT);
         if ($weight) {
             $styleArgs[] = 'weight:' . $weight;
         }
     }
     $this->paths[] = implode('|', $styleArgs) . '|enc:' . $polyline;
 }
    public function addPath($points, $style=null)
    {
        $polyline = Polyline::encodeFromArray($points);

        if ($style === null) {
            // color can be 0xRRGGBB or
            // {black, brown, green, purple, yellow, blue, gray, orange, red, white}
            $styleArgs = array('color:red');
        } else {
            $styleArgs = array();
            $color = $style->getStyleForTypeAndParam(MapStyle::LINE, MapStyle::COLOR);
            if ($color) $styleArgs[] = 'color:0x'.$color;
            $weight = $style->getStyleForTypeAndParam(MapStyle::LINE, MapStyle::WEIGHT);
            if ($weight) $styleArgs[] = 'weight:'.$weight;
        }

        $this->paths[] = implode('|', $styleArgs).'|enc:'.$polyline;
    }