Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 208
Registered: ‎08-04-2009
My Device: Not Specified

Re: Blackberry maps

you should post every new problem in new thread, so can other programmers can find a solution, or even suggest a solution.

 

 

Regular Contributor
Posts: 94
Registered: ‎05-29-2010
My Device: 9000 bold
My Carrier: asfas

Re: Blakberry maps

Hello Mr Jitendra Sharma.

 I tried using your MultiMapField class but i am not able to resolve InfoTraceRoute. Is it your Custom class. If so can you please share it too.

Contributor
Posts: 11
Registered: ‎08-18-2010
My Device: Not Specified

plz send InfoTraceRoute

Hi Sir

 plz send InfoTraceRoute class in customMapField.

Thanks & Regards

A.suman

 

Trusted Contributor
Posts: 201
Registered: ‎12-17-2010
My Device: Not Specified

Re: Blackberry maps

Hello sir,

 

I want to get the lat & long clicking on map.

i write below code in custmo map field but i cant get the value of it.

I tried by debugging code but the debugger not go in the method.

so please help me to come out from this issue.

 

Thanks & Regards

:Helpsmilie:

 

 

protected boolean navigationClick(int status, int time) {
 int lat = getLatitude();
 int lang = getLongitude();
 System.out.println("Lat :~~~~~~~~~~~~~~~~>" + lat);
 System.out.println("Lang :~~~~~~~~~~~~~~~~>" + lang);
 return super.navigationClick(status, time);
 }

 

Trusted Contributor
Posts: 201
Registered: ‎12-17-2010
My Device: Not Specified

Blakberry maps

Hello Mr. Jitendra Sharma Sir,

 

can you please give me a favour ?

can you please send your InfoTraceRoute.java custom class mail me on mlnmodi@gmail.com?

 

Thanks & Regards

 

 

Trusted Contributor
Posts: 201
Registered: ‎12-17-2010
My Device: Not Specified

Re: Blakberry maps

Hello Sir,

 

I want to get the latitude & longitude of map.

 

Now I click on map any where i get the center of map's latitude & longitude.

 

But I want to get the latitude & longitude of map where i clicked on map.

 

So please any one has any idea please help me to solve my issue.

 

Thanks & Regards

Contributor
Posts: 21
Registered: ‎04-21-2011
My Device: Developer
My Carrier: ----

Re: Blackberry maps

Hi ,

 I have been trying to implement pretty much the same thing. But  i also want to include PAN ans ZOOM options through trackball and keypad respectively.

  I have  tried  the following

public

boolean navigationMovement(int dx, int dy, int status, inttime)

{

boolean b = false;

dx = dx << 3;

dy = dy << 3;

// Allows smoother panning on the map.if (Trackball.isSupported())

{

// Adjust the filter.

getScreen().setTrackballFilter(Trackball.

FILTER_NO_TIME_WINDOW | Trackball.FILTER_ACCELERATION);

b=

true;

}

mapField.mf.move(dx*10, dy*10);

 

invalidate();

// Delegates this task to the map instance.returnb;

}

protectedboolean keyDown(int keycode, inttime) {

 

int key=Keypad.key(keycode);

 

//String keyname= String.valueOf(Keypad.map(key, status));

String keyC=Integer.toString(key);

System.

out.println("********************************* key pressed"+key);

System.

out.println("********************************* key pressed to string"+keyC);

 

returnsuper.keyDown(keycode, time);

}

publicboolean keyChar(char key, int status, inttime)

{

System.

out.println("inside keychar");

 

boolean retval = false;

 

int zoom=mapField.mf.getZoom();

if(key== 'o'||key== 'O')

{

zoom=zoom-3;

mapField.mf.setZoom(zoom);

 

retval = true;

 

 

}

return

retval;

 

}

 

 

  I  have over ridden these methods inside the  place where I am calling the multimap manager.

Also this is the implementation of my multimap manager.Please tell me if  I am doing anythin wrong.As  I m unable to view certain location s and also zoom through touch event also doe snot work all the time.

 

import javax.microedition.location.Coordinates;

import net.rim.device.api.lbs.MapField;
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.XYPoint;
import net.rim.device.api.ui.component.BitmapField;
import net.rim.device.api.ui.container.AbsoluteFieldManager;
import net.rim.device.api.util.Arrays;


public class MultiMapLocManager extends AbsoluteFieldManager{
 Coordinates[] mPoints = new Coordinates[0];
 Bitmap mPoint;
 public  MapField mapField;
 boolean bitmapInLocationFlag[];
 BitmapField field[];
 int coordinatedCount;

