public void drawPlace() { // Prepare overlays: Center overlay and Details overlay Drawable marker = getResources().getDrawable(R.drawable.marker); Drawable centermarker = getResources().getDrawable(R.drawable.centermarker); centermarker.setBounds(0, 0, marker.getIntrinsicWidth(), marker.getIntrinsicHeight()); centerOverlay = new SitesOverlay(centermarker); Drawable detailmarker = getResources().getDrawable(R.drawable.star); detailmarker.setBounds(0, 0, marker.getIntrinsicWidth(), marker.getIntrinsicHeight()); detailOverlay = new SitesOverlay(detailmarker); // Add remain overlays into map centerOverlay.addItem( new OverlayItem( getPoint(curLAT, curLNG), "My Location", "My Location\n" + curLAT + " - " + curLNG)); centerOverlay.completeToPopulate(); // add user location map.getOverlays().add(centerOverlay); map.getOverlays().add(me); if (respectLocation != null) { // Draw position to map double detailLAT = respectLocation.getLat(); double detailLNG = respectLocation.getLng(); String address = ""; address += respectLocation.getHouse_number() + ", " + respectLocation.getStreet() + ", " + respectLocation.getWard() + ", " + respectLocation.getDistrict() + ", " + respectLocation.getCity(); String des = respectLocation.getName() + "\n" + address + "\n" + detailLAT + " - " + detailLNG; detailOverlay.addItem( new OverlayItem(getPoint(detailLAT, detailLNG), respectLocation.getName(), des)); detailOverlay.completeToPopulate(); map.getOverlays().add(detailOverlay); // Get route direction and list route point to draw map fromLat = fromLocation.getLat(); fromLng = fromLocation.getLng(); try { ms.getRoute(respectLocation, fromLat, fromLng, "en"); listRoutePoint = ms.getListPathPoint(); } catch (Exception e) { } directionEN = ms.getDirection(); statusDirection = ms.getStatusDirection(); // can not find the direction, listRoutePoint == null if (!statusDirection.equals("OK")) { detailOverlay.addItem( new OverlayItem(getPoint(detailLAT, detailLNG), respectLocation.getName(), des)); detailOverlay.completeToPopulate(); map.getOverlays().add(detailOverlay); } } }
public void zoomToCurrentPlace() { // zoom to Place location GeoPoint point = getPoint(respectLocation.getLat(), respectLocation.getLng()); mc.setZoom(16); mc.setCenter(point); }