public class

LineOfSight

extends Object
implements Function
java.lang.Object
   ↳ com.esri.core.analysis.LineOfSight

Class Overview

This function will calculate a line of sight based on provided raster data and observer and target positions. To visualize the result, call getOutputLayer() and add it to a MapView.

When you are done using the line of sight, call its dispose method to release native resources and clean up any temporary files on the machine.

Note that this function requires Android RenderScript support library. Please refer to Android document to configure your development environment to be able to use this function.

@Beta

Summary

Public Constructors
LineOfSight(String rasterPath)
Creates a LineOfSight function, which analyzes raster data located at the provided path.
Public Methods
void dispose()
Disposes the LineOfSight and releases its resources.
long getId()
Gets the unique ID of the line of sight function.
String getName()
Returns the name of the function.
Point getObserver()
Returns the position of the observer, which is used to calculate line of sight.
double getObserverZOffset()
Gets the height of the observer in meters.
Layer getOutputLayer()
Returns a Layer containing the output of the LineOfSight function.
Point getTarget()
Returns the position of the target, which is used to calculate line of sight.
double getTargetZOffset()
Gets the height of the target in meters.
void setObserver(Point observer)
Sets the position of the observer for use in calculating the line of sight from that position.
void setObserverZOffset(double observerZOffset)
Sets the height of the observer in meters (i.e.
void setSightRenderers(UniqueValueRenderer sightPointsRenderer, UniqueValueRenderer sightLinesRenderer)
Sets renderers for the sight points and sight lines.
void setTarget(Point target)
Sets the position of the target for use in calculating the line of sight to that position.
void setTargetZOffset(double targetZOffset)
Sets the height of the target in meters (i.e.
Protected Methods
void finalize()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.esri.core.analysis.Function

Public Constructors

public LineOfSight (String rasterPath)

Creates a LineOfSight function, which analyzes raster data located at the provided path.

@Beta

Parameters
rasterPath String: the path to the raster data to be analyzed
Throws
IllegalArgumentException if the raster path is null or empty string
FileNotFoundException if file cannot be found
RuntimeException if there was an error binding the line of sight function to the file

Public Methods

public void dispose ()

Disposes the LineOfSight and releases its resources.

@Beta

public long getId ()

Gets the unique ID of the line of sight function.

@Beta

Returns
long the unique ID of the line of sight function

public String getName ()

Returns the name of the function.

@Beta

Returns
String the name of the function.

public Point getObserver ()

Returns the position of the observer, which is used to calculate line of sight. The position is in map coordinates.

@Beta

Returns
Point the observer position

public double getObserverZOffset ()

Gets the height of the observer in meters. See setObserverHeight(double) for more details. Returns -1 if it can not be determined.

@Beta

Returns
double the height of the observer

public Layer getOutputLayer ()

Returns a Layer containing the output of the LineOfSight function. This layer can be added to a MapView to visualize the result.

@Beta

Returns
Layer a Layer containing the output of the LineOfSight function

public Point getTarget ()

Returns the position of the target, which is used to calculate line of sight. The position is in map coordinates.

@Beta

Returns
Point the target position

public double getTargetZOffset ()

Gets the height of the target in meters. See setTargetHeight(double) for more details. Returns -1 if it can not be determined.

@Beta

Returns
double the height of the target

public void setObserver (Point observer)

Sets the position of the observer for use in calculating the line of sight from that position. The position should have valid X, and Y values. Z value will be determined by the elevation of the raster data at that X,Y coordinate, plus the observer height offset, if any. Note, the observer position should use map coordinates, not screen coordinates.

@Beta

Parameters
observer Point: the observer position to set

public void setObserverZOffset (double observerZOffset)

Sets the height of the observer in meters (i.e. the physical height of the observer). For example, if the elevation is 650 meters, and the observer is a human that is 2.0 meters tall, then the line of sight will be calculated for 652 meters at that X,Y coordinate.

@Beta

Parameters
observerZOffset double

public void setSightRenderers (UniqueValueRenderer sightPointsRenderer, UniqueValueRenderer sightLinesRenderer)

Sets renderers for the sight points and sight lines. Both renderers depend on specific values to be supplied. Both renderers have the same requirements, except that the sight points renderer should have MarkerSymbols and the sight lines renderer should have LineSymbols. The requirements are as follows:

  • The UniqueValueRenderer's field1 must be set to "visibility"
  • The symbol mapped to value "1" will be used for visible points/lines
  • The symbol mapped to value "0" will be used for non-visible points/lines
  • The symbol mapped to value "-1" will be used for unknown points/lines (i.e. data unavailable)
Passing null for either renderer will cause it to be unchanged (either the last renderer set, or the default renderer if no renderer has been set).
@Beta

Parameters
sightPointsRenderer UniqueValueRenderer: the renderer to use for the sight points (or null to remain unchanged)
sightLinesRenderer UniqueValueRenderer: the renderer to use for the sight lines (or null to remain unchanged)

public void setTarget (Point target)

Sets the position of the target for use in calculating the line of sight to that position. The position should have valid X, and Y values. Z value will be determined by the elevation of the raster data at that X,Y coordinate, plus the target height offset, if any. Note, the target position should use map coordinates, not screen coordinates.

@Beta

Parameters
target Point: the target position to set

public void setTargetZOffset (double targetZOffset)

Sets the height of the target in meters (i.e. the physical height of the target). For example, if the elevation is 650 meters, and the target is a human that is 2.0 meters tall, then the line of sight will be calculated for 652 meters at that X,Y coordinate. If the desire was instead to see if a 75 meter building would be in line of sight, then the target height could be set to 75.

@Beta

Parameters
targetZOffset double

Protected Methods

protected void finalize ()

Throws
Throwable