-1
我想要做什麼...訪問黑莓地圖並在用戶指定的位置添加一個圖像如果用戶沒有指定位置
那麼找到當前位置客戶和圖像添加到這些座標......將圖像添加到地圖並在地圖上正確縮放
,如果你看看下面的鏈接,我想的MapView是完全一樣的... 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);
}
}
感謝你們!