NASA World Wind

gov.nasa.worldwindx.examples.lineofsight
Class PointGrid

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwindx.examples.lineofsight.PointGrid
All Implemented Interfaces:
AVList, MessageListener, Highlightable, OrderedRenderable, Renderable, WWObject, PropertyChangeListener, EventListener

public class PointGrid
extends WWObjectImpl
implements OrderedRenderable, Highlightable


Nested Class Summary
protected static class PointGrid.Attributes
           
 
Field Summary
protected  PointGrid.Attributes activeAttributes
           
protected  int altitudeMode
           
protected  boolean applyVerticalExaggeration
           
protected  List<Position> corners
           
protected  FloatBuffer currentPoints
           
protected static long DEFAULT_GEOMETRY_GENERATION_INTERVAL
          The default geometry regeneration interval, in milliseconds.
protected static Color DEFAULT_HIGHLIGHT_POINT_COLOR
          The highlight color to use when none is specified
protected static Double DEFAULT_HIGHLIGHT_SCALE
          The scale to use when highlighting if no highlight attributes are specified.
protected static Color DEFAULT_POINT_COLOR
          The color to use when none is specified
protected static Double DEFAULT_POINT_SIZE
          The point size to use when none is specified.
protected static PointGrid.Attributes defaultAttributes
          The attributes used if attributes are not specified.
protected  Extent extent
           
protected  double eyeDistance
           
protected  long frameID
           
protected  long geometryRegenerationInterval
           
protected  PointGrid.Attributes highlightAttrs
           
protected  boolean highlighted
           
protected  boolean highlightOnePosition
           
protected  PointGrid.Attributes normalAttrs
           
protected  int numPositions
           
protected  Layer pickLayer
           
protected  PickSupport pickSupport
           
protected  Iterable<? extends Position> positions
           
protected  double previousExaggeration
           
protected  long visGeomRegenFrame
           
protected  boolean visible
           
 
Constructor Summary
PointGrid()
           
PointGrid(List<Position> corners, Iterable<? extends Position> positions, Integer numPositions)
           
 
Method Summary
protected  void beginDrawing(DrawContext dc)
          Establish the OpenGL state needed to draw Paths.
protected  Extent computeExtentAndEyeDistance(DrawContext dc)
           
protected  FloatBuffer computeGridPoints(DrawContext dc, FloatBuffer coords)
           
protected  Vec4 computePoint(DrawContext dc, Position pos)
           
protected  void determineActiveAttributes()
           
protected  Color determineHighlightColor()
           
protected  Double determineHighlightPointSize()
           
protected  void doDrawOrderedRenderable(DrawContext dc)
          Draws the points as an ordered renderable.
protected  void drawOrderedRenderable(DrawContext dc)
          Draws the path as an ordered renderable.
protected  void drawPoints(DrawContext dc)
           
protected  void endDrawing(DrawContext dc)
          Pop the state set in beginDrawing.
 PointGrid.Attributes getActiveAttributes()
           
 int getAltitudeMode()
           
 PointGrid.Attributes getAttributes()
           
 List<Position> getCorners()
           
 double getDistanceFromEye()
          Returns the ordered renderable's distance from the current view's eye point.
 Extent getExtent()
           
 long getGeometryRegenerationInterval()
           
 PointGrid.Attributes getHighlightAttributes()
           
 int getNumPositions()
           
 Iterable<? extends Position> getPositions()
           
protected  boolean intersectsFrustum(DrawContext dc)
          Determines whether the points intersect the view frustum.
 boolean isApplyVerticalExaggeration()
           
 boolean isHighlighted()
          Indicates whether to highlight the shape.
 boolean isHighlightOnePosition()
           
 boolean isVisible()
           
protected  void makeOrderedRenderable(DrawContext dc)
          If the scene controller is rendering ordered renderables, this method draws this placemark's image as an ordered renderable.
protected  boolean mustRegenerateGeometry(DrawContext dc)
           
 void pick(DrawContext dc, Point pickPoint)
          Executes a pick of the ordered renderable.
