summaryrefslogtreecommitdiff
path: root/trunk/src/nav/navigate.java
diff options
context:
space:
mode:
authormanut <manut@58fc9717-fb00-483d-b79c-3a878c4e3be5>2007-08-12 11:39:18 +0000
committermanut <manut@58fc9717-fb00-483d-b79c-3a878c4e3be5>2007-08-12 11:39:18 +0000
commit1caba29952307e005eae662fcace54b2252b8c97 (patch)
tree57a5977cedc20b92a9878916c1095cb152fc79e5 /trunk/src/nav/navigate.java
InitialHEADmaster
git-svn-id: svn+ssh://mecka.net/home/svn/geoc@1 58fc9717-fb00-483d-b79c-3a878c4e3be5
Diffstat (limited to 'trunk/src/nav/navigate.java')
-rwxr-xr-xtrunk/src/nav/navigate.java93
1 files changed, 93 insertions, 0 deletions
diff --git a/trunk/src/nav/navigate.java b/trunk/src/nav/navigate.java
new file mode 100755
index 0000000..eeaffce
--- /dev/null
+++ b/trunk/src/nav/navigate.java
@@ -0,0 +1,93 @@
+/*
+ * navigate.java
+ *
+ * Created on July 14, 2007, 2:18 AM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package nav;
+
+import javax.microedition.location.*;
+import gui.geoc;
+import java.lang.Thread;
+
+/**
+ *
+ * @author manut
+ */
+public class navigate {
+
+ private geoc gui;
+ private LocationProvider pos;
+ private int provState;
+
+ private Location actLoc;
+ private Landmark dest;
+
+ private processLoc pLoc;
+ private processState pState;
+
+ /** Creates a new instance of navigate */
+ public navigate(geoc _gui) throws LocationException {
+
+ pos = LocationProvider.getInstance(null);
+ if (pos == null)
+ throw new LocationException();
+
+ gui = _gui;
+ pLoc = new processLoc(gui);
+ pState = new processState(gui);
+ }
+
+ /** sets destination */
+ public void setDestination ( String north, String east )
+ throws IllegalArgumentException {
+
+ double latitude, longitude;
+ float altitude, hAcc, vAcc;
+
+ latitude = Coordinates.convert(north);
+ longitude = Coordinates.convert(east);
+
+ altitude = Float.NaN;
+ hAcc = 0;
+ vAcc = 0;
+
+ QualifiedCoordinates coord;
+ coord = new QualifiedCoordinates( latitude,
+ longitude,
+ altitude, hAcc, vAcc
+ );
+
+ if(dest == null){
+ AddressInfo info = new AddressInfo();
+ dest = new Landmark("destination", "stageX", coord, info);
+ } else
+ dest.setQualifiedCoordinates(coord);
+
+
+ locListener locList = new locListener(this);
+ int interval = -1;
+
+ gui.get_stringItemDestNorth().setText(north);
+ gui.get_stringItemDestEast().setText(east);
+
+ pos.setLocationListener(locList, interval, 0, 0);
+
+ }
+
+ public void setNewLoc(Location loc){
+ actLoc = loc;
+ pLoc.set(loc, dest);
+ pLoc.run();
+ }
+
+ public void setNewState(int state){
+ provState = state;
+ pState.set(state);
+ pState.run();
+ }
+
+}