WEB开发网
开发学院网页设计JavaScript js实现googleMap中虚线的绘制方法 阅读

js实现googleMap中虚线的绘制方法

 2012-12-27 13:41:34 来源:WEB开发网   
核心提示:function drawPrePath(array,color){ var sorrow={ path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW //arrow }; var lineSymbol = { path: 'M 0,-1 0,1'
function drawPrePath(array,color){
  
  var sorrow={
  path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW //arrow
  };
  var lineSymbol = {
  path: 'M 0,-1 0,1',
  strokeOpacity: 1,
  scale: 3
  };
  var pathCoord = [
  new google.maps.LatLng(37.772323, -122.214897),new google.maps.LatLng(21.291982, -157.821856),
  new google.maps.LatLng(-18.142599, 178.431),new google.maps.LatLng(-27.46758, 153.027892)
  ];
  path = new google.maps.Polyline({
  path: pathCoord ,
  strokeColor:"#2d2d2d",
  strokeOpacity: 0,
  strokeWeight: 2,
  icons:[{icon:lineSymbol,offset: '0',repeat: '20px'}],
  map:map
  });
  path.setMap(map);
}
  var lineSymbol = {path: 'M 0,-1 0,1',strokeOpacity: 1,scale: 3};
关键在于’M 0,-1 0,1’ 其实这是SVG的绘制路径的写法,具体什么意思我还解释不清楚。嘻嘻 自己学svg教程吧!

Tags:js 实现 googleMap

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接