Class 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:
    1. 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();
       
    2. 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" />
       ...
       
       
    • Constructor Detail

      • SitumMapsLibrary

        public SitumMapsLibrary​(@IdRes
                                int containerId,
                                @NonNull
                                androidx.fragment.app.FragmentActivity context,
                                @NonNull
                                LibrarySettings settings)
        Creates a new SitumMapsLibrary.
        Parameters:
        containerId - ID of the ViewGroup that will contain the MapsFragment fragment.
        context - A FragmentActivity that will be the parent of the fragment.
        settings - Settings needed.
    • Method Detail

      • load

        public void load()
        Prepares the MapsFragment 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 the MapsFragment and commits the fragment transaction. Use this method to load the library inside a Fragment.
      • unload

        public void unload()
        Removes the MapsFragment from the container and commits the fragment transaction.
      • getGoogleMap

        public void getGoogleMap​(@NonNull
                                 com.google.android.gms.maps.OnMapReadyCallback googleCallback)
        Get the GoogleMap instance when ready.
        Specified by:
        getGoogleMap in class SitumMap
        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 your Activity.onBackPressed() method if you want the situm maps fragment to handle these events.
        Specified by:
        onBackPressed in class SitumMap
        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 a Interceptor that will intercept LocationRequest object creations.
        Specified by:
        addLocationRequestInterceptor in class SitumMap
        Parameters:
        interceptor - Given interceptor.
      • addNavigationRequestInterceptor

        public void addNavigationRequestInterceptor​(Interceptor<es.situm.sdk.navigation.NavigationRequest.Builder> interceptor)
        Description copied from class: SitumMap
        Add a Interceptor that will intercept NavigationRequest object creations.
        Specified by:
        addNavigationRequestInterceptor in class SitumMap
        Parameters:
        interceptor - Given interceptor.
      • addDirectionsRequestInterceptor

        public void addDirectionsRequestInterceptor​(Interceptor<es.situm.sdk.directions.DirectionsRequest.Builder> interceptor)
        Description copied from class: SitumMap
        Add a Interceptor that will intercept DirectionsRequest object creations.
        Specified by:
        addDirectionsRequestInterceptor in class SitumMap
        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 class SitumMap
        Parameters:
        building - Building.
      • enableOneBuildingMode

        public void enableOneBuildingMode()
        Description copied from class: SitumMap
        Limit the map to the first loaded building bounds.
        Specified by:
        enableOneBuildingMode in class SitumMap
      • enableOneBuildingMode

        public void enableOneBuildingMode​(@Nullable
                                          String buildingId)
        Description copied from class: SitumMap
        Limit the map to the given building bounds.
        Specified by:
        enableOneBuildingMode in class SitumMap
        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 class SitumMap
        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 class SitumMap
      • selectPoi

        public void selectPoi​(@NonNull
                              es.situm.sdk.model.cartography.Poi poi)
        Description copied from class: SitumMap
        Select the given poi on the map.
        Specified by:
        selectPoi in class SitumMap
        Parameters:
        poi - Poi.
      • 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.
        Specified by:
        selectPoi in class SitumMap
        Parameters:
        poi - Poi.
        callback - Callback.
      • selectCustomPoi

        public void selectCustomPoi​(int poiId,
                                    @Nullable
                                    ActionsCallback callback)
        Description copied from class: SitumMap
        Selects the CustomPoi instance saved on cache.
        Specified by:
        selectCustomPoi in class SitumMap
        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 class SitumMap
        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 class SitumMap
        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 class SitumMap
        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 a Poi or location. Does nothing if navigation is not running.
        Specified by:
        stopNavigation in class SitumMap
      • 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 class SitumMap
        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 class SitumMap
      • 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 class SitumMap
        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 class SitumMap
        Parameters:
        buildingId - Building identifier.
      • stopPositioning

        public void stopPositioning()
        Description copied from class: SitumMap
        Stop positioning.
        Specified by:
        stopPositioning in class SitumMap
      • 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 class SitumMap
        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 class SitumMap
        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 class SitumMap
        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 class SitumMap
        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 class SitumMap
        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:
        1. Over the map and all its markers/buildings.
        2. Behind the UI controls (positioning fab, search bar...).
        Specified by:
        addView in class SitumMap
        Parameters:
        view - Child view.
        index - Index.
        params - Layout params.
      • 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 class SitumMap
        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 the Pois displayed using the given list of PoiCategory identifiers. The selected Poi is always visible; the filter will be applied when it gets deselected.
        Specified by:
        filterPoisBy in class SitumMap
        Parameters:
        categoryIdsFilter - List PoiCategory 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 of CustomPoi if it does not exist or update the one that is currently saved. The resulting CustomPoi is saved on local storage.
        Specified by:
        startCustomPoiCreation in class SitumMap
        Parameters:
        name - Name of the CustomPoi
        description - Description of the CustomPoi
        selectedIcon - Icon that is painted on the map when the CustomPoi is selected.
        unSelectedIcon - Icon that is painted on the map when the CustomPoi 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 of CustomPoi with default name and description if it does not exist. If a custom poi is already saved, the creation operation will override it. The resulting CustomPoi is saved on local storage.
        Specified by:
        startCustomPoiCreation in class SitumMap
        Parameters:
        callback - Callback that notifies the state of this event.
      • getCustomPoi

        public CustomPoi getCustomPoi​(int poiId)
        Description copied from class: SitumMap
        Reads the CustomPoi that matches the id, returns null if no CustomPoi stored matches the id provided.
        Specified by:
        getCustomPoi in class SitumMap
        Parameters:
        poiId - Identifier of custom POI.
        Returns:
        CustomPoi to be retrieved.
      • removeCustomPoi

        public void removeCustomPoi​(int poiId,
                                    @Nullable
                                    ActionsCallback callback)
        Description copied from class: SitumMap
        Deletes the CustomPoi currently stored both on local storage and on runtime storage.
        Specified by:
        removeCustomPoi in class SitumMap
        Parameters:
        poiId - Identifier of the POI that will be removed.
        callback - Callback that notifies of the state of this event.