I need your help.. How i can make more than one layer of container in nokia here map then put some id of it.. I am using Polyline to draw my gps tracks

This is my code this time..

var coords = [],
// Loop to add all the coordinates to an array
$.each(data, function (i, val) {
coords.push(parseFloat(val.latitude));
coords.push(parseFloat(val.longitude));
});

// Now create the Polyline
salesmanTrackPoints = new nokia.maps.map.Polyline(coords, {
pen: {
strokeColor: "#22CA",
lineWidth: 5
},
arrows: true
});
map.objects.add(salesmanTrackPoints);

i hope you can give some answer.. Thanks in advance

有帮助吗?

解决方案

You can add multiple Polylines directly onto the map to draw separate tracks like this:

track1 = new nokia.maps.map.Polyline(coords, {
  pen: {
    strokeColor: "#22CA",
    lineWidth: 5
  },
  arrows: true
});

track2 = new nokia.maps.map.Polyline(coords, {
  pen: {
    strokeColor: "#22CA",
    lineWidth: 5
  },
  arrows: true
});

map.objects.addAll([track1, track2]);

Alternatively you could use a container to separate out the MapObjects into logical collections e.g.:

var container1 = new nokia.maps.map.Container();
  container2 = new nokia.maps.map.Container(),

map.objects.add(container1);
map.objects.add(container2);

// Add Objects to container 1.
container1.objects.addAll([track1, markerA, markerB]);
// Add Other Objects to container 2.
container1.objects.addAll([track2, markerX, markerY]);

You can then retrieve the various MapObjects with the Container using the OList interface.

Since this is JavaScript, there is no problem with adding additional properties directly onto the Polyline objects if you wish:

polyline = new nokia.maps.map.Polyline(coords, {
      myCustomProperty : "I like Thursdays",
      mySecondCustomId : "Thurs",
      pen: {
        strokeColor: "#22CA",
        lineWidth: 5
      },
      arrows: true
    });
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top