Package com.mapfactor.sdk.map
Class MapFragment
java.lang.Object
SdkFragment
com.mapfactor.sdk.map.MapFragment
public class MapFragment
extends SdkFragment
Map fragment. Use directly or via MapView.
- Since:
- 1.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Head-up navigation display mode typesstatic enum
Map modesstatic enum
setMapMode method result -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addOnMapClickedListener
(MapClickedListener listener) Add MapClickedListenervoid
addOnMapReadyListener
(MapReadyListener listener) Add MapReadyListenerGet current Head-up modeGet map center coordinateGet Map controls moduleboolean
Test whether compass is used in 2D forMapFragment.MapMode.ROTATE
andMapFragment.MapMode.ROTATE_CENTER
map modesvoid
removeOnMapClickedListener
(MapClickedListener listener) Remove MapClickedListenervoid
removeOnMapReadyListener
(MapReadyListener listener) Remove MapReadyListenervoid
Set Head-up display mode during navigationboolean
setMapCenter
(Coordinate mapCenterCoordinate) Center map to given coordinate.setMapMode
(MapFragment.MapMode mapMode) Change map modevoid
setUseCompass
(boolean useCompass) Enable/disable using compass in 2D whenMapFragment.MapMode.ROTATE
orMapFragment.MapMode.ROTATE_CENTER
map mode is on.boolean
showMessage
(String message) Show a messagevoid
showOnMap
(NavigationHistoryRoute navigationHistoryRoute, int routeColor, int lineWidth) Show navigation history route on mapvoid
showOnMap
(SearchResult searchResult) Show search result on map
-
Constructor Details
-
MapFragment
public MapFragment()
-
-
Method Details
-
addOnMapReadyListener
Add MapReadyListener- Parameters:
listener
- map ready listener- Since:
- 1.0
-
removeOnMapReadyListener
Remove MapReadyListener- Parameters:
listener
- map ready listener- Since:
- 4.9
-
addOnMapClickedListener
Add MapClickedListener- Parameters:
listener
- map clicked listener- Since:
- 4.9
-
removeOnMapClickedListener
Remove MapClickedListener- Parameters:
listener
- map clicked listener- Since:
- 4.9
-
setMapMode
Change map mode- Parameters:
mapMode
- new map mode- Returns:
- success/failure
- Since:
- 1.0
-
setMapCenter
Center map to given coordinate. Can be called only when not navigating in 3D.- Parameters:
mapCenterCoordinate
- coordinate to move map center to- Returns:
- true on success, false when there is an ongoing 3D navigation
- Since:
- 4.2
-
getMapCenter
Get map center coordinate- Returns:
- map center coordinate
- Since:
- 4.2
-
setUseCompass
public void setUseCompass(boolean useCompass) Enable/disable using compass in 2D whenMapFragment.MapMode.ROTATE
orMapFragment.MapMode.ROTATE_CENTER
map mode is on. If compass is disabled, azimuth from GPS is used.- Parameters:
useCompass
- true/false to use/not use compass for map rotation in 2D- Since:
- 4.8
-
isCompassUsed
public boolean isCompassUsed()Test whether compass is used in 2D forMapFragment.MapMode.ROTATE
andMapFragment.MapMode.ROTATE_CENTER
map modes- Returns:
- true/false when compass is/is not used
- Since:
- 4.8
-
setHUDMode
Set Head-up display mode during navigation- Parameters:
mode
- head-up mode to set- Since:
- 2.2
-
getHUDMode
Get current Head-up mode- Returns:
- current Head-up mode
- Since:
- 2.2
-
getMapControls
Get Map controls module- Returns:
- Map controls instance
- Since:
- 1.0
-
showOnMap
Show search result on map- Parameters:
searchResult
- result from Search engine to show on map- Since:
- 1.0
-
showMessage
Show a message- Parameters:
message
- text to show- Returns:
- success/failure (may fail when the fragment is npt attached to an activity)
- Since:
- 1.0
-