【问题标题】:Performance issue with set of images on map地图上的一组图像的性能问题
【发布时间】:2017-02-27 10:30:55
【问题描述】:

需要添加大约 400 个图像(标记)来映射。图像是可绘制的,而不是位图图片。这是正确的做法吗?

GeoJsonSource source;
mapboxMap.addSource(source);

for(Item item : items){

        Bitmap bitmap;
        SymbolLayer markerLayer = new SymbolLayer("layerA", sourceId);

        markerLayer.withProperties(PropertyFactory.iconImage(imageId));
        markerLayer.setFilter(
                all(
                        eq("id", item.getId()),
                        eq("coordinates", item.getLatLng())
                )
        );

        mapboxMap.addLayer(markerLayer, layerId);
        mapboxMap.addImage(imageId, bitmap);

}

使用此方法,地图变得无响应并且 fps 显着下降。可能这只是地图引擎的限制。

【问题讨论】:

    标签: android mapbox mapbox-gl mapbox-marker


    【解决方案1】:

    创建一个可绘制图像的数组,将所有图像存储在其中。

    喜欢

    int[] images = new int[] {};//store all images {in here}
    

    然后按位置使用地图图标..或者创建一个for循环

    喜欢

    for (int i = 0;i<images.lenght;i++){
    //apply your code here and set the images
    mapboxMap.addImage(imageId, bitmap.get[i]);
    }
    

    也许它会帮助你..

    【讨论】:

      猜你喜欢
      • 2015-04-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-17
      • 1970-01-01
      相关资源
      最近更新 更多