Class Navigation
- java.lang.Object
-
- com.supermap.navi.Navigation
-
public class Navigation extends java.lang.Object
The navigation class. This class provides path analysis and guide functions. - After setting the start and destination, you can perform path analysis and navigate after the analysis is successful.
- Path analysis consists of four modes: recommendation, fastest time, minimum distance and minimum charge.
- Guide is divided into real navigation, simulation navigation and positioning cruise and other three modes.
The guide provides the display of the boot information and the associated voice prompts.
Navigation vector map rotation (reference setCarUpFront(boolean)
}), does not support network map rotation
Note: After starting the boot, the external incoming GPS / BD and other positioning information.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
Navigation.SpeechParam
The parameter class for the guide information report during the navigation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description boolean
addBarrierBound(double left, double bottom, double right, double top)
Adds barrier bound.boolean
addBarrierPoint(double x, double y)
Adds barrier point.void
addNaviInfoListener(NaviListener listener)
Adds navigation information listener.boolean
addWayPoint(double x, double y)
Adds way points.void
cleanPath()
Clears the path result.boolean
clearBarrierBound()
Clears barrier boundboolean
clearBarrierPoints()
Clears barrier points.boolean
connectNaviData(java.lang.String DataPath)
Links to the navigation data, including path analysis data and guide data.void
enablePanOnGuide(boolean bPan)
Panning the map is available or not during the guide.int
getAdjust()
Gets the match status between positioning vehicle and road network.double
getCarAngle()
Gets the angle of the vehicle.Point2D
getCarPosition()
Gets the vehicle position.boolean
getCarUpFront()
Gets whether the car is up front.java.lang.String
getCurRoadName()
Gets current road name.double
getDisToDestination()
Gets the distance from current place to destination.double
getDisToSwerve()
Gets the distance from current place to the next swerve.int
getNaviAction()
Gets navigation action.NaviPath
getNaviPath()
Gets the detailed information of the navigation path.java.lang.String
getNextRoadName()
Gets the next road name.int
getPathRoadLevel()
Get the current road level.GeoLine
getRoute()
Gets the route analysis results.int
getSecondaryAction()
Gets the navigation secondary action.int
getTimeToDestination(double speed)
Gets the rest time to destination.boolean
isGuiding()
Whether it is guiding.void
locateMap()
Make the vehicle as the center of the map during the navigation.void
pauseGuide()
Pauses guide.void
resumeGuide()
Continues to guide.int
routeAnalyst(int mode)
Executes path analysis.boolean
setCarUpFront(boolean value)
Sets whether the car is up front.void
setDestinationPoint(double x, double y)
Sets the destination point.void
setEncryption(Encryption encryption)
Sets encryption.void
setGPSData(LocationManagePlugin.GPSData newGps)
Sets GPS data.void
setPathVisible(boolean isVisible)
Sets whether to highlight the path.void
setRouteStyle(GeoStyle value)
Sets the route style.boolean
setSimulationInterval(int interval)
Sets the simulation navigation interval, in milliseconds.boolean
setSimulationSpeed(double speed)
Set the analog navigation speed, so that the car in accordance with the set speed (unit m / s)boolean
setSpeechParam(Navigation.SpeechParam speechparam)
Sets the guide information management to determine whether the guide information reports or not during navigation.void
setStartPoint(double x, double y)
Sets the start point.boolean
setViewSize(int width, int height)
Sets the view size for the auto-rotate screen.boolean
startGuide(int status)
Starts navigating.boolean
stopGuide()
Stops guiding.
-
-
-
Method Detail
-
setStartPoint
public void setStartPoint(double x, double y)
Sets the start point.- Parameters:
x
- longitude longitude coordinates (degrees).y
- longitude longitude coordinates (degrees).
-
setDestinationPoint
public void setDestinationPoint(double x, double y)
Sets the destination point.- Parameters:
x
- end point longitude coordinates (degrees).y
- end point latitude coordinates (degrees).
-
routeAnalyst
public int routeAnalyst(int mode)
Executes path analysis.The path analysis mode has a value of [0,1,2,3], which represents the recommended mode, the fastest time mode, the shortest distance mode, and the least charge mode.
- Parameters:
mode
- Path analysis mode.- Returns:
- The path analysis returns 1 successively, the path analysis fails to return 0, no return to the starting point around the starting point, and no return to -2 around the end point.
-
getRoute
public GeoLine getRoute()
Gets the route analysis results.- Returns:
- Path analysis line.
-
startGuide
public boolean startGuide(int status)
Starts navigating.The value of the boot status is [0,1,2], which indicates that the actual navigation is performed, simulated navigation is performed, and the positioning point cruise is performed.
- Parameters:
status
- Boot state.- Returns:
- Start navigation successfully, return true, otherwise false.
-
getCarAngle
public double getCarAngle()
Gets the angle of the vehicle.The return angle is the clockwise angle of the forward direction of the vehicle and the north direction.
- Returns:
- Vehicle driving angle.
-
getCarPosition
public Point2D getCarPosition()
Gets the vehicle position.That is, access to the current location of the vehicle latitude and longitude coordinates, the unit "degree".
- Returns:
- The current position of the vehicle.
-
connectNaviData
public boolean connectNaviData(java.lang.String DataPath)
Links to the navigation data, including path analysis data and guide data.- Parameters:
DataPath
- Navigate the path where the data file is located. Path is an absolute path, the directory should be placed in the "NaviMap", that is, road network data compiled in iDesktop results- Returns:
- Link navigation data is successful, return true, otherwise false.
-
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.
-
isGuiding
public boolean isGuiding()
Whether it is guiding.- Returns:
- Returns true in the current boot process, false otherwise.
-
cleanPath
public void cleanPath()
Clears the path result.
-
stopGuide
public boolean stopGuide()
Stops guiding.- Returns:
- Stops successful, returns true, false otherwise.
-
setViewSize
public boolean setViewSize(int width, int height)
Sets the view size for the auto-rotate screen.- Parameters:
width
- Screen width.height
- Screen height.- Returns:
- Returns true if the boot information layout is successful during screen setup navigation, false otherwise.
-
setGPSData
public void setGPSData(LocationManagePlugin.GPSData newGps)
Sets GPS data.- Parameters:
newGps
- GPS data.
-
setPathVisible
public void setPathVisible(boolean isVisible)
Sets whether to highlight the path.- Parameters:
isVisible
- A Boolean value that indicates whether the highlighted route is displayed, true, indicates highlighting, false, and indicates that it is not highlighted.
-
addNaviInfoListener
public void addNaviInfoListener(NaviListener listener)
Adds navigation information listener.- Parameters:
listener
- Boot information update listener
-
getCarUpFront
public boolean getCarUpFront()
Gets whether the car is up front.- Returns:
- The car head up, return true; otherwise, return false
-
getCurRoadName
public java.lang.String getCurRoadName()
Gets current road name.- Returns:
- Current road name
-
getDisToDestination
public double getDisToDestination()
Gets the distance from current place to destination.- Returns:
- distance
-
getDisToSwerve
public double getDisToSwerve()
Gets the distance from current place to the next swerve.- Returns:
- distance
-
getNaviAction
public int getNaviAction()
Gets navigation action.- Returns:
- Navigation master action
-
getNextRoadName
public java.lang.String getNextRoadName()
Gets the next road name.- Returns:
- Road name
-
resumeGuide
public void resumeGuide()
Continues to guide.
-
pauseGuide
public void pauseGuide()
Pauses guide.
-
setCarUpFront
public boolean 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 direction along the road in line- Returns:
- True if the setting is successful, false otherwise
-
setRouteStyle
public void setRouteStyle(GeoStyle value)
Sets the route style.- Parameters:
value
- The style of the boot path, that is, the geometric object style
-
getTimeToDestination
public int getTimeToDestination(double speed)
Gets the rest time to destination.- Parameters:
speed
- Current speed- Returns:
- Returns the remaining time
-
getPathRoadLevel
public int getPathRoadLevel()
Get the current road level.- Returns:
- Return road grade value
-
getSecondaryAction
public int getSecondaryAction()
Gets the navigation secondary action.- Returns:
- Navigation action value
-
addWayPoint
public boolean addWayPoint(double x, double y)
Adds way points.- Parameters:
x
- Passing point x coordinatey
- Passing point y coordinate- Returns:
- Returns true if successful, false otherwise.
-
addBarrierPoint
public boolean addBarrierPoint(double x, double y)
Adds barrier point.- Parameters:
x
- The x coordinate of the obstacley
- The y coordinate of the obstacle- Returns:
- Returns true if successful, false otherwise
-
clearBarrierPoints
public boolean clearBarrierPoints()
Clears barrier points.- Returns:
- Returns true if clear, false otherwise
-
addBarrierBound
public boolean addBarrierBound(double left, double bottom, double right, double top)
Adds barrier bound. The barrier bound should be rectangle, and the rectangle is determined by the coordinates of four corners.- Parameters:
left
- The left border coordinates of the obstacle areabottom
- The right border of the obstacle arearight
- The lower boundary coordinates of the obstacle areatop
- The upper boundary coordinates of the obstacle area- Returns:
- Returns true if successful, false otherwise
-
clearBarrierBound
public boolean clearBarrierBound()
Clears barrier bound- Returns:
- Clear succeed, return true, false otherwise
-
getAdjust
public int getAdjust()
Gets the match status between positioning vehicle and road network.- Returns:
- Returns the match status value
-
setSimulationSpeed
public boolean setSimulationSpeed(double speed)
Set the analog navigation speed, so that the car in accordance with the set speed (unit m / s)- Parameters:
speed
- Simulate navigation speed- Returns:
- The setting is valid, returns true, otherwise returns false, such as setting a negative number
-
setSimulationInterval
public boolean setSimulationInterval(int interval)
Sets the simulation navigation interval, in milliseconds.- Parameters:
interval
- Simulated navigation interval- Returns:
- The set time is valid and returns true, otherwise false
-
setSpeechParam
public boolean setSpeechParam(Navigation.SpeechParam speechparam)
Sets the guide information management to determine whether the guide information reports or not during navigation.- Parameters:
speechparam
- Guide broadcast control class, see alsoNavigation.SpeechParam
- Returns:
- Set true, return true, false otherwise
-
locateMap
public void locateMap()
Make the vehicle as the center of the map during the navigation. The vehicle can be always in the center of the map even after you pan the map.
-
setEncryption
public void setEncryption(Encryption encryption)
Sets encryption.- Parameters:
encryption
- Coordinate encryption algorithmEncryption
-
-