笼络4K折线在谷歌Android地图折线、地图、Android

2023-09-06 04:29:31 作者:精神病院Ⅴiρ用戶

我发展,现在Android设备的应用程序。其主要功能是绘制折线在地图上显示的是在每个街道城市的喧嚣。不幸的是,当我画3K左右折线 - 数是根据屏幕大小和缩放级别降低 - 我的地图变得慢得令人难以置信......我不提绘制的所有行的时间

I'm developing right now an application for Android devices. The main functionality is to draw polylines on map to show what is the traffic in the city on each street. Unfortunately when I draw around 3K polylines - the number is reduced according to the screen size and zoom level - my map gets incredibly slow... I do not mention the time of drawing all of the lines.

也许你知道,更高效的方式来标记街道或地图上画线?

Maybe you know more efficient way to mark streets or draw lines on a map?

我也想切换到OSM但我从来没有使用过,我不知道它是多么有效。

I was also thinking about switching to OSM but I never used it and I don't know how efficient it is.

我在三星Galaxy Note 10.1调试应用程序,应用程序使用地图API V2

I debug app on Samsung Galaxy Note 10.1 and App uses Map API v2

我的code绘制折线:

My code to draw polylines:

Polyline line;
List<Float> coordinatesStart;
List<Float> coordinatesEnd;
LatLng start;
LatLng end;
List<List<Float>> coordinates;
int polylinesNumber = 0;
for(Features ftr : features){
    coordinates = ftr.geometry.coordinates;

    for(int i = 0; i<coordinates.size()-1; i++){

            coordinatesStart = coordinates.get(i);
            coordinatesEnd = coordinates.get(i+1);
            start = new LatLng(coordinatesStart.get(1), coordinatesStart.get(0));
            end = new LatLng(coordinatesEnd.get(1), coordinatesEnd.get(0));
            line = map.addPolyline(new PolylineOptions()
             .add(start, end)
             .width(3)
             .color(0x7F0000FF)); //semi-transparent blue
            polylinesNumber++;

    }
}

我会AP preciate任何帮助!

I would appreciate any help!

推荐答案

你检查你绘制折线偶可见于屏幕上的用户?如果不是这样,那将是我的第一个想法。 This问题可能是该帮助。

Do you check if the polyline that you draw is even visible to the user on the screen? If not, that would be my first idea. This question could be of help for that.

 
精彩推荐