在此处地图2.5.3上渲染时,标记突然丢失 [英] Markers are missing suddenly while rendering on here maps 2.5.3

查看:117
本文介绍了在此处地图2.5.3上渲染时,标记突然丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个应用程序,它在navteq地图上显示标记的集合.当我使用navteq maps 2.2.3时,一切工作正常,但是由于Navteq maps 2.2.3不支持Asynchronous behaviour,所以我已切换到支持Asynchronous行为.

I have developed an application where it displays collection of markeres on the navteq map.when i was working with navteq maps 2.2.3 everything was working fine, but as Navteq maps 2.2.3 does not support for Asynchronous behaviour i have switched to HereMaps 2.5.3 which supports Asynchronous behaviour.

现在,切换到最新版本后,我面临一个奇怪的问题.也就是说,在地图上绘制标记时,突然已经渲染的点/标记(一些点)消失了.此问题有时会发生,如果再次尝试在地图上生成标记,效果会很好.

Now after switching to latest version i'm facing one strange problem. that is while rendering the markers on the map suddenly already rendered points/markers(some points) gets disappeared.this problem happens some times and if again i try to generate markeres on the map it works fine.

所以我认为我需要在渲染之前正确处理一些Display事件.

so i think i need to handle some Display events properly before rendering.

示例图片如下:

图片1:标记正确渲染

图片2:呈现但缺少一些点

MyCode如下:

以下功能负责在地图上显示标记.

the below function is responsible for displaying the markers on the map.

function displayAllPoints(arrLightPointCoordinats, totalLightPoints, selectedSegmentId,
                                        totalSegmentsCount, segmentColorcode) 
{
    var MyTheme1 = function () {
    };
    segmentColorcode = segmentColorcode.substring(2, segmentColorcode.length - 1);
    MyTheme1.prototype.getNoisePresentation = function (dataPoint) {
        var markerLightPoint = new nokia.maps.map.Marker(dataPoint, {
            icon: new nokia.maps.gfx.BitmapImage("..//Images//Lightpoint//" + segmentColorcode + ".png"),
            anchor: {
                x: 12,
                y: 12
            }
        });
        return markerLightPoint;
    };
    MyTheme1.prototype.getClusterPresentation = function (data) {
        var markerLightPoint = new nokia.maps.map.StandardMarker(data.getBounds().getCenter(), {
            icon: new nokia.maps.gfx.BitmapImage("..//Images//SegmentController/" + 
                                    segmentColorcode + ".png", null, 66, 65),
            text: data.getSize(),
            zIndex: 2,
            anchor: {
                x: 12,
                y: 12
            }
        });
        return markerLightPoint;
    };
    var indexes = new nokia.maps.clustering.Index();
    var lightpointsDataSet1 = new Array();

    for (var i = 0; i < totalLightPoints; i++) {
        lightpointsDataSet1[i] = { latitude: arrLightPointCoordinats[i][0],
        longitude: arrLightPointCoordinats[i][1], title: 'LightPoint ' + (i + 1) };
        indexes.add([arrLightPointCoordinats[i][0], arrLightPointCoordinats[i][1]]);
    }
    var ClusterProvider = nokia.maps.clustering.ClusterProvider,
        theme = new MyTheme1(),
        clusterProvider = new ClusterProvider(map, {
            eps: 0.00000000001,
            minPts: 1000000,
            strategy: nokia.maps.clustering.ClusterProvider.STRATEGY_DENSITY_BASED,
            index: indexes,
            theme: theme,
            dataPoints: []
        });
    clusterProvider.addAll(lightpointsDataSet1);
    clusterProvider.cluster();
    map.update(-1, 0);
    //set zoom level here

    setCenterAndZoom(13, arrSegmentControllerIds[0]);
}

任何帮助将不胜感激.

推荐答案

在开始群集之前,我使用Display Ready事件:

I use the Display Ready Event, before starting the Clustering:

        map.addListener("displayready", function()
        {
            mapContainer.style.display = 'block';

            // load the photos as cluster data
            url = "http://developer.here.com/apiexplorer/examples/res/clustering/photos.js";
            script = document.createElement("script");
            script.src = url;
            document.body.appendChild(script);
        });

        onDataReceive = function(data)
        {
            displayAllPoints(data);
        }

        function displayAllPoints(arrLightPointCoordinates) 
        {           {
            var MyTheme1 = function (){};
            MyTheme1.prototype.getNoisePresentation = function (dataPoint) {
                var markerLightPoint = new nokia.maps.map.Marker(dataPoint, {
                    icon: new nokia.maps.gfx.BitmapImage("/res/marker_red.png"),
                    anchor: {
                        x: 12,
                        y: 12
                    }
                });
                return markerLightPoint;
            };

            MyTheme1.prototype.getClusterPresentation = function (data) {
                var markerLightPoint = new nokia.maps.map.StandardMarker(data.getBounds().getCenter(), {
                    icon: new nokia.maps.gfx.BitmapImage("/res/marker_green.png", null, 66, 65),
                    text: data.getSize(),
                    zIndex: 2,
                    anchor: {
                        x: 12,
                        y: 12
                    }
                });
                return markerLightPoint;
            };
/*              
            var indexes = new nokia.maps.clustering.Index();
            var lightpointsDataSet1 = new Array();

            for (var i = 0; i < totalLightPoints; i++) {
                lightpointsDataSet1[i] = { latitude: arrLightPointCoordinats[i][0],
                longitude: arrLightPointCoordinats[i][1], title: 'LightPoint ' + (i + 1) };
                indexes.add([arrLightPointCoordinats[i][0], arrLightPointCoordinats[i][1]]);
            }
*/
            var ClusterProvider = nokia.maps.clustering.ClusterProvider,
                theme = new MyTheme1(),
                clusterProvider = new ClusterProvider(map, {
                    eps: 0.00000000001,
                    minPts: 1000000,
                    strategy: nokia.maps.clustering.ClusterProvider.STRATEGY_DENSITY_BASED,
                    // index: indexes,
                    theme: theme,
                    dataPoints: []
                });
            clusterProvider.addAll(arrLightPointCoordinates);
            clusterProvider.cluster();
            map.update(-1, 0);
            //set zoom level here
            // setCenterAndZoom(13, arrSegmentControllerIds[0]);
        }

希望有帮助.您也可以签出最新版本2.5.4.

Hope that helps. Also you can check out the newest version 2.5.4.

最佳,

Dom

这篇关于在此处地图2.5.3上渲染时,标记突然丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