Module com.esri.arcgisruntime
Class LocationDistanceMeasurement
java.lang.Object
com.esri.arcgisruntime.geoanalysis.Analysis
com.esri.arcgisruntime.geoanalysis.LocationDistanceMeasurement
LocationDistanceMeasurement measures the distance between a start and an end location (each using
Point
geometry). Three distance components are calculated:
- Direct distance - the direct distance between the start and end location
- Horizontal distance - the horizontal component of the direct distance
- Vertical distance - the vertical component of the direct distance
AnalysisOverlay
within a SceneView
before distances will be returned. The units of the distance components are specified
using setUnitSystem(UnitSystem)
.- Since:
- 100.3.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Represents the event for changes in distances.static interface
Listener for changes in the distances. -
Constructor Summary
ConstructorDescriptionLocationDistanceMeasurement
(Point startLocation, Point endLocation) Creates a LocationDistanceMeasurement analysis object that defines a start and an end location usingPoint
objects. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a listener for when any of the distances have changed.Gets the direct distance between the start and end locations.Gets the end location.Gets the horizontal distance between the start and end locations.Gets the start location.Gets the unit system used to report distances.Gets the vertical distance between the start and end locations.boolean
Removes a measurement changed listener.void
setEndLocation
(Point endLocation) Sets the end location.void
setStartLocation
(Point startLocation) Sets the start location.void
setUnitSystem
(UnitSystem unitSystem) Sets the unit system used to report distances.Methods inherited from class com.esri.arcgisruntime.geoanalysis.Analysis
isVisible, setVisible
-
Constructor Details
-
LocationDistanceMeasurement
Creates a LocationDistanceMeasurement analysis object that defines a start and an end location usingPoint
objects.The LocationDistanceMeasurement analysis result is a distance measurement between the start and end locations with direct, horizontal, and vertical components.
- Parameters:
startLocation
- the start locationendLocation
- the end location- Throws:
IllegalArgumentException
- if startLocation is nullIllegalArgumentException
- if endLocation is nullArcGISRuntimeException
- if startLocation or endLocation are missing z values- Since:
- 100.3.0
-
-
Method Details
-
getStartLocation
Gets the start location.- Returns:
- the start location
- Since:
- 100.3.0
-
setStartLocation
Sets the start location. The given point must be a 3D point.- Parameters:
startLocation
- the start location- Throws:
IllegalArgumentException
- if startLocation is nullArcGISRuntimeException
- if startLocation is missing the z value- Since:
- 100.3.0
-
getEndLocation
Gets the end location.- Returns:
- the end location
- Since:
- 100.3.0
-
setEndLocation
Sets the end location. The given point must be a 3D point.- Parameters:
endLocation
- the end location- Throws:
IllegalArgumentException
- if endLocation is nullArcGISRuntimeException
- if endLocation is missing the z value- Since:
- 100.3.0
-
getDirectDistance
Gets the direct distance between the start and end locations.- Returns:
- the direct distance between the start and end locations, or null if not in an AnalysisOverlay
- Since:
- 100.3.0
-
getHorizontalDistance
Gets the horizontal distance between the start and end locations.- Returns:
- the horizontal distance between the start and end locations, or null if not in an AnalysisOverlay
- Since:
- 100.3.0
-
getVerticalDistance
Gets the vertical distance between the start and end locations.- Returns:
- the vertical distance between the start and end locations, or null if not in an AnalysisOverlay
- Since:
- 100.3.0
-
setUnitSystem
Sets the unit system used to report distances.- Throws:
IllegalArgumentException
- if unitSystem is null- Since:
- 100.3.0
-
getUnitSystem
Gets the unit system used to report distances.- Returns:
- the unit system used to report distances, The default is
UnitSystem.METRIC
. - Since:
- 100.3.0
-
addMeasurementChangedListener
public void addMeasurementChangedListener(LocationDistanceMeasurement.MeasurementChangedListener listener) Adds a listener for when any of the distances have changed.- Parameters:
listener
- the listener to add- Throws:
IllegalArgumentException
- if the listener is null- Since:
- 100.3.0
-
removeMeasurementChangedListener
public boolean removeMeasurementChangedListener(LocationDistanceMeasurement.MeasurementChangedListener listener) Removes a measurement changed listener.- Parameters:
listener
- the listener to remove- Returns:
- true if successful, otherwise false
- Since:
- 100.3.0
-