@Override public void onMarkerDragStart(Marker marker) { if (mMarkerDragListener != null) { final MarkerInfo markerInfo = mBiMarkersMap.getKey(marker); markerInfo.setPosition(DroneHelper.ILatLngToCoord(marker.getPoint())); mMarkerDragListener.onMarkerDragStart(markerInfo); } }
@Override public void updateMarker(MarkerInfo markerInfo, boolean isDraggable) { // if the drone hasn't received a gps signal yet final Coord2D coord = markerInfo.getPosition(); if (coord == null) { return; } final LatLng position = DroneHelper.CoordToLatLng(coord); Marker marker = mBiMarkersMap.getValue(markerInfo); if (marker == null) { marker = new Marker(mMapView, markerInfo.getTitle(), markerInfo.getSnippet(), position); mMarkersOverlay.addItem(marker); mBiMarkersMap.put(markerInfo, marker); } else { marker.setTitle(markerInfo.getTitle()); marker.setDescription(markerInfo.getSnippet()); marker.setPoint(position); } // Update the marker final Resources res = getResources(); Bitmap markerIcon = markerInfo.getIcon(res); if (markerIcon == null) { markerIcon = BitmapFactory.decodeResource(res, R.drawable.ic_action_location); } marker.setIcon(new Icon(new BitmapDrawable(res, markerIcon))); marker.setAnchor(new PointF(markerInfo.getAnchorU(), markerInfo.getAnchorV())); marker.invalidate(); mMapView.invalidate(); }
@Override public boolean onMarkerClick(MarkerInfo markerInfo) { drone.guidedPoint.newGuidedCoord(markerInfo.getPosition()); return true; }
@Override public void updateMarker(MarkerInfo markerInfo) { updateMarker(markerInfo, markerInfo.isDraggable()); }
@Override public void onMarkerDragEnd(MarkerInfo markerInfo) { drone.guidedPoint.newGuidedCoord(markerInfo.getPosition()); }