Class LocationDistanceMeasurement
- java.lang.Object
-
- com.esri.arcgisruntime.geoanalysis.Analysis
-
- com.esri.arcgisruntime.geoanalysis.LocationDistanceMeasurement
-
public final class LocationDistanceMeasurement extends Analysis
LocationDistanceMeasurement measures the distance between a start and an end location (each usingPoint
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 aSceneView
before distances will be returned. The units of the distance components are specified usingsetUnitSystem(UnitSystem)
.- Since:
- 100.3.0
- See Also:
Analysis
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LocationDistanceMeasurement.MeasurementChangedEvent
Represents the event for changes in distances.static interface
LocationDistanceMeasurement.MeasurementChangedListener
Listener for changes in the distances.
-
Constructor Summary
Constructors Constructor Description LocationDistanceMeasurement(Point startLocation, Point endLocation)
Creates an instance of LocationDistanceMeasurement based on start and end locations given as 3D points.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMeasurementChangedListener(LocationDistanceMeasurement.MeasurementChangedListener listener)
Adds a listener for when any of the distances have changed.Distance
getDirectDistance()
Gets the direct distance between the start and end locations.Point
getEndLocation()
Gets the end location.Distance
getHorizontalDistance()
Gets the horizontal distance between the start and end locations.Point
getStartLocation()
Gets the start location.UnitSystem
getUnitSystem()
Gets the unit system used to report distances.Distance
getVerticalDistance()
Gets the vertical distance between the start and end locations.boolean
removeMeasurementChangedListener(LocationDistanceMeasurement.MeasurementChangedListener listener)
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 Detail
-
LocationDistanceMeasurement
public LocationDistanceMeasurement(Point startLocation, Point endLocation)
Creates an instance of LocationDistanceMeasurement based on start and end locations given as 3D points.- Parameters:
startLocation
- the start locationendLocation
- the end location- Throws:
java.lang.IllegalArgumentException
- if startLocation is nulljava.lang.IllegalArgumentException
- if endLocation is nullArcGISRuntimeException
- if startLocation or endLocation are missing z values- Since:
- 100.3.0
-
-
Method Detail
-
getStartLocation
public Point getStartLocation()
Gets the start location.- Returns:
- the start location
- Since:
- 100.3.0
-
setStartLocation
public void setStartLocation(Point startLocation)
Sets the start location. The given point must be a 3D point.- Parameters:
startLocation
- the start location- Throws:
java.lang.IllegalArgumentException
- if startLocation is nullArcGISRuntimeException
- if startLocation is missing the z value- Since:
- 100.3.0
-
getEndLocation
public Point getEndLocation()
Gets the end location.- Returns:
- the end location
- Since:
- 100.3.0
-
setEndLocation
public void setEndLocation(Point endLocation)
Sets the end location. The given point must be a 3D point.- Parameters:
endLocation
- the end location- Throws:
java.lang.IllegalArgumentException
- if endLocation is nullArcGISRuntimeException
- if endLocation is missing the z value- Since:
- 100.3.0
-
getDirectDistance
public Distance 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
public Distance 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
public Distance 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
public void setUnitSystem(UnitSystem unitSystem)
Sets the unit system used to report distances.- Throws:
java.lang.IllegalArgumentException
- if unitSystem is null- Since:
- 100.3.0
-
getUnitSystem
public UnitSystem 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:
java.lang.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
-
-