javascript - 是否可以删除 RouteBoxer-boxes 的边框?

标签 javascript google-maps-api-3 routeboxer

编辑这个问题已得到解答,但我已为 future 的读者进行了澄清。

RouteBoxer提供了在 Google map 中“装箱”路线的解决方案,以便我可以列出该路线沿途的各个兴趣点。不过,这种技术会在 map 上显示的每个框周围创建边框。我附上了一张图片来描述它的样子。

An example image of what kind of borders I want to remove

创建 RouteBoxer 的代码如下所示:

<script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/routeboxer/src/RouteBoxer.js"></script>

var directionService = new google.maps.DirectionsService();
var rboxer = new RouteBoxer();
var distance = 20; // km

directionService.route(request, function(result, status) {
  if (status == google.maps.DirectionsStatus.OK) {

    // Box the overview path of the first route
    var path = result.routes[0].overview_path;
    var boxes = routeBoxer.box(path, distance);

    for (var i = 0; i < boxes.length; i++) {
      var bounds = box[i];
      // Perform search over this bounds 
    }
  }
});

是否可以删除 map 上每个框周围的边框?

最佳答案

您拥有完全的控制权。这是上面的 fiddle 示例,没有黑色边框 -> http://jsfiddle.net/ftgr8dyp/ 看一下函数drawBoxes():

function drawBoxes(boxes) {
     boxpolys = new Array(boxes.length);
     for (var i = 0; i < boxes.length; i++) {
         boxpolys[i] = new google.maps.Rectangle({
             bounds: boxes[i],
             fillOpacity: 0, 
             strokeOpacity: 1.0, 
             strokeColor: '#000000', //<-- change color 
             strokeWeight: 0, //<-- change strokeWeight from 1 to 0
             map: map
         });
     }
}

这是标准 google.maps.Rectangleyou can style as you are used toRouterBoxer-code里什么都没有强制某些设计或风格。

关于javascript - 是否可以删除 RouteBoxer-boxes 的边框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28556325/

相关文章:

javascript - 为什么即使数组在 pop() 中完成后,Javascript 仍继续运行

javascript - Ajax.BeginForm 标识 OnComplete 方法中单击了哪个按钮

javascript - Google map 圆半径不起作用的问题

javascript - 将函数链接到单击事件

javascript - Google 地方信息未使用 RouteBoxer 返回完整结果

javascript - ng-style 不适用于嵌套对象?

javascript - d3.js nvd3 问题 : different charts on the same HTML page look the same (even though they have different IDs)

java - 一项 Activity 中是否可以有多个 GoogleApiClient?

javascript - 从routeboxer盒子创建多边形