Class PointGrid
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwindx.examples.lineofsight.PointGrid
-
- All Implemented Interfaces:
AVList,MessageListener,Highlightable,OrderedRenderable,Renderable,WWObject,java.beans.PropertyChangeListener,java.util.EventListener
public class PointGrid extends WWObjectImpl implements OrderedRenderable, Highlightable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classPointGrid.Attributes
-
Field Summary
Fields Modifier and Type Field Description protected PointGrid.AttributesactiveAttributesprotected intaltitudeModeprotected booleanapplyVerticalExaggerationprotected java.util.List<Position>cornersprotected java.nio.FloatBuffercurrentPointsprotected static longDEFAULT_GEOMETRY_GENERATION_INTERVALThe default geometry regeneration interval, in milliseconds.protected static java.awt.ColorDEFAULT_HIGHLIGHT_POINT_COLORThe highlight color to use when none is specifiedprotected static java.lang.DoubleDEFAULT_HIGHLIGHT_SCALEThe scale to use when highlighting if no highlight attributes are specified.protected static java.awt.ColorDEFAULT_POINT_COLORThe color to use when none is specifiedprotected static java.lang.DoubleDEFAULT_POINT_SIZEThe point size to use when none is specified.protected static PointGrid.AttributesdefaultAttributesThe attributes used if attributes are not specified.protected Extentextentprotected doubleeyeDistanceprotected longframeIDprotected longgeometryRegenerationIntervalprotected PointGrid.AttributeshighlightAttrsprotected booleanhighlightedprotected booleanhighlightOnePositionprotected PointGrid.AttributesnormalAttrsprotected intnumPositionsprotected LayerpickLayerprotected PickSupportpickSupportprotected java.lang.Iterable<? extends Position>positionsprotected doublepreviousExaggerationprotected longvisGeomRegenFrameprotected booleanvisible
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbeginDrawing(DrawContext dc)Establish the OpenGL state needed to draw Paths.protected ExtentcomputeExtentAndEyeDistance(DrawContext dc)protected java.nio.FloatBuffercomputeGridPoints(DrawContext dc, java.nio.FloatBuffer coords)protected Vec4computePoint(DrawContext dc, Position pos)protected voiddetermineActiveAttributes()protected java.awt.ColordetermineHighlightColor()protected java.lang.DoubledetermineHighlightPointSize()protected voiddoDrawOrderedRenderable(DrawContext dc)Draws the points as an ordered renderable.protected voiddrawOrderedRenderable(DrawContext dc)Draws the path as an ordered renderable.protected voiddrawPoints(DrawContext dc)protected voidendDrawing(DrawContext dc)Pop the state set in beginDrawing.PointGrid.AttributesgetActiveAttributes()intgetAltitudeMode()PointGrid.AttributesgetAttributes()java.util.List<Position>getCorners()doublegetDistanceFromEye()Returns the ordered renderable's distance from the current view's eye point.ExtentgetExtent()longgetGeometryRegenerationInterval()PointGrid.AttributesgetHighlightAttributes()intgetNumPositions()java.lang.Iterable<? extends Position>getPositions()protected booleanintersectsFrustum(DrawContext dc)Determines whether the points intersect the view frustum.booleanisApplyVerticalExaggeration()booleanisHighlighted()Indicates whether to highlight the shape.booleanisHighlightOnePosition()booleanisVisible()protected voidmakeOrderedRenderable(DrawContext dc)If the scene controller is rendering ordered renderables, this method draws this placemark's image as an ordered renderable.protected booleanmustRegenerateGeometry(DrawContext dc)voidpick(DrawContext dc, java.awt.Point pickPoint)Executes a pick of the ordered renderable.protected voidpickPoints(DrawContext dc)voidrender(DrawContext dc)Causes thisRenderableto render itself using the provided draw context.voidsetAltitudeMode(int altitudeMode)voidsetApplyVerticalExaggeration(boolean applyVerticalExaggeration)voidsetAttributes(PointGrid.Attributes normalAttrs)voidsetCorners(java.util.List<Position> corners)protected voidsetExtent(Extent extent)voidsetHighlightAttributes(PointGrid.Attributes highlightAttrs)voidsetHighlighted(boolean highlighted)Specifies whether to highlight the shape.voidsetHighlightOnePosition(boolean highlightOnePosition)protected voidsetPointColor(DrawContext dc, java.awt.Color color)protected voidsetPointSize(DrawContext dc, java.lang.Double size)voidsetPositions(java.lang.Iterable<? extends Position> positions, java.lang.Integer numPositions)voidsetVisible(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, 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
-
DEFAULT_HIGHLIGHT_SCALE
protected static final java.lang.Double DEFAULT_HIGHLIGHT_SCALE
The scale to use when highlighting if no highlight attributes are specified.
-
DEFAULT_POINT_SIZE
protected static final java.lang.Double DEFAULT_POINT_SIZE
The point size to use when none is specified.
-
DEFAULT_POINT_COLOR
protected static final java.awt.Color DEFAULT_POINT_COLOR
The color to use when none is specified
-
DEFAULT_HIGHLIGHT_POINT_COLOR
protected static final java.awt.Color DEFAULT_HIGHLIGHT_POINT_COLOR
The highlight color to use when none is specified
-
DEFAULT_GEOMETRY_GENERATION_INTERVAL
protected static final long DEFAULT_GEOMETRY_GENERATION_INTERVAL
The default geometry regeneration interval, in milliseconds.- See Also:
- Constant Field Values
-
defaultAttributes
protected static final PointGrid.Attributes defaultAttributes
The attributes used if attributes are not specified.
-
corners
protected java.util.List<Position> corners
-
positions
protected java.lang.Iterable<? extends Position> positions
-
numPositions
protected int numPositions
-
highlighted
protected boolean highlighted
-
highlightOnePosition
protected boolean highlightOnePosition
-
visible
protected boolean visible
-
altitudeMode
protected int altitudeMode
-
applyVerticalExaggeration
protected boolean applyVerticalExaggeration
-
geometryRegenerationInterval
protected long geometryRegenerationInterval
-
normalAttrs
protected PointGrid.Attributes normalAttrs
-
highlightAttrs
protected PointGrid.Attributes highlightAttrs
-
activeAttributes
protected PointGrid.Attributes activeAttributes
-
extent
protected Extent extent
-
eyeDistance
protected double eyeDistance
-
currentPoints
protected java.nio.FloatBuffer currentPoints
-
pickSupport
protected PickSupport pickSupport
-
pickLayer
protected Layer pickLayer
-
frameID
protected long frameID
-
previousExaggeration
protected double previousExaggeration
-
visGeomRegenFrame
protected long visGeomRegenFrame
-
-
Method Detail
-
getCorners
public java.util.List<Position> getCorners()
-
setCorners
public void setCorners(java.util.List<Position> corners)
-
getNumPositions
public int getNumPositions()
-
getPositions
public java.lang.Iterable<? extends Position> getPositions()
-
setPositions
public void setPositions(java.lang.Iterable<? extends Position> positions, java.lang.Integer numPositions)
-
isHighlighted
public boolean isHighlighted()
Indicates whether to highlight the shape.- Specified by:
isHighlightedin interfaceHighlightable- Returns:
- true to highlight the shape, otherwise false.
-
setHighlighted
public void setHighlighted(boolean highlighted)
Specifies whether to highlight the shape.- Specified by:
setHighlightedin interfaceHighlightable- Parameters:
highlighted- true to highlight the shape, otherwise false.
-
isHighlightOnePosition
public boolean isHighlightOnePosition()
-
setHighlightOnePosition
public void setHighlightOnePosition(boolean highlightOnePosition)
-
isVisible
public boolean isVisible()
-
setVisible
public void setVisible(boolean visible)
-
getAltitudeMode
public int getAltitudeMode()
-
setAltitudeMode
public void setAltitudeMode(int altitudeMode)
-
isApplyVerticalExaggeration
public boolean isApplyVerticalExaggeration()
-
setApplyVerticalExaggeration
public void setApplyVerticalExaggeration(boolean applyVerticalExaggeration)
-
getGeometryRegenerationInterval
public long getGeometryRegenerationInterval()
-
getAttributes
public PointGrid.Attributes getAttributes()
-
setAttributes
public void setAttributes(PointGrid.Attributes normalAttrs)
-
getHighlightAttributes
public PointGrid.Attributes getHighlightAttributes()
-
setHighlightAttributes
public void setHighlightAttributes(PointGrid.Attributes highlightAttrs)
-
getActiveAttributes
public PointGrid.Attributes getActiveAttributes()
-
mustRegenerateGeometry
protected boolean mustRegenerateGeometry(DrawContext dc)
-
determineActiveAttributes
protected void determineActiveAttributes()
-
determineHighlightColor
protected java.awt.Color determineHighlightColor()
-
determineHighlightPointSize
protected java.lang.Double determineHighlightPointSize()
-
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:
getDistanceFromEyein interfaceOrderedRenderable- Returns:
- the distance of the ordered renderable from the current view's eye point.
-
getExtent
public Extent getExtent()
-
setExtent
protected void setExtent(Extent extent)
-
computeExtentAndEyeDistance
protected Extent computeExtentAndEyeDistance(DrawContext dc)
-
pick
public void pick(DrawContext dc, java.awt.Point pickPoint)
Executes a pick of the ordered renderable.- Specified by:
pickin interfaceOrderedRenderable- Parameters:
dc- the current draw context.pickPoint- the pick point.
-
render
public void render(DrawContext dc)
Causes thisRenderableto render itself using the provided draw context.- Specified by:
renderin interfaceRenderable- Parameters:
dc- theDrawContextto be used- See Also:
DrawContext
-
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.
-
drawOrderedRenderable
protected void drawOrderedRenderable(DrawContext dc)
Draws the path as an ordered renderable.- Parameters:
dc- the current draw context.
-
beginDrawing
protected void beginDrawing(DrawContext dc)
Establish the OpenGL state needed to draw Paths.- Parameters:
dc- the current draw context.
-
endDrawing
protected void endDrawing(DrawContext dc)
Pop the state set in beginDrawing.- Parameters:
dc- the current draw context.
-
doDrawOrderedRenderable
protected void doDrawOrderedRenderable(DrawContext dc)
Draws the points as an ordered renderable.- Parameters:
dc- the current draw context.
-
pickPoints
protected void pickPoints(DrawContext dc)
-
drawPoints
protected void drawPoints(DrawContext dc)
-
setPointColor
protected void setPointColor(DrawContext dc, java.awt.Color color)
-
setPointSize
protected void setPointSize(DrawContext dc, java.lang.Double size)
-
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.
-
computeGridPoints
protected java.nio.FloatBuffer computeGridPoints(DrawContext dc, java.nio.FloatBuffer coords)
-
computePoint
protected Vec4 computePoint(DrawContext dc, Position pos)
-
-