简体   繁体   English

Google Maps V3,strokeWeight折线可扩展

[英]Google Maps V3, strokeWeight Polyline scalable

I have a problem: this is my map now: 我有一个问题:这是我的地图:

在此处输入图片说明

I have circles in the map, and I can scale them. 我在地图上有圆圈,可以缩放它们。 But I have polylines too, I tried to scale them by strokeWeight but this doesn't work. 但是我也有折线,我试图通过strokeWeight缩放它们,但这是行不通的。 I need draw a route with a personalizable width, like the circle's radius. 我需要绘制一条具有个性化宽度的路线,例如圆的半径。 Any idea? 任何想法?

EDIT: some code 编辑:一些代码

    google.maps.event.addListener(this.markerEdit, 'mouseup', function() {
        if(me.poly!=null){
            var Options = {strokeWeight: 2000};
            me.poly.setOptions(Options);
        }
    });

Or 要么

    google.maps.event.addListener(this.markerEdit, 'mouseup', function() {
        if(me.poly!=null){
            me.poly.setStrokeWeight(2000);
        }
    });

I tried the two. 我尝试了两个。

Thank you 谢谢

I think you're using the wrong function to change the strokeweight. 我认为您使用了错误的功能来更改行程重量。

Try using 尝试使用

me.poly.setOptions({strokeWeight: 2000});

Check out this example fiddle: http://jsfiddle.net/cx4Gm/ It should explain everything you need. 查看以下示例小提琴: http : //jsfiddle.net/cx4Gm/它应该解释您需要的一切。

I have the same problem. 我也有同样的问题。

This is what i made : 这就是我做的:

google.maps.event.addListener(mapRelatorioMapa , 'zoom_changed', function(){
    var zoom = mapRelatorioMapa.getZoom() * larg /17 ; 
    for(var obj in redLine)
    {
        redLine[obj].setOptions({strokeWeight: zoom});
    }
});

So I get the zoom and try to multiply it , but it doesn't work so good I think that you have to try to find the real scale for each zoom and make a table. 因此,我得到了缩放并尝试将其倍增,但效果不佳,我认为您必须尝试找到每个缩放的真实比例并制作一张桌子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM