Package gov.nasa.worldwind.shape
Class ShapeAttributes
- java.lang.Object
-
- gov.nasa.worldwind.shape.ShapeAttributes
-
public class ShapeAttributes extends java.lang.Object
Holds attributes applied to geographic shapes.
-
-
Constructor Summary
Constructors Constructor Description ShapeAttributes()
ShapeAttributes(ShapeAttributes attributes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
Color
getInteriorColor()
Indicates the color and opacity of shape interiors.ImageSource
getInteriorImageSource()
Indicates the image source applied to shape interiors.Color
getOutlineColor()
Indicates the color and opacity of shape outlines.ImageSource
getOutlineImageSource()
Indicates the image source applied to shape outlines.float
getOutlineWidth()
Indicates the width of shape outlines.int
hashCode()
boolean
isDepthTest()
Indicates whether shape depth-testing is enabled.boolean
isDrawInterior()
Indicates whether shape interiors are enabled.boolean
isDrawOutline()
Indicates whether shape outlines are enabled.boolean
isDrawVerticals()
Indicates whether shape vertical outlines are enabled.boolean
isEnableLighting()
Sets whether shape lighting is enabled.ShapeAttributes
set(ShapeAttributes attributes)
ShapeAttributes
setDepthTest(boolean enable)
Sets whether to enable shape depth-testing.ShapeAttributes
setDrawInterior(boolean enable)
Sets whether to enable shape interiors.ShapeAttributes
setDrawOutline(boolean enable)
Sets whether to enable shape outlines.ShapeAttributes
setDrawVerticals(boolean enable)
Sets whether to enable shape vertical outlines.ShapeAttributes
setEnableLighting(boolean enable)
Sets whether to enable shape lighting.ShapeAttributes
setInteriorColor(Color color)
Sets shape interior color and opacity.ShapeAttributes
setInteriorImageSource(ImageSource imageSource)
Sets the image source to apply to shape interiors.ShapeAttributes
setOutlineColor(Color color)
Sets shape outline color and opacity.ShapeAttributes
setOutlineImageSource(ImageSource imageSource)
Sets the image source to apply to shape outlines.ShapeAttributes
setOutlineWidth(float lineWidth)
Sets shape outline width.
-
-
-
Constructor Detail
-
ShapeAttributes
public ShapeAttributes()
-
ShapeAttributes
public ShapeAttributes(ShapeAttributes attributes)
-
-
Method Detail
-
set
public ShapeAttributes set(ShapeAttributes attributes)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
isDrawInterior
public boolean isDrawInterior()
Indicates whether shape interiors are enabled.- Returns:
- true if shape interiors are enabled, and false otherwise
-
setDrawInterior
public ShapeAttributes setDrawInterior(boolean enable)
Sets whether to enable shape interiors.- Parameters:
enable
- true to enable shape interiors, and false otherwise
-
isDrawOutline
public boolean isDrawOutline()
Indicates whether shape outlines are enabled.- Returns:
- true if shape outlines are enabled, and false otherwise
-
setDrawOutline
public ShapeAttributes setDrawOutline(boolean enable)
Sets whether to enable shape outlines.- Parameters:
enable
- true to enable shape outlines, and false otherwise
-
isDrawVerticals
public boolean isDrawVerticals()
Indicates whether shape vertical outlines are enabled. Not all shapes display vertical outlines. Those that do not ignore this property. When enabled, those that do display vertical lines extending from the shape's specified positions to the ground.- Returns:
- true if shape vertical outlines are enabled, and false otherwise
-
setDrawVerticals
public ShapeAttributes setDrawVerticals(boolean enable)
Sets whether to enable shape vertical outlines. Not all shapes display vertical outlines. Those that do not ignore this property. When enabled, those that do display vertical lines extending from the shape's specified positions to the ground.- Parameters:
enable
- true to enable shape vertical outlines, and false otherwise
-
isDepthTest
public boolean isDepthTest()
Indicates whether shape depth-testing is enabled. When true, shapes may be occluded by terrain and other shapes in certain viewing situations. When false, shapes will not be occluded by terrain and other shapes.- Returns:
- true if enable shape depth-testing is enabled, and false otherwise
-
setDepthTest
public ShapeAttributes setDepthTest(boolean enable)
Sets whether to enable shape depth-testing. When true, shapes may be occluded by terrain and other shapes in certain viewing situations. When false, shapes will not be occluded by terrain and other shapes.- Parameters:
enable
- true to enable shape depth-testing, and false otherwise
-
isEnableLighting
public boolean isEnableLighting()
Sets whether shape lighting is enabled. When true, the appearance of a shape's color and image source may be modified by shading applied from a global light source.- Returns:
- true if shape lighting is enabled, and false otherwise
-
setEnableLighting
public ShapeAttributes setEnableLighting(boolean enable)
Sets whether to enable shape lighting. When true, the appearance of a shape's color and image source may be modified by shading applied from a global light source.- Parameters:
enable
- true to enable shape lighting, and false otherwise
-
getInteriorColor
public Color getInteriorColor()
Indicates the color and opacity of shape interiors.- Returns:
- the RGBA color used for shape interiors
-
setInteriorColor
public ShapeAttributes setInteriorColor(Color color)
Sets shape interior color and opacity.- Parameters:
color
- the new RGBA color to use for shape interiors- Throws:
java.lang.IllegalArgumentException
- If the color is null
-
getOutlineColor
public Color getOutlineColor()
Indicates the color and opacity of shape outlines.- Returns:
- the RGBA color used for shape outlines
-
setOutlineColor
public ShapeAttributes setOutlineColor(Color color)
Sets shape outline color and opacity.- Parameters:
color
- the new RGBA color to use for shape outlines- Throws:
java.lang.IllegalArgumentException
- If the color is null
-
getOutlineWidth
public float getOutlineWidth()
Indicates the width of shape outlines.- Returns:
- the line width, in screen pixels.
-
setOutlineWidth
public ShapeAttributes setOutlineWidth(float lineWidth)
Sets shape outline width.- Parameters:
lineWidth
- the new line width, in screen pixels
-
getInteriorImageSource
public ImageSource getInteriorImageSource()
Indicates the image source applied to shape interiors. When null, shape interiors are displayed in the interior color. When non-null, image pixels appear in shape interiors, with each image pixel multiplied by the interior RGBA color. Use a white interior color to display unmodified image pixels.
By default, interior image sources are displayed as a repeating pattern across shape interiors. The pattern matches image pixels to screen pixels, such that the image appears to repeat in screen coordinates.- Returns:
- a reference to the interior image source; may be null
-
setInteriorImageSource
public ShapeAttributes setInteriorImageSource(ImageSource imageSource)
Sets the image source to apply to shape interiors. When null, shape interiors are displayed in the interior color. When non-null, image pixels appear in shape interiors, with each image pixel multiplied by the interior RGBA color. Use a white interior color to display the original image pixels.
Interior images appear as a two-dimensional repeating pattern that fills each shape's interior. The image is repeated both horizontally and vertically in screen coordinates, with camera perspective applied to the pattern.- Parameters:
imageSource
- a reference to the new interior image source; may be null
-
getOutlineImageSource
public ImageSource getOutlineImageSource()
Indicates the image source applied to shape outlines.- Returns:
- a reference to the outline image source; may be null
-
setOutlineImageSource
public ShapeAttributes setOutlineImageSource(ImageSource imageSource)
Sets the image source to apply to shape outlines. When null, shape outlines are displayed in the outline color. When non-null, image pixels appear along shape outlines, with each image pixel multiplied by the outline RGBA color. Use a white outline color to display the original image pixels.
Outline images appear as a one-dimensional repeating pattern that fills each shape's outline. The first row of image pixels is repeated linearly along shape outlines in screen coordinates, with camera perspective applied to the pattern.
Dashed shape outlines are accomplished with a one-dimensional outline image containing a mix of a transparent pixels and white pixels. The image width indicates the pattern length in screen coordinates, while the transparent pixels and white pixels indicate the dashing pattern. To display dashed lines similar to OpenGL's classic line stippling feature, seeImageSource.fromLineStipple(int, short)
.- Parameters:
imageSource
- a reference to the new outline image source; may be null
-
-