Class 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
    See Also:
    Analysis
    • 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 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 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:
        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
      • 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