Map API

Nutiteq Maps Lib SDK enables developing advanced mobile mapping applications.
Platforms: Android, RIM BlackBerry, Java ME (J2ME)
Download maps API SDK »
Untitled Document

Products

» View demos
» Downloads

Uudised

Viimane: Thu, 15 Mar 2012 14:51:08
Teema: Vabad töökohad pakkuda
Veel uudiseid »

not able to add places on Map

6 replies [Last post]
Leo
User offline. Last seen 2 years 38 weeks ago. Offline
Joined: 07/10/2009

I am trying to show Place on map. But I am not able to see icon on the maps. following is my code snippets..

Image img = Image.createImage(imgbyte, 0,imgbyte.length);

Place[] p = {new Place(1,new PlaceLabel("test"), img,42,-71)
,new Place(1,new PlaceLabel("test"), img,42,-70)
,new Place(1,new PlaceLabel("test"), img,41,-71)};

mapComponent.addPlaces(p);

any suggestion why its failing?

jaak
User offline. Last seen 1 day 22 hours ago. Offline
Joined: 06/19/2008

Maybe you mean different coordinate order: -71,42 ? Your code puts points to Antarctica, maybe you were looking them from New York state, where they are if lot and lang are swapped?

/JaakL

Leo
User offline. Last seen 2 years 38 weeks ago. Offline
Joined: 07/10/2009

Thanks Jaak it's working now. Now places shows up on the map. Now another issue. Not able to get placeListener working

mapComponent.setPlaceListener(this);

implemented 3 method

PlaceLeft
PlaceEntered
Placeclicked

Any feedback highly appreciated.

jaak
User offline. Last seen 1 day 22 hours ago. Offline
Joined: 06/19/2008

Please describe more what you try to get and do not get.

To use the listeners you need 3 steps:

1. add "implements Placelistener" to class header
2. add .setPlaceListener(Implementing class)
3. implement the 3 methods

Maybe "placeEntered/Left" is a bit confusing name in terms of touchscreen. With touch-screen first click is "placeEntered" (unless some other place was selected already, then it is "placeLeft" for last selected object). Then second click to the same object is "PlaceClicked" event.

With non-touchscreen "Entered" means that cursor in moved nearby center of map is nearby place icon.

Note that PlaceListener is applicable only for point places. For all geometries: points, lines and polygons use new OnMapElementListener and it's similar functions.

Also make sure that you have cursor set, there is different forum thread about it: http://www.nutiteq.com/content/errors-tutorial-mapslib0100#comment-88

/JaakL

Leo
User offline. Last seen 2 years 38 weeks ago. Offline
Joined: 07/10/2009

Jaak:

Do I need to implement touchEvent for Place or if I implement PlaceListener with three method will be sufficient. Because the reason is I am able to place places on map but not able to fire any of the method. PlaceLeft, PlaceEntered or PlaceClicked. Do we need to fire this method or Listener will handle click event?

jaak
User offline. Last seen 1 day 22 hours ago. Offline
Joined: 06/19/2008

For Java ME platforms just PlaceListener is enough.

If you mean BlackBerry Storm platform here, then there you need to implement touchEvent, as library has no built-in implementation for that.

/JaakL