net.landspurg
Class MapMain

java.lang.Object
  extended by javax.microedition.midlet.MIDlet
      extended by net.landspurg.MapMain
All Implemented Interfaces:
javax.microedition.lcdui.CommandListener, javax.microedition.lcdui.ItemStateListener, LocateMeListener, MapCanvasListener, GenericFeedback, NotifyLoadURL

public class MapMain
extends javax.microedition.midlet.MIDlet
implements javax.microedition.lcdui.CommandListener, NotifyLoadURL, MapCanvasListener, javax.microedition.lcdui.ItemStateListener, GenericFeedback, LocateMeListener

Main midlet for j2memap. It's where reside mostly of the logic specific to this midlet, menus, and call to various submenus....


Field Summary
 int m_initCount
           
static boolean m_useNavizon
           
static MapMain singleton
           
 java.lang.String urlGPS
           
 java.lang.String version
           
 
Constructor Summary
MapMain()
           
 
Method Summary
 void actionDone(java.lang.Object source, int erroCode)
           
 void addPlace(OneLoc place)
           
 java.lang.String checkWellKnowLocations(java.lang.String inLoc)
           
 void commandAction(javax.microedition.lcdui.Command c, javax.microedition.lcdui.Displayable d)
           
 GPSDisplay createCanvas()
           
static void debug(java.lang.String inStr)
           
 void destroyApp(boolean unconditional)
          Destroy app: save current position in the settings
 void error(int inErrorCode)
           
 void findPattern(java.io.InputStream is, java.lang.String inPattern)
           
 OneLoc findPlaceByName(java.lang.String inName)
           
 void found(double inlon, double inlat, double alt, double dir, double speed, long stamp, boolean isValid)
           
 java.lang.String getFloat(java.io.InputStream is)
           
 javax.microedition.lcdui.Form getFormLocation(OneLoc theLoc)
          Creation of the form which display the current location
 java.lang.String getPhoneNum(java.lang.String phone)
           
 java.lang.String getStringTo(java.io.InputStream is, java.lang.String inPattern)
           
 java.lang.String getStringTo(java.io.InputStream is, java.lang.String inPattern, boolean keepInBetween)
           
 void initAll()
          Various initialisation , commands, etc...
 boolean inputStream(java.io.InputStream is)
           
 boolean isGPSRunning()
           
 boolean isLocationStarted()
           
 void itemStateChanged(javax.microedition.lcdui.Item inItem)
           
 boolean lineRead(URLFetcher f, java.lang.String inLine)
           
 void loaded(URLFetcher f)
           
 boolean mapKeyPressed(MapCanvas c, int inCode)
          Called when a key has been pressed.
 boolean oneLocationSelected(MapCanvas c, OneLoc theLoc)
          Callback called when the user select a location in the map
 void pauseApp()
           
 void removePlace(java.lang.String name)
           
 void restartGPS()
           
 void startApp()
          Lets go....
 void startFon()
           
 void startGPS()
           
 void startingLocation()
           
 void startWikiMapia()
          Start the automatic fetching to Wikimapia....
 void statusInfo(int id, java.lang.String stringInfo)
           
 void stopGPS()
           
 
Methods inherited from class javax.microedition.midlet.MIDlet
checkPermission, getAppProperty, notifyDestroyed, notifyPaused, platformRequest, resumeRequest
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

version

public java.lang.String version

m_initCount

public int m_initCount

singleton

public static MapMain singleton

m_useNavizon

public static boolean m_useNavizon

urlGPS

public java.lang.String urlGPS
Constructor Detail

MapMain

public MapMain()
Method Detail

debug

public static void debug(java.lang.String inStr)

findPlaceByName

public OneLoc findPlaceByName(java.lang.String inName)

removePlace

public void removePlace(java.lang.String name)

addPlace

public void addPlace(OneLoc place)

pauseApp

public void pauseApp()
Specified by:
pauseApp in class javax.microedition.midlet.MIDlet

