visad.bom.annotations
Class QuadrilateralJ3D

java.lang.Object
  extended by visad.bom.annotations.QuadrilateralJ3D
All Implemented Interfaces:
ScreenAnnotation

public class QuadrilateralJ3D
extends Object
implements ScreenAnnotation

Meant to encapsulate information representing a Quadrilateral which is going to be rendered on a VisAD display without being subject to the usual VisAD transformations. Thus the label should stick in Screen Coordinates.


Field Summary
static int FILL
          fill style FILL
static int LINE
          fill style LINE
static int POINT
          fill style POINT
 
Constructor Summary
QuadrilateralJ3D()
          Simple constructor which makes a zero size "box" at (0, 0) coloured white.
QuadrilateralJ3D(int style, int[][] points, float[] colour, double zValue, double thickness)
          Constructor to make an arbitrary rectangle with the given specifications; it should not be self intersecting.
QuadrilateralJ3D(int style, int x, int y, int width, int height, float[] colour, double zValue, double thickness)
          Constructor to make an upright "box" with the given specifications; the box should not be self intesecting.
QuadrilateralJ3D(int style, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, float[] colour, double zValue, double thickness)
          Constructor to make an arbitrary rectangle with the given specifications; it should not be self intersecting.
 
Method Summary
 void setColour(float[] colour)
          Set the colour for the quadrilateral.
 void setLocation(int x, int y)
          Applies a shift to the quadrilateral to place the first point on the given coordinates.
 void setPoints(int[][] points)
          Sets the points for an arbitrary quadrilateral; should not be self intersecting.
 void setPoints(int x, int y, int width, int height)
          Makes an upright "box".
 void setPoints(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
          Sets the 4 points for an arbitrary quadrilateral; should not be self intersecting.
 void setSize(int width, int height)
          Constructs a rectangular box using the existing first point as the top left point and the input width and height.
 void setStyle(int style)
          Set the drawing style of the quadrilateral.
 void setThickness(double thickness)
          Set the thickness for the quadrilateral.
 void setZValue(double zValue)
          Set the Z value for the quadrilateral.
 Object toDrawable(DisplayImpl display)
          Make the QuadrilateralJ3D into a Shape3D.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POINT

public static final int POINT
fill style POINT

See Also:
Constant Field Values

LINE

public static final int LINE
fill style LINE

See Also:
Constant Field Values

FILL

public static final int FILL
fill style FILL

See Also:
Constant Field Values
Constructor Detail

QuadrilateralJ3D

public QuadrilateralJ3D()
Simple constructor which makes a zero size "box" at (0, 0) coloured white. More meaningful values can be set after construction.


QuadrilateralJ3D

public QuadrilateralJ3D(int style,
                        int x,
                        int y,
                        int width,
                        int height,
                        float[] colour,
                        double zValue,
                        double thickness)
Constructor to make an upright "box" with the given specifications; the box should not be self intesecting.

Parameters:
style - one of
  • QuadrilateralJ3D.FILL,
  • QuadrilateralJ3D.LINE,
  • QuadrilateralJ3D.POINT.
x - top left x value in screen coordinates.
y - top left y value in screen coordinates.
width - width, in pixels, of the "box".
height - height, in pixels, of the "box".
colour - red, green blue triple each in the range [0.0, 1.0].
zValue - Virtual world value - larger z is closer to eye.
thickness - used for outline thickness and point size.

QuadrilateralJ3D

public QuadrilateralJ3D(int style,
                        int[][] points,
                        float[] colour,
                        double zValue,
                        double thickness)
Constructor to make an arbitrary rectangle with the given specifications; it should not be self intersecting.

Parameters:
style - one of
  • QuadrilateralJ3D.FILL,
  • QuadrilateralJ3D.LINE,
  • QuadrilateralJ3D.POINT.
points - 2 rows with each column containing a point in screen coordinates; requires 4 points (columns).
colour - red, green blue triple each in the range [0.0, 1.0]
zValue - Virtual world value - larger z is closer to eye.
thickness - used for outline thickness and point size.

QuadrilateralJ3D

public QuadrilateralJ3D(int style,
                        int x1,
                        int y1,
                        int x2,
                        int y2,
                        int x3,
                        int y3,
                        int x4,
                        int y4,
                        float[] colour,
                        double zValue,
                        double thickness)
Constructor to make an arbitrary rectangle with the given specifications; it should not be self intersecting.

Parameters:
style - one of
  • QuadrilateralJ3D.FILL,
  • QuadrilateralJ3D.LINE,
  • QuadrilateralJ3D.POINT.
x1 - x screen coordinate of the first point.
y1 - y screen coordinate of the first point.
x2 - x screen coordinate of the second point.
y2 - y screen coordinate of the second point.
x3 - x screen coordinate of the third point.
y3 - y screen coordinate of the third point.
x4 - x screen coordinate of the fourth point.
y4 - y screen coordinate of the fourth point.
colour - red, green blue triple each in the range [0.0, 1.0].
zValue - Virtual world value - larger z is closer to eye.
thickness - used for outline thickness and point size.
Method Detail

setStyle

public void setStyle(int style)
Set the drawing style of the quadrilateral.

Parameters:
style - one of
  • QuadrilateralJ3D.FILL,
  • QuadrilateralJ3D.LINE,
  • QuadrilateralJ3D.POINT.

setLocation

public void setLocation(int x,
                        int y)
Applies a shift to the quadrilateral to place the first point on the given coordinates.

Expects a "box" i.e. a vertically aligned rectangle with points enumerated clockwise. This sets top left to (x, y) with other points adjusted accordingly. If it is not a "box" then all points are shifted as though moving the first point to (x, y).

Parameters:
x - new top left x pixel value.
y - new top left y pixel value.

setSize

public void setSize(int width,
                    int height)
Constructs a rectangular box using the existing first point as the top left point and the input width and height.

Parameters:
width - width, in pixels, of the "box".
height - height, in pixels, of the "box".

setPoints

public void setPoints(int[][] points)
Sets the points for an arbitrary quadrilateral; should not be self intersecting.

Parameters:
points - 2 rows with each column containing a point in screen coordinates; requires 4 points (columns).

setPoints

public void setPoints(int x,
                      int y,
                      int width,
                      int height)
Makes an upright "box".

Parameters:
x - top left x value in screen coordinates.
y - top left y value in screen coordinates.
width - width, in pixels, of the "box".
height - height, in pixels, of the "box".

setPoints

public void setPoints(int x1,
                      int y1,
                      int x2,
                      int y2,
                      int x3,
                      int y3,
                      int x4,
                      int y4)
Sets the 4 points for an arbitrary quadrilateral; should not be self intersecting.

Parameters:
x1 - x screen coordinate of the first point.
y1 - y screen coordinate of the first point.
x2 - x screen coordinate of the second point.
y2 - y screen coordinate of the second point.
x3 - x screen coordinate of the third point.
y3 - y screen coordinate of the third point.
x4 - x screen coordinate of the fourth point.
y4 - y screen coordinate of the fourth point.

setColour

public void setColour(float[] colour)
Set the colour for the quadrilateral.

Parameters:
colour - red, green blue triple each in the range [0.0, 1.0]

setZValue

public void setZValue(double zValue)
Set the Z value for the quadrilateral.

Parameters:
zValue - Virtual world value - larger z is closer to eye.

setThickness

public void setThickness(double thickness)
Set the thickness for the quadrilateral.

Parameters:
thickness - used for outline thickness and point size.

toDrawable

public Object toDrawable(DisplayImpl display)
Make the QuadrilateralJ3D into a Shape3D.

Specified by:
toDrawable in interface ScreenAnnotation
Parameters:
display - the VisAD display for this Quadrilateral.
Returns:
the QuadrilateralJ3D description as a Shape3D object