public void displayPosition(GPSDataDTO data)
{
map.clearOverlays();
map.addOverlay(createMarker(data));
map.setCenter(LatLng.newInstance(data.getLat(),data.getLongitude()),14);
}
private Marker createMarker(GPSDataDTO data)
{
final Marker marker = new Marker(LatLng.newInstance(data.getLat(),data.getLongitude()));
final GPSDataDTO p = data;
marker.addMarkerClickHandler(new MarkerClickHandler() {
public void onClick(MarkerClickEvent event) {
InfoWindow info = map.getInfoWindow();
info.open(marker,
new InfoWindowContent(
"ID: <b> " + p.getID() + "</b><br />" +
"Date: <b>" + p.getDate() +"</b><br />" +
"Time: <b>"+p.getTime() + "</b><br />" +
"Latitude: <b>" + p.getLat() + "</b><br/>" +
"Latitude Direction: <b>"+p.getLat_Dir() + "</b><br />" +
"Longitude: <b>"+ p.getLongitude() + "</b><br />" +
"Longitude Direction: <b>"+p.getLong_Dir() + "</b><br />" +
"Speed: <b>" + p.getSpeed() + "</b>kph??<br />" +
"Course: <b>" + p.getCourse() + "</b>Course<br />" +
"IP Address: <b>" + p.getIp_add() + "</b>"));}
});
return marker;
}
public void displayPositionHistory(Vector<GPSDataDTO> data) {
map.clearOverlays();
GPSDataDTO init = new GPSDataDTO();
init = data.elementAt(0);
map.setCenter(LatLng.newInstance(init.getLat(),init.getLongitude()),14);
for (int i=0; i < data.size(); i++)
{
GPSDataDTO marker = (GPSDataDTO)data.elementAt(i);
map.addOverlay(createMarker(marker));
}
}
|