public function addPath(Placemark $placemark) { parent::addPath($placemark); $geometry = $placemark->getGeometry(); $coordString = $this->coordsToGoogleArray($geometry->getPoints()); $properties = array('path: coordinates'); $style = $placemark->getStyle(); if ($style) { if (($color = $style->getStyleForTypeAndParam(MapStyle::LINE, MapStyle::COLOR)) !== null) { $properties[] = 'strokeColor: "#' . htmlColorForColorString($color) . '"'; if (strlen($color) == 8) { $alphaHex = substr($color, 0, 2); $alpha = hexdec($alphaHex) / 256; $properties[] = 'strokeOpacity: ' . round($alpha, 2); } } if ($style && ($weight = $style->getStyleForTypeAndParam(MapStyle::LINE, MapStyle::WEIGHT)) !== null) { $properties[] = "strokeWeight: {$weight}"; } } $propString = implode(',', $properties); $this->paths[] = <<<JS coordinates = [{$coordString}]; path = new google.maps.Polyline({{$propString}}); path.setMap(map); JS; }
protected function addPath(Placemark $placemark) { parent::addPath($placemark); $this->paths[] = $placemark; }
public function addPath(Placemark $placemark) { parent::addPath($placemark); $polyline = $placemark->getGeometry(); $style = $placemark->getStyle(); // http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jsapi/polyline.htm $jsonObj = array('paths' => array($this->collapseAssociativePoints($polyline->getPoints())), 'spatialReference' => array('wkid' => $this->mapProjection)); $templateValues = array('___POLYLINE_SPEC___' => json_encode($jsonObj)); if ($style !== null) { // either three or zero parameters are all set // TODO there isn't yet a good way to get valid values for this from outside $consistency = $style->getStyleForTypeAndParam(MapStyle::LINE, MapStyle::CONSISTENCY) or $consistency = 'esri.symbol.SimpleFillSymbol.STYLE_SOLID'; $color = $style->getStyleForTypeAndParam(MapStyle::LINE, MapStyle::COLOR); if ($color) { $color = htmlColorForColorString($color); } else { $color = 'FF0000'; } $weight = $style->getStyleForTypeAndParam(MapStyle::LINE, MapStyle::WEIGHT) or $weight = 4; $templateValues['___SYMBOL_SPEC___'] = "{$consistency},new dojo.Color(\"#{$color}\"),{$weight}"; } $this->paths[] = $templateValues; }