【问题标题】:Google Maps V3 Polyline Drawing / Editing / Continue DrawingGoogle Maps V3 折线绘图/编辑/继续绘图
【发布时间】:2013-03-15 14:19:46
【问题描述】:

我正在寻找一种通过谷歌地图 v3 绘制折线的方法。完成后可以编辑多段线,然后继续绘制相同的多段线。

我已经阅读了很多关于 DrawingManager(在 3.7 中引入)并阅读了此处找到的 V3 的大部分 API:

https://developers.google.com/maps/documentation/javascript/overlays#drawing_tools

这显示了这个例子:

https://google-developers.appspot.com/maps/documentation/javascript/examples/drawing-tools

developers.google 示例很棒,它允许用户通过单击最后一个顶点来绘制和完成折线。但是一旦完成,我似乎无法找出如何继续在同一条折线上绘图。这可能吗?

我知道 Google Maps API 最高版本为 10(冻结)。我什至查看了他们的发布和实验版本,但那里没有谈论它。

我愿意接受任何建议。

【问题讨论】:

    标签: google-maps google-maps-api-3 google-polyline


    【解决方案1】:

    使用 Google 创建的问题:http://code.google.com/p/gmaps-api-issues/issues/detail?id=5213 希望能得到更多的“赞”

    【讨论】:

      【解决方案2】:

      DrawingManagerOptions 中的PolylineOptions 忽略路径属性。因此,您可以做的是在绘制时(在 polylinecomplete 事件上)在 las 折线的末端和新折线的开始之间绘制一条新的折线。

      google.maps.event.addListener(drawingManager, 'polylinecomplete', function(event) {
            if (event.type == google.maps.drawing.OverlayType.POLYLINE) {
              //save last point
              //draw a new polyline to join last final point and this first point if this isn't the first polyline
            }
      });
      

      希望对你有帮助

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2013-02-10
        • 1970-01-01
        • 1970-01-01
        • 2014-11-05
        • 1970-01-01
        • 2011-03-24
        • 2013-07-02
        相关资源
        最近更新 更多