destroyApp

public void destroyApp(boolean unconditional)
Destroy app: save current position in the settings

Specified by:
destroyApp in class javax.microedition.midlet.MIDlet

getFormLocation

public javax.microedition.lcdui.Form getFormLocation(OneLoc theLoc)
Creation of the form which display the current location

Parameters:
theLoc -
Returns:
a Form!

createCanvas

public GPSDisplay createCanvas()

initAll

public void initAll()
Various initialisation , commands, etc...


startGPS

public void startGPS()

isGPSRunning

public boolean isGPSRunning()

stopGPS

public void stopGPS()

restartGPS

public void restartGPS()

actionDone

public void actionDone(java.lang.Object source,
                       int erroCode)
Specified by:
actionDone in interface GenericFeedback

isLocationStarted

public boolean isLocationStarted()

startingLocation

public void startingLocation()

startApp

public void startApp()
Lets go.... if not yet started, do some initialisation, and display the main canvas...

Specified by:
startApp in class javax.microedition.midlet.MIDlet

itemStateChanged

public void itemStateChanged(javax.microedition.lcdui.Item inItem)
Specified by:
itemStateChanged in interface javax.microedition.lcdui.ItemStateListener

startWikiMapia

public void startWikiMapia()
Start the automatic fetching to Wikimapia....


startFon

public void startFon()

checkWellKnowLocations

public java.lang.String checkWellKnowLocations(java.lang.String inLoc)

commandAction

public void commandAction(javax.microedition.lcdui.Command c,
                          javax.microedition.lcdui.Displayable d)
Specified by:
commandAction in interface javax.microedition.lcdui.CommandListener

loaded

public void loaded(URLFetcher f)
Specified by:
loaded in interface NotifyLoadURL

error

public void error(int inErrorCode)
Specified by:
error in interface NotifyLoadURL

findPattern

public void findPattern(java.io.InputStream is,
                        java.lang.String inPattern)
                 throws java.io.IOException
Throws:
java.io.IOException

getFloat

public java.lang.String getFloat(java.io.InputStream is)
                          throws java.io.IOException
Throws:
java.io.IOException

getStringTo

public java.lang.String getStringTo(java.io.InputStream is,
                                    java.lang.String inPattern)
                             throws java.io.IOException
Throws:
java.io.IOException

getStringTo

public java.lang.String getStringTo(java.io.InputStream is,
                                    java.lang.String inPattern,
                                    boolean keepInBetween)
                             throws java.io.IOException
Throws:
java.io.IOException

inputStream

public boolean inputStream(java.io.InputStream is)
Specified by:
inputStream in interface NotifyLoadURL
Returns:
false if loading must stop from here

lineRead

public boolean lineRead(URLFetcher f,
                        java.lang.String inLine)
Specified by:
lineRead in interface NotifyLoadURL
Returns:

getPhoneNum

public java.lang.String getPhoneNum(java.lang.String phone)

oneLocationSelected

public boolean oneLocationSelected(MapCanvas c,
                                   OneLoc theLoc)
Description copied from interface: MapCanvasListener
Callback called when the user select a location in the map

Specified by:
oneLocationSelected in interface MapCanvasListener
theLoc - return true if default behavior (switch map/satellite) needs to be applied also

mapKeyPressed

public boolean mapKeyPressed(MapCanvas c,
                             int inCode)
Description copied from interface: MapCanvasListener
Called when a key has been pressed. Note: return true to keep default behavior...

Specified by:
mapKeyPressed in interface MapCanvasListener
Returns:

found

public void found(double inlon,
                  double inlat,
                  double alt,
                  double dir,
                  double speed,
                  long stamp,
                  boolean isValid)
Specified by:
found in interface LocateMeListener

statusInfo

public void statusInfo(int id,
                       java.lang.String stringInfo)
Specified by:
statusInfo in interface LocateMeListener