-
- All Implemented Interfaces:
-
org.osmdroid.views.util.constants.OverlayConstants
public class SimpleFastPointOverlay extends Overlay
Overlay to draw a layer of clickable simple points, optimized for rendering speed. Nice performance up to 100k points. Supports styling each point and label individually, or shared style for all points in a theme. Does not support rotated maps. There are three rendering algorithms: NO_OPTIMIZATION: all points all drawn in every draw event MEDIUM_OPTIMIZATION: not recommended for >10k points. Recalculates the grid index on each draw event and only draws one point per grid cell. MAXIMUM_OPTIMIZATION: for >10k points, only recalculates the grid on touch up, hence much faster. Performs well for 100k points.
TODO: a quadtree index would improve rendering speed! TODO: an alternative to the CIRCLE shape, cause this is slow to render Created by Miguel Porto on 25-10-2016.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classSimpleFastPointOverlay.StyledLabelledPointJust a light internal class for storing point data
public interfaceSimpleFastPointOverlay.PointAdapterpublic interfaceSimpleFastPointOverlay.OnClickListener
-
Constructor Summary
Constructors Constructor Description SimpleFastPointOverlay(SimpleFastPointOverlay.PointAdapter pointList, SimpleFastPointOverlayOptions style)SimpleFastPointOverlay(SimpleFastPointOverlay.PointAdapter pointList)
-
Method Summary
Modifier and Type Method Description SimpleFastPointOverlayOptionsgetStyle()booleanonTouchEvent(MotionEvent event, MapView mapView)You can prevent all(!) other Touch-related events from happening! booleanonSingleTapConfirmed(MotionEvent event, MapView mapView)Default action on tap is to select the nearest point. voidsetSelectedPoint(Integer toSelect)Sets the highlighted point. IntegergetSelectedPoint()BoundingBoxgetBoundingBox()voidsetOnClickListener(SimpleFastPointOverlay.OnClickListener listener)voiddraw(Canvas canvas, MapView mapView, boolean b)Draw the overlay over the map. -
Methods inherited from class org.osmdroid.views.overlay.Overlay
draw, draw, getBounds, isEnabled, onDetach, onDoubleTap, onDoubleTapEvent, onDown, onFling, onKeyDown, onKeyUp, onLongPress, onPause, onResume, onScroll, onShowPress, onSingleTapConfirmed, onSingleTapUp, onTouchEvent, onTrackballEvent, setEnabled -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
SimpleFastPointOverlay
SimpleFastPointOverlay(SimpleFastPointOverlay.PointAdapter pointList, SimpleFastPointOverlayOptions style)
-
SimpleFastPointOverlay
SimpleFastPointOverlay(SimpleFastPointOverlay.PointAdapter pointList)
-
-
Method Detail
-
getStyle
SimpleFastPointOverlayOptions getStyle()
-
onTouchEvent
boolean onTouchEvent(MotionEvent event, MapView mapView)
You can prevent all(!) other Touch-related events from happening!By default does nothing (
{@code return false}). If you handled the Event, return{@code true}, otherwise return{@code false}. If you returned{@code true}none of the following Overlaysor the underlying MapView has the chance to handle this event.
-
onSingleTapConfirmed
boolean onSingleTapConfirmed(MotionEvent event, MapView mapView)
Default action on tap is to select the nearest point.
-
setSelectedPoint
void setSelectedPoint(Integer toSelect)
Sets the highlighted point. App must invalidate the MapView.
- Parameters:
toSelect- The index of the point (zero-based) in the original list.
-
getSelectedPoint
Integer getSelectedPoint()
-
getBoundingBox
BoundingBox getBoundingBox()
-
setOnClickListener
void setOnClickListener(SimpleFastPointOverlay.OnClickListener listener)
-
draw
void draw(Canvas canvas, MapView mapView, boolean b)
Draw the overlay over the map. This will be called on all active overlays with shadow=true,to lay down the shadow layer, and then again on all overlays with shadow=false. Callersshould check isEnabled() before calling draw(). By default, draws nothing.
changed for 5.6 to be public see https://github.com/osmdroid/osmdroid/issues/466If possible, use draw instead (cf. MapSnapshot
-
-
-
-