protected  void pickPoints(DrawContext dc)
           
 void render(DrawContext dc)
          Causes this Renderable to render itself using the provided draw context.
 void setAltitudeMode(int altitudeMode)
           
 void setApplyVerticalExaggeration(boolean applyVerticalExaggeration)
           
 void setAttributes(PointGrid.Attributes normalAttrs)
           
 void setCorners(List<Position> corners)
           
protected  void setExtent(Extent extent)
           
 void setHighlightAttributes(PointGrid.Attributes highlightAttrs)
           
 void setHighlighted(boolean highlighted)
          Specifies whether to highlight the shape.
 void setHighlightOnePosition(boolean highlightOnePosition)
           
protected  void setPointColor(DrawContext dc, Color color)
           
protected  void setPointSize(DrawContext dc, Double size)
           
 void setPositions(Iterable<? extends Position> positions, Integer numPositions)
           
 void setVisible(boolean visible)
           
 
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage, propertyChange
 
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 

Field Detail

activeAttributes

protected PointGrid.Attributes activeAttributes

altitudeMode

protected int altitudeMode

applyVerticalExaggeration

protected boolean applyVerticalExaggeration

corners

protected List<Position> corners

currentPoints

protected FloatBuffer currentPoints

DEFAULT_GEOMETRY_GENERATION_INTERVAL

protected static final long DEFAULT_GEOMETRY_GENERATION_INTERVAL
The default geometry regeneration interval, in milliseconds.

See Also:
Constant Field Values

DEFAULT_HIGHLIGHT_POINT_COLOR

protected static final Color DEFAULT_HIGHLIGHT_POINT_COLOR
The highlight color to use when none is specified


DEFAULT_HIGHLIGHT_SCALE

protected static final Double DEFAULT_HIGHLIGHT_SCALE
The scale to use when highlighting if no highlight attributes are specified.


DEFAULT_POINT_COLOR

protected static final Color DEFAULT_POINT_COLOR
The color to use when none is specified


DEFAULT_POINT_SIZE

protected static final Double DEFAULT_POINT_SIZE
The point size to use when none is specified.


defaultAttributes

protected static final PointGrid.Attributes defaultAttributes
The attributes used if attributes are not specified.


extent

protected Extent extent

eyeDistance

protected double eyeDistance

frameID

protected long frameID

geometryRegenerationInterval

protected long geometryRegenerationInterval

highlightAttrs

protected PointGrid.Attributes highlightAttrs

highlighted

protected boolean highlighted

highlightOnePosition

protected boolean highlightOnePosition

normalAttrs

protected PointGrid.Attributes normalAttrs

numPositions

protected int numPositions

pickLayer

protected Layer pickLayer

pickSupport

protected PickSupport pickSupport

positions

protected Iterable<? extends Position> positions

previousExaggeration

protected double previousExaggeration

visGeomRegenFrame

protected long visGeomRegenFrame

visible

protected boolean visible
Constructor Detail

PointGrid

public PointGrid()

PointGrid

public PointGrid(List<Position> corners,
                 Iterable<? extends Position> positions,
                 Integer numPositions)
Method Detail

beginDrawing

protected void beginDrawing(DrawContext dc)
Establish the OpenGL state needed to draw Paths.

Parameters:
dc - the current draw context.

computeExtentAndEyeDistance

protected Extent computeExtentAndEyeDistance(DrawContext dc)

computeGridPoints

protected FloatBuffer computeGridPoints(DrawContext dc,
                                        FloatBuffer coords)

computePoint

protected Vec4 computePoint(DrawContext dc,
                            Position pos)

determineActiveAttributes

protected void determineActiveAttributes()

determineHighlightColor

protected Color determineHighlightColor()

determineHighlightPointSize

protected Double determineHighlightPointSize()

doDrawOrderedRenderable

protected void doDrawOrderedRenderable(DrawContext dc)
Draws the points as an ordered renderable.

