Class PTRMapFragment
-
- All Implemented Interfaces:
-
android.content.ComponentCallbacks
,android.view.View.OnCreateContextMenuListener
,androidx.activity.result.ActivityResultCaller
,androidx.lifecycle.HasDefaultViewModelProviderFactory
,androidx.lifecycle.LifecycleOwner
,androidx.lifecycle.ViewModelStoreOwner
,androidx.savedstate.SavedStateRegistryOwner
,com.pointrlabs.core.management.ConfigurationManager.Listener
,com.pointrlabs.core.management.PTRListener
,com.pointrlabs.core.management.UserManager.Listener
public final class PTRMapFragment extends PTRFragment implements ConfigurationManager.Listener, UserManager.Listener
Default implementation for PTRMapFragment
Responsible for:
-> Displaying map -> All map interactions (map zoom in/out, scroll) -> Displaying Pois -> Displaying Position -> Displaying Path
The primary component under MapWidget.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
PTRMapFragment.Companion
-
Field Summary
Fields Modifier and Type Field Description public final static String
TAG
public final static Double
maximumAllowedZoomLevel
private PathSession
currentPathSession
private Path
currentPath
private Double
zoomLevel
private Double
minimumZoomLevel
private Double
maximumZoomLevel
private Double
defaultLocationZoomLevel
private final Boolean
isMapFullyRendered
private Boolean
areAllFramesFullyRendered
private final Poi
highlightedPoi
private Boolean
isJoystickEnabled
private List<String>
filteredPoiSet
private final Double
rotationalDirection
private LocalizationPlugin
localizationPlugin
private FutureTask<Object>
loadTileTimeoutRunner
public final String
mPreviousWho
private final SavedStateRegistry
savedStateRegistry
public final static PTRMapFragment.Companion
Companion
-
Constructor Summary
Constructors Constructor Description PTRMapFragment()
-
Method Summary
Modifier and Type Method Description final PathSession
getCurrentPathSession()
final Unit
setCurrentPathSession(PathSession currentPathSession)
final Path
getCurrentPath()
final Unit
setCurrentPath(Path currentPath)
final Double
getZoomLevel()
final Unit
setZoomLevel(Double zoomLevel)
final Double
getMinimumZoomLevel()
final Unit
setMinimumZoomLevel(Double minimumZoomLevel)
final Double
getMaximumZoomLevel()
final Unit
setMaximumZoomLevel(Double maximumZoomLevel)
final Double
getDefaultLocationZoomLevel()
final Unit
setDefaultLocationZoomLevel(Double defaultLocationZoomLevel)
final Boolean
isMapFullyRendered()
final Boolean
getAreAllFramesFullyRendered()
final Unit
setAreAllFramesFullyRendered(Boolean areAllFramesFullyRendered)
final Poi
getHighlightedPoi()
final Boolean
isJoystickEnabled()
Joystick to simulate user position should be displayed. final Unit
setJoystickEnabled(Boolean isJoystickEnabled)
final List<String>
getFilteredPoiSet()
Filters the map to show only the list of given poi ids. final Unit
setFilteredPoiSet(List<String> filteredPoiSet)
final Double
getRotationalDirection()
final LocalizationPlugin
getLocalizationPlugin()
final Unit
setLocalizationPlugin(LocalizationPlugin localizationPlugin)
final FutureTask<Object>
getLoadTileTimeoutRunner()
final Unit
setLoadTileTimeoutRunner(FutureTask<Object> loadTileTimeoutRunner)
Unit
onCreate(Bundle savedInstanceState)
View
onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
Unit
onStart()
Unit
onResume()
Unit
onSaveInstanceState(Bundle outState)
Unit
onPause()
Unit
onStop()
Unit
onDestroyView()
Unit
onDestroy()
Unit
onLowMemory()
Unit
onConfigurationUpdate()
Configuration updated final Unit
loadAndSet(Level level, Boolean shouldZoomToLevel)
final Unit
loadAndSet(Building building)
When calling this method, the map widget will load the content for this building and related site, if necessary, and displays it. final Unit
loadAndSet(Site site)
When calling this method, the map widget will load the content for this site, if necessary, and displays it. final Unit
show(Level level, Boolean shouldZoomLevel, Boolean trackingModeChanged, PTRMapAnimationType animationType, Double bearing, Double tilt, Function1<String, Unit> onComplete)
Updates map to display given Level final Unit
highlightPoi(Poi poi)
Highlights given Poi final Unit
unhighlightPoi(Poi poi)
Un-highlights given Poi final Unit
unhighlightAllPois()
Unhighlight all Poi final Unit
scrollToLocation(GeoPoint location, Double zoomLevel, Function1<String, Unit> onComplete)
Scroll the map to given location final Unit
zoomToLocation(GeoPoint location, Function1<String, Unit> onComplete)
Zooms the camera to given location with the default location zoom level. final Unit
setZoomLevel(Double zoomLevel, Boolean isAnimated, Function1<String, Unit> onComplete)
Zooms the camera with desired zoom level. final Unit
rotateToDirection(Double direction, Boolean isAnimated, Function1<String, Unit> onComplete)
Changed the heading of the map and optionally animates the change final Unit
resetNorth()
Resets the map rotation to a northern heading with animation. final Unit
addAnnotation(PTRMapViewMarker ptrMapViewMarker, Level level, PTRMapViewAnnotationLayer ptrMapViewAnnotationLayer)
invoke this method to add an annotation on map final Unit
addAnnotation(PTRMapViewMarker ptrMapViewMarker, PTRMapViewAnnotationLayer ptrMapViewAnnotationLayer)
invoke this method to add an annotation on map final Unit
addAnnotations(ArrayList<PTRMapViewMarker> ptrMapViewMarkerList, Level level, PTRMapViewAnnotationLayer ptrMapViewAnnotationLayer)
invoke this method to add multiple annotations on map final Unit
addAnnotations(ArrayList<PTRMapViewMarker> ptrMapViewMarkerList, PTRMapViewAnnotationLayer ptrMapViewAnnotationLayer)
invoke this method to add multiple annotations on map final Unit
addMarker(PTRMapMarker ptrMapMarker)
invoke this method to add marker on the map final Unit
handleLevelChange(Level level)
final Unit
handleZoomChange(Double zoomLevel)
final Unit
removeMarker(PTRMapMarker ptrMapViewMarker)
invoke this method to remove marker from the map final Unit
removeAnnotation(PTRMapViewMarker ptrMapViewMarker, Function0<Unit> completion)
invoke this method to remove an annotation on map final Unit
removeAnnotations(List<PTRMapViewMarker> ptrMapViewMarkers, Function0<Unit> completion)
invoke this method to remove annotations on map final Unit
removeAllAnnotations(Function0<Unit> completion)
invoke this method to remove all annotations on map final Unit
addLayer(PTRMapLayer layer, String belowLayerIdentifier, Function2<Boolean, String, Unit> completion)
Add layer to map final Unit
removeLayer(String layerIdentifier, Function2<Boolean, String, Unit> completion)
invoke this method to remove a layer and corresponding source final Unit
addFeatures(List<Feature> features, String layerIdentifier, Function2<Boolean, String, Unit> completion)
invoke this method to add multiple features to the map final Unit
removeFeatures(List<Feature> features, Function2<Boolean, String, Unit> completion)
invoke this method to remove multiple features from the map final Unit
removeAllFeatures(Function2<Boolean, String, Unit> completion)
invoke this method to remove all features Unit
onUserManagerUserSessionUpdated(UserSession newSession)
This function is called when there is an update on user's session. Unit
onUserManagerPreferredLanguageUpdated(String newLangCode)
Called when user's current language preference changes to something new -
Methods inherited from class androidx.fragment.app.Fragment
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getDefaultViewModelCreationExtras, getDefaultViewModelProviderFactory, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, getParentFragmentManager, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSavedStateRegistry, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, getViewModelStore, hasOptionsMenu, hashCode, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isStateSaved, isVisible, onActivityCreated, onActivityResult, onAttach, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroyOptionsMenu, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onInflate, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onRequestPermissionsResult, onViewStateRestored, postponeEnterTransition, postponeEnterTransition, registerForActivityResult, registerForActivityResult, registerForContextMenu, requestPermissions, requireActivity, requireArguments, requireContext, requireFragmentManager, requireHost, requireParentFragment, requireView, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, startIntentSenderForResult, startPostponedEnterTransition, toString, unregisterForContextMenu
-
Methods inherited from class com.pointrlabs.core.map.views.helper_views.PTRFragment
getColor, hideKeyboard, onViewCreated, showKeyboard, toast, toast
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getCurrentPathSession
final PathSession getCurrentPathSession()
-
setCurrentPathSession
final Unit setCurrentPathSession(PathSession currentPathSession)
-
getCurrentPath
final Path getCurrentPath()
-
setCurrentPath
final Unit setCurrentPath(Path currentPath)
-
getZoomLevel
final Double getZoomLevel()
-
setZoomLevel
final Unit setZoomLevel(Double zoomLevel)
-
getMinimumZoomLevel
final Double getMinimumZoomLevel()
-
setMinimumZoomLevel
final Unit setMinimumZoomLevel(Double minimumZoomLevel)
-
getMaximumZoomLevel
final Double getMaximumZoomLevel()
-
setMaximumZoomLevel
final Unit setMaximumZoomLevel(Double maximumZoomLevel)
-
getDefaultLocationZoomLevel
final Double getDefaultLocationZoomLevel()
-
setDefaultLocationZoomLevel
final Unit setDefaultLocationZoomLevel(Double defaultLocationZoomLevel)
-
isMapFullyRendered
final Boolean isMapFullyRendered()
-
getAreAllFramesFullyRendered
final Boolean getAreAllFramesFullyRendered()
-
setAreAllFramesFullyRendered
final Unit setAreAllFramesFullyRendered(Boolean areAllFramesFullyRendered)
-
getHighlightedPoi
final Poi getHighlightedPoi()
-
isJoystickEnabled
final Boolean isJoystickEnabled()
Joystick to simulate user position should be displayed.
-
setJoystickEnabled
final Unit setJoystickEnabled(Boolean isJoystickEnabled)
-
getFilteredPoiSet
final List<String> getFilteredPoiSet()
Filters the map to show only the list of given poi ids. Keep in mind that this will be applied to all levels.
-
setFilteredPoiSet
final Unit setFilteredPoiSet(List<String> filteredPoiSet)
-
getRotationalDirection
final Double getRotationalDirection()
-
getLocalizationPlugin
final LocalizationPlugin getLocalizationPlugin()
-
setLocalizationPlugin
final Unit setLocalizationPlugin(LocalizationPlugin localizationPlugin)
-
getLoadTileTimeoutRunner
final FutureTask<Object> getLoadTileTimeoutRunner()
-
setLoadTileTimeoutRunner
final Unit setLoadTileTimeoutRunner(FutureTask<Object> loadTileTimeoutRunner)
-
onCreateView
View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
-
onSaveInstanceState
Unit onSaveInstanceState(Bundle outState)
-
onDestroyView
Unit onDestroyView()
-
onLowMemory
Unit onLowMemory()
-
onConfigurationUpdate
Unit onConfigurationUpdate()
Configuration updated
-
loadAndSet
@Deprecated(message = "This method is going to be removed at version 9. `show` method is going to replace the functionality.", level = DeprecationLevel.WARNING, replaceWith = @ReplaceWith(imports = {}, expression = "show(level, shouldZoomToLevel)")) final Unit loadAndSet(Level level, Boolean shouldZoomToLevel)
-
loadAndSet
@Deprecated(message = "This method is going to be removed at version 9. `show` method is going to replace the functionality.", level = DeprecationLevel.WARNING, replaceWith = @ReplaceWith(imports = {}, expression = "show(building)")) final Unit loadAndSet(Building building)
When calling this method, the map widget will load the content for this building and related site, if necessary, and displays it. By default it displays the first level of the given building.
- Parameters:
building
- to be displayed
-
loadAndSet
@Deprecated(message = "This method is going to be removed at version 9. `show` method is going to replace the functionality.", level = DeprecationLevel.WARNING, replaceWith = @ReplaceWith(imports = {}, expression = "show(site)")) final Unit loadAndSet(Site site)
When calling this method, the map widget will load the content for this site, if necessary, and displays it. By default it displays the first level of the first building of the given site.
- Parameters:
site
- to be displayed
-
show
final Unit show(Level level, Boolean shouldZoomLevel, Boolean trackingModeChanged, PTRMapAnimationType animationType, Double bearing, Double tilt, Function1<String, Unit> onComplete)
Updates map to display given Level
- Parameters:
level
- to display on mapshouldZoomLevel
- true if it is desired to zoom to the level
-
highlightPoi
final Unit highlightPoi(Poi poi)
Highlights given Poi
- Parameters:
poi
- to highlight
-
unhighlightPoi
final Unit unhighlightPoi(Poi poi)
Un-highlights given Poi
- Parameters:
poi
- to unhighlight
-
unhighlightAllPois
final Unit unhighlightAllPois()
Unhighlight all Poi
-
scrollToLocation
final Unit scrollToLocation(GeoPoint location, Double zoomLevel, Function1<String, Unit> onComplete)
Scroll the map to given location
- Parameters:
location
- Location to be scrolled on mapzoomLevel
- Desired zoom level, current zoom level if not provided
-
zoomToLocation
final Unit zoomToLocation(GeoPoint location, Function1<String, Unit> onComplete)
Zooms the camera to given location with the default location zoom level.
- Parameters:
location
- Location to be zoomed upon
-
setZoomLevel
final Unit setZoomLevel(Double zoomLevel, Boolean isAnimated, Function1<String, Unit> onComplete)
Zooms the camera with desired zoom level.
- Parameters:
zoomLevel
- Desired zoom levelisAnimated
- Flag to determine zooming should be animated or not
-
rotateToDirection
final Unit rotateToDirection(Double direction, Boolean isAnimated, Function1<String, Unit> onComplete)
Changed the heading of the map and optionally animates the change
- Parameters:
direction
- The heading of the map, measured in degrees clockwise from true northisAnimated
- Flag to determine changing should be animated or not.
-
resetNorth
final Unit resetNorth()
Resets the map rotation to a northern heading with animation.
-
addAnnotation
@Deprecated(message = "This method is going to be removed at version 9. `addFeatures()` method is going to replace the functionality.", level = DeprecationLevel.WARNING) final Unit addAnnotation(PTRMapViewMarker ptrMapViewMarker, Level level, PTRMapViewAnnotationLayer ptrMapViewAnnotationLayer)
invoke this method to add an annotation on map
- Parameters:
ptrMapViewMarker
-contains the data for annotation to be added
level
-the level on which the annotation has to be added
ptrMapViewAnnotationLayer
-the layer on which the annotation has to be added
-
addAnnotation
@Deprecated(message = "This method is going to be removed at version 9. `addFeatures()` method is going to replace the functionality.", level = DeprecationLevel.WARNING) final Unit addAnnotation(PTRMapViewMarker ptrMapViewMarker, PTRMapViewAnnotationLayer ptrMapViewAnnotationLayer)
invoke this method to add an annotation on map
- Parameters:
ptrMapViewMarker
-contains the data for annotation to be added
ptrMapViewAnnotationLayer
-the layer on which the annotation has to be added
-
addAnnotations
@Deprecated(message = "This method is going to be removed at version 9. `addFeatures()` method is going to replace the functionality.", level = DeprecationLevel.WARNING) final Unit addAnnotations(ArrayList<PTRMapViewMarker> ptrMapViewMarkerList, Level level, PTRMapViewAnnotationLayer ptrMapViewAnnotationLayer)
invoke this method to add multiple annotations on map
- Parameters:
ptrMapViewMarkerList
-contains the data for annotation to be added
level
-the level on which the annotation has to be added
ptrMapViewAnnotationLayer
-the layer on which the annotation has to be added
-
addAnnotations
@Deprecated(message = "This method is going to be removed at version 9. `addFeatures()` method is going to replace the functionality.", level = DeprecationLevel.WARNING) final Unit addAnnotations(ArrayList<PTRMapViewMarker> ptrMapViewMarkerList, PTRMapViewAnnotationLayer ptrMapViewAnnotationLayer)
invoke this method to add multiple annotations on map
- Parameters:
ptrMapViewMarkerList
-contains the data for annotation to be added
ptrMapViewAnnotationLayer
-the layer on which the annotation has to be added
-
addMarker
final Unit addMarker(PTRMapMarker ptrMapMarker)
invoke this method to add marker on the map
- Parameters:
ptrMapMarker
-the view to be added on the map
-
handleLevelChange
final Unit handleLevelChange(Level level)
-
handleZoomChange
final Unit handleZoomChange(Double zoomLevel)
-
removeMarker
final Unit removeMarker(PTRMapMarker ptrMapViewMarker)
invoke this method to remove marker from the map
- Parameters:
ptrMapViewMarker
-the view to be removed from the map
-
removeAnnotation
@Deprecated(message = "This method is going to be removed at version 9. `removeFeatures()` method is going to replace the functionality.", level = DeprecationLevel.WARNING, replaceWith = @ReplaceWith(imports = {}, expression = "removeFeatures()")) final Unit removeAnnotation(PTRMapViewMarker ptrMapViewMarker, Function0<Unit> completion)
invoke this method to remove an annotation on map
- Parameters:
ptrMapViewMarker
-PTRMapViewMarker to be removed from the map
-
removeAnnotations
@Deprecated(message = "This method is going to be removed at version 9. `removeFeatures()` method is going to replace the functionality.", level = DeprecationLevel.WARNING) final Unit removeAnnotations(List<PTRMapViewMarker> ptrMapViewMarkers, Function0<Unit> completion)
invoke this method to remove annotations on map
- Parameters:
ptrMapViewMarkers
-list of PTRMapViewMarker to be removed from the map
-
removeAllAnnotations
@Deprecated(message = "This method is going to be removed at version 9. `removeAllFeatures()` method is going to replace the functionality.", level = DeprecationLevel.WARNING) final Unit removeAllAnnotations(Function0<Unit> completion)
invoke this method to remove all annotations on map
-
addLayer
final Unit addLayer(PTRMapLayer layer, String belowLayerIdentifier, Function2<Boolean, String, Unit> completion)
Add layer to map
- Parameters:
layer
- PTRMapLayer to be addedbelowLayerIdentifier
- layer identifier below which we are going to add new layer.completion
- completion unit to check if the layer is added successfully.
-
removeLayer
final Unit removeLayer(String layerIdentifier, Function2<Boolean, String, Unit> completion)
invoke this method to remove a layer and corresponding source
- Parameters:
layerIdentifier
-layer identifier
-
addFeatures
final Unit addFeatures(List<Feature> features, String layerIdentifier, Function2<Boolean, String, Unit> completion)
invoke this method to add multiple features to the map
- Parameters:
features
-features to be added
layerIdentifier
-the layer on which the features will be added
completion
-completion callback
-
removeFeatures
final Unit removeFeatures(List<Feature> features, Function2<Boolean, String, Unit> completion)
invoke this method to remove multiple features from the map
- Parameters:
features
-features to be removed
completion
-completion callback
-
removeAllFeatures
final Unit removeAllFeatures(Function2<Boolean, String, Unit> completion)
invoke this method to remove all features
- Parameters:
completion
-completion callback
-
onUserManagerUserSessionUpdated
Unit onUserManagerUserSessionUpdated(UserSession newSession)
This function is called when there is an update on user's session. (log out, log in) Note that user session might be null as well in the case of log out.
-
onUserManagerPreferredLanguageUpdated
Unit onUserManagerPreferredLanguageUpdated(String newLangCode)
Called when user's current language preference changes to something new
-
-
-
-