Package gov.nasa.worldwind.render
Interface ShapeAttributes
-
- All Superinterfaces:
Exportable
- All Known Subinterfaces:
AirspaceAttributes
,BalloonAttributes
- All Known Implementing Classes:
BasicAirspaceAttributes
,BasicBalloonAttributes
,BasicShapeAttributes
public interface ShapeAttributes extends Exportable
Holds common attributes for WorldWind shapes such asPath
,Polygon
, andSurfaceShape
. Changes made to the attributes are applied to the shape when theWorldWindow
renders the next frame. Instances ofShapeAttributes
may be shared by many shapes, thereby reducing the memory normally required to store attributes for each shape.
-
-
Field Summary
-
Fields inherited from interface gov.nasa.worldwind.Exportable
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ShapeAttributes
copy()
Returns a new ShapeAttributes instance of the same type as this ShapeAttributes who's properties are configured exactly as this ShapeAttributes.void
copy(ShapeAttributes attributes)
Copies the specified ShapeAttributes' properties into this object's properties.double
getImageScale()
Indicates the amount the shape's texture is scaled by as a floating-point value.java.lang.Object
getImageSource()
Indicates the image source that is applied as a texture to the shape's interior.Material
getInteriorMaterial()
Indicates the material properties of the shape's interior.double
getInteriorOpacity()
Indicates the opacity of the shape's interior as a floating-point value in the range 0.0 to 1.0.Material
getOutlineMaterial()
Indicates the material properties of the shape's outline.double
getOutlineOpacity()
Indicates the opacity of the shape's outline as a floating-point value in the range 0.0 to 1.0.int
getOutlineStippleFactor()
Indicates the number of times each bit in the outline stipple pattern is repeated before the next bit is used.short
getOutlineStipplePattern()
Indicates the 16-bit integer that defines which pixels are rendered in the shape's outline.double
getOutlineWidth()
Indicates the line width (in pixels) used when rendering the shape's outline.void
getRestorableState(RestorableSupport rs, RestorableSupport.StateObject so)
Saves the attributes' current state in the specifiedRestorableSupport
.boolean
isDrawInterior()
Indicates whether the shape's interior geometry is drawn.boolean
isDrawOutline()
Indicates whether the shape's outline geometry is drawn.boolean
isEnableAntialiasing()
Indicates whether the shape is rendered with smooth lines and edges.boolean
isEnableLighting()
Indicates whether lighting is applied to the shape.boolean
isUnresolved()
Indicates whether some of the shape's attributes are unresolved.void
restoreState(RestorableSupport rs, RestorableSupport.StateObject so)
Restores the state of any attributes contained in the specifiedRestorableSupport
.void
setDrawInterior(boolean draw)
Specifies whether to draw the shape's interior geometry.void
setDrawOutline(boolean draw)
Specifies whether to draw the shape's outline geometry.void
setEnableAntialiasing(boolean enable)
Specifies whether the shape should be rendered with smooth lines and edges.void
setEnableLighting(boolean enableLighting)
Specifies whether to apply lighting to the shape.void
setImageScale(double scale)
Specifies the amount to scale the shape's texture as a floating-point value.void
setImageSource(java.lang.Object imageSource)
Specifies the image source to apply as a texture to the shape's interior, ornull
to specify that the shape should not have a texture.void
setInteriorMaterial(Material material)
Specifies the material properties of the shape's interior.void
setInteriorOpacity(double opacity)
Specifies the opacity of the shape's interior as a floating-point value in the range 0.0 to 1.0.void
setOutlineMaterial(Material material)
Specifies the material properties of the shape's outline.void
setOutlineOpacity(double opacity)
Specifies the opacity of the shape's outline as a floating-point value in the range 0.0 to 1.0.void
setOutlineStippleFactor(int factor)
Specifies the number of times each bit in the outline stipple pattern should be repeated before the next bit is used.void
setOutlineStipplePattern(short pattern)
Specifies a 16-bit integer that defines which pixels are rendered in the shape's outline.void
setOutlineWidth(double width)
Specifies the line width (in pixels) to use when rendering the shape's outline.void
setUnresolved(boolean unresolved)
Specifies whether some of the shape's attributes are unresolved.-
Methods inherited from interface gov.nasa.worldwind.Exportable
export, isExportFormatSupported
-
-
-
-
Method Detail
-
copy
ShapeAttributes copy()
Returns a new ShapeAttributes instance of the same type as this ShapeAttributes who's properties are configured exactly as this ShapeAttributes.- Returns:
- a copy of this ShapeAttributes.
-
copy
void copy(ShapeAttributes attributes)
Copies the specified ShapeAttributes' properties into this object's properties. This does nothing if the specified attributes isnull
.- Parameters:
attributes
- the attributes to copy.
-
isUnresolved
boolean isUnresolved()
Indicates whether some of the shape's attributes are unresolved.- Returns:
true
to indicate that one or more attributes are unresolved, otherwisefalse
.- See Also:
setUnresolved(boolean)
-
setUnresolved
void setUnresolved(boolean unresolved)
Specifies whether some of the shape's attributes are unresolved. This can be used to denote that a shape's attributes are being retrieved from a non-local resource. During retrieval, the controlling code sets unresolved totrue
, then sets it tofalse
once the retrieval is complete. Code that interprets the attributes knows that the attributes are complete when unresolved isfalse
.- Parameters:
unresolved
-true
to specify that one or more attributes are unresolved, otherwisefalse
.- See Also:
isUnresolved()
-
isDrawInterior
boolean isDrawInterior()
Indicates whether the shape's interior geometry is drawn.- Returns:
true
if the shape's interior is drawn, otherwisefalse
.- See Also:
setDrawInterior(boolean)
-
setDrawInterior
void setDrawInterior(boolean draw)
Specifies whether to draw the shape's interior geometry.- Parameters:
draw
-true
to draw the shape's interior, otherwisefalse
.- See Also:
isDrawInterior()
-
isDrawOutline
boolean isDrawOutline()
Indicates whether the shape's outline geometry is drawn.- Returns:
true
if the shape's outline is drawn, otherwisefalse
.- See Also:
setDrawOutline(boolean)
-
setDrawOutline
void setDrawOutline(boolean draw)
Specifies whether to draw the shape's outline geometry.- Parameters:
draw
-true
to draw the shape's outline, otherwisefalse
.- See Also:
isDrawOutline()
-
isEnableAntialiasing
boolean isEnableAntialiasing()
Indicates whether the shape is rendered with smooth lines and edges.- Returns:
true
if the shape is drawn with smooth lines and edges, otherwisefalse
.- See Also:
setEnableAntialiasing(boolean)
-
setEnableAntialiasing
void setEnableAntialiasing(boolean enable)
Specifies whether the shape should be rendered with smooth lines and edges.- Parameters:
enable
-true
to draw the shape with smooth lines and edges, otherwisefalse
.- See Also:
isEnableAntialiasing()
-
isEnableLighting
boolean isEnableLighting()
Indicates whether lighting is applied to the shape.- Returns:
true
to apply lighting, otherwisefalse
.- See Also:
setEnableLighting(boolean)
-
setEnableLighting
void setEnableLighting(boolean enableLighting)
Specifies whether to apply lighting to the shape. By default, the shape is lit using theDrawContext
's standard lighting by callingDrawContext.beginStandardLighting()
andDrawContext.endStandardLighting()
before and after the shape is rendered, respectively.- Parameters:
enableLighting
-true
to apply lighting, otherwisefalse
.- See Also:
isEnableLighting()
-
getInteriorMaterial
Material getInteriorMaterial()
Indicates the material properties of the shape's interior. If lighting is applied to the shape, this indicates the interior's ambient, diffuse, and specular colors, its shininess, and the color of any emitted light. Otherwise, the material's diffuse color indicates the shape's constant interior color.- Returns:
- the material applied to the shape's interior.
- See Also:
setInteriorMaterial(Material)
-
setInteriorMaterial
void setInteriorMaterial(Material material)
Specifies the material properties of the shape's interior. If lighting is applied to the shape, this specifies the interior's ambient, diffuse, and specular colors, its shininess, and the color of any emitted light. Otherwise, the material's diffuse color specifies the shape's constant interior color.- Parameters:
material
- the material to apply to the shape's interior.- Throws:
java.lang.IllegalArgumentException
- ifmaterial
isnull
.- See Also:
getInteriorMaterial()
-
getOutlineMaterial
Material getOutlineMaterial()
Indicates the material properties of the shape's outline. If lighting is applied to the shape, this indicates the outline's ambient, diffuse, and specular colors, its shininess, and the color of any emitted light. Otherwise, the material's diffuse color indicates the shape's constant outline color.- Returns:
- the material applied to the shape's outline.
- See Also:
setOutlineMaterial(Material)
-
setOutlineMaterial
void setOutlineMaterial(Material material)
Specifies the material properties of the shape's outline. If lighting is applied to the shape, this specifies the outline's ambient, diffuse, and specular colors, its shininess, and the color of any emitted light. Otherwise, the material's diffuse color specifies as the shape's constant outline color.- Parameters:
material
- the material to apply to the shape's outline.- Throws:
java.lang.IllegalArgumentException
- ifmaterial
isnull
.- See Also:
getOutlineMaterial()
-
getInteriorOpacity
double getInteriorOpacity()
Indicates the opacity of the shape's interior as a floating-point value in the range 0.0 to 1.0.- Returns:
- the interior opacity as a floating-point value from 0.0 to 1.0.
- See Also:
setInteriorOpacity(double)
-
setInteriorOpacity
void setInteriorOpacity(double opacity)
Specifies the opacity of the shape's interior as a floating-point value in the range 0.0 to 1.0. A value of 1.0 specifies a completely opaque interior, and 0.0 specifies a completely transparent interior. Values in between specify a partially transparent interior.- Parameters:
opacity
- the interior opacity as a floating-point value from 0.0 to 1.0.- Throws:
java.lang.IllegalArgumentException
- ifopacity
is less than 0.0 or greater than 1.0.- See Also:
getInteriorOpacity()
-
getOutlineOpacity
double getOutlineOpacity()
Indicates the opacity of the shape's outline as a floating-point value in the range 0.0 to 1.0.- Returns:
- the outline opacity as a floating-point value from 0.0 to 1.0.
- See Also:
setOutlineOpacity(double)
-
setOutlineOpacity
void setOutlineOpacity(double opacity)
Specifies the opacity of the shape's outline as a floating-point value in the range 0.0 to 1.0. A value of 1.0 specifies a completely opaque outline, and 0.0 specifies a completely transparent outline. Values in between specify a partially transparent outline.- Parameters:
opacity
- the outline opacity as a floating-point value from 0.0 to 1.0.- Throws:
java.lang.IllegalArgumentException
- ifopacity
is less than 0.0 or greater than 1.0.- See Also:
getOutlineOpacity()
-
getOutlineWidth
double getOutlineWidth()
Indicates the line width (in pixels) used when rendering the shape's outline. The returned value is either zero or a positive floating-point value.- Returns:
- the line width in pixels.
- See Also:
setOutlineWidth(double)
-
setOutlineWidth
void setOutlineWidth(double width)
Specifies the line width (in pixels) to use when rendering the shape's outline. The specifiedwidth
must be zero or a positive floating-point value. Specifying a line width of zero disables the shape's outline. Thewidth
may be limited by an implementation-defined maximum during rendering. The maximum width is typically 10 pixels.- Parameters:
width
- the line width in pixels.- Throws:
java.lang.IllegalArgumentException
- ifwidth
is less than zero.- See Also:
getOutlineWidth()
-
getOutlineStippleFactor
int getOutlineStippleFactor()
Indicates the number of times each bit in the outline stipple pattern is repeated before the next bit is used.- Returns:
- the number of times each bit in the outline stipple pattern is repeated.
- See Also:
setOutlineStippleFactor(int)
-
setOutlineStippleFactor
void setOutlineStippleFactor(int factor)
Specifies the number of times each bit in the outline stipple pattern should be repeated before the next bit is used. For example, iffactor
is 3, each bit is repeated 3 times before using the next bit. The specifiedfactor
must be either zero or an integer greater than zero. Thefactor
may be limited by an implementation-defined maximum during rendering. The maximum stipple factor is typically 256.To disable outline stippling, either specify a stipple factor of 0, or specify a stipple pattern of all 1 bits:
0xFFFF
.- Parameters:
factor
- the number of times each bit in the outline stipple pattern should be repeated.- Throws:
java.lang.IllegalArgumentException
- iffactor
is less than zero.- See Also:
getOutlineStippleFactor()
,setOutlineStipplePattern(short)
-
getOutlineStipplePattern
short getOutlineStipplePattern()
Indicates the 16-bit integer that defines which pixels are rendered in the shape's outline.- Returns:
- a 16-bit integer whose bit pattern defines which pixels are rendered in the shape's outline.
- See Also:
setOutlineStipplePattern(short)
-
setOutlineStipplePattern
void setOutlineStipplePattern(short pattern)
Specifies a 16-bit integer that defines which pixels are rendered in the shape's outline. Starting at the least significant bit and moving to the most significant bit, the 16 bits define a repeating a pattern of which pixels in the outline are rendered and which are suppressed. Each bit corresponds to a pixel in the shape's outline, and the bit pattern repeats after reaching n*16 pixels, where n is the stipple factor. Each bit is repeated n-times according to the outline stipple factor. For example, if the outline stipple factor is 3, each bit is repeated 3 times before using the next bit.To disable outline stippling, either specify a stipple factor of 0, or specify a stipple pattern of all 1 bits:
0xFFFF
.- Parameters:
pattern
- a 16-bit integer whose bit pattern defines which pixels are rendered in the shape's outline.- See Also:
getOutlineStipplePattern()
,setOutlineStippleFactor(int)
-
getImageSource
java.lang.Object getImageSource()
Indicates the image source that is applied as a texture to the shape's interior.- Returns:
- the source of the shape's texture, either a
String
path, aURL
, aBufferedImage
, ornull
. - See Also:
setImageSource(Object)
-
setImageSource
void setImageSource(java.lang.Object imageSource)
Specifies the image source to apply as a texture to the shape's interior, ornull
to specify that the shape should not have a texture. When notnull
, the texture replaces the shape's interior material. The source type may be one of the following:String
containing a path to a local file, or a resource on the classpath.URL
BufferedImage
null
URL
, it is read only when the shape is rendered.- Parameters:
imageSource
- the source of the shape's texture, either aString
path, aURL
, aBufferedImage
, ornull
.- See Also:
getImageSource()
-
getImageScale
double getImageScale()
Indicates the amount the shape's texture is scaled by as a floating-point value.- Returns:
- the amount the shape's texture is scaled by as a floating-point value. This value is always greater than zero.
- See Also:
setImageScale(double)
-
setImageScale
void setImageScale(double scale)
Specifies the amount to scale the shape's texture as a floating-point value. A value of 1.0 specifies that the texture should be applied without any scaling, a value greater than 1.0 specifies that the texture should be magnified, and a value less than 1.0 specifies that the texture should be minified. For example, a scale of 2.0 magnifies the texture by a factor of 2x.- Parameters:
scale
- the amount to scale the shape's texture as a floating-point value.- Throws:
java.lang.IllegalArgumentException
- ifscale
is less than or equal to zero.- See Also:
getImageScale()
,setImageSource(Object)
-
getRestorableState
void getRestorableState(RestorableSupport rs, RestorableSupport.StateObject so)
Saves the attributes' current state in the specifiedRestorableSupport
. If theStateObject
is notnull
the state is appended to it. Otherwise the state is added to theRestorableSupport
root. This state can be restored later by callingrestoreState(gov.nasa.worldwind.util.RestorableSupport, gov.nasa.worldwind.util.RestorableSupport.StateObject)
.- Parameters:
rs
- theRestorableSupport
that receives the attributes' state.so
- theStateObject
the state is appended to, if notnull
.- Throws:
java.lang.IllegalArgumentException
- ifrs
isnull
.
-
restoreState
void restoreState(RestorableSupport rs, RestorableSupport.StateObject so)
Restores the state of any attributes contained in the specifiedRestorableSupport
. If theStateObject
is notnull
it's searched for attribute state values, otherwise theRestorableSupport
root is searched.- Parameters:
rs
- theRestorableSupport
that contains the attributes' state.so
- theStateObject
to search for state values, if notnull
.- Throws:
java.lang.IllegalArgumentException
- ifrs
isnull
.
-
-