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 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
The analysis must be added to an AnalysisOverlay within a SceneView before distances will be returned. The units of the distance components are specified using setUnitSystem(UnitSystem).
Since:
100.3.0
  • Constructor Details

    • LocationDistanceMeasurement

      public LocationDistanceMeasurement(Point startLocation, Point endLocation)
      Creates a LocationDistanceMeasurement analysis object that defines a start and an end location using Point 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 location
      endLocation - the end location
      Throws:
      IllegalArgumentException - if startLocation is null
      IllegalArgumentException - if endLocation is null
      ArcGISRuntimeException - if startLocation or endLocation are missing z values
      Since:
      100.3.0
  • Method Details

    • 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:
      IllegalArgumentException - if startLocation is null
      ArcGISRuntimeException - 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:
      IllegalArgumentException - if endLocation is null
      ArcGISRuntimeException - 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:
      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:
      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