-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);
}
}
感谢你们!