The code is
public void start() {
l= 0;
if(current != null){
current.show();
return;
}
hi = new Form("TalkingGps", new BorderLayout());
MapContainer cnt = new MapContainer();
// cnt = new MapContainer(provider);
// String tileLayer= "http://t1.openseamap.org/seamark/";
// cnt.addTilelayer(tileLayer);
cnt.addLongPressListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
t.setSelectedIndex(0);
}
});
Kaart= BoxLayout.encloseYCenter(cnt);
cnt.addTapListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if ((routenw == true)) {
int x = evt.getX()-cnt.getAbsoluteX(); ;
int y = evt.getY()-cnt.getAbsoluteY();
Coord positie = cnt.getCoordAtPosition(x,y);
double Latt = positie.getLatitude();
double Lonn = positie.getLongitude();
nwrtetabel(Latt,Lonn);
try {
cnt.addMarker(EncodedImage.create("/maps-pin2.png"), positie
, "Marker At","punt", new ActionListener() {
public void actionPerformed(ActionEvent evt) {
Dialog.show("Marker At", "Marker At" , "OK", null);
}
});
Integer zm = 17;
cnt.zoom(new Coord(Latt, Lonn ), zm);
cnt.setShowMyLocation(true);
markerLookup.put(1,"punt");
} catch(IOException err) {
// since the image is iin the jar this is unlikely
err.printStackTrace();
}
} else if (addm == true ) {
addm = false ;
int x = evt.getX()-cnt.getAbsoluteX(); ;
int y = evt.getY()-cnt.getAbsoluteY();
Coord positie = cnt.getCoordAtPosition(x,y);
double Latt = positie.getLatitude();
double Lonn = positie.getLongitude();
nwrtetabel(Latt,Lonn);
try {
cnt.addMarker(EncodedImage.create("/maps-pin.png"), positie ,
"Marker At","punt", new ActionListener() {
public void actionPerformed(ActionEvent evt) {
Dialog.show("Marker At", "Marker At" , "OK", null);
}
});
Integer zm = 17;
cnt.zoom(new Coord(Latt, Lonn ), zm);
cnt.setShowMyLocation(true);
markerLookup.put(1,"punt");
} catch(IOException err) {
// since the image is iin the jar this is unlikely
err.printStackTrace();
}
}
}
} );
hi.addComponent(BorderLayout.CENTER, Kaart );
hi.show();
}
--
You received this message because you are subscribed to the Google Groups
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/a37b1731-929d-49fc-ae68-22d71b68e5f9%40googlegroups.com.