Package gov.nasa.worldwind.shape
Class OmnidirectionalSightline
- java.lang.Object
-
- gov.nasa.worldwind.render.AbstractRenderable
-
- gov.nasa.worldwind.shape.OmnidirectionalSightline
-
- All Implemented Interfaces:
Renderable
,Attributable
,Highlightable
,Movable
public class OmnidirectionalSightline extends AbstractRenderable implements Attributable, Highlightable, Movable
Displays an omnidirectional sightline's visibility within the WorldWind scene. The sightline's placement and area of potential visibility are represented by a Cartesian sphere with a center position and a range. Terrain features within the sphere are considered visible if there is a direct line-of-sight between the center position and a given terrain point.
OmnidirectionalSightline displays an overlay on the WorldWind terrain indicating which terrain features are visible, and which are occluded. Visible terrain features, those having a direct line-of-sight to the center position, appear in the sightline's normal attributes or its highlight attributes, depending on the highlight state. Occluded terrain features appear in the sightline's occlude attributes, regardless of highlight state. Terrain features outside the sightline's range are excluded from the overlay.
Limitations and Planned Improvements
- OmnidirectionalSightline is currently limited to terrain-based occlusion, and does not incorporate other 3D scene elements during visibility determination. Subsequent iterations will support occlusion of both terrain and 3D polygons.
- The visibility overlay is drawn in ShapeAttributes' interior color only. Subsequent iterations will add an outline where the sightline's range intersects the scene, and will display the sightline's geometry as an outline.
- OmnidirectionalSightline requires OpenGL ES 2.0 extension GL_OES_depth_texture. Subsequent iterations may relax this requirement.
-
-
Constructor Summary
Constructors Constructor Description OmnidirectionalSightline(Position position, double range)
Constructs an OmnidirectionalSightline that displays the line-of-sight from a specified center position and range.OmnidirectionalSightline(Position position, double range, ShapeAttributes attributes)
Constructs an OmnidirectionalSightline that displays the line-of-sight from a specified center position and range.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getAltitudeMode()
Indicates the altitude mode associated with this sightline's position.ShapeAttributes
getAttributes()
Indicates this sightline's "normal" attributes.ShapeAttributes
getHighlightAttributes()
Indicates this sightline's "highlight" attributes.ShapeAttributes
getOccludeAttributes()
Indicates this sightline's "occlude" attributes.Position
getPosition()
Indicates the geographic position where this sightline is centered.double
getRange()
Indicates this sightline's range.Position
getReferencePosition()
A position associated with the object that indicates its aggregate geographic position.boolean
isHighlighted()
Indicates whether this sightline's overlay uses its highlight attributes rather than its normal attributes for visible features.void
moveTo(Globe globe, Position position)
Moves the sightline over the globe's surface.OmnidirectionalSightline
setAltitudeMode(int altitudeMode)
Sets the altitude mode associated with this sightline's position.void
setAttributes(ShapeAttributes attributes)
Sets this sightline's "normal" attributes to the supplied attributes bundle.void
setHighlightAttributes(ShapeAttributes highlightAttributes)
Sets this sightline's "highlight" attributes.void
setHighlighted(boolean highlighted)
Sets the highlighted state of this sightline, which indicates whether this sightline's overlay uses its highlight attributes rather than its normal attributes for visible features.void
setOccludeAttributes(ShapeAttributes occludeAttributes)
Sets this sightline's "occlude" attributes.OmnidirectionalSightline
setPosition(Position position)
Sets this sightline's geographic position to the values in the supplied position.OmnidirectionalSightline
setRange(double meters)
Sets this sightline's range.-
Methods inherited from class gov.nasa.worldwind.render.AbstractRenderable
getDisplayName, getPickDelegate, getUserProperty, hasUserProperty, isEnabled, putUserProperty, removeUserProperty, render, setDisplayName, setEnabled, setPickDelegate
-
-
-
-
Constructor Detail
-
OmnidirectionalSightline
public OmnidirectionalSightline(Position position, double range)
Constructs an OmnidirectionalSightline that displays the line-of-sight from a specified center position and range. Visible features are displayed in white, while occluded features are displayed in red.- Parameters:
position
- the position where the sightline is centeredrange
- the sightline's range in meters from its position- Throws:
java.lang.IllegalArgumentException
- If the position is null, or if the range is negative
-
OmnidirectionalSightline
public OmnidirectionalSightline(Position position, double range, ShapeAttributes attributes)
Constructs an OmnidirectionalSightline that displays the line-of-sight from a specified center position and range. Visible features are displayed in the specified attributes, while occluded features are displayed in red.- Parameters:
position
- the position where the sightline is centeredrange
- the sightline's range in meters from its positionattributes
- a reference to an attributes bundle used by this sightline when not highlighted- Throws:
java.lang.IllegalArgumentException
- If the position is null, or if the range is negative
-
-
Method Detail
-
getPosition
public Position getPosition()
Indicates the geographic position where this sightline is centered.- Returns:
- this sightline's geographic position
-
setPosition
public OmnidirectionalSightline setPosition(Position position)
Sets this sightline's geographic position to the values in the supplied position.- Parameters:
position
- the new position where this sightline is centered- Returns:
- this sightline, with its position set to the specified value
- Throws:
java.lang.IllegalArgumentException
- If the position is null
-
getAltitudeMode
public int getAltitudeMode()
Indicates the altitude mode associated with this sightline's position.- Returns:
- the altitude mode, see
WorldWind.AltitudeMode
for possible
-
setAltitudeMode
public OmnidirectionalSightline setAltitudeMode(int altitudeMode)
Sets the altitude mode associated with this sightline's position.- Parameters:
altitudeMode
- the new altitude mode, seeWorldWind.AltitudeMode
for acceptable values- Returns:
- this sightline with its altitude mode set to the specified value
-
getRange
public double getRange()
Indicates this sightline's range. Range represents the sightline's transmission distance in meters from its center position.- Returns:
- this sightline's range in meters.
-
setRange
public OmnidirectionalSightline setRange(double meters)
Sets this sightline's range. Range represents the sightline's transmission distance in meters from its center position.- Parameters:
meters
- this sightline's range in meters- Returns:
- this sightline with its range set to the specified value
- Throws:
java.lang.IllegalArgumentException
- If the range is negative
-
getAttributes
public ShapeAttributes getAttributes()
Indicates this sightline's "normal" attributes. These attributes are used for the sightline's overlay when the highlighted flag is false, and there is a direct line-of-sight from the sightline's center position to a terrain feature. If null and this sightline is not highlighted, visible terrain features are excluded from the overlay.- Specified by:
getAttributes
in interfaceAttributable
- Returns:
- a reference to this sightline's attributes bundle
-
setAttributes
public void setAttributes(ShapeAttributes attributes)
Sets this sightline's "normal" attributes to the supplied attributes bundle. These attributes are used for the sightline's overlay when the highlighted flag is false, and there is a direct line-of-sight from the sightline's center position to a terrain feature. If null and this sightline is not highlighted, visible terrain features are excluded from the overlay.
It is permissible to share attribute bundles between sightlines.- Specified by:
setAttributes
in interfaceAttributable
- Parameters:
attributes
- a reference to an attributes bundle used by this sightline when not highlighted
-
getHighlightAttributes
public ShapeAttributes getHighlightAttributes()
Indicates this sightline's "highlight" attributes. These attributes are used for the sightline's overlay when the highlighted flag is true, and there is a direct line-of-sight from the sightline's center position to a terrain feature. If null and the highlighted flag is true, this sightline's normal attributes are used. If they, too, are null, visible terrain features are excluded from the overlay.- Specified by:
getHighlightAttributes
in interfaceAttributable
- Returns:
- a reference to this sightline's highlight attributes bundle
-
setHighlightAttributes
public void setHighlightAttributes(ShapeAttributes highlightAttributes)
Sets this sightline's "highlight" attributes. These attributes are used for the sightline's overlay when the highlighted flag is true, and there is a direct line-of-sight from the sightline's center position to a terrain feature. If null and the highlighted flag is true, this sightline's normal attributes are used. If they, too, are null, visible terrain features are excluded from the overlay.
It is permissible to share attribute bundles between sightlines.- Specified by:
setHighlightAttributes
in interfaceAttributable
- Parameters:
highlightAttributes
- a reference to the attributes bundle used by this sightline when highlighted
-
getOccludeAttributes
public ShapeAttributes getOccludeAttributes()
Indicates this sightline's "occlude" attributes. These attributes are used for the sightline's overlay when there's no direct line-of-sight from the sightline's center position to a terrain feature. If null, occluded terrain features are excluded from the overlay.- Returns:
- a reference to this sightline's occlude attributes bundle
-
setOccludeAttributes
public void setOccludeAttributes(ShapeAttributes occludeAttributes)
Sets this sightline's "occlude" attributes. These attributes are used for the sightline's overlay when there's no direct line-of-sight from the sightline's center position to a terrain feature. If null, occluded terrain features are excluded from the overlay.
It is permissible to share attribute bundles between sightlines.- Parameters:
occludeAttributes
- a reference to an attributes bundle used by this sightline when occluded
-
isHighlighted
public boolean isHighlighted()
Indicates whether this sightline's overlay uses its highlight attributes rather than its normal attributes for visible features.- Specified by:
isHighlighted
in interfaceHighlightable
- Returns:
- true if this sightline is highlighted, and false otherwise
-
setHighlighted
public void setHighlighted(boolean highlighted)
Sets the highlighted state of this sightline, which indicates whether this sightline's overlay uses its highlight attributes rather than its normal attributes for visible features.- Specified by:
setHighlighted
in interfaceHighlightable
- Parameters:
highlighted
- true to highlight this sightline, and false otherwise
-
getReferencePosition
public Position getReferencePosition()
A position associated with the object that indicates its aggregate geographic position. For an OmnidirectionalSightline, this is simply it's position property.- Specified by:
getReferencePosition
in interfaceMovable
- Returns:
getPosition()
-
moveTo
public void moveTo(Globe globe, Position position)
Moves the sightline over the globe's surface. For an OmnidirectionalSightline, this simply callssetPosition(Position)
.
-
-