public interface IMapController
Modifier and Type | Method and Description |
---|---|
Marker |
addMarker(LatLng coordinates,
MapObjectStyle style)
Adds a
Marker to the map which can be used to dynamically add points and polylines
to the map. |
Polygon |
addPolygon(GeoPointsList geoPointsList,
PolygonStyle style)
Adds a
Polygon to the map. |
Polyline |
addPolyline(GeoPointsList geoPointsList,
PolylineStyle style)
Adds a
Polyline to the map. |
void |
captureFrame(MapController.FrameCaptureCallback callback,
boolean waitForCompleteView)
Capture MapView as Bitmap.
|
Set<Polygon> |
getAllPolygons()
Gets a copy of all polygons that are currently on the map
|
Set<Polyline> |
getAllPolylines()
Gets a copy of all polylines that are currently on the map
|
CameraPosition |
getCameraPosition()
Returns the camera position.
|
MapController.CameraType |
getCameraType()
Get the camera type currently in use for the map view.
|
float |
getMaxTiltRad()
Returns the maximum tilt angle of the view, in radians.
|
RelativeLayout |
getOverlaysParent()
Returns the map's overlay layout, into which various statically-positioned views can be
added.
|
LatLng |
getPosition()
Get the geographic position of the center of the map view.
|
float |
getRotationDeg()
Get the rotation of the view, in degrees.
|
float |
getRotationRad()
Get the rotation of the view, normalized to 0-2*PI.
|
float |
getTiltRad()
Get the tilt angle of the view, Normalized to 0-PI/2.
|
UserLocationMarkerManager |
getUserLocationMarkerManager()
Returns the manager of the user location marker.
|
float |
getZoom()
Get the zoom level of the map view.
|
boolean |
hasPolygons()
Checks if the map contains polygons
|
boolean |
hasPolylines()
Checks if the map contains polylines
|
boolean |
isRotateGesturesEnabled()
Are rotation gestures enabled
|
boolean |
isScrollGesturesEnabled()
Whether the map should support scrolling gestures (pan)
|
boolean |
isTiltGesturesEnabled()
Are tilt gestures enabled
|
boolean |
isZoomGesturesEnabled()
Are zoom gestures enabled
|
PointF |
latLngToScreenPosition(LatLng location)
Find the position on screen corresponding to the given geographic coordinates.
|
void |
pickFeature(float posX,
float posY)
Query the map for geometry features at the given screen coordinates; results will be returned
in a callback to the object set by
IMapController.setFeaturePickListener(MapController.FeaturePickListener) . |
void |
pickLabel(float posX,
float posY)
Query the map for labeled features at the given screen coordinates; results will be returned
in a callback to the object set by
IMapController.setLabelPickListener(MapController.LabelPickListener) . |
void |
pickMarker(float posX,
float posY)
Query the map for a
Marker at the given screen coordinates; results will be returned
in a callback to the object set by IMapController.setMarkerPickListener(MapController.MarkerPickListener) . |
void |
removeAllMarkers()
Remove all the
Marker objects from the map. |
void |
removeAllPolygons()
Removes all polygons
|
void |
removeAllPolylines()
Removes all polylines
|
void |
removeMarker(Marker marker)
Removes the passed in
Marker from the map. |
void |
removePolygon(Polygon polygon)
Removes a polygon.
|
void |
removePolyline(Polyline polyline)
Removes a polyline.
|
LatLng |
screenPositionToLatLng(float x,
float y)
Find the geographic coordinates corresponding to the given position on the screen.
|
LatLng |
screenPositionToLatLng(PointF screenPosition)
Find the geographic coordinates corresponding to the given position on the screen.
|
void |
setCameraPosition(CameraPosition pos)
Sets the camera position to the given one.
|
void |
setCameraPositionEased(CameraPosition pos,
int duration)
Sets the camera position to the given one, with the default easing of the given duration.
|
void |
setCameraPositionEased(CameraPosition pos,
int duration,
MapController.EaseType ease)
Sets the camera position to the given one, with the default easing of the given duration.
|
void |
setCameraType(MapController.CameraType type)
Set the camera type for the map view.
|
void |
setCompassView(CompassView compassView)
Sets a custom compass view.
|
void |
setCompassView(int layoutResId)
Sets a custom
CompassView . |
void |
setCompassVisibility(MapController.CompassVisibility compassVisibility)
Sets the visibility mode of the compass.
|
void |
setDefaultBackgroundColor(float red,
float green,
float blue)
Sets an opaque background color used as default color when a scene is being loaded.
|
void |
setDoubleTapResponder(TouchInput.DoubleTapResponder responder)
Set a responder for double-tap gestures.
|
void |
setFeaturePickListener(com.here.mobility.sdk.map.MapController.FeaturePickListener listener)
Set a listener for feature pick events.
|
void |
setLabelPickListener(com.here.mobility.sdk.map.MapController.LabelPickListener listener)
Set a listener for label pick events.
|
void |
setLongPressResponder(TouchInput.LongPressResponder responder)
Set a responder for long press gestures
|
void |
setMarkerPickListener(MapController.MarkerPickListener listener)
Set a listener for marker pick events.
|
void |
setMaxTiltRad(float maxTilt)
Set the maximum tilt angle of the view.
|
void |
setPanResponder(TouchInput.PanResponder responder)
Set a responder for pan gestures
|
void |
setPickRadius(float radius)
Set the radius to use when picking features on the map.
|
void |
setPosition(LatLng position)
Set the geographic position of the center of the map view.
|
void |
setPositionEased(LatLng position)
Set the geographic position of the center of the map view with default easing.
|
void |
setPositionEased(LatLng position,
long duration)
Set the geographic position of the center of the map view with default easing.
|
void |
setPositionEased(LatLng position,
long duration,
MapController.EaseType ease)
Set the geographic position of the center of the map view with custom easing.
|
void |
setRotateGesturesEnabled(boolean isEnabled)
Sets whether the map should support rotation gestures.
|
void |
setRotateResponder(TouchInput.RotateResponder responder)
Set a responder for rotate gestures.
|
void |
setRotationRad(float rotation)
Set the rotation of the view.
|
void |
setRotationRadEased(float rotation)
Set the rotation of the view with the default duration (proportional to the rotation amount)
|
void |
setRotationRadEased(float rotation,
long duration)
Set the rotation of the view with default easing.
|
void |
setRotationRadEased(float rotation,
long duration,
MapController.EaseType ease)
Set the rotation of the view with custom easing.
|
void |
setScaleResponder(TouchInput.ScaleResponder responder)
Set a responder for scale gestures.
|
void |
setScrollGesturesEnabled(boolean isEnabled)
Sets whether the map should support scrolling gestures (pan).
|
void |
setShoveResponder(TouchInput.ShoveResponder responder)
Set a responder for shove (vertical two-finger drag) gestures.
|
void |
setSimultaneousGestureAllowed(TouchInput.Gestures first,
TouchInput.Gestures second,
boolean allowed)
Set whether the gesture
second can be recognized while first is in progress. |
void |
setTapResponder(TouchInput.TapResponder responder)
Set a responder for tap gestures.
|
void |
setTiltGesturesEnabled(boolean isEnabled)
Sets whether the map should support tilt gestures.
|
void |
setTiltRad(float tilt)
Set the tilt angle of the view.
|
void |
setTiltRadEased(float tilt)
Set the tilt angle of the view with the default duration (proportional to the tilt amount)
|
void |
setTiltRadEased(float tilt,
long duration)
Set the tilt angle of the view with default easing.
|
void |
setTiltRadEased(float tilt,
long duration,
MapController.EaseType ease)
Set the tilt angle of the view with custom easing.
|
void |
setTwoFingerTapResponder(TouchInput.TwoFingerTapResponder responder)
Set a responder for two-finger tap gestures.
|
void |
setViewCompleteListener(MapController.ViewCompleteListener listener)
Set a listener for view complete events.
|
void |
setZoom(float zoom)
Set the zoom level of the map view.
|
void |
setZoomEased(float zoom)
Set the zoom level of the map view with default easing.
|
void |
setZoomEased(float zoom,
long duration)
Set the zoom level of the map view with default easing.
|
void |
setZoomEased(float zoom,
long duration,
MapController.EaseType ease)
Set the zoom level of the map view with custom easing
|
void |
setZoomGesturesEnabled(boolean isEnabled)
Sets whether the map should support zoom gestures.
|
void |
showBoundingBox(GeoBox box)
Set the position and zoom of the map such that the given bounding box is visible.
|
void |
showBoundingBox(GeoBox box,
Rect padding)
Set the position and zoom of the map such that the given bounding box is visible.
|
void |
showBoundingBoxEased(GeoBox box,
Rect padding,
int duration)
Like
IMapController.showBoundingBox(GeoBox, Rect) , but with an animation of the given length, in
milliseconds. |
void |
showBoundingBoxEased(GeoBox box,
Rect padding,
int duration,
MapController.EaseType ease)
Like
IMapController.showBoundingBox(GeoBox, Rect) , but with an animation of the given type and
length, in milliseconds. |
void captureFrame(MapController.FrameCaptureCallback callback, boolean waitForCompleteView)
waitForCompleteView
- Delay the capture until the view is fully loaded and
no ease- or label-animation is running.void setCameraPosition(CameraPosition pos)
pos
- The camera position to set.void setCameraPositionEased(CameraPosition pos, int duration)
pos
- The camera position to set.duration
- Time in milliseconds to ease to the given positionvoid setCameraPositionEased(CameraPosition pos, int duration, MapController.EaseType ease)
pos
- The camera position to set.duration
- Time in milliseconds to ease to the given positionCameraPosition getCameraPosition()
void setPosition(LatLng position)
position
- LatLng
of the position to setvoid setPositionEased(LatLng position, long duration)
position
- LatLng
of the position to setduration
- Time in milliseconds to ease to the given positionvoid setPositionEased(LatLng position)
position
- LatLng
of the position to setvoid setPositionEased(LatLng position, long duration, MapController.EaseType ease)
position
- LatLng
of the position to setduration
- Time in milliseconds to ease to the given positionease
- Type of easing to useLatLng getPosition()
LatLng
void showBoundingBox(GeoBox box)
void showBoundingBox(GeoBox box, Rect padding)
void showBoundingBoxEased(GeoBox box, Rect padding, int duration)
IMapController.showBoundingBox(GeoBox, Rect)
, but with an animation of the given length, in
milliseconds.void showBoundingBoxEased(GeoBox box, Rect padding, int duration, MapController.EaseType ease)
IMapController.showBoundingBox(GeoBox, Rect)
, but with an animation of the given type and
length, in milliseconds.void setZoom(float zoom)
zoom
- Zoom level; lower values show more areavoid setZoomEased(float zoom)
zoom
- Zoom level; lower values show more areavoid setZoomEased(float zoom, long duration)
zoom
- Zoom level; lower values show more areaduration
- Time in milliseconds to ease to given zoomvoid setZoomEased(float zoom, long duration, MapController.EaseType ease)
zoom
- Zoom level; lower values show more areaduration
- Time in milliseconds to ease to given zoomease
- Type of easing to usefloat getZoom()
void setRotationRad(float rotation)
rotation
- Counter-clockwise rotation in radians; 0 corresponds to North pointing upvoid setRotationRadEased(float rotation)
rotation
- Counter-clockwise rotation in radians; 0 corresponds to North pointing upvoid setRotationRadEased(float rotation, long duration)
rotation
- Counter-clockwise rotation in radians; 0 corresponds to North pointing upduration
- Time in milliseconds to ease to the given rotationvoid setRotationRadEased(float rotation, long duration, MapController.EaseType ease)
rotation
- Counter-clockwise rotation in radians; 0 corresponds to North pointing upduration
- Time in milliseconds to ease to the given rotationease
- Type of easing to usefloat getRotationRad()
float getRotationDeg()
void setMaxTiltRad(float maxTilt)
maxTilt
- angle in radians; 0 corresponds to straight downfloat getMaxTiltRad()
void setTiltRad(float tilt)
tilt
- Tilt angle in radians; 0 corresponds to straight downvoid setTiltRadEased(float tilt)
tilt
- Tilt angle in radians; 0 corresponds to straight downvoid setTiltRadEased(float tilt, long duration)
tilt
- Tilt angle in radians; 0 corresponds to straight downduration
- Time in milliseconds to ease to the given tiltvoid setTiltRadEased(float tilt, long duration, MapController.EaseType ease)
tilt
- Tilt angle in radians; 0 corresponds to straight downduration
- Time in milliseconds to ease to the given tiltease
- Type of easing to usefloat getTiltRad()
void setCameraType(MapController.CameraType type)
type
- A CameraType
MapController.CameraType getCameraType()
CameraType
LatLng screenPositionToLatLng(PointF screenPosition)
screenPosition
- Position in pixels from the top-left corner of the map areaLatLng
corresponding to the given point, or null if the screen position
does not intersect a geographic location (this can happen at high tilt angles).LatLng screenPositionToLatLng(float x, float y)
x
- Position on the X axis, in pixels from the top-left corner of the map areay
- Position on the Y axis, in pixels from the top-left corner of the map areaLatLng
corresponding to the given point, or null if the screen position
does not intersect a geographic location (this can happen at high tilt angles).PointF latLngToScreenPosition(LatLng location)
location
- Geographic coordinatesvoid setScrollGesturesEnabled(boolean isEnabled)
isEnabled
- is scrolling gestures should be enabledboolean isScrollGesturesEnabled()
void setRotateGesturesEnabled(boolean isEnabled)
isEnabled
- set to true to enable rotation gestures; false to disableboolean isRotateGesturesEnabled()
void setTiltGesturesEnabled(boolean isEnabled)
isEnabled
- set to true to enable tilt gestures; false to disableboolean isTiltGesturesEnabled()
void setZoomGesturesEnabled(boolean isEnabled)
isEnabled
- set to true to enable zoom gestures; false to disableboolean isZoomGesturesEnabled()
void setTapResponder(TouchInput.TapResponder responder)
responder
- TapResponder to callvoid setDoubleTapResponder(TouchInput.DoubleTapResponder responder)
responder
- DoubleTapResponder to callvoid setTwoFingerTapResponder(TouchInput.TwoFingerTapResponder responder)
responder
- TwoFingerTapResponder to callvoid setLongPressResponder(TouchInput.LongPressResponder responder)
responder
- LongPressResponder to callvoid setPanResponder(TouchInput.PanResponder responder)
responder
- PanResponder to call; if onPan returns true, normal panning behavior will not occurvoid setRotateResponder(TouchInput.RotateResponder responder)
responder
- RotateResponder to call; if onRotate returns true, normal rotation behavior will not occurvoid setScaleResponder(TouchInput.ScaleResponder responder)
responder
- ScaleResponder to call; if onScale returns true, normal scaling behavior will not occurvoid setShoveResponder(TouchInput.ShoveResponder responder)
responder
- ShoveResponder to call; if onShove returns true, normal tilting behavior will not occurvoid setSimultaneousGestureAllowed(TouchInput.Gestures first, TouchInput.Gestures second, boolean allowed)
second
can be recognized while first
is in progress.first
- Initial gesture typesecond
- Subsequent gesture typeallowed
- True if second
should be recognized, else falsevoid setPickRadius(float radius)
radius
- The radius in dp (density-independent pixels).void setFeaturePickListener(com.here.mobility.sdk.map.MapController.FeaturePickListener listener)
listener
- The MapController.FeaturePickListener
to callvoid setLabelPickListener(com.here.mobility.sdk.map.MapController.LabelPickListener listener)
listener
- The MapController.LabelPickListener
to callvoid setMarkerPickListener(MapController.MarkerPickListener listener)
listener
- The MapController.MarkerPickListener
to callvoid pickFeature(float posX, float posY)
IMapController.setFeaturePickListener(MapController.FeaturePickListener)
.posX
- The horizontal screen coordinateposY
- The vertical screen coordinatevoid pickLabel(float posX, float posY)
IMapController.setLabelPickListener(MapController.LabelPickListener)
.posX
- The horizontal screen coordinateposY
- The vertical screen coordinatevoid pickMarker(float posX, float posY)
Marker
at the given screen coordinates; results will be returned
in a callback to the object set by IMapController.setMarkerPickListener(MapController.MarkerPickListener)
.posX
- The horizontal screen coordinateposY
- The vertical screen coordinateMarker addMarker(LatLng coordinates, MapObjectStyle style)
Marker
to the map which can be used to dynamically add points and polylines
to the map.coordinates
- the initial coordinates of the markerstyle
- the style of the markerMarker
object.Polygon addPolygon(GeoPointsList geoPointsList, PolygonStyle style)
Polygon
to the map.geoPointsList
- the polygon's geometrystyle
- the polygon's style. if null, a default style will be createdIMapController.removePolygon(Polygon)
.void removePolygon(Polygon polygon)
polygon
- the polygon to be removedvoid removeAllPolygons()
Set<Polygon> getAllPolygons()
boolean hasPolygons()
Polyline addPolyline(GeoPointsList geoPointsList, PolylineStyle style)
Polyline
to the map.geoPointsList
- the polyline's geometrystyle
- the polyline's style. if null, a default style will be createdIMapController.removePolyline(Polyline)
.void removePolyline(Polyline polyline)
polyline
- the polyline to be removedvoid removeAllPolylines()
Set<Polyline> getAllPolylines()
boolean hasPolylines()
void removeMarker(Marker marker)
Marker
from the map.marker
- to remove from the map.void removeAllMarkers()
Marker
objects from the map.void setViewCompleteListener(MapController.ViewCompleteListener listener)
listener
- The MapController.ViewCompleteListener
to call when the view is completeRelativeLayout getOverlaysParent()
void setDefaultBackgroundColor(float red, float green, float blue)
red
- red component of the background color - a value between 0 and 1.0green
- green component of the background color - a value between 0 and 1.0blue
- blue component of the background color - a value between 0 and 1.0UserLocationMarkerManager getUserLocationMarkerManager()
void setCompassVisibility(MapController.CompassVisibility compassVisibility)
MapController.CompassVisibility.VISIBLE_ALWAYS
- the compass is always visibleMapController.CompassVisibility.HIDDEN_ALWAYS
- the compass is never visibleMapController.CompassVisibility.VISIBLE_WHEN_MAP_ROTATED
- the compass is visible only
when the rotation of the map is not 0void setCompassView(int layoutResId)
CompassView
. This layout root element of the layout must be an instance
of CompassView
. It will be added into the overlays parent
, which is a RelativeLayout
.
Use a value of 0
to reset to the default compass view.void setCompassView(CompassView compassView)
null
value to reset to the default one.