I want to add a route fence within the jxmap is it possible? like the picture above, with the feature of directly drawing a polyline in the map
Asked
Active
Viewed 155 times
1 Answers
0
Current version of JxMaps doesn't implement drawing tools.(https://developers.google.com/maps/documentation/javascript/examples/drawing-tools). This functionality will be included to one of next JxMaps releases.
But you can implement own logic using map events and polylines. For example you can add mouse click handler to the Map instance:
LatLng[] path = new LatLng[count];
map.addEventListener("click", new MapMouseEvent() {
@Override
public void onEvent(MouseEvent mouseEvent) {
path[current] = mouseEvent.latLng();
}
});
Using this handler you can collect positions and then write polyline with them:
Polyline polyline = new Polyline(map);
polyline.setPath(path);

Vitaly Eremenko
- 341
- 1
- 5
-
sir can i have another question... is real time tracking of vehicle can be done in jxmaps?... i will be using a gps tracker and micro controller to fetch the lat and long. and for every 30secs or 1 min a marker moves as the location of the vehicle changes. tnx – Renrenren Feb 15 '17 at 03:44
-
Yes, it possible. You can create marker and then update it coordinates with information received from your gps tracker. – Vitaly Eremenko Feb 15 '17 at 09:49