Parameters:
dc - the current draw context.

drawOrderedRenderable

protected void drawOrderedRenderable(DrawContext dc)
Draws the path as an ordered renderable.

Parameters:
dc - the current draw context.

drawPoints

protected void drawPoints(DrawContext dc)

endDrawing

protected void endDrawing(DrawContext dc)
Pop the state set in beginDrawing.

Parameters:
dc - the current draw context.

getActiveAttributes

public PointGrid.Attributes getActiveAttributes()

getAltitudeMode

public int getAltitudeMode()

getAttributes

public PointGrid.Attributes getAttributes()

getCorners

public List<Position> getCorners()

getDistanceFromEye

public double getDistanceFromEye()
Returns the ordered renderable's distance from the current view's eye point. Intended to be used only to sort a list of ordered renderables according to eye distance, and only during frame generation when a view is active.

Specified by:
getDistanceFromEye in interface OrderedRenderable
Returns:
the distance of the ordered renderable from the current view's eye point.

getExtent

public Extent getExtent()

getGeometryRegenerationInterval

public long getGeometryRegenerationInterval()

getHighlightAttributes

public PointGrid.Attributes getHighlightAttributes()

getNumPositions

public int getNumPositions()

getPositions

public Iterable<? extends Position> getPositions()

intersectsFrustum

protected boolean intersectsFrustum(DrawContext dc)
Determines whether the points intersect the view frustum.

Parameters:
dc - the current draw context.
Returns:
true if the points intersect the frustum, otherwise false.

isApplyVerticalExaggeration

public boolean isApplyVerticalExaggeration()

isHighlighted

public boolean isHighlighted()
Indicates whether to highlight the shape.

Specified by:
isHighlighted in interface Highlightable
Returns:
true to highlight the shape, otherwise false.

isHighlightOnePosition

public boolean isHighlightOnePosition()

isVisible

public boolean isVisible()

makeOrderedRenderable

protected void makeOrderedRenderable(DrawContext dc)
If the scene controller is rendering ordered renderables, this method draws this placemark's image as an ordered renderable. Otherwise the method determines whether this instance should be added to the ordered renderable list.

The Cartesian and screen points of the placemark are computed during the first call per frame and re-used in subsequent calls of that frame.

Parameters:
dc - the current draw context.

mustRegenerateGeometry

protected boolean mustRegenerateGeometry(DrawContext dc)

pick

public void pick(DrawContext dc,
                 Point pickPoint)
Executes a pick of the ordered renderable.

Specified by:
pick in interface OrderedRenderable
Parameters:
dc - the current draw context.
pickPoint - the pick point.

pickPoints

protected void pickPoints(DrawContext dc)

render

public void render(DrawContext dc)
Causes this Renderable to render itself using the provided draw context.

Specified by:
render in interface Renderable
Parameters:
dc - the DrawContext to be used
See Also:
DrawContext

setAltitudeMode

public void setAltitudeMode(int altitudeMode)

setApplyVerticalExaggeration

public void setApplyVerticalExaggeration(boolean applyVerticalExaggeration)

setAttributes

public void setAttributes(PointGrid.Attributes normalAttrs)

setCorners

public void setCorners(List<Position> corners)

setExtent

protected void setExtent(Extent extent)

setHighlightAttributes

public void setHighlightAttributes(PointGrid.Attributes highlightAttrs)

setHighlighted

public void setHighlighted(boolean highlighted)
Specifies whether to highlight the shape.

Specified by:
setHighlighted in interface Highlightable
Parameters:
highlighted - true to highlight the shape, otherwise false.

setHighlightOnePosition

public void setHighlightOnePosition(boolean highlightOnePosition)

setPointColor

protected void setPointColor(DrawContext dc,
                             Color color)

setPointSize

protected void setPointSize(DrawContext dc,
                            Double size)

setPositions

public void setPositions(Iterable<? extends Position> positions,
                         Integer numPositions)

setVisible

public void setVisible(boolean visible)

NASA World Wind