public MarkerDelegate() { this.marker = new GoogleMapMarker(); }
@Override public String getCaption() { return marker.getCaption(); }
@Override public String getIconUrl() { return marker.getIconUrl(); }
@Override public void markerDragged(long markerId, LatLon newPosition) { GoogleMapMarker marker = getMarker(markerId); LatLon oldPosition = marker.getPosition(); marker.setPosition(newPosition); for (MarkerDragListener listener : markerDragListeners) { listener.markerDragged(marker, oldPosition); } } };
/** * Adds a new marker to the map. * * @param caption Caption of the marker shown when the marker is hovered. * @param position Coordinates of the marker on the map. * @param draggable Set true to enable dragging of the marker. * @param iconUrl The url of the icon of the marker. * @return GoogleMapMarker object created with the given settings. */ public GoogleMapMarker addMarker(String caption, LatLon position, boolean draggable, String iconUrl) { GoogleMapMarker marker = new GoogleMapMarker(caption, position, draggable, iconUrl); getState().markers.put(marker.getId(), marker); return marker; }
@Override public void setPosition(GeoPoint position) { marker.setPosition(position != null ? ((GeoPointDelegate) position).getLatLon() : null); }
@Override public GeoPoint getPosition() { return GeoPointDelegate.fromLatLon(marker.getPosition()); }
/** * Removes a marker from the map. * * @param marker The marker to remove. */ public void removeMarker(GoogleMapMarker marker) { getState().markers.remove(marker.getId()); }
@Override public boolean isAnimationEnabled() { return marker.isAnimationEnabled(); }
@Override public int hashCode() { return marker.hashCode(); }
@Override public MarkerImage getIcon() { return MarkerImageDelegate.fromMarkerImage(marker.getMarkerImage()); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } MarkerDelegate other = (MarkerDelegate) obj; return marker.equals(other.getMarker()); } }
/** * Checks if a marker has been added to the map. * * @param marker The marker to check. * @return true, if the marker has been added to the map. */ public boolean hasMarker(GoogleMapMarker marker) { return getState(false).markers.containsKey(marker.getId()); }
@Override public Marker createMarker(String caption, GeoPoint position, boolean draggable, String iconUrl) { return new MarkerDelegate(new GoogleMapMarker(caption, position != null ? ((GeoPointDelegate) position).getLatLon() : null, draggable, iconUrl)); }
/** * Adds a marker to the map. * * @param marker The marker to add. */ public void addMarker(GoogleMapMarker marker) { getState().markers.put(marker.getId(), marker); }
@Override public Marker createMarker(String caption, GeoPoint position, boolean draggable) { return new MarkerDelegate(new GoogleMapMarker(caption, ((GeoPointDelegate) position).getLatLon(), draggable)); }
@Override public Marker createMarker(String caption, GeoPoint position, boolean draggable, MarkerImage icon) { return new MarkerDelegate(new GoogleMapMarker( caption, position != null ? ((GeoPointDelegate) position).getLatLon() : null, draggable, icon != null ? ((MarkerImageDelegate) icon).getMarkerImage() : null)); }