|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgov.nasa.worldwind.examples.analytics.AnalyticSurface
public class AnalyticSurface
AnalyticSurface represents a connected grid of geographic locations, covering a specified Sector at a
specified base altitude in meters. The number of grid locations is defined by the AnalyticSurface's dimensions. The
default dimensions are (10, 10). Callers specify the dimensions by using one of the constructors
accepting width and height, or by invoking setDimensions(int, int). Each grid
point has the following set of attributes:
setValues(Iterable) with an Iterable of AnalyticSurface.GridPointAttributes. Grid points are assigned attributes
from this iterable staring at the upper left hand corner, and proceeding in row-first order across the grid. The
iterable should contain at least width * height values, where width and height are the AnalyticSurface's
grid dimensions. If the caller does not specify any GridPointAttributes, or the caller specified iterable contains
too few values, the unassigned grid points are given default attributes: the default scalar value is 0, the default
color is Color.BLACK, and the default opacity is 1 (totally opaque).
| Nested Class Summary | |
|---|---|
static interface |
AnalyticSurface.GridPointAttributes
GridPointAttributes defines the properties associated with a single grid point of an AnalyticSurface. |
protected static class |
AnalyticSurface.OrderedSurface
|
protected static class |
AnalyticSurface.OrderedSurfaceShadow
|
protected static class |
AnalyticSurface.RenderInfo
|
protected static class |
AnalyticSurface.SurfaceShadow
|
| Constructor Summary | |
|---|---|
AnalyticSurface()
Constructs a new AnalyticSurface with the default Sector Sector.EMPTY_SECTOR, the default altitude of 0
meters, default dimensions of (10, 10), and default AnalyticSurface.GridPointAttributes. |
|
AnalyticSurface(int width,
int height)
Constructs a new AnalyticSurface with the specified grid dimensions. |
|
AnalyticSurface(Sector sector,
double altitude)
Constructs a new AnalyticSurface with the specified Sector and base altitude in meters. |
|
AnalyticSurface(Sector sector,
double altitude,
int width,
int height)
Constructs a new AnalyticSurface with the specified Sector, base altitude in meters, and grid dimensions. |
|
AnalyticSurface(Sector sector,
double altitude,
int width,
int height,
java.lang.Iterable<? extends AnalyticSurface.GridPointAttributes> iterable)
Constructs a new AnalyticSurface with the specified Sector, base altitude in meters, grid dimensions, and
iterable of GridPointAttributes. |
|
| Method Summary | |
|---|---|
protected void |
beginShapeRendering(DrawContext dc)
|
protected double[] |
computeExtremeAltitudes(double minValue,
double maxValue)
|
static double[] |
computeExtremeValues(java.lang.Iterable<? extends AnalyticSurface.GridPointAttributes> iterable)
Returns the minimum and maximum values in the specified iterable of AnalyticSurface.GridPointAttributes. |
static double[] |
computeExtremeValues(java.lang.Iterable<? extends AnalyticSurface.GridPointAttributes> iterable,
double missingDataSignal)
Returns the minimum and maximum values in the specified iterable of AnalyticSurface.GridPointAttributes. |
protected static void |
computeNormalsFromIndexedTriStrip(int numIndices,
BufferWrapper indexBuffer,
int numVertices,
VecBuffer vertexBuffer,
VecBuffer outNormalBuffer)
|
static AnalyticSurface.GridPointAttributes |
createColorGradientAttributes(double value,
double minValue,
double maxValue,
double minHue,
double maxHue)
Returns a new instance of AnalyticSurface.GridPointAttributes with Color and opacity computed by the specified value and
value range. |
static java.lang.Iterable<? extends AnalyticSurface.GridPointAttributes> |
createColorGradientValues(BufferWrapper values,
double missingDataSignal,
double minValue,
double maxValue,
double minHue,
double maxHue)
Returns a new iterable populated with AnalyticSurface.GridPointAttributes computed by invoking createColorGradientAttributes(double, double, double, double, double) for each double value in the speicfied
BufferWrapper. |
static java.lang.Iterable<? extends AnalyticSurface.GridPointAttributes> |
createDefaultValues(int count)
Returns a new iterable populated with the default AnalyticSurface.GridPointAttributes. |
static AnalyticSurface.GridPointAttributes |
createGridPointAttributes(double value,
java.awt.Color color,
double opacity)
Returns a new instance of AnalyticSurface.GridPointAttributes with the specified value, color, and opacity. |
protected void |
doPreRender(DrawContext dc)
|
protected void |
doRender(DrawContext dc)
|
protected void |
doUpdate(DrawContext dc)
|
protected void |
drawShape(DrawContext dc)
|
protected void |
drawShapeInterior(DrawContext dc)
|
protected void |
drawShapeOutline(DrawContext dc)
|
protected void |
drawSurface(DrawContext dc)
|
protected void |
drawSurfaceShadow(DrawContext dc)
|
protected void |
endShapeRendering(DrawContext dc)
|
double |
getAltitude()
Returns this surface's base altitude, in meters. |
Layer |
getClientLayer()
Returns the layer associated with this surface during picking. |
int[] |
getDimensions()
Returns the number of horizontal and vertical points composing this surface as an array with two values. |
Extent |
getExtent(DrawContext dc)
Returns this surface's extent in model coordinates. |
java.lang.Object |
getPickObject()
Returns the object which is associated with this surface during picking. |
Sector |
getSector()
Returns the Sector defining the geographic boundary of this surface. |
AnalyticSurfaceAttributes |
getSurfaceAttributes()
Returns a copy of the rendering attributes associated with this surface. |
java.lang.Iterable<? extends AnalyticSurface.GridPointAttributes> |
getValues()
Returns the surface's iterable of AnalyticSurface.GridPointAttributes. |
double |
getVerticalScale()
Returns the scale applied to the value at each grid point. |
protected boolean |
isExpired(DrawContext dc)
|
boolean |
isVisible()
Returns true if the surface is visible in the scene, and false otherwise. |
void |
preRender(DrawContext dc)
|
void |
render(DrawContext dc)
Causes this Renderable to render itself using the DrawContext provided. |
void |
setAltitude(double altitude)
Sets this surface's base altitude, in meters. |
void |
setClientLayer(Layer layer)
Sets the layer associated with this surface during picking. |
void |
setDimensions(int width,
int height)
Sets the number of horizontal and vertical points composing this surface. |
protected void |
setExpired(boolean expired)
|
void |
setPickObject(java.lang.Object pickObject)
Sets the object associated with this surface during picking. |
void |
setSector(Sector sector)
Sets this surface's geographic boundary, as a Sector. |
void |
setSurfaceAttributes(AnalyticSurfaceAttributes attributes)
Sets the rendering attributes associated with this surface. |
void |
setValues(java.lang.Iterable<? extends AnalyticSurface.GridPointAttributes> iterable)
Sets this surface's iterable of AnalyticSurface.GridPointAttributes. |
void |
setVerticalScale(double scale)
Sets the scale applied to the value at each grid point. |
void |
setVisible(boolean visible)
Sets whether or not the surface is visible in the scene. |
protected static BufferWrapper |
tessellateInteriorAsTriStrip(int width,
int height,
BufferFactory factory)
|
protected static BufferWrapper |
tessellateOutlineAsLineStrip(int width,
int height,
BufferFactory factory)
|
protected void |
update(DrawContext dc)
|
protected void |
updateSurfaceNormals(AnalyticSurface.RenderInfo outRenderInfo)
|
protected void |
updateSurfacePoint(DrawContext dc,
int x,
int y,
Angle lat,
Angle lon,
AnalyticSurface.GridPointAttributes attr,
Vec4 referencePoint,
AnalyticSurface.RenderInfo outRenderInfo)
|
protected void |
updateSurfacePoints(DrawContext dc,
Vec4 referencePoint,
AnalyticSurface.RenderInfo outRenderInfo)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected double altitude
protected Layer clientLayer
protected static final double DEFAULT_ALTITUDE
protected static final java.awt.Color DEFAULT_COLOR
protected static final int DEFAULT_DIMENSION
protected static final AnalyticSurface.GridPointAttributes DEFAULT_GRID_POINT_ATTRIBUTES
protected static final double DEFAULT_OPACITY
protected static final java.awt.Color DEFAULT_SHADOW_COLOR
protected static final double DEFAULT_VALUE
protected boolean expired
protected double[] extremeValues
protected final float[] floatArray
protected java.lang.Object globeStateKey
protected int height
protected static final double MIN_DISTANCE_FROM_EYE
protected java.lang.Object pickObject
protected final PickSupport pickSupport
protected Vec4 referencePoint
protected Sector sector
protected final OGLStackHandler stackHandler
protected AnalyticSurfaceAttributes surfaceAttributes
protected AnalyticSurface.RenderInfo surfaceRenderInfo
protected AnalyticSurface.SurfaceShadow surfaceShadow
protected TiledSurfaceObjectRenderer surfaceShadowRenderer
protected boolean updateFailed
protected java.lang.Iterable<? extends AnalyticSurface.GridPointAttributes> values
protected double verticalScale
protected boolean visible
protected int width
| Constructor Detail |
|---|
public AnalyticSurface()
Sector.EMPTY_SECTOR, the default altitude of 0
meters, default dimensions of (10, 10), and default AnalyticSurface.GridPointAttributes.
public AnalyticSurface(int width,
int height)
Sector.EMPTY_SECTOR, the default altitude of 0 meters, and default AnalyticSurface.GridPointAttributes.
width - the surface grid width, in number of grid points.height - the surface grid height, in number of grid points.
java.lang.IllegalArgumentException - if the sector is null.
public AnalyticSurface(Sector sector,
double altitude)
Sector and base altitude in meters. The new
AnalyticSurface has default dimensions of (10, 10), and default AnalyticSurface.GridPointAttributes.
sector - the Sector which defines the surface's geographic region.altitude - the base altitude to place the surface at, in meters.
java.lang.IllegalArgumentException - if the sector is null.
public AnalyticSurface(Sector sector,
double altitude,
int width,
int height)
Sector, base altitude in meters, and grid dimensions.
The new AnalyticSurface has the default AnalyticSurface.GridPointAttributes.
sector - the Sector which defines the surface's geographic region.altitude - the base altitude to place the surface at, in meters.width - the surface grid width, in number of grid points.height - the surface grid height, in number of grid points.
java.lang.IllegalArgumentException - if the sector is null, if the width is less than 1, or if the height is less
than 1.
public AnalyticSurface(Sector sector,
double altitude,
int width,
int height,
java.lang.Iterable<? extends AnalyticSurface.GridPointAttributes> iterable)
Sector, base altitude in meters, grid dimensions, and
iterable of GridPointAttributes. The iterable should contain at least with * height non-null
GridPointAttributes.
sector - the Sector which defines the surface's geographic region.altitude - the base altitude to place the surface at, in meters.width - the surface grid width, in number of grid points.height - the surface grid height, in number of grid points.iterable - the attributes associated with each grid point.
java.lang.IllegalArgumentException - if the sector is null, if the width is less than 1, if the height is less than
1, or if the iterable is null.| Method Detail |
|---|
protected void beginShapeRendering(DrawContext dc)
protected double[] computeExtremeAltitudes(double minValue,
double maxValue)
public static double[] computeExtremeValues(java.lang.Iterable<? extends AnalyticSurface.GridPointAttributes> iterable)
AnalyticSurface.GridPointAttributes. Values
equivalent to Double.NaN are ignored. This returns null if the buffer is empty or contains only NaN
values.
iterable - the GridPointAttributes to search for the minimum and maximum value.
java.lang.IllegalArgumentException - if the iterable is null.
public static double[] computeExtremeValues(java.lang.Iterable<? extends AnalyticSurface.GridPointAttributes> iterable,
double missingDataSignal)
AnalyticSurface.GridPointAttributes. Values
equivalent to the specified missingDataSignal are ignored. This returns null if the iterable is
empty or contains only missing values.
iterable - the GridPointAttributes to search for the minimum and maximum value.missingDataSignal - the number indicating a specific value to ignore.
java.lang.IllegalArgumentException - if the iterable is null.
protected static void computeNormalsFromIndexedTriStrip(int numIndices,
BufferWrapper indexBuffer,
int numVertices,
VecBuffer vertexBuffer,
VecBuffer outNormalBuffer)
public static AnalyticSurface.GridPointAttributes createColorGradientAttributes(double value,
double minValue,
double maxValue,
double minHue,
double maxHue)
AnalyticSurface.GridPointAttributes with Color and opacity computed by the specified value and
value range. The color hue is computed by mapping value's relative position in the range [minValue,
maxValue] to the range of color hues [minHue, maxHue]. The opacity is computed by mapping the
values's relative position in the range [minValue, minValue + (maxValue - minValue) / 10] to the
opacity range [0, 1]. This has the effect of interpolating hue and opacity based on the grid point
value.
value - the new GridPointAttributes' value.minValue - the minimum value.maxValue - the maximum value.minHue - the mimimum color hue, corresponding to the minimum value.maxHue - the maximum color hue, corresponding to the maximum value.
public static java.lang.Iterable<? extends AnalyticSurface.GridPointAttributes> createColorGradientValues(BufferWrapper values,
double missingDataSignal,
double minValue,
double maxValue,
double minHue,
double maxHue)
AnalyticSurface.GridPointAttributes computed by invoking createColorGradientAttributes(double, double, double, double, double) for each double value in the speicfied
BufferWrapper. Values equivalent to the specified missingDataSignal are replaced with the
specified minValue.
values - the buffer of values.missingDataSignal - the number indicating a specific value to ignore.minValue - the minimum value.maxValue - the maximum value.minHue - the mimimum color hue, corresponding to the minimum value.maxHue - the maximum color hue, corresponding to the maximum value.
public static java.lang.Iterable<? extends AnalyticSurface.GridPointAttributes> createDefaultValues(int count)
AnalyticSurface.GridPointAttributes. The default GridPointAttributes
have a value of 0, the color Color.BLACK, and an opacity of 0.
count - the desired number of GridPointAttributes to return.
count default GridPointAttributes.
public static AnalyticSurface.GridPointAttributes createGridPointAttributes(double value,
java.awt.Color color,
double opacity)
AnalyticSurface.GridPointAttributes with the specified value, color, and opacity.
value - the new GridPointAttributes' value.color - the new GridPointAttributes' color.opacity - the new GridPointAttributes' opacity.
protected void doPreRender(DrawContext dc)
protected void doRender(DrawContext dc)
protected void doUpdate(DrawContext dc)
protected void drawShape(DrawContext dc)
protected void drawShapeInterior(DrawContext dc)
protected void drawShapeOutline(DrawContext dc)
protected void drawSurface(DrawContext dc)
protected void drawSurfaceShadow(DrawContext dc)
protected void endShapeRendering(DrawContext dc)
public double getAltitude()
public Layer getClientLayer()
public int[] getDimensions()
public Extent getExtent(DrawContext dc)
dc - the current DrawContext.
java.lang.IllegalArgumentException - if the DrawContext is null.public java.lang.Object getPickObject()
public Sector getSector()
Sector defining the geographic boundary of this surface.
public AnalyticSurfaceAttributes getSurfaceAttributes()
setSurfaceAttributes(AnalyticSurfaceAttributes) with the modified attributes.
public java.lang.Iterable<? extends AnalyticSurface.GridPointAttributes> getValues()
AnalyticSurface.GridPointAttributes. See setValues(Iterable) for details on
how this iterable is interpreted by AnalyticSurface.
public double getVerticalScale()
protected boolean isExpired(DrawContext dc)
public boolean isVisible()
public void preRender(DrawContext dc)
preRender in interface PreRenderabledc - public void render(DrawContext dc)
Renderable to render itself using the DrawContext provided. The
DrawContext provides the elevation model, openGl instance, globe and other information required for
drawing. It is recommended that the DrawContext is non-null as most implementations do not support
null DrawContexts.
render in interface Renderabledc - the DrawContext to be usedDrawContextpublic void setAltitude(double altitude)
altitude - the new base altitude, in meters.public void setClientLayer(Layer layer)
layer - this surface's pick layer.
public void setDimensions(int width,
int height)
width - the new grid width.height - the new grid height.
java.lang.IllegalArgumentException - if either width or heigth are less than 1.protected void setExpired(boolean expired)
public void setPickObject(java.lang.Object pickObject)
pickObject - the object to associated with this surface during picking. A null value is permitted and
indicates that the surface itself will be the object returned during picking.public void setSector(Sector sector)
Sector.
sector - this surface's new geographic boundary, as a Sector.
java.lang.IllegalArgumentException - if the surface is null.public void setSurfaceAttributes(AnalyticSurfaceAttributes attributes)
attributes - this surface's new rendering attributes.
java.lang.IllegalArgumentException - if attributes is null.public void setValues(java.lang.Iterable<? extends AnalyticSurface.GridPointAttributes> iterable)
AnalyticSurface.GridPointAttributes. Grid points are assigned attributes from this
iterable staring at the upper left hand corner, and proceeding in row-first order across the grid. The iterable
should contain at least width * height values, where width and height are the AnalyticSurface's grid
dimensions. If the iterable contains too few values, the unassigned grid points are given default attributes: the
default scalar value is 0, the default color is Color.BLACK, and the default opacity is 1
(totally opaque).
iterable - the new grid point attributes.
java.lang.IllegalArgumentException - if the iterable is null.public void setVerticalScale(double scale)
scale - the surface's vertical scale coefficient.public void setVisible(boolean visible)
visible - true to make the surface visible, and false to make it hidden.
protected static BufferWrapper tessellateInteriorAsTriStrip(int width,
int height,
BufferFactory factory)
protected static BufferWrapper tessellateOutlineAsLineStrip(int width,
int height,
BufferFactory factory)
protected void update(DrawContext dc)
protected void updateSurfaceNormals(AnalyticSurface.RenderInfo outRenderInfo)
protected void updateSurfacePoint(DrawContext dc,
int x,
int y,
Angle lat,
Angle lon,
AnalyticSurface.GridPointAttributes attr,
Vec4 referencePoint,
AnalyticSurface.RenderInfo outRenderInfo)
protected void updateSurfacePoints(DrawContext dc,
Vec4 referencePoint,
AnalyticSurface.RenderInfo outRenderInfo)
|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||