2012-10-03 2 views
-1

내가하고 싶은 것 ... 사용자가 지정하지 않은 경우 사용자가 지정한 위치에서 이미지를 추가하고
위치를 지정한 다음 위치를 지정한 다음 현재 위치를 찾습니다. 다음 링크에서 살펴 경우 나는지도보기 정확히 같은 싶습니다지도에 이미지를 추가하고지도에서 정확하게 확대/축소

고객 및 그 좌표에 이미지를 추가 ... ... 지금은 How to show our own icon in BlackBerry Map?

나는 점점 걱정이 아니다 사용자가 제공하고 그 좌표에 이미지에 추가하는 주소의 좌표, 순간에 "내 위치 찾기"를 얻을 수있는 경우 Functi 올바른 좌표로 이미지를 추가하면 올바르게 작동합니다. 매우 행복합니다.

은 무엇 내 코드는 현재 두 개의 맵을 추가하고있다 ... 하나의지도는 다음 링크에있는 것과 같습니다 How to show our own icon in BlackBerry Map?

그러나 어떤 이미지가 없습니다, 당신은 즉 또 다른지도가 나타납니다 다시 클릭 할 때 아이콘이 표시된 국가를 볼 수있는 한 줌까지 축소했습니다.

내 코드 (MainScreen)

lat = qualifiedCoordinates.getLatitude(); 
lng = qualifiedCoordinates.getLongitude(); 
latString = Double.toString(lat); 
lngstring = Double.toString(lng); 
String Test2="."; 
String Test3=""; 
FinalSringLatetude =replace(latString,Test2,Test3); 
FinalSringLongdetude =replace(lngstring,Test2,Test3); 
intLat = Integer.valueOf(FinalSringLatetude).intValue(); 
iintLng = Integer.valueOf(FinalSringLongdetude).intValue(); 
mCoordinates = new Coordinates(doublelat, doublelon, 0); 
mMapField = new CustomMapField(); 
mMapField.mIcon = Bitmap.getBitmapResource("coin_silver.png"); 
mMapField.moveTo(mCoordinates); 
MapView mapView = new MapView(); 
mapView.setLatitude(intLat); 
mapView.setLongitude(iintLng); 
mapView.setZoom(10); 
Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new MapsArguments(mapView)); 
add(mMapField); 

(사용자 정의 MapField 클래스)

Bitmap mIcon; 
XYRect mDest; 

public void moveTo(Coordinates coordinates) { 
    super.moveTo(coordinates); 
    mDest = null; 
} 

protected void paint(Graphics graphics) { 
    super.paint(graphics); 
    if (null != mIcon) { 
     if (null == mDest) { 
      XYPoint fieldOut = new XYPoint(); 
      convertWorldToField(getCoordinates(), fieldOut); 
      int imgW = mIcon.getWidth(); 
      int imgH = mIcon.getHeight(); 
      mDest = new XYRect(fieldOut.x - imgW/2, 
      fieldOut.y - imgH, imgW, imgH); 
     } 
     graphics.drawBitmap(mDest, mIcon, 0, 0); 
    } 
} 

너희들 감사합니다!

답변

1

다음 코드는 확대/축소 기능을 수행합니다.

mMapField.setZoom(3);