 public MultiMapLocManager(int count,Bitmap mPoint) {
  mapField=new MapField();
  this.mPoint=mPoint;
  this.coordinatedCount=count;
  add(mapField);
  bitmapInLocationFlag=new boolean[count];
  field=new BitmapField[count];
  for(int i=0;i<count;i++){
   field[i]=new BitmapField(Bitmap.getBitmapResource("red-pin.png"));
   bitmapInLocationFlag[i]=false;
  }

 }

 public void addCoordinates(Coordinates coordinates) {
  Arrays.add(mPoints, coordinates);
  zoomToFitPoints();
 }
 protected void zoomToFitPoints() {
  // zoom to max
  mapField.setZoom(mapField.getMaxZoom());

  // get pixels of all points
  int minLeft = getWidth();
  int minUp = getHeight();
  int maxRight = 0;
  int maxDown = 0;
  Coordinates minLeftCoordinates = null;
  Coordinates minUpCoordinates = null;
  Coordinates maxRightCoordinates = null;
  Coordinates maxDownCoordinates = null;
  for (int i = 0; i < mPoints.length; i++) {
   XYPoint point = new XYPoint();
   mapField.convertWorldToField(mPoints[i], point);
   if (point.x <= minLeft) {
    minLeft = point.x;
    minLeftCoordinates = mPoints[i];
   }
   if (point.x >= maxRight) {
    maxRight = point.x;
    maxRightCoordinates = mPoints[i];
   }
   if (point.y <= minUp) {
    minUp = point.y;
    minUpCoordinates = mPoints[i];
   }
   if (point.y >= maxDown) {
    maxDown = point.y;
    maxDownCoordinates = mPoints[i];
   }
  }

  double moveToLat = maxDownCoordinates.getLatitude()
  + (minUpCoordinates.getLatitude() - maxDownCoordinates
    .getLatitude()) / 2;
  double moveToLong = minLeftCoordinates.getLongitude()
  + (maxRightCoordinates.getLongitude() - minLeftCoordinates
    .getLongitude()) / 2;
  Coordinates moveTo = new Coordinates(moveToLat, moveToLong, 0);
  mapField.moveTo(moveTo);
  // zoom to min left up, max right down pixels + 1
  int zoom = mapField.getZoom();
  boolean outOfBounds = false;
  while (!outOfBounds && zoom > mapField.getMinZoom()) {
   zoom--;
   mapField.setZoom(zoom);
   XYPoint point = new XYPoint();
   try {
    mapField.convertWorldToField(minLeftCoordinates, point);
    if (point.x < 0)
     outOfBounds = true;
    mapField.convertWorldToField(minUpCoordinates, point);
    if (point.y < 0)
     outOfBounds = true;
    mapField.convertWorldToField(maxRightCoordinates, point);
    if (point.x > getWidth())
     outOfBounds = true;
    mapField.convertWorldToField(maxDownCoordinates, point);
    if (point.y > getHeight())
     outOfBounds = true;
   } catch (IllegalArgumentException ex) {
    outOfBounds = true;
   }
  }
  zoom++;
  mapField.setZoom(zoom);
 }

 protected void paint(Graphics graphics) {
  super.paint(graphics);
  if (null != mPoint) {
   for (int i = 0; i < mPoints.length; i++) {
    if(bitmapInLocationFlag[i])
    {
     delete(field[i]); 
    }
    XYPoint fieldOut = new XYPoint();
    mapField.convertWorldToField(mPoints[i], fieldOut);
    int imgW = mPoint.getWidth();
    int imgH = mPoint.getHeight();
    add(field[i],fieldOut.x - imgW / 2, fieldOut.y - imgH);

    bitmapInLocationFlag[i]=true;


   }
  }
 }


}

 

 

Please guide me  jitendra...  Thanks in advance.

Contributor
Posts: 18
Registered: ‎11-16-2011
My Device: 9900
My Carrier: blackberry

Re: Blakberry maps

[ Edited ]

Hi Jitendra Sharma, I gone through this forum for map. I am also new to Blackberry and i have to show the same multiple location point on map. But i don't know how to do that what extra thing i have download. Please guide me how to implement that. Also please provide me the InfoTraceRoute.java custom class on my personal  I shall be very very very thanksfull to you. Please help me Its urgent for me. Hope you understand and help me to get out of this. Thanks in Advance Rahul