Package es.situm.wayfinding
Class SitumMapsLibrary
- java.lang.Object
-
- es.situm.wayfinding.SitumMap
-
- es.situm.wayfinding.LibraryListeners
-
- es.situm.wayfinding.LibraryContext
-
- es.situm.wayfinding.SitumMapsLibrary
-
public class SitumMapsLibrary extends es.situm.wayfinding.LibraryContext
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
addExternalLocation(es.situm.sdk.location.ExternalLocation externalLocation)
Add an external location for the SDK to use as it's own.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
centerBuilding(String buildingId, 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(String buildingId)
Limit the map to the given building bounds.void
enableOneBuildingMode(String buildingId, ActionsCallback callback)
Limit the map to the given building bounds.void
filterPoisBy(List<String> categoryIdsFilter)
Filter thePoi
s displayed using the given list ofPoiCategory
identifiers.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.CustomPoi
getCustomPoi()
CustomPoi
getCustomPoi(int poiId)
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
removeCustomPoi(int poiId, ActionsCallback callback)
Deletes theCustomPoi
currently stored both on local storage and on runtime storage.void
removeView(View view)
Remove a previously added child view.void
removeViewAt(int index)
Remove a previously added child view.void
selectCustomPoi(int poiId, ActionsCallback callback)
Selects theCustomPoi
instance saved on cache.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
setPositioningFabVisible(boolean visible)
Show/hide the default positioning Foating Action Button.void
startCustomPoiCreation(ActionsCallback callback)
Initiates the creation of an instance ofCustomPoi
with default name and description if it does not exist.void
startCustomPoiCreation(String name, String description, Bitmap selectedIcon, Bitmap unSelectedIcon, ActionsCallback callback)
Create an instance ofCustomPoi
if it does not exist or update the one that is currently saved.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.-
Methods inherited from class es.situm.wayfinding.LibraryListeners
setOnActiveBuildingListener, setOnCustomPoiChangeListener, setOnFloorChangeListener, setOnLibraryViewListener, setOnLoadBuildingsListener, setOnLocationChangeListener, setOnNavigationListener, setOnPoiSelectionListener, setOnRealtimeDataChangeListener, setSitumMapsListener, setUserInteractionsListener
-
-
-
-
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 String buildingId, @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
-
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(@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.
-
enableOneBuildingMode
public void enableOneBuildingMode(@Nullable String buildingId, @Nullable ActionsCallback callback)
Description copied from class:SitumMap
Limit the map to the given building bounds.- Specified by:
enableOneBuildingMode
in classSitumMap
- Parameters:
buildingId
- Building identifier.callback
- Get notified when de action concludes.
-
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.
-
selectCustomPoi
public void selectCustomPoi(int poiId, @Nullable ActionsCallback callback)
Description copied from class:SitumMap
Selects theCustomPoi
instance saved on cache.- Specified by:
selectCustomPoi
in classSitumMap
- Parameters:
poiId
- Identifier of POI that is to be selected.callback
- Callback that notifies the state of this event.
-
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)
-
addExternalLocation
public void addExternalLocation(@NonNull es.situm.sdk.location.ExternalLocation externalLocation)
Description copied from class:SitumMap
Add an external location for the SDK to use as it's own.- Specified by:
addExternalLocation
in classSitumMap
- Parameters:
externalLocation
- this location will be forwarded by the SDK and drawn on the map
-
filterPoisBy
public void filterPoisBy(List<String> categoryIdsFilter)
Description copied from class:SitumMap
Filter thePoi
s displayed using the given list ofPoiCategory
identifiers. The selected Poi is always visible; the filter will be applied when it gets deselected.- Specified by:
filterPoisBy
in classSitumMap
- Parameters:
categoryIdsFilter
- ListPoiCategory
identifiers. Empty or null to clear filters.
-
startCustomPoiCreation
public void startCustomPoiCreation(@Nullable String name, @Nullable String description, @Nullable Bitmap selectedIcon, @Nullable Bitmap unSelectedIcon, @Nullable ActionsCallback callback)
Description copied from class:SitumMap
Create an instance ofCustomPoi
if it does not exist or update the one that is currently saved. The resultingCustomPoi
is saved on local storage.- Specified by:
startCustomPoiCreation
in classSitumMap
- Parameters:
name
- Name of theCustomPoi
description
- Description of theCustomPoi
selectedIcon
- Icon that is painted on the map when theCustomPoi
is selected.unSelectedIcon
- Icon that is painted on the map when theCustomPoi
is selected.callback
- Callback that notifies the state of this event.
-
startCustomPoiCreation
public void startCustomPoiCreation(@Nullable ActionsCallback callback)
Description copied from class:SitumMap
Initiates the creation of an instance ofCustomPoi
with default name and description if it does not exist. If a custom poi is already saved, the creation operation will override it. The resultingCustomPoi
is saved on local storage.- Specified by:
startCustomPoiCreation
in classSitumMap
- Parameters:
callback
- Callback that notifies the state of this event.
-
getCustomPoi
public CustomPoi getCustomPoi(int poiId)
Description copied from class:SitumMap
Reads theCustomPoi
that matches the id, returns null if noCustomPoi
stored matches the id provided.- Specified by:
getCustomPoi
in classSitumMap
- Parameters:
poiId
- Identifier of custom POI.- Returns:
CustomPoi
to be retrieved.
-
getCustomPoi
public CustomPoi getCustomPoi()
Description copied from class:SitumMap
- Specified by:
getCustomPoi
in classSitumMap
- Returns:
CustomPoi
to be retrieved.
-
removeCustomPoi
public void removeCustomPoi(int poiId, @Nullable ActionsCallback callback)
Description copied from class:SitumMap
Deletes theCustomPoi
currently stored both on local storage and on runtime storage.- Specified by:
removeCustomPoi
in classSitumMap
- Parameters:
poiId
- Identifier of the POI that will be removed.callback
- Callback that notifies of the state of this event.
-
-