Class LineOfSight

java.lang.Object
com.esri.arcgisruntime.geoanalysis.Analysis
com.esri.arcgisruntime.geoanalysis.LineOfSight
Direct Known Subclasses:
GeoElementLineOfSight, LocationLineOfSight

public abstract class LineOfSight extends Analysis
Line of Sight analysis calculates segments of visibility between two points.

The LineOfSight analysis result is a line rendered between the observer and target with distinct colors representing visible and obstructed segments.

When at least one of the two ends (the observer and the target) of the line is placed outside the view, the colors of the visible part of the line may not accurately represent the hidden part. In such cases, the line is rendered gray. To display the color, move both the observer and the target into the view.

Maximum number of line of sights per GeoView is 64. Line of sights in excess of 64 will not be rendered.

Since:
10.2.0
  • Property Details

    • visibleColor

      public static ObjectProperty<Color> visibleColorProperty
      The color used to render segments that are visible along LineOfSight analysis results.

      Sections of the line between the observer and the target that are visible are drawn with the specified color. This property is applied to all LineOfSight analyses in the view.

      Default is Color.LIME.

      Attempting to set the color to null will throw an exception.

      Since:
      200.0.0
      See Also:
    • obstructedColor

      public static ObjectProperty<Color> obstructedColorProperty
      The color used to render segments that are obstructed along the line of sight.

      Sections of the line between the observer and the target that are obstructed (not visible) are drawn with the specified color. This property is applied to all LineOfSight analyses in the view.

      Default is Color.RED.

      Attempting to set the color to null will throw an exception.

      Since:
      200.0.0
      See Also:
  • Method Details

    • visibleColorProperty

      public static ObjectProperty<Color> visibleColorProperty()
      The color used to render segments that are visible along LineOfSight analysis results.

      Sections of the line between the observer and the target that are visible are drawn with the specified color. This property is applied to all LineOfSight analyses in the view.

      Default is Color.LIME.

      Attempting to set the color to null will throw an exception.

      Returns:
      the visibleColor property
      Since:
      200.0.0
      See Also:
    • getVisibleColor

      public static Color getVisibleColor()
      Gets the value of the visibleColor property.
      Property description:
      The color used to render segments that are visible along LineOfSight analysis results.

      Sections of the line between the observer and the target that are visible are drawn with the specified color. This property is applied to all LineOfSight analyses in the view.

      Default is Color.LIME.

      Attempting to set the color to null will throw an exception.

      Returns:
      the value of the visibleColor property
      Since:
      200.0.0
      See Also:
    • setVisibleColor

      public static void setVisibleColor(Color color)
      Sets the value of the visibleColor property.
      Property description:
      The color used to render segments that are visible along LineOfSight analysis results.

      Sections of the line between the observer and the target that are visible are drawn with the specified color. This property is applied to all LineOfSight analyses in the view.

      Default is Color.LIME.

      Attempting to set the color to null will throw an exception.

      Parameters:
      color - the value for the visibleColor property
      Since:
      200.0.0
      See Also:
    • setVisibleColor

      @Deprecated(since="200.0.0", forRemoval=true) public static void setVisibleColor(int visibleColor)
      Deprecated, for removal: This API element is subject to removal in a future version.
      as of 200.0.0, replaced by setVisibleColor(Color)
      Sets the color used to render segments that are visible along the line of sight.

      This is applied to all instances.

      Parameters:
      visibleColor - the color used to render segments that are visible along the line of sight, in 0xAARRGGBB format
      Since:
      10.2.0
    • obstructedColorProperty

      public static ObjectProperty<Color> obstructedColorProperty()
      The color used to render segments that are obstructed along the line of sight.

      Sections of the line between the observer and the target that are obstructed (not visible) are drawn with the specified color. This property is applied to all LineOfSight analyses in the view.

      Default is Color.RED.

      Attempting to set the color to null will throw an exception.

      Returns:
      the obstructedColor property
      Since:
      200.0.0
      See Also:
    • getObstructedColor

      public static Color getObstructedColor()
      Gets the value of the obstructedColor property.
      Property description:
      The color used to render segments that are obstructed along the line of sight.

      Sections of the line between the observer and the target that are obstructed (not visible) are drawn with the specified color. This property is applied to all LineOfSight analyses in the view.

      Default is Color.RED.

      Attempting to set the color to null will throw an exception.

      Returns:
      the value of the obstructedColor property
      Since:
      200.0.0
      See Also:
    • setObstructedColor

      public static void setObstructedColor(Color color)
      Sets the value of the obstructedColor property.
      Property description:
      The color used to render segments that are obstructed along the line of sight.

      Sections of the line between the observer and the target that are obstructed (not visible) are drawn with the specified color. This property is applied to all LineOfSight analyses in the view.

      Default is Color.RED.

      Attempting to set the color to null will throw an exception.

      Parameters:
      color - the value for the obstructedColor property
      Since:
      200.0.0
      See Also:
    • setObstructedColor

      @Deprecated(since="200.0.0", forRemoval=true) public static void setObstructedColor(int obstructedColor)
      Deprecated, for removal: This API element is subject to removal in a future version.
      as of 200.0.0, replaced by setObstructedColor(Color)
      Sets the color used to render segments that are obstructed along the line of sight.

      This is applied to all instances.

      Parameters:
      obstructedColor - the color used to render segments that are obstructed along the line of sight, in 0xAARRGGBB format
      Since:
      10.2.0
    • getLineWidth

      public static float getLineWidth()
      Gets the line width used to render line of sight.

      Default is 1.0.

      Returns:
      the line width used to render line of sight, in dp
      Since:
      10.2.0
    • setLineWidth

      public static void setLineWidth(float lineWidth)
      Sets the line width used to render line of sight.

      Default is 1.0.

      This is applied to all instances.

      Parameters:
      lineWidth - the line width used to render line of sight, in dp
      Since:
      10.2.0
    • getTargetVisibility

      public LineOfSight.TargetVisibility getTargetVisibility()
      Gets the target's visibility.
      Returns:
      the target's visibility
      Since:
      10.2.0
    • addTargetVisibilityChangedListener

      public void addTargetVisibilityChangedListener(LineOfSight.TargetVisibilityChangedListener listener)
      Adds a listener for when the target visibility has changed.
      Parameters:
      listener - the listener
      Throws:
      IllegalArgumentException - if the listener is null
      Since:
      100.2.0
    • removeTargetVisibilityChangedListener

      public boolean removeTargetVisibilityChangedListener(LineOfSight.TargetVisibilityChangedListener listener)
      Removes a target visibility changed listener.
      Parameters:
      listener - the listener
      Returns:
      true if successful, otherwise false
      Since:
      100.2.0