Map API

MGMaps Lib SDK is professional toolkit to develop mobile mapping applications.
Platforms: iPhone, Android, RIM BlackBerry, Java ME (J2ME)
Download maps API SDK »
Untitled Document

Products

Latest news

Last at Mon, 6 Sep 2010 12:27:06
Topic: Let your feedback ideas flow
See more news »

Nutiteq on Twitter

11 weeks 6 days ago Nutiteq is proud sponsor of StateOfTheMap 2010 #sotm10

TouchScreen compatible

6 replies [Last post]
paul.haenel
User offline. Last seen 50 weeks 1 day ago. Offline
Joined: 08/14/2009

Hi i have written a blackberry application with has been designed for the keyboard blackberry. Now i want to support touchscreen devices too. Any suggestion on how to support the touch screen device with the this library i looked around but could find any help full API. Any suggestion appreciated....

jaak
User is online Online
Joined: 06/19/2008

BlackBerry 4.7 touchscreen API (for Storm) is not yet built in to the library, but it is in the roadmap. Meanwhile some have implemented it in the application level, and send moveMap() commands to map.

/JaakL

paul.haenel
User offline. Last seen 50 weeks 1 day ago. Offline
Joined: 08/14/2009

Where about in the roadmap is it ? When can we expect to have the updated library for that ?

jaak
User is online Online
Joined: 06/19/2008

In principle all you need is to redefine touchEvents in your application like following:

protected boolean touchEvent(TouchEvent event) {

int eventCode = event.getEvent();
switch (eventCode) {
 case TouchEvent.CLICK:
 mapComponent.pointerPressed(event.getX(1), event.getY(1));
 break;

 case TouchEvent.MOVE:
 mapComponent.pointerDragged(event.getX(1), event.getY(1));
  break;

 case TouchEvent.UNCLICK:
 mapComponent.pointerReleased(event.getX(1), event.getY(1));
  break;
 }
 return false;
}

You can make it much more advanced with using also second finger click for zoom (for iPhone style zooming), caching more events etc.

/JaakL

paul.haenel
User offline. Last seen 50 weeks 1 day ago. Offline
Joined: 08/14/2009

Hi actaully the above code sample works in the Emulator / Simulator but it doesnt work on the real device. If you use the above code then it works perfectly on device and sim:

protected boolean touchEvent(TouchEvent event) {
int eventCode = event.getEvent();

switch (eventCode) {
case TouchEvent.CLICK:
System.out.println("TouchEvent.CLICK");
mapComponent.pointerPressed(event.getX(1), event.getY(1));
break;
case TouchEvent.DOWN:
System.out.println("TouchEvent.DOWN");
mapComponent.pointerPressed(event.getX(1), event.getY(1));
break;
case TouchEvent.MOVE:
System.out.println("TouchEvent.MOVE");
mapComponent.pointerDragged(event.getX(1), event.getY(1));
break;
case TouchEvent.UNCLICK:
System.out.println("TouchEvent.UNCLICK");
mapComponent.pointerReleased(event.getX(1), event.getY(1));
break;
case TouchEvent.UP:
System.out.println("TouchEvent.UP");
mapComponent.pointerReleased(event.getX(1), event.getY(1));
break;
}
return false;
}

jaak
User is online Online
Joined: 06/19/2008

Great, thank you!

Maybe also dual-touch zooming? You cannot use pointerDragged then, and should handle (memorize) click/unclick events and locations of both fingers (event.getX(1) and event.getX(2)), and then call zoomIn() and zoomOut() methods of the library.

/JaakL

Emilio
User offline. Last seen 43 weeks 5 days ago. Offline
Joined: 03/20/2009

The code is great and works, but then my next question will be how to handle place/element clicks with the touch features. Maybe there is some easy way to do it but I don´t see it right now.

Any help will be appreciated.

Emilio