Package es.situm.wayfinding
Class SitumMapsLibrary
- java.lang.Object
-
- es.situm.wayfinding.SitumMap
-
- es.situm.wayfinding.SitumMapsLibrary
-
public class SitumMapsLibrary extends SitumMap
The Situm Maps Library object. Use this class to insert a Situm Map in a view of your choice:-
In your activity or convenience method:
librarySettings = new LibrarySettings(); librarySettings.setCredentials(this, USER, API_KEY, true); // Create library: mLibrary = new SitumMapsLibrary(R.id.maps_library_target, this, librarySettings); mLibrary.load();
-
In your layout:
<!-- The target view: --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/maps_library_target" android:layout_width="match_parent" android:layout_height="match_parent" /> ...
-
In your activity or convenience method:
-
-
Constructor Summary
Constructors Constructor Description SitumMapsLibrary(int containerId, androidx.fragment.app.FragmentActivity context, LibrarySettings settings)
Creates a newSitumMapsLibrary
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDirectionsRequestInterceptor(Interceptor<es.situm.sdk.directions.DirectionsRequest.Builder> interceptor)
Add aInterceptor
that will interceptDirectionsRequest
object creations.void
addLocationRequestInterceptor(Interceptor<es.situm.sdk.location.LocationRequest.Builder> interceptor)
Add aInterceptor
that will interceptLocationRequest
object creations.void
addNavigationRequestInterceptor(Interceptor<es.situm.sdk.navigation.NavigationRequest.Builder> interceptor)
Add aInterceptor
that will interceptNavigationRequest
object creations.void
addOnBackPressedListener(es.situm.maps.library.ui.OnBackPressedListener listener)
Adds a listener that will be notified of onBackPressed events.void
addPrivateExtensions(es.situm.wayfinding.PrivateExtensions privateExtensions)
Set up private extensions (search, settings and calibration) in this application.void
addView(View view)
Add this child view.void
addView(View view, int index)
Add this child view.void
addView(View child, int width, int height)
Add this child view.void
addView(View view, int index, ViewGroup.LayoutParams params)
Add this child view.void
addView(View child, ViewGroup.LayoutParams params)
Add this child view.void
centerBuilding(es.situm.sdk.model.cartography.Building building)
Center the given building in the map.void
centerBuilding(es.situm.sdk.model.cartography.Building building, ActionsCallback callback)
Center the given building in the map.void
changeGeofencesColor(Map<Integer,List<es.situm.sdk.model.cartography.Geofence>> geofences)
Change the color of the geofences that you want painted over the map.void
closeToasts()
Closes all the currently open toasts.void
enableOneBuildingMode()
Limit the map to the first loaded building bounds.void
enableOneBuildingMode(es.situm.sdk.model.cartography.Building building)
Limit the map to the given building bounds.void
enableOneBuildingMode(String buildingId)
Limit the map to the given building bounds.void
findRouteToLocation(es.situm.sdk.model.cartography.Floor floor, double lat, double lng)
Find a route to the given location.void
findRouteToLocation(String buildingId, String floorId, double lat, double lng)
Find a route to the given location.void
findRouteToPoi(es.situm.sdk.model.cartography.Poi poi)
Find a route to the given Poi.es.situm.maps.library.domain.model.Building
getActiveBuilding()
void
getGoogleMap(com.google.android.gms.maps.OnMapReadyCallback googleCallback)
Get theGoogleMap
instance when ready.void
load()
Prepares theMapsFragment
and commits the fragment transaction.void
loadInFragment(androidx.fragment.app.Fragment parentFragment)
Prepares theMapsFragment
and commits the fragment transaction.boolean
onBackPressed()
Notifies the underlying fragment the onBackPressed event.void
releaseOneBuildingMode()
Release the one building mode.void
removeView(View view)
Remove a previously added child view.void
removeViewAt(int index)
Remove a previously added child view.void
selectFloor(es.situm.sdk.model.cartography.Floor floor)
Select the given floor.void
selectPoi(es.situm.sdk.model.cartography.Poi poi)
Select the given poi on the map.void
selectPoi(es.situm.sdk.model.cartography.Poi poi, ActionsCallback callback)
Select the given poi on the map.void
setFloorsListVisible(boolean visible)
Show/hide the floors list selector.void
setGetMeToPoiFabVisible(boolean visible)
Show/hide the default get-me-to-poi Foating Action Button.void
setInfoViewVisible(boolean visible)
Show/hide the info-view bottom area.void
setOnActiveBuildingListener(OnActiveBuildingListener listener)
Get notified about active building events.void
setOnFloorChangeListener(OnFloorChangeListener listener)
Get notified about changes in the floor level selector.void
setOnLibraryViewListener(OnLibraryViewListener listener)
Get notified about activity/view events.void
setOnLoadBuildingsListener(OnLoadBuildingsListener listener)
Get notified about buildings events.void
setOnLocationChangeListener(OnLocationChangeListener listener)
Get notified about user location changes.void
setOnNavigationListener(OnNavigationListener onNavigationListener)
Get notified about navigation events (request, cancel, destination reached).void
setOnPoiSelectionListener(OnPoiSelectionListener listener)
Get notified about POI events.void
setOnRealtimeDataChangeListener(es.situm.wayfinding.OnRealtimeDataChangeListener listener)
Get notified about realtime data changes.void
setPositioningFabVisible(boolean visible)
Show/hide the default positioning Foating Action Button.void
setSitumMapsListener(SitumMapsListener listener)
Get notified ofSitumMapsLibrary
events.void
setUserInteractionsListener(OnUserInteractionListener listener)
Get notified of events produced by user interactions.void
startPositioning()
Start positioning at the first loaded building.void
startPositioning(es.situm.sdk.model.cartography.Building building)
Start positioning at the given building.void
startPositioning(String buildingId)
Start positioning at the given building.void
stopNavigation()
Stop navigating if the user is currently navigating to aPoi
or location.void
stopPositioning()
Stop positioning.void
unload()
Removes theMapsFragment
from the container and commits the fragment transaction.
-
-
-
Constructor Detail
-
SitumMapsLibrary
public SitumMapsLibrary(@IdRes int containerId, @NonNull androidx.fragment.app.FragmentActivity context, @NonNull LibrarySettings settings)
Creates a newSitumMapsLibrary
.- Parameters:
containerId
- ID of the ViewGroup that will contain theMapsFragment
fragment.context
- AFragmentActivity
that will be the parent of the fragment.settings
- Settings needed.
-
-
Method Detail
-
load
public void load()
Prepares theMapsFragment
and commits the fragment transaction. Use this method to load the library inside an Activity.
-
loadInFragment
public void loadInFragment(androidx.fragment.app.Fragment parentFragment)
Prepares theMapsFragment
and commits the fragment transaction. Use this method to load the library inside a Fragment.
-
unload
public void unload()
Removes theMapsFragment
from the container and commits the fragment transaction.
-
getGoogleMap
public void getGoogleMap(@NonNull com.google.android.gms.maps.OnMapReadyCallback googleCallback)
Get theGoogleMap
instance when ready.- Specified by:
getGoogleMap
in classSitumMap
- Parameters:
googleCallback
- Google Callback.
-
addPrivateExtensions
public void addPrivateExtensions(es.situm.wayfinding.PrivateExtensions privateExtensions)
Set up private extensions (search, settings and calibration) in this application.- Parameters:
privateExtensions
- Private extensions.
-
onBackPressed
public boolean onBackPressed()
Notifies the underlying fragment the onBackPressed event. Call this method from yourActivity.onBackPressed()
method if you want the situm maps fragment to handle these events.- Specified by:
onBackPressed
in classSitumMap
- Returns:
- true if the event was consumed, false elsewhere.
-
addOnBackPressedListener
public void addOnBackPressedListener(es.situm.maps.library.ui.OnBackPressedListener listener)
Adds a listener that will be notified of onBackPressed events.- Parameters:
listener
- OnBackPressedListener- See Also:
onBackPressed()
-
closeToasts
public void closeToasts()
Closes all the currently open toasts.
-
addLocationRequestInterceptor
public void addLocationRequestInterceptor(Interceptor<es.situm.sdk.location.LocationRequest.Builder> interceptor)
Description copied from class:SitumMap
Add aInterceptor
that will interceptLocationRequest
object creations.- Specified by:
addLocationRequestInterceptor
in classSitumMap
- Parameters:
interceptor
- Given interceptor.
-
addNavigationRequestInterceptor
public void addNavigationRequestInterceptor(Interceptor<es.situm.sdk.navigation.NavigationRequest.Builder> interceptor)
Description copied from class:SitumMap
Add aInterceptor
that will interceptNavigationRequest
object creations.- Specified by:
addNavigationRequestInterceptor
in classSitumMap
- Parameters:
interceptor
- Given interceptor.
-
addDirectionsRequestInterceptor
public void addDirectionsRequestInterceptor(Interceptor<es.situm.sdk.directions.DirectionsRequest.Builder> interceptor)
Description copied from class:SitumMap
Add aInterceptor
that will interceptDirectionsRequest
object creations.- Specified by:
addDirectionsRequestInterceptor
in classSitumMap
- Parameters:
interceptor
- Given interceptor.
-
centerBuilding
public void centerBuilding(@NonNull es.situm.sdk.model.cartography.Building building)
Description copied from class:SitumMap
Center the given building in the map.- Specified by:
centerBuilding
in classSitumMap
- Parameters:
building
- Building.
-
centerBuilding
public void centerBuilding(@NonNull es.situm.sdk.model.cartography.Building building, @Nullable ActionsCallback callback)
Description copied from class:SitumMap
Center the given building in the map. Use the given callback to chain other commands (ex.SitumMap.selectPoi(Poi)
,SitumMap.enableOneBuildingMode()
...).- Specified by:
centerBuilding
in classSitumMap
-
enableOneBuildingMode
public void enableOneBuildingMode()
Description copied from class:SitumMap
Limit the map to the first loaded building bounds.- Specified by:
enableOneBuildingMode
in classSitumMap
-
enableOneBuildingMode
public void enableOneBuildingMode(@NonNull es.situm.sdk.model.cartography.Building building)
Description copied from class:SitumMap
Limit the map to the given building bounds.- Specified by:
enableOneBuildingMode
in classSitumMap
- Parameters:
building
- Building.
-
enableOneBuildingMode
public void enableOneBuildingMode(@Nullable String buildingId)
Description copied from class:SitumMap
Limit the map to the given building bounds.- Specified by:
enableOneBuildingMode
in classSitumMap
- Parameters:
buildingId
- Building identifier.
-
releaseOneBuildingMode
public void releaseOneBuildingMode()
Description copied from class:SitumMap
Release the one building mode.- Specified by:
releaseOneBuildingMode
in classSitumMap
-
selectPoi
public void selectPoi(@NonNull es.situm.sdk.model.cartography.Poi poi)
Description copied from class:SitumMap
Select the given poi on the map.
-
selectPoi
public void selectPoi(@NonNull es.situm.sdk.model.cartography.Poi poi, @Nullable ActionsCallback callback)
Description copied from class:SitumMap
Select the given poi on the map.
-
findRouteToPoi
public void findRouteToPoi(@NonNull es.situm.sdk.model.cartography.Poi poi)
Description copied from class:SitumMap
Find a route to the given Poi.- Specified by:
findRouteToPoi
in classSitumMap
- Parameters:
poi
- Poi.
-
findRouteToLocation
public void findRouteToLocation(@NonNull es.situm.sdk.model.cartography.Floor floor, double lat, double lng)
Description copied from class:SitumMap
Find a route to the given location.- Specified by:
findRouteToLocation
in classSitumMap
- Parameters:
floor
- Floor.lat
- Latitude.lng
- Longitude.
-
findRouteToLocation
public void findRouteToLocation(String buildingId, String floorId, double lat, double lng)
Description copied from class:SitumMap
Find a route to the given location.- Specified by:
findRouteToLocation
in classSitumMap
- Parameters:
buildingId
- Id of the building.floorId
- Id of the desired floor.lat
- Latitude.lng
- Longitude.
-
stopNavigation
public void stopNavigation()
Description copied from class:SitumMap
Stop navigating if the user is currently navigating to aPoi
or location. Does nothing if navigation is not running.- Specified by:
stopNavigation
in classSitumMap
-
changeGeofencesColor
public void changeGeofencesColor(Map<Integer,List<es.situm.sdk.model.cartography.Geofence>> geofences)
Description copied from class:SitumMap
Change the color of the geofences that you want painted over the map. The color is a 32-bit ARGB. Default color is 0x7Ff9ff80.- Specified by:
changeGeofencesColor
in classSitumMap
- Parameters:
geofences
- Map with the colors and the geofences list
-
startPositioning
public void startPositioning()
Description copied from class:SitumMap
Start positioning at the first loaded building.- Specified by:
startPositioning
in classSitumMap
-
startPositioning
public void startPositioning(@NonNull es.situm.sdk.model.cartography.Building building)
Description copied from class:SitumMap
Start positioning at the given building.- Specified by:
startPositioning
in classSitumMap
- Parameters:
building
- Building.
-
startPositioning
public void startPositioning(@Nullable String buildingId)
Description copied from class:SitumMap
Start positioning at the given building.- Specified by:
startPositioning
in classSitumMap
- Parameters:
buildingId
- Building identifier.
-
stopPositioning
public void stopPositioning()
Description copied from class:SitumMap
Stop positioning.- Specified by:
stopPositioning
in classSitumMap
-
selectFloor
public void selectFloor(@NonNull es.situm.sdk.model.cartography.Floor floor)
Description copied from class:SitumMap
Select the given floor.- Specified by:
selectFloor
in classSitumMap
- Parameters:
floor
- Floor to select.
-
setPositioningFabVisible
public void setPositioningFabVisible(boolean visible)
Description copied from class:SitumMap
Show/hide the default positioning Foating Action Button.- Specified by:
setPositioningFabVisible
in classSitumMap
- Parameters:
visible
- Visible/gone.
-
setGetMeToPoiFabVisible
public void setGetMeToPoiFabVisible(boolean visible)
Description copied from class:SitumMap
Show/hide the default get-me-to-poi Foating Action Button.- Specified by:
setGetMeToPoiFabVisible
in classSitumMap
- Parameters:
visible
- Visible/gone.
-
setFloorsListVisible
public void setFloorsListVisible(boolean visible)
Description copied from class:SitumMap
Show/hide the floors list selector.- Specified by:
setFloorsListVisible
in classSitumMap
- Parameters:
visible
- Visible/gone.
-
setInfoViewVisible
public void setInfoViewVisible(boolean visible)
Description copied from class:SitumMap
Show/hide the info-view bottom area.- Specified by:
setInfoViewVisible
in classSitumMap
- Parameters:
visible
- Visible/gone.
-
addView
public void addView(View view, int index, ViewGroup.LayoutParams params)
Description copied from class:SitumMap
Add this child view. The target will be placed in an overlay that is:- Over the map and all its markers/buildings.
- Behind the UI controls (positioning fab, search bar...).
-
addView
public void addView(View view, int index)
Description copied from class:SitumMap
Add this child view.- Specified by:
addView
in classSitumMap
- Parameters:
view
- Child view.index
- Index.- See Also:
SitumMap.addView(View, int, ViewGroup.LayoutParams)
-
addView
public void addView(View view)
Description copied from class:SitumMap
Add this child view.- Specified by:
addView
in classSitumMap
- Parameters:
view
- Child view.- See Also:
SitumMap.addView(View, int, ViewGroup.LayoutParams)
-
addView
public void addView(View child, ViewGroup.LayoutParams params)
Description copied from class:SitumMap
Add this child view.- Specified by:
addView
in classSitumMap
- Parameters:
child
- Child view.params
- Layout params.- See Also:
SitumMap.addView(View, int, ViewGroup.LayoutParams)
-
addView
public void addView(View child, int width, int height)
Description copied from class:SitumMap
Add this child view.- Specified by:
addView
in classSitumMap
- Parameters:
child
- Child view.width
- Width.height
- Height.- See Also:
SitumMap.addView(View, int, ViewGroup.LayoutParams)
-
removeView
public void removeView(View view)
Description copied from class:SitumMap
Remove a previously added child view.- Specified by:
removeView
in classSitumMap
- Parameters:
view
- Child view.- See Also:
SitumMap.addView(View, int, ViewGroup.LayoutParams)
-
removeViewAt
public void removeViewAt(int index)
Description copied from class:SitumMap
Remove a previously added child view.- Specified by:
removeViewAt
in classSitumMap
- Parameters:
index
- Index of the child view.- See Also:
SitumMap.addView(View, int, ViewGroup.LayoutParams)
-
getActiveBuilding
public es.situm.maps.library.domain.model.Building getActiveBuilding()
-
setSitumMapsListener
public void setSitumMapsListener(SitumMapsListener listener)
Get notified ofSitumMapsLibrary
events.- Specified by:
setSitumMapsListener
in classSitumMap
- Parameters:
listener
- listener.
-
setOnLocationChangeListener
public void setOnLocationChangeListener(OnLocationChangeListener listener)
Get notified about user location changes.- Specified by:
setOnLocationChangeListener
in classSitumMap
- Parameters:
listener
- listener
-
setUserInteractionsListener
public void setUserInteractionsListener(OnUserInteractionListener listener)
Get notified of events produced by user interactions.- Specified by:
setUserInteractionsListener
in classSitumMap
- Parameters:
listener
- listener.
-
setOnPoiSelectionListener
public void setOnPoiSelectionListener(OnPoiSelectionListener listener)
Get notified about POI events.- Specified by:
setOnPoiSelectionListener
in classSitumMap
- Parameters:
listener
- listener
-
setOnActiveBuildingListener
public void setOnActiveBuildingListener(OnActiveBuildingListener listener)
Get notified about active building events.- Specified by:
setOnActiveBuildingListener
in classSitumMap
- Parameters:
listener
- listener
-
setOnLoadBuildingsListener
public void setOnLoadBuildingsListener(OnLoadBuildingsListener listener)
Get notified about buildings events.- Specified by:
setOnLoadBuildingsListener
in classSitumMap
- Parameters:
listener
- listener.
-
setOnFloorChangeListener
public void setOnFloorChangeListener(OnFloorChangeListener listener)
Get notified about changes in the floor level selector.- Specified by:
setOnFloorChangeListener
in classSitumMap
- Parameters:
listener
- listener
-
setOnRealtimeDataChangeListener
public void setOnRealtimeDataChangeListener(es.situm.wayfinding.OnRealtimeDataChangeListener listener)
Get notified about realtime data changes.- Specified by:
setOnRealtimeDataChangeListener
in classSitumMap
- Parameters:
listener
- listener
-
setOnLibraryViewListener
public void setOnLibraryViewListener(@Nullable OnLibraryViewListener listener)
Get notified about activity/view events.- Specified by:
setOnLibraryViewListener
in classSitumMap
- Parameters:
listener
- Listener.
-
setOnNavigationListener
public void setOnNavigationListener(@Nullable OnNavigationListener onNavigationListener)
Description copied from class:SitumMap
Get notified about navigation events (request, cancel, destination reached).- Specified by:
setOnNavigationListener
in classSitumMap
- Parameters:
onNavigationListener
- Listener.
-
-