如何在谷歌地图上捕捉带有折线和openInfoWindowHtml的快照

6
我正在开发一个与Google地图相关的功能,可以在Google地图上拍摄带折线的快照,并在单击折线时打开弹出窗口。 拍摄带有折线的Google地图已经可以使用,但是无法在折线上打开快照中的弹出窗口。 折线显示在快照图片上,但信息窗口没有显示。 以下是拍摄快照的代码。
此代码用于在JavaScript onload上初始化代码控件:
     var snapShotControlOptions = { hidden: true };
                snapShotControlOptions.buttonLabelHtml="<snap id='snap' style='display:none' >snap</span>"
                snapShotControl = new SnapShotControl(snapShotControlOptions);
                map.addControl(snapShotControl);

这里是使用take snap方法来拍摄谷歌地图快照的步骤。
        function takeSnap() {

            //static map size
            var sizeStr = "640x640";
            var imgSize = "";
            if (sizeStr != "") {
                var sizeArray = sizeStr.split("x");
                imgSize = new GSize(sizeArray[0], sizeArray[1]);
            }
            snapShotControl.setMapSize(imgSize);
            var format = "jpg";
            snapShotControl.setFormat(format);

            var url = snapShotControl.getImage();
            //            document.getElementById("snapshot_canvas").src = url;
            SaveImage(url);

            //         
        }

//this will add polyline overlay to draw line on google map with different color of polyline on google map .

  var polyline = directionsArray[num].getPolyline();
                polyline.setStrokeStyle({ color: streetColor, weight: 3, opacity: 0.7 });
                polyline.ssColor=streetColor;                
                map.addOverlay(polyline);


///this code will open the pop info window on polyline those polyline created on google map 

问题是当我截取谷歌地图的快照时,这些弹出窗口没有被包含在快照中。
  var MousePoint = "";
                var marker;
                GEvent.addListener(map, "mousemove", function (point) {
                    MousePoint = new GLatLng(point.lat(), point.lng());

                });

                GEvent.addListener(polyline, "click", function () {                   
                    map.openInfoWindowHtml(MousePoint, headMarkerHtml);                   
                });
                GEvent.addListener(polyline, "mouseout", function () {
                    // map.closeInfoWindow();
                });

您好,请问如何在折线覆盖物中传递弹出窗口?这与IT技术有关。我已经使用JavaScript文件snapshotcontrol.js来进行快照。


你能提供一个 JSFiddle 脚本吗?我可以帮你,但我需要看到您的运行时代码。 - Mehmet
1个回答

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接