package com.safemobile.interfaces; import android.view.LayoutInflater; import com.google.android.gms.maps.model.LatLng; import com.safemobile.enums.MapType; import com.safemobile.lib.Position; import com.safenet.lib.Geofence; import com.safenet.lib.Landmark; import com.safenet.lib.Unit; import java.util.ArrayList; /** * Created by Adi on 3/25/2016. */ public interface IMap { interface MapInteraction { void onMapLocationChanged(double latitude, double longitude, float zoomLevel); void onInfoBubbleClosed(long assetId, LatLng position); void onInfoBubbleOpened(long assetId, LatLng position); } void setMapInteractionListener(MapInteraction delegate); long MYSELF = 0l; long LABEL_START = 16777215; int MAPBOX = 1; int GOOGLE = 2; int OSM = 3; /** INTENTS **/ String MAP_TERRAIN_REQ = "MAP_TERRAIN_REQ"; String MAP_SATELLITE_REQ = "MAP_SATELLITE_REQ"; String MAP_NORMAL_REQ = "MAP_NORMAL_REQ"; String MAP_HYBRID_REQ = "MAP_HYBRID_REQ"; String MAP_SHOW_ME = "MAP_SHOW_ME"; String MAP_LOCATION_REQUEST = "MAP_LOCATION_REQUEST"; /** GOOGLE MAP TYPE **/ int MAP_TYPE_NONE = 0; int MAP_TYPE_NORMAL = 1; int MAP_TYPE_SATELLITE = 2; int MAP_TYPE_TERRAIN = 3; int MAP_TYPE_HYBRID = 4; /** * Display the contacts that are flaged as onMap to be drawn on the * Google map. The list is available on the AppParams . * The same function will remove previous contacts that were on the map * @param units The list of assets that needs to be displayed */ void showContactsOnMap(ArrayList units); /** * Update the marker icon/location if displayed else do nothing. This method is called * whenever the asset position is changed, or when the asset goes offline/online or in emergency * @param unit The asset that changed the state or position */ void updateMarkerPosition(Unit unit); /** * Change the map type to one of the following options * GoogleMap.MAP_TYPE_HYBRID * GoogleMap.MAP_TYPE_NORMAL * GoogleMap.MAP_TYPE_SATELLITE * GoogleMap.MAP_TYPE_TERRAIN * @param mapType The mapType value of the map */ void setMapType(MapType mapType); /** * Change the map type to one of the following options * Style.MAPBOX_STREETS * Style.EMERALD * Style.LIGHT * Style.DARK * Style.SATELLITE * Style.SATELLITE_STREETS * @param mapType The int value of the map */ void setMapType(String mapType); /** * Center map and then zoom to the location of a specific contact * @param unit The contact which needs to be focused. It contains the * gps location */ void centerZoomContact(Unit unit); /** * Center the map on a particular position represented by a LatLng point * @param mapLocation Location to which the map needs to center */ void centerZoomMapOnLocation(LatLng mapLocation); /** * Center the map on a particular position represented by a LatLng point * @param mapLocation Location to which the map needs to center * @param zoomLevel The zoom at which the map needs to be set * */ void centerZoomMapOnLocation(LatLng mapLocation, float zoomLevel); /** * Show a custom marker on the map representing the current user * @param position The location at which the user is * @param shouldOpenInfoBubble Specify if the info bubble for the myself location should be opened * @param shouldCenterNow Specify if the map needs to be animated to that location */ void showMyselfOnMap(Position position, boolean shouldOpenInfoBubble, boolean shouldCenterNow); /** * Hide the marker for myself from the map */ void hideMyselfFromMap(); /** * Open the info bubble for a specific marker * @param markerKey The marker identifier from the hashtable */ void openInfoBubbleForMarker(Long markerKey); /** * Open the info bubble for the last opened marker if it wasn't closed by the user explicitly */ void openInfoBubble(); /** * Show or hide the landmarks on the map * @param isShown Boolean that will flag if the landmarks should be * displayed. True is affirmative * @param landmarks The landmarks that needs to be shown, Empty if none */ void onShowLandmarksChangedHandler(boolean isShown, ArrayList landmarks); /** * Show or hide the geofence on the map * @param isShown Boolean that will flag if the geofence should be * displayed. True is affirmative * @param geofences The geofences that needs to be shown. Empty if none */ void onShowGeofencesChangedHandler(boolean isShown, ArrayList geofences); /** * Show or hide the traffic on the map * @param isShown Boolean that will flag if the traffic should be * displayed. True is affirmative */ void onShowTrafficChangedHandler(boolean isShown); /** * Handler for when the map is ready and bound to the UI * @param map The received map * @param layoutInflater Inflater needed to inflate the InfoBubble */ void onMapReceived(Object map, LayoutInflater layoutInflater); /** * Handler for when the map is ready and bound to the UI * @param map The received map * @param tileServer Map tile server used for OSM or other private environments */ void onMapReceived(Object map, String tileServer); /** * Change the map center and zoom level to allow the display of all the displayed markers */ void panZoomMap(); /** * On activity paused */ void onPause(); /** * On activity resumed */ void onResume(); /** * Handler for when the map needs to be refreshed/invalidated */ void refresh(); boolean isMapAvailable(); }