嗨我用少量pinOverlays做了一个小地图应用程序。当引脚不在初始屏幕上时,问题就出现了,所以应用程序不会绘制它们。生成地图标记
例如,如果我在animateTO(point1)中看不到point3和point2,那么永远不会出现在地图上,但是如果我animateTo(point2)其他引脚永远不会出现在地图上,就像应用程序只画出可以在屏幕上看到的点。为什么会发生这种情况的任何想法?
List<Overlay> mapOverlays = mapView.getOverlays();
Drawable drawable = this.getResources().getDrawable(R.drawable.indicador_mapa);
ContactItemizedOverlay itemizedoverlay = new ContactItemizedOverlay(drawable, this);
//first point of location
//oficina central
String coordinates[] = {"-16.50355741", "-68.13074811"};
//prado cerca a las gradas
String coordinates1[] ={"-16.50120505", "-68.13334501"};
//calle murillo y oruro
String coordinates2[] ={"-16.449587", "-68.136130"};
//san miguel
String coordinates3[] ={"-16.540237", "-68.078138"};
double lat = Double.parseDouble(coordinates[0]);
double lng = Double.parseDouble(coordinates[1]);
double lat1 = Double.parseDouble(coordinates1[0]);
double lng1 = Double.parseDouble(coordinates1[1]);
double lat2 = Double.parseDouble(coordinates2[0]);
double lng2 = Double.parseDouble(coordinates2[1]);
double lat3 = Double.parseDouble(coordinates2[0]);
double lng3 = Double.parseDouble(coordinates2[1]);
GeoPoint point = new GeoPoint((int) (lat * 1E6),
(int) (lng * 1E6));
GeoPoint point1 = new GeoPoint((int) (lat1 * 1E6),
(int) (lng1 * 1E6));
GeoPoint point2 = new GeoPoint((int) (lat2 * 1E6),
(int) (lng2 * 1E6));
GeoPoint point3 = new GeoPoint((int) (lat3 * 1E6),
(int) (lng3 * 1E6));
OverlayItem overlayitem = new OverlayItem(point, "oficina1", "Agencia calle Batallón Colorado");
OverlayItem overlayitem1 = new OverlayItem(point1, "oficina2", "Agencia calle camacho #2135");
OverlayItem overlayitem2 = new OverlayItem(point2, "oficina3", "agencia Calle Murillo");
OverlayItem overlayitem3 = new OverlayItem(point3, "oficina4", "Agencia san miguel calle 21 esquina montenegro");
//add the itemized overlay to the list of itemized overlays
itemizedoverlay.addOverlay(overlayitem);
itemizedoverlay.addOverlay(overlayitem1);
itemizedoverlay.addOverlay(overlayitem2);
itemizedoverlay.addOverlay(overlayitem3);
mapOverlays.add(itemizedoverlay);
mapControler = mapView.getController();
mapControler.animateTo(point);
mapControler.setZoom(16);
// MyLocationOverlay mLocationOverlay = new MyLocationOverlay(getBaseContext(), mapView);
// mapControler.animateTo(mLocationOverlay.getMyLocation());
感谢您的回应。关于你的代码,在另一个答案中,这解决了不在屏幕上的点的问题,我看到这个代码的唯一区别是它们是从数据库中添加的,这是你的代码的一部分没有提出答案。我想知道这是如何解决这种情况的,即只有初始屏幕上出现的引脚被绘制出来,如果你能解释我多一点会很棒,我不明白。 – 2012-04-19 16:34:38
在那个链接中,你有forloop(setoflocations)只需在你的代码中制作地理点的数组列表,然后你可以使用它作为循环。 – 2012-04-19 16:37:20
好吧,比单独添加地址点更简单,这是非常棒的工作,但它不能解决我的问题,即初始屏幕之外的地址点永远不会被绘制。 – 2012-04-19 18:42:09