我想知道如何使用我们自己的标志来显示BBMap中的特定位置?有谁知道怎么做?
I want to know how to use our own logo to show the particular place in BBMap? Can anyone knows how to do this ?
Blackberry Map 无法显示 POI 的自定义图标.您可以在 Blackberry Map 上的位置中包含的内容:
It's not possible in Blackberry Map to show custom icon for POI. Things you can include in Location on Blackberry Map:
位置的纬度 * 100,000.南是负数.位置的经度 * 100,000.West 是否定的.要显示在位置旁边的标签.BlackBerry 智能手机用户选择时显示的说明详情.缩放级别从 0 到 MAX_ZOOM.地址城市省或州国家邮政编码电话传真网址电子邮件地址类别0 到 5 之间的评分信息请参阅 什么是 - 黑莓地图位置文档格式
另请参阅 如何 - 调用黑莓地图
作为替代方案,您可以尝试 MapField + 管理器/屏幕绘制覆盖.
As an alternative you can try MapField + manager/screen paint override.
MapField 的自定义扩展:
Custom extension for MapField:
class CustomMapField extends 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);
}
}
}
使用示例:
class Scr extends MainScreen {
CustomMapField mMapField;
Coordinates mCoordinates;
public Scr() {
LocationProvider provider = null;
Location location = null;
try {
provider = LocationProvider.getInstance(null);
} catch (LocationException e) {
e.printStackTrace();
}
try {
location = provider.getLocation(-1);
} catch (LocationException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
mCoordinates = location.getQualifiedCoordinates();
add(new LabelField("Latitude: "
+ String.valueOf(Coordinates.convert(
mCoordinates.getLatitude(),
Coordinates.DD_MM_SS))));
add(new LabelField("Longitude: "
+ String.valueOf(Coordinates.convert(
mCoordinates.getLongitude(),
Coordinates.DD_MM_SS))));
mMapField = new CustomMapField();
mMapField.mIcon = Bitmap.getBitmapResource("poi_icon.png");
mMapField.moveTo(mCoordinates);
add(mMapField);
}
}
另见在黑莓中使用 MapComponentGPS 和 BlackBerry 地图开发指南
如果是真实设备,请确保 GPS 可用且已打开.如果是模拟器,那么在你开始程序之前使用模拟器菜单 -> 模拟 -> GPS 位置来设置 GPS 数据.其他选项是硬编码您自己的坐标并在没有 GPS 的情况下使用它们:
If it's real device, be sure GPS is available and turned on. If it's simulator, then before you start program use simulator menu -> simulate -> GPS Location to set GPS data. Other option is hardcode your own Coordinats and use them without GPS:
double latitude = 51.507778;
double longitude = -0.128056;
Coordinates mCoordinates = new Coordinates(latitude, longitude, 0);
上一篇:自定义序列化使用XmlSerializer的自定义、序列化、XmlSerializer
下一篇:在 iOS4 上运行的 iPhone 4 或 3GS 上是否可以进行后台 GPS位置记录后台、位置、iPhone、GPS