public class BasicShapeAttributes extends java.lang.Object implements ShapeAttributes
ShapeAttributes
interface.Modifier and Type | Field and Description |
---|---|
protected boolean |
drawInterior
Indicates whether or not the shape's interior is drawn.
|
protected boolean |
drawOutline
Indicates whether or not the shape's outline is drawn.
|
protected boolean |
enableAntialiasing
Indicates whether or not the shape should be rendered with smooth lines and edges.
|
protected boolean |
enableLighting
Indicates whether lighting is applied to the shape.
|
protected double |
imageScale
Indicates the amount the balloon's texture is scaled by as a floating-point value.
|
protected java.lang.Object |
imageSource
Indicates the image source that is applied as a texture to the shape's interior.
|
protected Material |
interiorMaterial
Indicates the material properties of the shape's interior.
|
protected double |
interiorOpacity
Indicates the opacity of the shape's interior as a floating-point value in the range 0.0 to 1.0.
|
protected Material |
outlineMaterial
Indicates the material properties of the shape's outline.
|
protected double |
outlineOpacity
Indicates the opacity of the shape's outline as a floating-point value in the range 0.0 to 1.0.
|
protected int |
outlineStippleFactor
Indicates the number of times each bit in the outline stipple pattern is repeated.
|
protected short |
outlineStipplePattern
Indicates the 16-bit integer that defines which pixels are rendered in the shape's outline.
|
protected double |
outlineWidth
Indicates the line width (in pixels) used when rendering the shape's outline.
|
protected boolean |
unresolved
Indicates whether or not some of the shape's attributes are unresolved.
|
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
Constructor and Description |
---|
BasicShapeAttributes()
Creates a new
BasicShapeAttributes with the default attributes. |
BasicShapeAttributes(ShapeAttributes attributes)
Creates a new
BasicShapeAttributes configured with the specified attributes . |
Modifier and Type | Method and 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.
|
boolean |
equals(java.lang.Object o) |
void |
export(java.lang.String mimeType,
java.lang.Object output)
Exports the object to a format.
|
protected void |
exportAsKML(java.lang.Object output)
Export the placemark attributes to KML as a
<Style> element. |
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 specified
RestorableSupport . |
int |
hashCode() |
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.
|
java.lang.String |
isExportFormatSupported(java.lang.String mimeType)
Does this object support a certain export format?
|
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 specified
RestorableSupport . |
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, or
null 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.
|
protected boolean drawInterior
false
.protected boolean drawOutline
false
.protected boolean enableAntialiasing
false
.protected boolean enableLighting
false
.protected double imageScale
protected java.lang.Object imageSource
null
.protected Material interiorMaterial
null
.protected double interiorOpacity
protected Material outlineMaterial
null
.protected double outlineOpacity
protected int outlineStippleFactor
protected short outlineStipplePattern
protected double outlineWidth
protected boolean unresolved
false
.public BasicShapeAttributes()
BasicShapeAttributes
with the default attributes. The default attributes are as
follows:
Attribute | Default Value |
---|---|
unresolved | true |
drawInterior | true |
drawOutline | true |
enableAntialiasing | true |
enableLighting | false |
interiorMaterial | Material.WHITE |
outlineMaterial | Material.BLACK |
interiorOpacity | 1.0 |
outlineOpacity | 1.0 |
outlineWidth | 1.0 |
outlineStippleFactor | 0 |
outlineStipplePattern | 0xF0F0 |
imageSource | null |
imageScale | 1.0 |
public BasicShapeAttributes(ShapeAttributes attributes)
BasicShapeAttributes
configured with the specified attributes
.attributes
- the attributes to configure the new BasicShapeAttributes
with.java.lang.IllegalArgumentException
- if attributes
is null
.public ShapeAttributes copy()
copy
in interface ShapeAttributes
public void copy(ShapeAttributes attributes)
null
.copy
in interface ShapeAttributes
attributes
- the attributes to copy.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public void export(java.lang.String mimeType, java.lang.Object output) throws java.io.IOException, java.lang.UnsupportedOperationException
export
in interface Exportable
mimeType
- Desired export format. Call Exportable.isExportFormatSupported(String)
to make sure that the object
supports the format before trying to export, or be prepared to handle UnsupportedOperationException
.output
- Object that will receive the exported data. The type of this object depends on the export format.
All formats should support java.io.OutputStream
. Text based format (for example, XML
formats) should also support java.io.Writer
. Certain formats may also support other
object types.java.io.IOException
- if an exception occurs while exporting the data.java.lang.UnsupportedOperationException
- if the format is not supported by this object, or if the output
argument is not of a supported type.Exportable.isExportFormatSupported(String)
protected void exportAsKML(java.lang.Object output) throws javax.xml.stream.XMLStreamException
<Style>
element. The output
object will receive the
data. This object must be one of: output
- Object to receive the generated KML.javax.xml.stream.XMLStreamException
- If an exception occurs while writing the KMLexport(String, Object)
public double getImageScale()
getImageScale
in interface ShapeAttributes
ShapeAttributes.setImageScale(double)
public java.lang.Object getImageSource()
getImageSource
in interface ShapeAttributes
String
path, a URL
, a BufferedImage
, or null
.ShapeAttributes.setImageSource(Object)
public Material getInteriorMaterial()
getInteriorMaterial
in interface ShapeAttributes
ShapeAttributes.setInteriorMaterial(Material)
public double getInteriorOpacity()
getInteriorOpacity
in interface ShapeAttributes
ShapeAttributes.setInteriorOpacity(double)
public Material getOutlineMaterial()
getOutlineMaterial
in interface ShapeAttributes
ShapeAttributes.setOutlineMaterial(Material)
public double getOutlineOpacity()
getOutlineOpacity
in interface ShapeAttributes
ShapeAttributes.setOutlineOpacity(double)
public int getOutlineStippleFactor()
getOutlineStippleFactor
in interface ShapeAttributes
ShapeAttributes.setOutlineStippleFactor(int)
public short getOutlineStipplePattern()
getOutlineStipplePattern
in interface ShapeAttributes
ShapeAttributes.setOutlineStipplePattern(short)
public double getOutlineWidth()
getOutlineWidth
in interface ShapeAttributes
ShapeAttributes.setOutlineWidth(double)
public void getRestorableState(RestorableSupport rs, RestorableSupport.StateObject so)
RestorableSupport
. If the
StateObject
is not null
the state is appended to it. Otherwise the state is added to
the RestorableSupport
root. This state can be restored later by calling ShapeAttributes.restoreState(gov.nasa.worldwind.util.RestorableSupport, gov.nasa.worldwind.util.RestorableSupport.StateObject)
.getRestorableState
in interface ShapeAttributes
rs
- the RestorableSupport
that receives the attributes' state.so
- the StateObject
the state is appended to, if not null
.public int hashCode()
hashCode
in class java.lang.Object
public boolean isDrawInterior()
isDrawInterior
in interface ShapeAttributes
true
if the shape's interior is drawn, otherwise false
.ShapeAttributes.setDrawInterior(boolean)
public boolean isDrawOutline()
isDrawOutline
in interface ShapeAttributes
true
if the shape's outline is drawn, otherwise false
.ShapeAttributes.setDrawOutline(boolean)
public boolean isEnableAntialiasing()
isEnableAntialiasing
in interface ShapeAttributes
true
if the shape is drawn with smooth lines and edges, otherwise false
.ShapeAttributes.setEnableAntialiasing(boolean)
public boolean isEnableLighting()
isEnableLighting
in interface ShapeAttributes
true
to apply lighting, otherwise false
.ShapeAttributes.setEnableLighting(boolean)
public java.lang.String isExportFormatSupported(java.lang.String mimeType)
isExportFormatSupported
in interface Exportable
mimeType
- Desired export format.Exportable.FORMAT_SUPPORTED
, Exportable.FORMAT_NOT_SUPPORTED
, or Exportable.FORMAT_PARTIALLY_SUPPORTED
.Exportable.export(String, Object)
public boolean isUnresolved()
isUnresolved
in interface ShapeAttributes
true
to indicate that one or more attributes are unresolved, otherwise false
.ShapeAttributes.setUnresolved(boolean)
public void restoreState(RestorableSupport rs, RestorableSupport.StateObject so)
RestorableSupport
. If the
StateObject
is not null
it's searched for attribute state values, otherwise the
RestorableSupport
root is searched.restoreState
in interface ShapeAttributes
rs
- the RestorableSupport
that contains the attributes' state.so
- the StateObject
to search for state values, if not null
.public void setDrawInterior(boolean draw)
setDrawInterior
in interface ShapeAttributes
draw
- true
to draw the shape's interior, otherwise false
.ShapeAttributes.isDrawInterior()
public void setDrawOutline(boolean draw)
setDrawOutline
in interface ShapeAttributes
draw
- true
to draw the shape's outline, otherwise false
.ShapeAttributes.isDrawOutline()
public void setEnableAntialiasing(boolean enable)
setEnableAntialiasing
in interface ShapeAttributes
enable
- true
to draw the shape with smooth lines and edges, otherwise false
.ShapeAttributes.isEnableAntialiasing()
public void setEnableLighting(boolean enableLighting)
DrawContext
's standard lighting by calling DrawContext.beginStandardLighting()
and DrawContext.endStandardLighting()
before and after the shape is rendered, respectively.setEnableLighting
in interface ShapeAttributes
enableLighting
- true
to apply lighting, otherwise false
.ShapeAttributes.isEnableLighting()
public void setImageScale(double scale)
setImageScale
in interface ShapeAttributes
scale
- the amount to scale the shape's texture as a floating-point value.ShapeAttributes.getImageScale()
,
ShapeAttributes.setImageSource(Object)
public void setImageSource(java.lang.Object imageSource)
null
to specify that
the shape should not have a texture. When not null
, 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.setImageSource
in interface ShapeAttributes
imageSource
- the source of the shape's texture, either a String
path, a URL
, a
BufferedImage
, or null
.ShapeAttributes.getImageSource()
public void setInteriorMaterial(Material material)
setInteriorMaterial
in interface ShapeAttributes
material
- the material to apply to the shape's interior.ShapeAttributes.getInteriorMaterial()
public void setInteriorOpacity(double opacity)
setInteriorOpacity
in interface ShapeAttributes
opacity
- the interior opacity as a floating-point value from 0.0 to 1.0.ShapeAttributes.getInteriorOpacity()
public void setOutlineMaterial(Material material)
setOutlineMaterial
in interface ShapeAttributes
material
- the material to apply to the shape's outline.ShapeAttributes.getOutlineMaterial()
public void setOutlineOpacity(double opacity)
setOutlineOpacity
in interface ShapeAttributes
opacity
- the outline opacity as a floating-point value from 0.0 to 1.0.ShapeAttributes.getOutlineOpacity()
public void setOutlineStippleFactor(int factor)
factor
is 3, each bit is repeated 3 times before using the next bit. The
specified factor
must be either zero or an integer greater than zero. The factor
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
.
setOutlineStippleFactor
in interface ShapeAttributes
factor
- the number of times each bit in the outline stipple pattern should be repeated.ShapeAttributes.getOutlineStippleFactor()
,
ShapeAttributes.setOutlineStipplePattern(short)
public void setOutlineStipplePattern(short pattern)
To disable outline stippling, either specify a stipple factor of 0, or specify a stipple pattern of all 1 bits:
0xFFFF
.
setOutlineStipplePattern
in interface ShapeAttributes
pattern
- a 16-bit integer whose bit pattern defines which pixels are rendered in the shape's outline.ShapeAttributes.getOutlineStipplePattern()
,
ShapeAttributes.setOutlineStippleFactor(int)
public void setOutlineWidth(double width)
width
must be zero or a positive floating-point value. Specifying a line width of zero disables the shape's outline.
The width
may be limited by an implementation-defined maximum during rendering. The maximum width is
typically 10 pixels.setOutlineWidth
in interface ShapeAttributes
width
- the line width in pixels.ShapeAttributes.getOutlineWidth()
public void setUnresolved(boolean unresolved)
true
, then sets it to false
once the retrieval is complete. Code that interprets the
attributes knows that the attributes are complete when unresolved is false
.setUnresolved
in interface ShapeAttributes
unresolved
- true
to specify that one or more attributes are unresolved, otherwise
false
.ShapeAttributes.isUnresolved()