aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/web/client/controller/MapController.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-01-10 23:42:16 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-01-10 23:42:16 +1300
commit5100c457ad2f1faf1cffa8503c6baaf3a26c5d89 (patch)
treea848e347421c88ce3288391e250c76737fd50e05 /src/org/traccar/web/client/controller/MapController.java
parent137c89bc9a870c4018f4c000494c89af9ceea67a (diff)
downloadtrackermap-web-5100c457ad2f1faf1cffa8503c6baaf3a26c5d89.tar.gz
trackermap-web-5100c457ad2f1faf1cffa8503c6baaf3a26c5d89.tar.bz2
trackermap-web-5100c457ad2f1faf1cffa8503c6baaf3a26c5d89.zip
Archive panel and some map features
Diffstat (limited to 'src/org/traccar/web/client/controller/MapController.java')
-rw-r--r--src/org/traccar/web/client/controller/MapController.java26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/org/traccar/web/client/controller/MapController.java b/src/org/traccar/web/client/controller/MapController.java
index 5ab5bbcf..738b2811 100644
--- a/src/org/traccar/web/client/controller/MapController.java
+++ b/src/org/traccar/web/client/controller/MapController.java
@@ -1,5 +1,8 @@
package org.traccar.web.client.controller;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.LinkedList;
import java.util.List;
import org.traccar.web.client.Application;
@@ -13,7 +16,7 @@ import com.sencha.gxt.widget.core.client.ContentPanel;
public class MapController implements ContentController {
- private static final int UPDATE_INTERVAL = 10000;
+ private static final int UPDATE_INTERVAL = 15000;
private MapView mapView;
@@ -44,7 +47,7 @@ public class MapController implements ContentController {
Application.getDataService().getLatestPositions(new AsyncCallback<List<Position>>() {
@Override
public void onSuccess(List<Position> result) {
- mapView.showPositions(result);
+ mapView.showLatestPositions(result);
updateTimer.schedule(UPDATE_INTERVAL);
}
@Override
@@ -54,8 +57,23 @@ public class MapController implements ContentController {
});
}
- public void select(Device device) {
- mapView.select(device, true);
+ public void selectDevice(Device device) {
+ mapView.selectDevice(device);
+ }
+
+ public void showArchivePositions(List<Position> positions) {
+ List<Position> sortedPositions = new LinkedList<Position>(positions);
+ Collections.sort(sortedPositions, new Comparator<Position>() {
+ @Override
+ public int compare(Position o1, Position o2) {
+ return o1.getTime().compareTo(o2.getTime());
+ }
+ });
+ mapView.showArchivePositions(sortedPositions);
+ }
+
+ public void selectArchivePosition(Position position) {
+ mapView.selectArchivePosition(position);
}
}