- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我在我的 Android 应用程序中包含了 Open Street Maps。在 map View 中,用户应该能够在 map 完全加载后捕获屏幕。但目前即使 map View 仍在加载,用户也可以捕获图像。谁能告诉我如何检测 map View 何时完全加载?
下面是我加载 map View 的代码:
public class MainActivity extends Activity {
MapView mapView;
MyLocationOverlay myLocationOverlay = null;
ArrayList<OverlayItem> anotherOverlayItemArray;
protected ItemizedOverlayWithBubble<ExtendedOverlayItem> itineraryMarkers;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mapView = (MapView) findViewById(R.id.mapview);
final ArrayList<ExtendedOverlayItem> waypointsItems = new ArrayList<ExtendedOverlayItem>();
itineraryMarkers = new ItemizedOverlayWithBubble<ExtendedOverlayItem>(this, waypointsItems, mapView, new ViaPointInfoWindow(R.layout.itinerary_bubble, mapView));
mapView.getOverlays().add(itineraryMarkers);
mapView.setTileSource(TileSourceFactory.MAPNIK);
mapView.setBuiltInZoomControls(true);
MapController mapController = mapView.getController();
mapController.setZoom(1);
GeoPoint point2 = new GeoPoint(51496994, -134733);
mapController.setCenter(point2);
Drawable marker=getResources().getDrawable(android.R.drawable.star_big_on);
GeoPoint myPoint1 = new GeoPoint(0*1000000, 0*1000000);
ExtendedOverlayItem overlayItem = new ExtendedOverlayItem("Title Test Loc", "Desc", myPoint1, this);
overlayItem.setMarkerHotspot(OverlayItem.HotspotPlace.BOTTOM_CENTER);
overlayItem.setMarker(marker);
overlayItem.setRelatedObject(0);
itineraryMarkers.addItem(overlayItem);
mapView.invalidate();
myLocationOverlay = new MyLocationOverlay(this, mapView);
mapView.getOverlays().add(myLocationOverlay);
myLocationOverlay.enableMyLocation();
myLocationOverlay.runOnFirstFix(new Runnable() {
public void run() {
mapView.getController().animateTo(myLocationOverlay.getMyLocation());
}
});
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
myLocationOverlay.enableMyLocation();
myLocationOverlay.enableCompass();
myLocationOverlay.enableFollowLocation();
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
myLocationOverlay.disableMyLocation();
myLocationOverlay.disableCompass();
myLocationOverlay.disableFollowLocation();
}
最佳答案
看看 TilesOverlay
和 TileLooper
实现。这就是我们用来加载然后在屏幕上绘制每个图 block 的方法。在 handleTile(...)
中,我们尝试从图 block 提供程序 mTileProvider.getMapTile(pTile)
获取图 block 。如果返回 Drawable
,则加载图 block ,否则将返回 null
。
一个简单的方法是扩展 TilesOverlay
,覆盖 drawTiles(...)
并在调用之前调用您自己的 TileLooper
super.drawTiles(...)
将检查是否所有传递给 handleTile(...)
的图 block 都不为空。要使用您的 TilesOverlay,请调用 mMapView.getOverlayManager().setTilesOverlay(myTilesOverlay)
。
关于android - 检测 OSM Mapview 是否仍在加载或不在 android 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17079359/
我想从 .osm.pbf 文件中提取一些信息。我查看了 OpenStreetMapX.jl 包,但没有找到读取这些数据的函数。我想知道是否有人知道读取这些数据的方法。或者有没有办法将 .osm.pbf
我第一次尝试了解 MapKit。 与在route-me/mapbox中使用OSM相比,iOS 6 MapKit提供的 map 有什么区别吗? MapKit提供的 map 是Apple的tile服务器提
场景:我想为地址编写自己的自动完成 API,就像 Google 提供的那样。 (非常基本:街道、门牌号码、城市、邮政编码、国家)。它仅供私有(private)使用和培训目的。我想先涵盖大约 100 万
我正在寻找将 Open street map 包含到我的 android 应用程序中的教程/手册或步骤。我所发现的要么是一个具有更多功能的大项目,要么就是很多问题都没有关于“如何”的正确结论而结束..
我正在开发一个桌面应用程序,它需要显示带有一些叠加层的 map 。我有该区域的 .osm 文件和从 OSM 预下载的图 block 。有人知道这个的开源工具吗? 最佳答案 http://code.go
我正在使用 python osmnx 来处理 OpenStreetMap,并且我正在尝试将 networkx map 保存在 .xml 文件中,其结构与从openstreetmap.org。是否可以将
单击标记时不显示 OSM 弹出窗口。我尝试过标记上的点击事件。有效吗?建议我如何在单击标记时在标记上显示弹出窗口。 JS 我尝试过的代码 var newlonLat = new OpenLayers.
有没有人为 OpenStreetMap 使用过以下任何热图 api/scritpts: Bjoern Hoehrmann 的 OpenLayers 热图层:http://www.websitedev.
谁能告诉我如何使用自定义图标在 OSM map 上显示我的当前位置? 最佳答案 使用默认人物图标: MyLocationNewOverlay myLocationoverlay = new MyLoc
我在创建表格连接时遇到了问题。查询永远运行。我在一张表中有开放的街道 map 自行车路线,其中包含所有属性。 Table planet_osm_line osm_id bigint, route te
当尝试在 map 上定义坐标时,我会得到不同的结果,具体取决于我是否对经度/纬度进行硬编码或它们是否来自数据库。 document.title = eventName; document.getEle
我有一个使用 osmdroid 和(非常有用的)osm 奖励包库开发的功能齐全的 Android map 应用程序。我使用了 osmdroid 3.0.10 和 osm Bonus Pack v3.6
从overpass-API读取数据,获取基本字段没有问题。从下面的示例中,可以轻松读取纬度和经度。我无法管理的是读取带有 K=xxxx, v=yyyyy 的各种标签;我需要读取 k="name"的内容
我下载了一个小区域的 Open Street Map 数据,我想过滤数据以获得具有特殊类别的节点。 这是 OSM 数据的示例 我想获取整个学校、医院的数据
我想使用 Polygon 在 Google map 上绘制一个市区区域类和一个纬度/经度坐标数组。 OpenStreetMap 提供了我需要的所有数据——如果我输入一些地区名称,我可以获得 OSM X
我目前正在开发一个基于 OpenStreetMap 的 map 项目,使用 Mapnik、renderd 和 mod_tile(就像 osm 在他们的网站上所做的那样)。 我已经按照一些教程在我的个人
我正在解析 OSM 数据的国家/地区摘录。我想要的是获取该点或路径所属的城市和国家的名称。这可能吗?我怎样才能获得这些信息? 最佳答案 要检索此信息,您需要一个地理编码器,除非该节点具有相关 addr
我正在制作一个使用开放街道 map 的 Web 应用程序,并向其中添加一些标记。我需要删除 map 上的所有图层。 我已经尝试过在其他问题上找到的一些示例,但没有一个对我有用。我不确定我是否使用开放层
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,因为
是否存在从 OSM map 中删除所有地点的方法?还包括商店、酒吧、修复物、酒店等。 我希望使用信息较少的 map 。是否可以从原始 OSM 服务器执行此操作?也许像 URL 中的选项或其他什么?我在
我是一名优秀的程序员,十分优秀!