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
  • Constructor Details

    • MapFragment

      public MapFragment()
  • Method Details

    • addOnMapReadyListener

      public void addOnMapReadyListener(@NonNull MapReadyListener listener)
      Add MapReadyListener
      Parameters:
      listener - map ready listener
      Since:
      1.0
    • setCenter

      public void setCenter(@NonNull Coordinate center)
      Center map to given coordinate. This turns off map centering to current GPS position.
      Parameters:
      center - coordinate to set map center to
      Since:
      3.11
    • setMapMode

      public MapFragment.SetMapModeResult setMapMode(@NonNull MapFragment.MapMode mapMode)
      Change map mode
      Parameters:
      mapMode - new map mode
      Returns:
      success/failure
      Since:
      1.0
    • setNightMode

      public void setNightMode(boolean nightModeOn)
      Enable/disable night mode
      Parameters:
      nightModeOn - true/false to enable/disable night mode
      Since:
      1.0
    • setHUDMode

      public void setHUDMode(@NonNull MapFragment.HudMode mode)
      Set Head-up display mode during navigation
      Parameters:
      mode - head-up mode to set
      Since:
      2.2
    • getHUDMode

      @NonNull public MapFragment.HudMode getHUDMode()
      Get current Head-up mode
      Returns:
      current Head-up mode
      Since:
      2.2
    • getMapControls

      @NonNull public MapControls getMapControls()
      Get Map controls module
      Returns:
      Map controls instance
      Since:
      1.0
    • showOnMap

      public void showOnMap(@NonNull SearchResult searchResult)
      Show search result on map
      Parameters:
      searchResult - result from Search engine to show on map
      Since:
      1.0
    • showOnMap

      public void showOnMap(@NonNull NavigationHistoryRoute navigationHistoryRoute, int routeColor, int lineWidth)
      Show navigation history route on map
      Parameters:
      navigationHistoryRoute - navigation history route to show on map
      routeColor - color to paint the route
      lineWidth - width of the line
      Since:
      3.9
    • showMessage

      public boolean showMessage(@NonNull String message)
      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