Class Navigation2
- java.lang.Object
-
- com.supermap.navi.Navigation2
-
public class Navigation2 extends java.lang.Object
The industrial navigation class, used for path analysis and guide under topological road network.Support the use of custom network data to navigate, and can edit the modified road network data;
Support the establishment of road weights and restrictions, speed limit settings and prompts;
Support the establishment of obstacles, obstacles, obstacles nodes;
Supports boot path style settings;
Support for custom GPS encryption;
The layout of the navigation information can be adjusted according to the application needs, and the map rotation function (reference
setCarUpFront(boolean)
) of the vector map is provided, and the network map is not supported at all.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
addNaviInfoListener(NaviListener listener)
Adds navigation information listener.void
addWayPoint(double x, double y)
Sets the coordinates of passing pointsvoid
cleanPath()
Clear the path analysis resultsvoid
enablePanOnGuide(boolean bPan)
Panning the map is available or not during the guide.int[]
getBarrierEdges()
Gets barrier edge collection.Point2Ds
getBarrierPoints()
Gets the barrier point collection.double
getCarAngle()
Gets the car angle.Point2D
getCarPosition()
Gets the car position.boolean
getCarUpFront()
Gets whether the car is up front.double
getGuideEndDistance()
Gets the navigation ending distance.NaviPath
getNaviPath()
Gets the detailed information of the navigation path.double
getNodeInterval()
Gets the selection tolerance of analyzed points.int
getPathID()
Gets the road ID where the car is.GeoLine
getRoute()
Gets the route analysis results.boolean
isGuiding()
Determines whether it is guiding.boolean
isPassedRouteHidden()
Whether to hide all passed routesboolean
isSimpleVoiceMode()
Whether the voice announcement is in lite mode.boolean
isUseSensorAzimuth()
Determines whether the sensor direction is used for the navigation icon direction during real navigationboolean
load()
Loads the network model.boolean
loadModel(java.lang.String filePath)
Load the memory file.void
locateMap()
The car displays in the center of the screeen during navigation.void
pauseGuide()
Pauses guide.void
removeWayPoint()
Remove all passing pointsvoid
resumeGuide()
Continues to guide.boolean
routeAnalyst()
Optimal path analysis.boolean
routeAnalyst(java.lang.String weightFieldName)
Optimal path analysisvoid
setAzimuthChangeListener(AzimuthChangeListener listener)
Set the azimuth change listenervoid
setBarrierEdges(int[] value)
Sets barrier edges.void
setBarrierNodes(int[] value)
Sets barrier nodes.void
setBarrierPoints(Point2Ds value)
Sets barrier points.void
setCarPicture(android.graphics.Bitmap carBmp)
Sets the car picture.void
setCarSize(float width, float height)
Sets the car icon size.void
setCarUpFront(boolean value)
Sets whether the car is up front.void
setClimbChangeListener(ClimbChangeListener listener)
Sets the climb change listener to the destination.void
setDatasetPoint(DatasetVector value)
Sets the elevation point dataset.void
setDestinationPoint(double x, double y)
Sets the destination point.void
setDeviateTolerance(double tolerance)
Adds the deviation tolerance.void
setGPSData(LocationManagePlugin.GPSData newGps)
Sets GPS data.void
setGuideEndDistance(double distance)
Sets the navigation ending distance (status=0).void
setIsAutoNavi(boolean isAutoNavi)
Sets whether to automatically collect GPS data.void
setIsEncryptGPS(boolean isEncryptGPS)
Set whether to encrypt GPS data, the default encryptionvoid
setNetworkDataset(DatasetVector value)
Sets the network dataset to be analyzed.void
setNodeInterval(double interval)
Adds the selection tolerance of analyzed points.void
setPassedRouteHidden(Map map, boolean isAutoHidden)
Sets whether to hide the passed routes.void
setPathVisible(boolean isVisible)
Set whether the analysis path is visiblevoid
setRoadInfoVisibie(boolean visibie)
Set whether to display the road information bar.void
setRouteStyle(GeoStyle value)
Sets the route style.void
setSimpleVoiceMode(boolean simpleVoiceMode)
Set the voice announcement to compact mode.boolean
setSimulationInterval(int interval)
Sets the simulation navigation interval, in milliseconds.boolean
setSimulationSpeed(double speed)
Set the analog navigation speed (in m / s)void
setSpeedField(java.lang.String value)
Sets the maximum speed field.void
setStartPoint(double x, double y)
Sets the start point.void
setTurnDataset(DatasetVector value)
Sets the turn table dataset.void
setUseSensorAzimuth(boolean useSensorAzimuth)
Set whether to use the sensor orientation for navigation icon orientation during navigation during real navigation The default value is true, and only real navigation is valid.boolean
setWeightFieldInfos(WeightFieldInfos infos)
Set weight fieldboolean
startGuide(int status)
Starts guiding.boolean
stopGuide()
Stops guiding.
-
-
-
Method Detail
-
getRoute
public GeoLine getRoute()
Gets the route analysis results.- Returns:
- Path analysis line.
-
startGuide
public boolean startGuide(int status)
Starts guiding.- Parameters:
status
- Boot mode. 0: real navigation, 1: simulated navigation.- Returns:
- whether succeed.
-
getCarAngle
public double getCarAngle()
Gets the car angle.- Returns:
- Car angle.
-
getCarPosition
public Point2D getCarPosition()
Gets the car position.- Returns:
- Car position.
-
isGuiding
public boolean isGuiding()
Determines whether it is guiding.- Returns:
- Whether it is booting.
-
cleanPath
public void cleanPath()
Clear the path analysis results
-
stopGuide
public boolean stopGuide()
Stops guiding.- Returns:
- whether succeed.
-
setPathVisible
public void setPathVisible(boolean isVisible)
Set whether the analysis path is visible- Parameters:
isVisible
- Is it visible?
-
setGPSData
public void setGPSData(LocationManagePlugin.GPSData newGps)
Sets GPS data.- Parameters:
newGps
- GPS data.
-
setNetworkDataset
public void setNetworkDataset(DatasetVector value)
Sets the network dataset to be analyzed. It is required.- Parameters:
value
- Network data set.
-
setTurnDataset
public void setTurnDataset(DatasetVector value)
Sets the turn table dataset. Optional.- Parameters:
value
- Steering table data set.
-
load
public boolean load()
Loads the network model.- Returns:
- whether succeed.
-
loadModel
public boolean loadModel(java.lang.String filePath)
Load the memory file.- Parameters:
filePath
- Memory file path.- Returns:
- whether succeed.
-
setStartPoint
public void setStartPoint(double x, double y)
Sets the start point.- Parameters:
x
- Starting point x coordinate.y
- Starting point y coordinate.
-
setDestinationPoint
public void setDestinationPoint(double x, double y)
Sets the destination point.- Parameters:
x
- End x coordinate.y
- End y coordinate.
-
routeAnalyst
public boolean routeAnalyst()
Optimal path analysis.- Returns:
- whether succeed.
-
setIsEncryptGPS
public void setIsEncryptGPS(boolean isEncryptGPS)
Set whether to encrypt GPS data, the default encryption- Parameters:
isEncryptGPS
- Set whether to encrypt.
-
setCarPicture
public void setCarPicture(android.graphics.Bitmap carBmp)
Sets the car picture.- Parameters:
carBmp
- Car icon.
-
enablePanOnGuide
public void enablePanOnGuide(boolean bPan)
Panning the map is available or not during the guide.- Parameters:
bPan
- A Boolean value that indicates whether the map is allowed to be translated during the navigation process, true, indicating that allowed, false, that is not allowed.
-
setRoadInfoVisibie
public void setRoadInfoVisibie(boolean visibie)
Set whether to display the road information bar.- Parameters:
visibie
- Whether it is displayed.
-
setDatasetPoint
public void setDatasetPoint(DatasetVector value)
Sets the elevation point dataset. Optional.- Parameters:
value
- Elevation point data set.
-
setIsAutoNavi
public void setIsAutoNavi(boolean isAutoNavi)
Sets whether to automatically collect GPS data. You should call setGPSData to transmit GPS data by yourself if it is false.- Parameters:
isAutoNavi
- Whether the automatic acquisition of GPS, the default automatic acquisition.
-
setClimbChangeListener
public void setClimbChangeListener(ClimbChangeListener listener)
Sets the climb change listener to the destination.- Parameters:
listener
- To the end of the cumulative climb listener.
-
setAzimuthChangeListener
public void setAzimuthChangeListener(AzimuthChangeListener listener)
Set the azimuth change listener- Parameters:
listener
- Azimuth change listener.
-
addNaviInfoListener
public void addNaviInfoListener(NaviListener listener)
Adds navigation information listener.- Parameters:
listener
- Boot information update listener
-
getBarrierEdges
public int[] getBarrierEdges()
Gets barrier edge collection.- Returns:
- The ID array of the barrier edge
-
getBarrierPoints
public Point2Ds getBarrierPoints()
Gets the barrier point collection.- Returns:
- Obstacle collection
-
getCarUpFront
public boolean getCarUpFront()
Gets whether the car is up front.- Returns:
- The car head up, return true; otherwise return false
-
getNaviPath
public NaviPath getNaviPath()
Gets the detailed information of the navigation path. For the roads information, please seeNaviPath
NaviStep
- Returns:
- Returns the details of the current navigation path
-
getPathID
public int getPathID()
Gets the road ID where the car is.- Returns:
- Path ID
-
locateMap
public void locateMap()
The car displays in the center of the screeen during navigation.
-
pauseGuide
public void pauseGuide()
Pauses guide.
-
resumeGuide
public void resumeGuide()
Continues to guide.
-
setBarrierEdges
public void setBarrierEdges(int[] value)
Sets barrier edges.- Parameters:
value
- Obstacle edge set (when the parameter is null, it is empty); it contains an int value that is the SmID value of the line data in the network dataset
-
setBarrierNodes
public void setBarrierNodes(int[] value)
Sets barrier nodes.- Parameters:
value
- The set of obstacle nodes (when the parameter is null, is the empty obstacle node); it contains an int value that is the SmID value of the node data in the network dataset
-
setBarrierPoints
public void setBarrierPoints(Point2Ds value)
Sets barrier points.- Parameters:
value
- Obstacle set (when the parameter is null, it is empty)
-
setCarSize
public void setCarSize(float width, float height)
Sets the car icon size.- Parameters:
width
- The icon widthheight
- The icon height
-
setCarUpFront
public void setCarUpFront(boolean value)
Sets whether the car is up front. The map can rotate if it is true.To use the map rotation also need to open the full screen drawing function in advance , then use
Map.setFullScreenDrawModel(boolean)
, and then set the head up to achieve the map rotation.The current map rotation only supports the rotation of the vector map, and the network map can not be rotated.
When the map is a network map, set the parameter value = true, return false, and will output the corresponding log information; when the map for the vector map, set the parameter value = true, return true; set the parameter value = false, the total return success, The map will not rotate in the navigation
Use the demonstration as follows:
map.open (mapName); //Open a map map.setFullScreenDrawModel(true); // Set the full-screen drawing navigation.setCarUpFront (true); // Set the car up front. If you want to make map rotation by tapping the north arrow on the map, you don't need to use this clause.
- Parameters:
value
- True, the car head up; for false, the car front and the road in line
-
setRouteStyle
public void setRouteStyle(GeoStyle value)
Sets the route style.- Parameters:
value
- The style of the boot path
-
setSpeedField
public void setSpeedField(java.lang.String value)
Sets the maximum speed field.The rate limit field is a field of record speed in the network dataset (ie
setNetworkDataset(com.supermap.data.DatasetVector)
). The field type is in the range of 32-bit integer or double precision , and the field value is in km / h; if the simulated navigation defaults to 18km / h, The road maximum speed (eg 10km / h) will be overtaken by voice prompts- Parameters:
value
- Speed field name
-
setDeviateTolerance
public void setDeviateTolerance(double tolerance)
Adds the deviation tolerance.- Parameters:
tolerance
- Navigation Offset Tolerance, in meters
-
setSimulationSpeed
public boolean setSimulationSpeed(double speed)
Set the analog navigation speed (in m / s)- Parameters:
speed
- Navigation speed- Returns:
- Whether the settings are successful
-
setSimulationInterval
public boolean setSimulationInterval(int interval)
Sets the simulation navigation interval, in milliseconds.- Parameters:
interval
- Navigation interval- Returns:
- Whether the settings are successful
-
addWayPoint
public void addWayPoint(double x, double y)
Sets the coordinates of passing points- Parameters:
x
- End x coordinatey
- End y coordinate
-
setNodeInterval
public void setNodeInterval(double interval)
Adds the selection tolerance of analyzed points. Unit: m. The tolerance is valid only when it is bigger than 0. Otherwise, the application will use the default value- Parameters:
interval
- Tolerance
-
getNodeInterval
public double getNodeInterval()
Gets the selection tolerance of analyzed points. Unit: m- Returns:
- Tolerance
-
setPassedRouteHidden
public void setPassedRouteHidden(Map map, boolean isAutoHidden)
Sets whether to hide the passed routes. (The routes are hidden when the analyzed routes are invisible) Note: to use it, you must call it before the path analysis- Parameters:
map
- map objectisAutoHidden
- Whether to hide
-
isPassedRouteHidden
public boolean isPassedRouteHidden()
Whether to hide all passed routes- Returns:
- whether to hide
-
setGuideEndDistance
public void setGuideEndDistance(double distance)
Sets the navigation ending distance (status=0). Unit: m- Parameters:
distance
- the ending distance
-
getGuideEndDistance
public double getGuideEndDistance()
Gets the navigation ending distance. Unit: m- Returns:
- the ending distance
-
removeWayPoint
public void removeWayPoint()
Remove all passing points
-
setWeightFieldInfos
public boolean setWeightFieldInfos(WeightFieldInfos infos)
Set weight field- Parameters:
infos
-- Returns:
-
isUseSensorAzimuth
public boolean isUseSensorAzimuth()
Determines whether the sensor direction is used for the navigation icon direction during real navigation- Returns:
- true real navigation mode navigation icon direction uses sensor direction, false real navigation mode navigation icon direction points to the nearest navigation path direction
-
setUseSensorAzimuth
public void setUseSensorAzimuth(boolean useSensorAzimuth)
Set whether to use the sensor orientation for navigation icon orientation during navigation during real navigation The default value is true, and only real navigation is valid.- Parameters:
useSensorAzimuth
- is set to true, the navigation icon direction follows the mobile phone sensor direction in real navigation mode, set to false, and the navigation icon direction in real navigation mode is the nearest navigation path direction
-
routeAnalyst
public boolean routeAnalyst(java.lang.String weightFieldName)
Optimal path analysis- Returns:
-
setSimpleVoiceMode
public void setSimpleVoiceMode(boolean simpleVoiceMode)
Set the voice announcement to compact mode.
-
isSimpleVoiceMode
public boolean isSimpleVoiceMode()
Whether the voice announcement is in lite mode.
-
-