Class AntennaModel
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.render.AbstractShape
-
- gov.nasa.worldwindx.applications.antenna.AntennaModel
-
- All Implemented Interfaces:
AVList
,Draggable
,MessageListener
,Exportable
,ExtentHolder
,Movable
,Movable2
,Attributable
,GeographicExtent
,Highlightable
,OrderedRenderable
,PreRenderable
,Renderable
,Restorable
,WWObject
,java.beans.PropertyChangeListener
,java.util.EventListener
public class AntennaModel extends AbstractShape
Models antenna gain. Gain values are drawn from anInterpolator2D
. The value plotted is determined by the gain and this object's gain offset and gain scale: gain plotted = gain * gain scale + gain offset. Both the offset and the gain can be specified.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AntennaModel.ShapeData
This class holds globe-specific data for this shape.-
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.AbstractShape
AbstractShape.AbstractShapeData
-
-
Field Summary
Fields Modifier and Type Field Description protected Angle
azimuth
static int
DISPLAY_MODE_FILL
static int
DISPLAY_MODE_LINE
static int
DISPLAY_MODE_POINT
protected Angle
elevationAngle
protected double
gainOffset
protected double
gainScale
protected Interpolator2D
interpolator
protected int
nPhiIntervals
protected int
nPhiPoints
protected int
nThetaIntervals
protected int
nThetaPoints
protected Position
position
protected WWTexture
texture
-
Fields inherited from class gov.nasa.worldwind.render.AbstractShape
activeAttributes, altitudeMode, BEogsh, currentData, DEFAULT_ALTITUDE_MODE, DEFAULT_GEOMETRY_GENERATION_INTERVAL, DEFAULT_HIGHLIGHT_MATERIAL, DEFAULT_INTERIOR_MATERIAL, DEFAULT_OUTLINE_MATERIAL, DEFAULT_OUTLINE_PICK_WIDTH, defaultAttributes, delegateOwner, dragEnabled, draggableSupport, enableBatchPicking, enableBatchRendering, enableDepthOffset, highlightAttrs, highlighted, maxExpiryTime, minExpiryTime, normalAttrs, outlinePickWidth, outlineShapeRenderer, pickLayer, pickSupport, referencePosition, sector, shapeDataCache, surfaceShape, VBO_THRESHOLD, viewDistanceExpiration, visible
-
Fields inherited from interface gov.nasa.worldwind.Exportable
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
-
-
Constructor Summary
Constructors Constructor Description AntennaModel(Interpolator2D interpolator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected AbstractShape.AbstractShapeData
createCacheEntry(DrawContext dc)
Creates and returns a new cache entry specific to the subclass.protected void
doDrawInterior(DrawContext dc)
Draws this shape's interior.protected void
doDrawOutline(DrawContext dc)
Draws this shape's outline.protected void
doExportAsKML(javax.xml.stream.XMLStreamWriter xmlWriter)
Exports shape-specific fields.protected boolean
doMakeOrderedRenderable(DrawContext dc)
Produces the geometry and other state necessary to represent this shape as an ordered renderable.void
drawModel(DrawContext dc, int displayMode, boolean showTexture)
protected void
fillVBO(DrawContext dc)
Fill this shape's vertex buffer objects.Angle
getAzimuth()
java.awt.image.BufferedImage
getColorRamp()
protected AntennaModel.ShapeData
getCurrent()
Returns the current shape data cache entry.Angle
getElevationAngle()
Extent
getExtent(Globe globe, double verticalExaggeration)
Returns the objects enclosing volume as anExtent
in model coordinates, given a specifiedGlobe
and vertical exaggeration (seeSceneController.getVerticalExaggeration()
.double
getGainOffset()
double
getGainScale()
int
getPhiResolution()
Position
getPosition()
double
getRadius()
Position
getReferencePosition()
A position associated with the object that indicates its aggregate geographic position.Sector
getSector()
Returns the object's geographic extent.int
getThetaResolution()
protected Vec4
getVec(AntennaModel.ShapeData shapeData, int i, int j)
protected void
initialize()
Called during construction to establish any subclass-specific state such as different default values than those set by this class.java.util.List<Intersection>
intersect(Line line, Terrain terrain)
Compute the intersections of a specified line with this shape.java.lang.String
isExportFormatSupported(java.lang.String mimeType)
Does this object support a certain export format?protected boolean
isOrderedRenderableValid(DrawContext dc)
Determines whether this shape's ordered renderable state is valid and can be rendered.protected void
makeNormals()
void
moveTo(Position position)
Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.protected boolean
mustApplyTexture(DrawContext dc)
Indicates whether texture should be applied to this shape.protected boolean
mustRegenerateGeometry(DrawContext dc)
Indicates whether this shape's renderable geometry must be recomputed, either as a result of an attribute or property change or the expiration of the geometry regeneration interval.protected void
putVec(int i, int j, Vec4 vec, java.nio.FloatBuffer buffer)
void
setAzimuth(Angle azimuth)
Specifies an angle clockwise from north by which to rotate the model.void
setColorRamp(java.awt.image.BufferedImage image)
Specifies an image to use as the color ramp for the model.void
setElevationAngle(Angle elevationAngle)
Specifies an angle to rotate the model vertically counterclockwise from the horizon.void
setGainOffset(double gainOffset)
Specifies the gain offset in the formula: gain plotted = gain * gain scale + gain offset.void
setGainScale(double gainScale)
Specifies the gain scale in the formula: gain plotted = gain * gain scale + gain offset.void
setPhiResolution(int numTPoints)
Specifies the number of plotted points in this model's longitudinal direction.void
setPosition(Position position)
Specifies the position of this model's center.void
setThetaResolution(int numSPoints)
Specifies the number of plotted points in this model's north-south direction.protected boolean
shouldUseVBOs(DrawContext dc)
Indicates whether this shape should use OpenGL vertex buffer objects.-
Methods inherited from class gov.nasa.worldwind.render.AbstractShape
addOrderedRenderable, beginDrawing, checkViewDistanceExpiration, clearCachedVbos, computeExtentFromPositions, computePoint, computePoint, countTriangleVertices, createPickedObject, createSurfaceShape, determineActiveAttributes, doDrag, doDrawOrderedRenderable, doGetRestorableState, doRestoreState, drag, drawBatched, drawInterior, drawOrderedRenderable, drawOutline, endDrawing, export, exportAsKML, getActiveAttributes, getAltitudeMode, getAttributes, getCurrentData, getDelegateOwner, getDistanceFromEye, getExtent, getGeometryRegenerationInterval, getHighlightAttributes, getOutlinePickWidth, getReferencePoint, getRestorableState, getVboIds, intersectsFrustum, isDragEnabled, isEnableBatchPicking, isEnableBatchRendering, isEnableDepthOffset, isHighlighted, isTerrainDependent, isViewDistanceExpiration, isVisible, makeOrderedRenderable, makeTexture, move, moveTo, mustApplyLighting, mustApplyLighting, mustCreateNormals, mustCreateNormals, mustDrawInterior, mustDrawOutline, pick, prepareToDrawInterior, prepareToDrawOutline, preRender, render, reset, restoreState, setAltitudeMode, setAttributes, setDelegateOwner, setDragEnabled, setEnableBatchPicking, setEnableBatchRendering, setEnableDepthOffset, setGeometryRegenerationInterval, setHighlightAttributes, setHighlighted, setOutlinePickWidth, setReferencePosition, setViewDistanceExpiration, setVisible, updateSurfaceShape
-
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
-
DISPLAY_MODE_FILL
public static final int DISPLAY_MODE_FILL
- See Also:
- Constant Field Values
-
DISPLAY_MODE_LINE
public static final int DISPLAY_MODE_LINE
- See Also:
- Constant Field Values
-
DISPLAY_MODE_POINT
public static final int DISPLAY_MODE_POINT
- See Also:
- Constant Field Values
-
nThetaIntervals
protected int nThetaIntervals
-
nPhiIntervals
protected int nPhiIntervals
-
texture
protected WWTexture texture
-
interpolator
protected Interpolator2D interpolator
-
position
protected Position position
-
azimuth
protected Angle azimuth
-
elevationAngle
protected Angle elevationAngle
-
gainOffset
protected double gainOffset
-
gainScale
protected double gainScale
-
nThetaPoints
protected int nThetaPoints
-
nPhiPoints
protected int nPhiPoints
-
-
Constructor Detail
-
AntennaModel
public AntennaModel(Interpolator2D interpolator)
-
-
Method Detail
-
createCacheEntry
protected AbstractShape.AbstractShapeData createCacheEntry(DrawContext dc)
Description copied from class:AbstractShape
Creates and returns a new cache entry specific to the subclass.- Specified by:
createCacheEntry
in classAbstractShape
- Parameters:
dc
- the current draw context.- Returns:
- a data cache entry for the state in the specified draw context.
-
getCurrent
protected AntennaModel.ShapeData getCurrent()
Returns the current shape data cache entry.- Returns:
- the current data cache entry.
-
initialize
protected void initialize()
Description copied from class:AbstractShape
Called during construction to establish any subclass-specific state such as different default values than those set by this class.- Specified by:
initialize
in classAbstractShape
-
getPosition
public Position getPosition()
-
setPosition
public void setPosition(Position position)
Specifies the position of this model's center.- Parameters:
position
- the position of this model's center.
-
getAzimuth
public Angle getAzimuth()
-
setAzimuth
public void setAzimuth(Angle azimuth)
Specifies an angle clockwise from north by which to rotate the model.- Parameters:
azimuth
- the angle from north.
-
getElevationAngle
public Angle getElevationAngle()
-
setElevationAngle
public void setElevationAngle(Angle elevationAngle)
Specifies an angle to rotate the model vertically counterclockwise from the horizon. The rotation is a right-handed rotation relative to the X axis.- Parameters:
elevationAngle
- the elevation angle.
-
getGainOffset
public double getGainOffset()
-
setGainOffset
public void setGainOffset(double gainOffset)
Specifies the gain offset in the formula: gain plotted = gain * gain scale + gain offset. The default gain offset is 0.- Parameters:
gainOffset
- the gain offset.
-
getGainScale
public double getGainScale()
-
setGainScale
public void setGainScale(double gainScale)
Specifies the gain scale in the formula: gain plotted = gain * gain scale + gain offset. The default gain scale is 1.- Parameters:
gainScale
- the gain offset.
-
getThetaResolution
public int getThetaResolution()
-
setThetaResolution
public void setThetaResolution(int numSPoints)
Specifies the number of plotted points in this model's north-south direction. The default is 61.- Parameters:
numSPoints
- the number of plotted points in the north-south direction. NOTE: this value minus one must divide 360 evenly, as in 31, 61, 91, etc.
-
getPhiResolution
public int getPhiResolution()
-
setPhiResolution
public void setPhiResolution(int numTPoints)
Specifies the number of plotted points in this model's longitudinal direction. The default is 121.- Parameters:
numTPoints
- the number of plotted points in the longitudinal direction. NOTE: this value minus one must divide 360 evenly, as in 31, 61, 91, 181, etc.
-
getRadius
public double getRadius()
-
getReferencePosition
public Position getReferencePosition()
Description copied from interface:Movable
A position associated with the object that indicates its aggregate geographic position. The chosen position varies among implementers of this interface. For objects defined by a list of positions, the reference position is typically the first position in the list. For symmetric objects the reference position is often the center of the object. In many cases the object's reference position may be explicitly specified by the application.- Returns:
- the object's reference position, or null if no reference position is available.
-
setColorRamp
public void setColorRamp(java.awt.image.BufferedImage image)
Specifies an image to use as the color ramp for the model. The image should modulate colors in its horizontal dimension and not modulate the colors in its vertical dimension. Minimum and maximum gain values are mapped respectively to the left-most and right-most color in the image. Intermediate gain values are mapped to the color at their position in the gain interval. The image should be a power of two in both dimensions.- Parameters:
image
- the image containing the color ramp used to color the model.
-
getColorRamp
public java.awt.image.BufferedImage getColorRamp()
-
getExtent
public Extent getExtent(Globe globe, double verticalExaggeration)
Description copied from interface:ExtentHolder
Returns the objects enclosing volume as anExtent
in model coordinates, given a specifiedGlobe
and vertical exaggeration (seeSceneController.getVerticalExaggeration()
.- Specified by:
getExtent
in interfaceExtentHolder
- Overrides:
getExtent
in classAbstractShape
- Parameters:
globe
- the Globe the object is related to.verticalExaggeration
- the vertical exaggeration of the scene containing this object.- Returns:
- the object's Extent in model coordinates.
-
getSector
public Sector getSector()
Description copied from interface:GeographicExtent
Returns the object's geographic extent.- Returns:
- the object's geographic extent.
-
mustApplyTexture
protected boolean mustApplyTexture(DrawContext dc)
Description copied from class:AbstractShape
Indicates whether texture should be applied to this shape. Called during rendering to determine whether texture state should be established during preparation for interior drawing.Note: This method always returns false during the pick pass.
- Specified by:
mustApplyTexture
in classAbstractShape
- Parameters:
dc
- the current draw context- Returns:
- true if texture should be applied, otherwise false.
-
shouldUseVBOs
protected boolean shouldUseVBOs(DrawContext dc)
Description copied from class:AbstractShape
Indicates whether this shape should use OpenGL vertex buffer objects.- Overrides:
shouldUseVBOs
in classAbstractShape
- Parameters:
dc
- the current draw context.- Returns:
- true if this shape should use vertex buffer objects, otherwise false.
-
mustRegenerateGeometry
protected boolean mustRegenerateGeometry(DrawContext dc)
Description copied from class:AbstractShape
Indicates whether this shape's renderable geometry must be recomputed, either as a result of an attribute or property change or the expiration of the geometry regeneration interval.A
AbstractShape.AbstractShapeData
must be current when this method is called.- Overrides:
mustRegenerateGeometry
in classAbstractShape
- Parameters:
dc
- the current draw context.- Returns:
- true if this shape's geometry must be regenerated, otherwise false.
-
doMakeOrderedRenderable
protected boolean doMakeOrderedRenderable(DrawContext dc)
Description copied from class:AbstractShape
Produces the geometry and other state necessary to represent this shape as an ordered renderable. Places this shape on the draw context's ordered renderable list for subsequent rendering. This method is called duringAbstractShape.pick(DrawContext, java.awt.Point)
andAbstractShape.render(DrawContext)
when it's been determined that the shape is likely to be visible.- Specified by:
doMakeOrderedRenderable
in classAbstractShape
- Parameters:
dc
- the current draw context.- Returns:
- true if the ordered renderable state was successfully computed, otherwise false, in which case the current pick or render pass is terminated for this shape. Subclasses should return false if it is not possible to create the ordered renderable state.
- See Also:
AbstractShape.pick(DrawContext, java.awt.Point)
,AbstractShape.render(DrawContext)
-
isOrderedRenderableValid
protected boolean isOrderedRenderableValid(DrawContext dc)
Description copied from class:AbstractShape
Determines whether this shape's ordered renderable state is valid and can be rendered. Called byAbstractShape.makeOrderedRenderable(DrawContext)
just prior to adding the shape to the ordered renderable list.- Specified by:
isOrderedRenderableValid
in classAbstractShape
- Parameters:
dc
- the current draw context.- Returns:
- true if this shape is ready to be rendered as an ordered renderable.
-
doDrawOutline
protected void doDrawOutline(DrawContext dc)
Description copied from class:AbstractShape
Draws this shape's outline. Called immediately after callingAbstractShape.prepareToDrawOutline(DrawContext, ShapeAttributes, ShapeAttributes)
, which establishes OpenGL state for lighting, blending, pick color and line attributes. Subclasses should execute the drawing commands specific to the type of shape.A
AbstractShape.AbstractShapeData
must be current when this method is called.- Specified by:
doDrawOutline
in classAbstractShape
- Parameters:
dc
- the current draw context.
-
doDrawInterior
protected void doDrawInterior(DrawContext dc)
Description copied from class:AbstractShape
Draws this shape's interior. Called immediately after callingAbstractShape.prepareToDrawInterior(DrawContext, ShapeAttributes, ShapeAttributes)
, which establishes OpenGL state for lighting, blending, pick color and interior attributes. Subclasses should execute the drawing commands specific to the type of shape.A
AbstractShape.AbstractShapeData
must be current when this method is called.- Specified by:
doDrawInterior
in classAbstractShape
- Parameters:
dc
- the current draw context.
-
drawModel
public void drawModel(DrawContext dc, int displayMode, boolean showTexture)
-
makeNormals
protected void makeNormals()
-
getVec
protected Vec4 getVec(AntennaModel.ShapeData shapeData, int i, int j)
-
putVec
protected void putVec(int i, int j, Vec4 vec, java.nio.FloatBuffer buffer)
-
fillVBO
protected void fillVBO(DrawContext dc)
Description copied from class:AbstractShape
Fill this shape's vertex buffer objects. If the vertex buffer object resource IDs don't yet exist, create them.A
AbstractShape.AbstractShapeData
must be current when this method is called.- Specified by:
fillVBO
in classAbstractShape
- Parameters:
dc
- the current draw context.
-
moveTo
public void moveTo(Position position)
Description copied from interface:Movable
Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.- Parameters:
position
- the new position of the shape's reference position.
-
intersect
public java.util.List<Intersection> intersect(Line line, Terrain terrain) throws java.lang.InterruptedException
Description copied from class:AbstractShape
Compute the intersections of a specified line with this shape. If the shape's altitude mode is other thanWorldWind.ABSOLUTE
, the shape's geometry is created relative to the specified terrain rather than the terrain used during rendering, which may be at lower level of detail than required for accurate intersection determination.- Specified by:
intersect
in classAbstractShape
- Parameters:
line
- the line to intersect.terrain
- theTerrain
to use when computing the shape's geometry.- Returns:
- a list of intersections identifying where the line intersects the shape, or null if the line does not intersect the shape.
- Throws:
java.lang.InterruptedException
- if the operation is interrupted.- See Also:
Terrain
-
isExportFormatSupported
public java.lang.String isExportFormatSupported(java.lang.String mimeType)
Description copied from interface:Exportable
Does this object support a certain export format?- Specified by:
isExportFormatSupported
in interfaceExportable
- Overrides:
isExportFormatSupported
in classAbstractShape
- Parameters:
mimeType
- Desired export format.- Returns:
- One of
Exportable.FORMAT_SUPPORTED
,Exportable.FORMAT_NOT_SUPPORTED
, orExportable.FORMAT_PARTIALLY_SUPPORTED
. - See Also:
Exportable.export(String, Object)
-
doExportAsKML
protected void doExportAsKML(javax.xml.stream.XMLStreamWriter xmlWriter) throws java.io.IOException, javax.xml.stream.XMLStreamException
Description copied from class:AbstractShape
Exports shape-specific fields.- Specified by:
doExportAsKML
in classAbstractShape
- Parameters:
xmlWriter
- the export writer to write to.- Throws:
java.io.IOException
- if an IO error occurs while writing to the output destination.javax.xml.stream.XMLStreamException
- if an exception occurs converting this shape's fields to XML.
-
-