Posts Tagged ‘J2memap’

New J2memap SDK available (v0.961)

Thursday, October 30th, 2008

Update of the SDK, with several improvment

* Already present in the latest version, but not yet announced here:
- Architecture rework, with the ability to display the map on a different canvas (not only his own canvas)
- Marker can have their own Style (MarkerStyle) shared between several markers. Note that by default, you still can use the old mode and change the
colors and pins attribute on the Marker, because the default style use
them directly.

* Several simplification: everything related to “typeSat”, “isSat”, and so on: satelite is just treated as a map like others. So to display YahooSat just do MyMap.setMap(”YahooSat”);

* The numSat is dropped too, as the list of mapping provider is dynamic. See belo, use setMap using a name if this sat is in listOfMap or setMap(MapOverlay) .

* Ask.com has been removed from the default map (they now use Microsoft maps).

* OpenStreetMap has been added in the list of default map provider.

* The “generic layer” support new quadtree URL

These should be minor changes from the external point of view, just by removing a few vars in your creation but this should clarify the usability.

Other improvment:
- the ressampled mode is much better
- cached map reactivation. You can put map in your jar file, or in the file system. A tutorial on this later.

The samples has been updated to reflect this. As usual, you can go to the J2memap web site to dowanload it…

Reblog this post [with Zemanta]

Tutorial: loading a KML file using the J2memap library

Wednesday, April 16th, 2008

Ok, following some requests, here is another tutorial on how to use the J2memap library. First, note that if you just want to display a KML file on mobile, you can use 8Motions directly, no need to create your own application.

Anyway, here we are going to show you how to create a very simple app that display a KML file on a cell phone. First, download the J2memap library (you need to be registered to download it), and put thelibraryCLDC11.jar (or 10.jar) as a library of your project. In netbeans, you do Properties,add jar/zip,select the jar file.

Here I take a KML file, but it could be also a GPX file, LOC or GEORSS file….

Then, here is the code:

package com.eightmotions.LoadTrack;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import com.eightmotions.util.*;
import com.eightmotions.map.*;
/**
 *
 * @author tlandspurg
 * @version
 */
public class LoadTrack extends MIDlet implements TrackNotifier {

    MapCanvas m_map;
    Display m_display;
    public void startApp() {
        UtilMidp.checkMIDP(this); //Initialise the utility library...

        // Initialize the map, get the display, and put the map on it
        m_map=new MapCanvas();
        m_display=Display.getDisplay(this);
        m_display.setCurrent(m_map);     

        // Load a track, and display this track to a map
        Track track=Track.getTrack(m_display,"http://www.8motions.com/map/showKml/107","Loading Track",m_map);
        // Listen for track loaded event...
        track.setNotifier(this);
    }

    public void pauseApp() { }

    public void destroyApp(boolean unconditional) {   }

    /* When the track has been loaded, display it... */
    public void onTrackLoaded(Track tr) {
        m_map.displayTrack(tr,true);
    }

    public void onTrackCreated(Track t) { };

    public void onTrackSaved(Track t) {};
}

Here is the result: