如何在服装谷歌地图路径符号

时间:2017-02-07 11:22:25

标签: javascript html5 google-maps

所以我正在开发一个项目,其中有一些移动符号表示某些平面在折线上移动,如图所示here

我的符号在这里宣布

 var planeSymbol = {             path: 'M 8.1326447,0.80527736 C 8.5471666,0.063577346 9.742752,0.030177346 10.052431,0.82497736 C 10.093464,3.0114774 10.134497,5.1980774 10.17553,7.3845774 C 12.760407,8.9653774 15.345284,10.546179 17.930161,12.127079 C 17.930161,12.881779 17.930161,13.636479 17.930161,14.391179 C 15.373077,13.579479 12.815993,12.767779 10.258908,11.956179 C 10.27281,13.280479 10.286713,14.604879 10.300615,15.929279 C 10.8565,16.555879 11.412385,17.182479 11.96827,17.809079 C 12.25527,18.269479 12.437605,19.641079 11.59784,19.085079 C 10.804104,18.802179 10.010367,18.519179 9.21663,18.236279 C 8.3133108,18.620779 7.4099916,19.005279 6.5066724,19.389779 C 6.3952441,18.705879 6.2272708,17.857479 6.8519879,17.359679 C 7.2927717,16.882879 7.7335555,16.406079 8.1743393,15.929279 C 8.1465467,14.604879 8.1187541,13.280479 8.0909615,11.956179 C 5.5894706,12.824879 3.0879797,13.693479 0.58648883,14.562179 C 0.54479393,13.821679 0.50309893,13.081079 0.46140403,12.340579 C 3.0184842,10.717079 5.5755645,9.0935778 8.1326447,7.4700774 C 8.1326447,5.2484774 8.1326447,3.0268774 8.1326447,0.80527736 z',
                scale: 1,
                strokeOpacity: 1,
                strokecolor: 'black',
                strokeWeight: 1,
                anchor: new google.maps.Point(9, 9)
        };

因为我是谷歌地图的新手,我尝试了像鼠标悬停信息窗口的东西,我用var名称planeymbol取代了标记

var infowindow = new google.maps.InfoWindow();
google.maps.event.addListener(planeSymbol, 'mouseover', (function(planeSymbol) {
        return function() {
            var content = address;
            infowindow.setContent(content);
            infowindow.open(map, planeSymbol);
        }
      })(planeSymbol));

但是它不起作用,所以你们有任何想法我怎么能用鼠标悬停显示每个平面不同内容的信息窗口?

1 个答案:

答案 0 :(得分:0)

您需要使用标记对象

https://developers.google.com/maps/documentation/javascript/reference#Marker

您可以为平面定义标记对象,使用平面图标更改默认图像,并创建要在标记单击事件中使用的内容气泡。

参考应该有足够的信息来制作一切