-
- All Implemented Interfaces:
-
android.graphics.drawable.Drawable.Callback,android.view.KeyEvent.Callback,android.view.ViewManager,android.view.ViewParent,android.view.accessibility.AccessibilityEventSource,androidx.lifecycle.LifecycleEventObserver,androidx.lifecycle.LifecycleObserver,com.telenav.map.api.MapView
public class TnMapView extends LinearLayout implements MapView, LifecycleEventObserver
Mapview is our primary class to show Map and Navigation information on the map. Beside the basic map/traffic functionality, there are: Annotation Rendering, which can be used to show point of interest on map Vehicle rendering and follow Vehicle Camera Copyright reserved by telenav 2022.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classTnMapView.Companion
-
Field Summary
Fields Modifier and Type Field Description private final FloatdensityDPIprivate final FloatdefaultDpi
-
Method Summary
Modifier and Type Method Description final FloatgetDensityDPI()final FloatgetDefaultDpi()Unitinitialize(MapViewInitConfig config)"Create a subview, add it to the map, and return it. MapSubViewcreateSubView(SubViewInitParams config)This function creates a subview of the map. final UnitremoveSubView(TnMapSubView subView)removeSubViewremoves a subview from the mapBooleanisFinishedLoading(Integer featureCategoryMask)Returns true if the map has finished loading the specified feature categories UnitsetOnCurrentRenderModeChangedListener(CurrentRenderModeChangeListener currentRenderModeChangeListener)sets the listener for the current rendering mode changes(between 2D and 3D) UnitsetOnTargetRenderModeChangedListener(TargetRenderModeChangeListener targetRenderModeChangedListener)sets the listener for the target rendering mode changes(between 2D and 3D) UnitonPause()Lifecycle hooks, call from owning fragment or activity UnitonResume()Lifecycle hooks, call from owning fragment or activity UnitonDestroy()dispose mapview UnitonStateChanged(LifecycleOwner source, Lifecycle.Event event)Set the preferred frames-per-second for the MapView renderer. UnitsetFPS(Integer fps)Set active gestures for the view. BooleansetActiveGestures(Set<GestureType> activeGestures)Register touch event callback UnitsetOnTouchListener(TouchListener listener)Sets the listener for annotation touch events. UnitsetOnAnnotationTouchListener(AnnotationTouchListener listener)Register POI touch event callback UnitsetOnPOITouchListener(POITouchListener poiTouchListener)Sets a listener for the route touch event. UnitsetOnRouteTouchListener(RouteTouchListener listener)It sets the listener for the touch events on the map. UnitsetOnViewTouchListener(ViewTouchListener listener)Register map element touch event callback UnitsetOnMapElementTouchListener(MapElementTouchListener listener)register the on-street parking touch listener UnitsetOnStreetParkingTouchListener(OnStreetParkingTouchListener listener)Register the mapView listener UnitaddMapViewListener(MapView.MapViewListener listener)Remove the mapView listener UnitremoveMapViewListener(MapView.MapViewListener listener)Enable or disable FPS throttling. final UnitsetFrameThrottlingEnabled(Boolean enabled)Enable or disable FPS throttling. VehicleControllergetVehicleController()This method is used to return the object used to manipulate routes for the MapView RoutesController RoutesControllergetRoutesController()The is method is used to return the object used to manipulate annotations for the MapView AnnotationsController AnnotationsControllergetAnnotationsController()This method is used to return the object used to manipulate renderable features for the MapView FeaturesController CameraControllergetCameraController()This method is used to return the object used to manipulate API-fed shape data for rendering on the MapView ShapesController FeaturesControllergetFeaturesController()This method is used to return the object used to manipulate the layout of the MapView LayoutController ShapesControllergetShapesController()This method is used to return the object used to show POI on MapView SearchController ThemeControllergetThemeController()It generates a snapshot of the map. LayoutControllergetLayoutController()This method is used to return the object used to manipulate the layout of the MapView LayoutController OnStreetParkingControllergetOnStreetParkingController()This method is used to return the object used to manipulate the on street parking of the MapView OnStreetParkingController SearchControllergetSearchController()This method is used to return the object used to show POI on MapView. DynamicPOISearchControllergetDynamicPOISearchController()This method is used to return the object used to manipulate dynamic POI search on MapView. MapDiagnosismapDiagnosis()This method is used to return the object used to diagnose MapView UnitgenerateSnapshot(MapView.SnapshotReadyCallback callback)Generate a bitmap image of the MapView UnitgenerateOffscreenSnapshot(OffscreenSnapshotInitParams config)It generates an offscreen snapshot of the current page. final UnitshowAutoZoomDebugInfo(Boolean status, Integer x, Integer y)Display the autozoom information content view in a popup window at the specified location. IntegergetViewWidth()Returns view width. IntegergetViewHeight()Returns view height. -
-
Method Detail
-
getDensityDPI
final Float getDensityDPI()
-
getDefaultDpi
final Float getDefaultDpi()
-
initialize
Unit initialize(MapViewInitConfig config)
"Create a subview, add it to the map, and return it."
The first thing we do is check that the width and height are greater than zero. If they are not, we return null
- Parameters:
config- is a data class that holds the context, dpi, default location, and ready listener for aMapView.
-
createSubView
MapSubView createSubView(SubViewInitParams config)
This function creates a subview of the map.
- Parameters:
config- SubViewInitConfig
-
removeSubView
final Unit removeSubView(TnMapSubView subView)
removeSubViewremoves a subview from the map- Parameters:
subView- The subview to be removed.
-
isFinishedLoading
Boolean isFinishedLoading(Integer featureCategoryMask)
Returns true if the map has finished loading the specified feature categories
- Parameters:
featureCategoryMask- The feature category mask.
-
setOnCurrentRenderModeChangedListener
Unit setOnCurrentRenderModeChangedListener(CurrentRenderModeChangeListener currentRenderModeChangeListener)
sets the listener for the current rendering mode changes(between 2D and 3D)
- Parameters:
currentRenderModeChangeListener- the listener that will be used to notify the change
-
setOnTargetRenderModeChangedListener
Unit setOnTargetRenderModeChangedListener(TargetRenderModeChangeListener targetRenderModeChangedListener)
sets the listener for the target rendering mode changes(between 2D and 3D)
- Parameters:
targetRenderModeChangedListener- the listener that will be used to notify the change
-
onPause
Unit onPause()
Lifecycle hooks, call from owning fragment or activity
-
onResume
Unit onResume()
Lifecycle hooks, call from owning fragment or activity
-
onDestroy
Unit onDestroy()
dispose mapview
-
onStateChanged
Unit onStateChanged(LifecycleOwner source, Lifecycle.Event event)
Set the preferred frames-per-second for the MapView renderer. Current default is 30fps
-
setFPS
Unit setFPS(Integer fps)
Set active gestures for the view. An empty or null list will turn off all gestures.
- Parameters:
fps- the preferred frames-per-second
-
setActiveGestures
Boolean setActiveGestures(Set<GestureType> activeGestures)
Register touch event callback
- Parameters:
activeGestures- the gestures that will be active on the view GestureType
-
setOnTouchListener
Unit setOnTouchListener(TouchListener listener)
Sets the listener for annotation touch events.
- Parameters:
listener- The listener to be set.
-
setOnAnnotationTouchListener
Unit setOnAnnotationTouchListener(AnnotationTouchListener listener)
Register POI touch event callback
- Parameters:
listener- The annotation press event listener AnnotationTouchListener
-
setOnPOITouchListener
Unit setOnPOITouchListener(POITouchListener poiTouchListener)
Sets a listener for the route touch event.
- Parameters:
poiTouchListener- The POI press event listener POITouchListener
-
setOnRouteTouchListener
Unit setOnRouteTouchListener(RouteTouchListener listener)
It sets the listener for the touch events on the map.
- Parameters:
listener- ViewTouchListener?
-
setOnViewTouchListener
Unit setOnViewTouchListener(ViewTouchListener listener)
Register map element touch event callback
- Parameters:
listener- The map element press event listener MapElementTouchListener
-
setOnMapElementTouchListener
Unit setOnMapElementTouchListener(MapElementTouchListener listener)
register the on-street parking touch listener
- Parameters:
listener- the on-street parking press event listener OnStreetParkingTouchListener
-
setOnStreetParkingTouchListener
Unit setOnStreetParkingTouchListener(OnStreetParkingTouchListener listener)
Register the mapView listener
- Parameters:
listener- The mapView listener MapViewListener
-
addMapViewListener
Unit addMapViewListener(MapView.MapViewListener listener)
Remove the mapView listener
- Parameters:
listener- The mapView listener MapViewListener
-
removeMapViewListener
Unit removeMapViewListener(MapView.MapViewListener listener)
Enable or disable FPS throttling.
- Parameters:
listener- The mapThe mapView listener MapViewListener
-
setFrameThrottlingEnabled
final Unit setFrameThrottlingEnabled(Boolean enabled)
Enable or disable FPS throttling.
- Parameters:
enabled- pass true to enable FPS idling when map is inactive pass false to run at full speed
-
getVehicleController
VehicleController getVehicleController()
This method is used to return the object used to manipulate routes for the MapView RoutesController
-
getRoutesController
RoutesController getRoutesController()
The is method is used to return the object used to manipulate annotations for the MapView AnnotationsController
-
getAnnotationsController
AnnotationsController getAnnotationsController()
This method is used to return the object used to manipulate renderable features for the MapView FeaturesController
-
getCameraController
CameraController getCameraController()
This method is used to return the object used to manipulate API-fed shape data for rendering on the MapView ShapesController
-
getFeaturesController
FeaturesController getFeaturesController()
This method is used to return the object used to manipulate the layout of the MapView LayoutController
-
getShapesController
ShapesController getShapesController()
This method is used to return the object used to show POI on MapView SearchController
-
getThemeController
ThemeController getThemeController()
It generates a snapshot of the map.
-
getLayoutController
LayoutController getLayoutController()
This method is used to return the object used to manipulate the layout of the MapView LayoutController
-
getOnStreetParkingController
OnStreetParkingController getOnStreetParkingController()
This method is used to return the object used to manipulate the on street parking of the MapView OnStreetParkingController
-
getSearchController
SearchController getSearchController()
This method is used to return the object used to show POI on MapView. TnMapSubView is not supported this function. SearchController
-
getDynamicPOISearchController
DynamicPOISearchController getDynamicPOISearchController()
This method is used to return the object used to manipulate dynamic POI search on MapView.
-
mapDiagnosis
MapDiagnosis mapDiagnosis()
This method is used to return the object used to diagnose MapView
-
generateSnapshot
Unit generateSnapshot(MapView.SnapshotReadyCallback callback)
Generate a bitmap image of the MapView
- Parameters:
callback- callback to receive bitmap
-
generateOffscreenSnapshot
Unit generateOffscreenSnapshot(OffscreenSnapshotInitParams config)
It generates an offscreen snapshot of the current page.
- Parameters:
config- OffscreenSnapshotInitConfig
-
showAutoZoomDebugInfo
final Unit showAutoZoomDebugInfo(Boolean status, Integer x, Integer y)
Display the autozoom information content view in a popup window at the specified location.
Important: using only for debugging.
- Parameters:
status- if set true auto-zoom info will be shown, otherwise hiden.x- the popup's x location offsety- the popup's y location offset
-
getViewWidth
Integer getViewWidth()
Returns view width.
-
getViewHeight
Integer getViewHeight()
Returns view height.
-
-
-
-