From 1caba29952307e005eae662fcace54b2252b8c97 Mon Sep 17 00:00:00 2001 From: manut Date: Sun, 12 Aug 2007 11:39:18 +0000 Subject: Initial git-svn-id: svn+ssh://mecka.net/home/svn/geoc@1 58fc9717-fb00-483d-b79c-3a878c4e3be5 --- trunk/build/preprocessed/nav/navigate.java | 93 ++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100755 trunk/build/preprocessed/nav/navigate.java (limited to 'trunk/build/preprocessed/nav/navigate.java') diff --git a/trunk/build/preprocessed/nav/navigate.java b/trunk/build/preprocessed/nav/navigate.java new file mode 100755 index 0000000..eeaffce --- /dev/null +++ b/trunk/build/preprocessed/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(); + } + +} -- cgit v1.2.3