Package ucar.visad
Class ShapeUtility
java.lang.Object
ucar.visad.ShapeUtility
A utility class for manipulating VisAD Shapes (VisADGeometryArrays).
Adapted from RAP's ShapeFactory class.
- Author:
- IDV Development Team
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Id for a 2-D airplane shapestatic final String
Id for a 3-D airplane shapestatic final float
coordinatesstatic final float
coordinatesstatic final float
coordinatesstatic final float
coordinatesstatic final String
shape name from WeatherSymbolsstatic final String
Id for a cross shapestatic final String
Id for a cube shapestatic final float
coordinatesstatic final String
shape name from WeatherSymbolsstatic final String
Id for a plus shapestatic final String
Id for a plus shapestatic final String
shape name from WeatherSymbolsstatic final String
shape name from WeatherSymbolsstatic final String
Id for a filled triangle shapestatic final String
Id for a filled square shapestatic final String
shape name from WeatherSymbolsstatic final String
Id for a filled triangle shapestatic final String
Id for a horizontal line shapestatic final String
Hurricane symbolstatic final float
coordinatesstatic final String
Id for a plus shapestatic final float
coordinatesstatic final String
Id for a plus shapestatic final int
The identifier for a circle station location markerstatic final int
The identifier for a diamond station location markerstatic final int
The identifier for a filled circle station location markerstatic final int
The identifier for a filled diamond station location markerstatic final int
The identifier for a filled square station location markerstatic final int
The identifier for a filled start station location markerstatic final int
The identifier for a filled triangle station location markerstatic final int
The identifier for hurricanestatic final int
The identifier for a minus station location markerstatic final int
The identifier for a pin station location markerstatic final int
The identifier for a plus station location markerstatic final int
The identifier for a square station location markerstatic final int
The identifier for a star station location markerstatic final int
The identifier for a triangle station location markerstatic final int
Id for tropical stormstatic final int[]
shape ids from WeatherSymbolsstatic final String[]
shape names from WeatherSymbolsstatic final float
coordinatesstatic final float
coordinatesstatic final float
coordinatesstatic final String
Id for a null shapestatic final String
shape idstatic final String
Id for a plus shapestatic final String
Id for a pyramid of 4 faces (triangular base)static final String
Id for a pyramid of 5 faces (square base)static final float
coordinatesstatic final String
Id for a plus shapestatic final TwoFacedObject[]
Array of all of the shapesstatic final String
Id for a square (unfilled) shapestatic final String
shape name from WeatherSymbolsstatic final float
coordinatesstatic final double[]
use in text callsstatic final double[]
use in text callsstatic final double[]
use in text callsstatic final String
Id for a triangle (unfilled) shapestatic final String
tropical storm symbolstatic final float
coordinatesstatic final String
Id for a plus shapestatic final String
Id for a vertical line shape -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
blendColor
(VisADGeometryArray shape, float R, float G, float B) Blend the color for the shape specified with RGB components specifiedstatic void
blendColor
(VisADGeometryArray shape, Color color) Blend the color for the shape specified with color.static Rectangle2D
bounds2d
(VisADGeometryArray shape) Return the bounds of this shapestatic Rectangle2D
bounds2d
(VisADGeometryArray[] shapes) Return the bounds of array of shapesstatic Rectangle2D
bounds2d
(VisADGeometryArray shape, Rectangle2D rect) Return the bounds of this shapestatic VisADGeometryArray[]
clone
(VisADGeometryArray[] shapes) Do a deep clone of the given shapes arraystatic VisADGeometryArray[]
Create a shape from a string namestatic VisADGeometryArray
Create a predefined shape.static VisADGeometryArray
offset
(VisADGeometryArray shape, float[] off) Offset the shape by the amounts in off.static VisADGeometryArray
offset
(VisADGeometryArray shape, float dx, float dy, float dz) Offset the shape by the amounts in off.static void
reScale
(VisADGeometryArray[] shapes, double scale) Rescale the shapesstatic void
reScale
(VisADGeometryArray[] shapes, double[] scale) Rescale the shapesstatic void
reScale
(VisADGeometryArray[] shapes, double[] scaleArray, double scale) Rescale the shapesstatic void
reScale
(VisADGeometryArray shape, double scale) Rescale the shapestatic void
reScale
(VisADGeometryArray shape, double[] scale) Rescale the shapestatic void
reScale
(VisADGeometryArray shape, double[] scaleArray, double scale) Rescale the shapestatic void
rotate
(VisADGeometryArray shape, float angle) Rotate the given shape about the z axis the given angle (in radians).static void
rotate
(VisADGeometryArray shape, javax.media.j3d.Transform3D transform) Rotate a shapestatic void
rotate
(VisADGeometryArray shape, javax.media.j3d.Transform3D transform, float deltax, float deltay, float deltaz) Rotate a shapestatic void
rotateX
(VisADGeometryArray shape, float angle) Rotate the given shape about the x axis the given angle (in radians).static void
rotateY
(VisADGeometryArray shape, float angle) Rotate the given shape about the y axis the given angle (in radians).static void
rotateZ
(VisADGeometryArray shape, float angle) Rotate the given shape about the z axis the given angle (in radians).static void
setColor
(VisADGeometryArray[] shapes, float[] RGB) Set the color for the shapes in the array.static void
setColor
(VisADGeometryArray[] shapes, Color color) Set the color for the shapes in the array.static void
setColor
(VisADGeometryArray shape, float[] RGB) Set the color for the shape specified.static void
setColor
(VisADGeometryArray shape, float R, float G, float B) Set the color for the shape specified.static void
setColor
(VisADGeometryArray shape, float R, float G, float B, float A) Set the color for the shape specified.static void
setColor
(VisADGeometryArray shape, Color color) Set the color for the shape specified.static VisADGeometryArray[]
setSize
(VisADGeometryArray[] shapes, float size) Set the size of the shapes.static VisADGeometryArray
setSize
(VisADGeometryArray shape, float size) Set the size of the shapes.static VisADGeometryArray
setSize
(VisADGeometryArray shape, float x, float y, float z) Set the size of the shapes.static VisADGeometryArray
Wrapper for PlotText using font.static VisADGeometryArray
Wrapper for PlotText.static VisADGeometryArray
Wrapper for PlotText.static VisADGeometryArray
Wrapper for PlotText.static VisADGeometryArray
Wrapper for PlotText.
-
Field Details
-
TEXT_START
public static final double[] TEXT_STARTuse in text calls -
TEXT_BASE
public static final double[] TEXT_BASEuse in text calls -
TEXT_UP
public static final double[] TEXT_UPuse in text calls -
PLUS
Id for a plus shape- See Also:
-
MINUS
Id for a plus shape- See Also:
-
DOWNLINE
Id for a plus shape- See Also:
-
RIGHTARROW
Id for a plus shape- See Also:
-
LEFTARROW
Id for a plus shape- See Also:
-
UPARROW
Id for a plus shape- See Also:
-
DOWNARROW
Id for a plus shape- See Also:
-
HORLINE
Id for a horizontal line shape- See Also:
-
VERTLINE
Id for a vertical line shape- See Also:
-
CROSS
Id for a cross shape- See Also:
-
SQUARE
Id for a square (unfilled) shape- See Also:
-
NONE
Id for a null shape- See Also:
-
FILLED_SQUARE
Id for a filled square shape- See Also:
-
CUBE
Id for a cube shape- See Also:
-
PYRAMID_4FACE
Id for a pyramid of 4 faces (triangular base)- See Also:
-
PYRAMID_5FACE
Id for a pyramid of 5 faces (square base)- See Also:
-
TRIANGLE
Id for a triangle (unfilled) shape- See Also:
-
FILLED_TRIANGLE
Id for a filled triangle shape- See Also:
-
FILLED_SPHERE
Id for a filled triangle shape- See Also:
-
AIRPLANE
Id for a 2-D airplane shape- See Also:
-
AIRPLANE3D
Id for a 3-D airplane shape- See Also:
-
PIN
shape id- See Also:
-
HURRICANE
Hurricane symbol- See Also:
-
TROPICALSTORM
tropical storm symbol- See Also:
-
MISC_ID_SQUARE
public static final int MISC_ID_SQUAREThe identifier for a square station location marker- See Also:
-
MISC_ID_FILLED_SQUARE
public static final int MISC_ID_FILLED_SQUAREThe identifier for a filled square station location marker- See Also:
-
MISC_ID_CIRCLE
public static final int MISC_ID_CIRCLEThe identifier for a circle station location marker- See Also:
-
MISC_ID_FILLED_CIRCLE
public static final int MISC_ID_FILLED_CIRCLEThe identifier for a filled circle station location marker- See Also:
-
MISC_ID_TRIANGLE
public static final int MISC_ID_TRIANGLEThe identifier for a triangle station location marker- See Also:
-
MISC_ID_FILLED_TRIANGLE
public static final int MISC_ID_FILLED_TRIANGLEThe identifier for a filled triangle station location marker- See Also:
-
MISC_ID_DIAMOND
public static final int MISC_ID_DIAMONDThe identifier for a diamond station location marker- See Also:
-
MISC_ID_FILLED_DIAMOND
public static final int MISC_ID_FILLED_DIAMONDThe identifier for a filled diamond station location marker- See Also:
-
MISC_ID_STAR
public static final int MISC_ID_STARThe identifier for a star station location marker- See Also:
-
MISC_ID_FILLED_STAR
public static final int MISC_ID_FILLED_STARThe identifier for a filled start station location marker- See Also:
-
MISC_ID_PLUS
public static final int MISC_ID_PLUSThe identifier for a plus station location marker- See Also:
-
MISC_ID_PIN
public static final int MISC_ID_PINThe identifier for a pin station location marker- See Also:
-
MISC_ID_MINUS
public static final int MISC_ID_MINUSThe identifier for a minus station location marker- See Also:
-
MISC_ID_TROPICALSTORM
public static final int MISC_ID_TROPICALSTORMId for tropical storm- See Also:
-
MISC_ID_HURRICANE
public static final int MISC_ID_HURRICANEThe identifier for hurricane- See Also:
-
CIRCLE
shape name from WeatherSymbols- See Also:
-
FILLED_CIRCLE
shape name from WeatherSymbols- See Also:
-
DIAMOND
shape name from WeatherSymbols- See Also:
-
FILLED_DIAMOND
shape name from WeatherSymbols- See Also:
-
STAR
shape name from WeatherSymbols- See Also:
-
FILLED_STAR
shape name from WeatherSymbols- See Also:
-
MISC_NAMES
shape names from WeatherSymbols -
MISC_IDS
public static final int[] MISC_IDSshape ids from WeatherSymbols -
SHAPES
Array of all of the shapes -
L_X
public static final float L_Xcoordinates- See Also:
-
ML_X
public static final float ML_Xcoordinates- See Also:
-
C_X
public static final float C_Xcoordinates- See Also:
-
MR_X
public static final float MR_Xcoordinates- See Also:
-
R_X
public static final float R_Xcoordinates- See Also:
-
T_Y
public static final float T_Ycoordinates- See Also:
-
MT_Y
public static final float MT_Ycoordinates- See Also:
-
C_Y
public static final float C_Ycoordinates- See Also:
-
MB_Y
public static final float MB_Ycoordinates- See Also:
-
B_Y
public static final float B_Ycoordinates- See Also:
-
D_Z
public static final float D_Zcoordinates- See Also:
-
C_Z
public static final float C_Zcoordinates- See Also:
-
U_Z
public static final float U_Zcoordinates- See Also:
-
-
Constructor Details
-
ShapeUtility
public ShapeUtility()Default constructor
-
-
Method Details
-
makeShape
Create a predefined shape. Shapes are drawn on a 1x1(x1) box. UsesetSize()
methods to rescale.- Parameters:
s
- shape to create deprecated Use create shape- Returns:
- corresponding shape
-
createShape
Create a shape from a string name- Parameters:
s
- name of the staring- Returns:
- corresponding array
-
shapeText
Wrapper for PlotText. Uses default values for start, base, and up to draw the text along the X axis.- Parameters:
s
- string to turn into a shape.- Returns:
- corresponding VisADGeometryArray
-
shapeText
Wrapper for PlotText. Uses default values for start, base, and up to draw the text along the X axis.- Parameters:
s
- string to turn into a shape.center
- center the text- Returns:
- corresponding VisADGeometryArray
-
shapeText
Wrapper for PlotText. Uses default values for start, base, and up to draw the text along the X axis.- Parameters:
s
- string to turn into a shape.fontSize
- the font sizecenter
- center the text- Returns:
- corresponding VisADGeometryArray
-
shapeFont
Wrapper for PlotText using font. Uses default values for start, base, and up to draw the text along the X axis.- Parameters:
s
- string to turn into a shape.f
- font to use- Returns:
- corresponding VisADGeometryArray
-
shapeFont
Wrapper for PlotText. Uses default values for start, base, and up to draw the text along the X axis.- Parameters:
s
- string to turn into a shape.f
- font to usecenter
- center the text- Returns:
- corresponding VisADGeometryArray
-
setSize
Set the size of the shapes. Scales the size by size.- Parameters:
shapes
- shapes to resizesize
- scaling factor- Returns:
- resized shapes
-
setSize
Set the size of the shapes. Scales the size by size.- Parameters:
shape
- shapes to resizesize
- scaling factor- Returns:
- rescaled shape
-
setSize
Set the size of the shapes. Scales the size by size.- Parameters:
shape
- shapes to resizex
- scaling factory
- scaling factorz
- scaling factor- Returns:
- rescaled shape
-
offset
Offset the shape by the amounts in off.- Parameters:
shape
- shape to offsetoff
- offset (x, y, z)- Returns:
- offset shape
-
offset
Offset the shape by the amounts in off.- Parameters:
shape
- shape to offsetdx
- delta xdy
- delta ydz
- delta z- Returns:
- offset shape
-
bounds2d
Return the bounds of this shape- Parameters:
shape
- shape to bound- Returns:
- Rectangle of shape coordinates
-
bounds2d
Return the bounds of this shape- Parameters:
shape
- shape to boundrect
- The rectangle to set. If null then create a new one.- Returns:
- Rectangle of shape coordinates
-
bounds2d
Return the bounds of array of shapes- Parameters:
shapes
- shape to bound- Returns:
- Rectangle of region bounded by shape coordinates
-
setColor
Set the color for the shapes in the array.- Parameters:
shapes
- array of shapes to colorcolor
- color to use.
-
setColor
Set the color for the shapes in the array.- Parameters:
shapes
- array of shapes to colorRGB
- array of color components (R, G, B) to use.
-
setColor
Set the color for the shape specified.- Parameters:
shape
- shape to colorcolor
- color to use.
-
setColor
Set the color for the shape specified.- Parameters:
shape
- shape to colorRGB
- array of color components (R, G, B) to use.
-
setColor
Set the color for the shape specified.- Parameters:
shape
- shape to colorR
- red color componentG
- green color componentB
- blue color component
-
setColor
Set the color for the shape specified.- Parameters:
shape
- shape to colorR
- red color componentG
- green color componentB
- blue color componentA
- alpha component
-
blendColor
Blend the color for the shape specified with color.- Parameters:
shape
- shape to colorcolor
- color to use for blending.
-
blendColor
Blend the color for the shape specified with RGB components specified- Parameters:
shape
- shape to colorR
- red color componentG
- green color componentB
- blue color component
-
reScale
Rescale the shapes- Parameters:
shapes
- shapes to scalescale
- scale factor
-
reScale
Rescale the shape- Parameters:
shape
- shape to scalescale
- scale factor
-
reScale
Rescale the shapes- Parameters:
shapes
- shapes to scalescale
- xyz scale factor
-
reScale
Rescale the shapes- Parameters:
shapes
- shapes to scalescaleArray
- xyz scale factorscale
- extra scale factor
-
clone
Do a deep clone of the given shapes array- Parameters:
shapes
- shape to clone- Returns:
- The cloned array
-
reScale
Rescale the shape- Parameters:
shape
- shape to scalescale
- xyz scale factor
-
reScale
Rescale the shape- Parameters:
shape
- shape to scalescaleArray
- xyz scale factorscale
- scale factor
-
rotate
Rotate the given shape about the z axis the given angle (in radians).- Parameters:
shape
- The shape to rotateangle
- Radians
-
rotateZ
Rotate the given shape about the z axis the given angle (in radians).- Parameters:
shape
- The shape to rotateangle
- Radians
-
rotate
Rotate a shape- Parameters:
shape
- the shapetransform
- the 3D transform
-
rotate
public static void rotate(VisADGeometryArray shape, javax.media.j3d.Transform3D transform, float deltax, float deltay, float deltaz) Rotate a shape- Parameters:
shape
- the shapetransform
- the transformdeltax
- delta xdeltay
- delta ydeltaz
- delta z
-
rotateX
Rotate the given shape about the x axis the given angle (in radians).- Parameters:
shape
- The shape to rotateangle
- Radians
-
rotateY
Rotate the given shape about the y axis the given angle (in radians).- Parameters:
shape
- The shape to rotateangle
- Radians
-