|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvisad.bom.annotations.ScreenAnnotatorUtils
public class ScreenAnnotatorUtils
This is a collection of static methods to help with the construction
of java3D objects used for annotating a VisAD display. The objects are
intended to be drawn directly to the screen using screen pixel
locations. See ScreenAnnotator.
This is meant to contain as much of the Java3D dependencies as posible.
| Constructor Summary | |
|---|---|
ScreenAnnotatorUtils()
|
|
| Method Summary | |
|---|---|
static void |
adjustZ(DisplayImplJ3D display,
Canvas3D canvas,
double z,
Point3d[] points)
This adjusts a set of points so that the drawn object has the same appearance even though the Z value is adjusted to a user given setting. |
static void |
ditherPoints(Canvas3D canvas,
double frac,
Point3d[] points)
Java3D seems to calculate a floating point pixel value and then take the integer part for the screen coordinate. |
static Shape3D |
makeImageShape3D(DisplayImplJ3D display,
Image image,
int position,
int x,
int y,
int width,
int height,
double zValue,
double scale)
Transforms an Image object into a Shape3D. |
static BranchGroup |
makeJLabelShape3D(DisplayImplJ3D display,
String text,
int x,
int y,
float[] colour,
Font font,
double zValue,
double fontSizeInPixels,
int align,
int path)
Construct a BranchGroup object from a routine
description of a Label using Text3D. |
static Shape3D |
makeLabelShape3D(DisplayImplJ3D display,
String text,
int x,
int y,
float[] colour,
Font font,
HersheyFont hfont,
double zValue,
double scaleFactor,
boolean filled,
double thickness,
double orientation,
TextControl.Justification horizontal,
TextControl.Justification vertical,
double charRotation)
Construct a Shape3D object from a routine description
of a Label using 2D fonts. |
static Shape3D |
makeLineShape3D(DisplayImplJ3D display,
int style,
int x1,
int y1,
int x2,
int y2,
float[] colour,
double z,
double thickness)
Construct a Shape3D object from a routine description
of a Line. |
static Shape3D |
makePointShape3D(DisplayImplJ3D display,
int x1,
int y1,
float[] colour,
double z,
double thickness)
Construct a Shape3D object from a routine description
of a Point. |
static Shape3D |
makeQuadrilateralShape3D(DisplayImplJ3D display,
int style,
int x1,
int y1,
int x2,
int y2,
int x3,
int y3,
int x4,
int y4,
float[] colour,
double z,
double thickness)
Construct a Shape3D object from a routine description
of a Quadrilateral. |
static Shape3D |
makeTriangleShape3D(DisplayImplJ3D display,
int style,
int x1,
int y1,
int x2,
int y2,
int x3,
int y3,
float[] colour,
double z,
double thickness)
Construct a Shape3D object from a routine description
of a Triangle. |
static Point3d[] |
screenToVworld(int[][] screenXY,
Canvas3D canvas)
Convert an array of Pixel points to Point3d array in the Virtual World. |
static int[][] |
vworldToScreen(Point3d[] points,
Canvas3D canvas)
Convert an array of Vworld points to int[][] array in Screen coordinates. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ScreenAnnotatorUtils()
| Method Detail |
|---|
public static BranchGroup makeJLabelShape3D(DisplayImplJ3D display,
String text,
int x,
int y,
float[] colour,
Font font,
double zValue,
double fontSizeInPixels,
int align,
int path)
BranchGroup object from a routine
description of a Label using Text3D. A label is a Text
string with attributes used for drawing it.
display - the VisAD display for this Label.text - the string.x - x screen coordinate of the text.y - y screen coordinate of the text.colour - red green blue triple; each value in [0.0, 1.0].font - Font to use.zValue - Virtual world value; larger z is in front.fontSizeInPixels - height of text.align - one of: path - one of: BranchGroup, suitably scaled, representing the
label.
public static Shape3D makeLabelShape3D(DisplayImplJ3D display,
String text,
int x,
int y,
float[] colour,
Font font,
HersheyFont hfont,
double zValue,
double scaleFactor,
boolean filled,
double thickness,
double orientation,
TextControl.Justification horizontal,
TextControl.Justification vertical,
double charRotation)
throws VisADException
Shape3D object from a routine description
of a Label using 2D fonts. A label is a Text string with
attributes used drawing it.
display - the VisAD display for this Label.text - the string.x - x screen coordinate of the text.y - y screen coordinate of the text.colour - red green blue triple; each value in [0.0, 1.0].font - Font to use.hfont - Hershey font to use; if both fonts are null
then use the default VisAD line font.zValue - Virtual world value; larger z is in front.scaleFactor - scale the font by this factor; by default
characters are 1 pixel in size.filled - if true the font is rendered as filled,
if false just the triangles are drawn.thickness - line width to use if just drawing triangles;
usually 1.0 is the most useful.orientation - angle of rotation of the text anticlockwise
from the horizontal.horizontal - one of:vertical - one of:charRotation - rotate each character
charRotation degrees clockwise from base line.
Shape3D.
VisADException - VisAD couldn't make the geometry array.
public static void adjustZ(DisplayImplJ3D display,
Canvas3D canvas,
double z,
Point3d[] points)
display - the VisAD display.canvas - Java3D canvas being drawn onz - Virtual world value; larger z is in front.points - array of values to have their z value adjusted.
public static Shape3D makeQuadrilateralShape3D(DisplayImplJ3D display,
int style,
int x1,
int y1,
int x2,
int y2,
int x3,
int y3,
int x4,
int y4,
float[] colour,
double z,
double thickness)
Shape3D object from a routine description
of a Quadrilateral.
display - the VisAD display for this Quadrilateral.style - one of: 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 value in [0.0, 1.0].z - Virtual world value; larger z is in front.thickness - used for LINE and POINT node.
Shape3D.
public static Shape3D makeTriangleShape3D(DisplayImplJ3D display,
int style,
int x1,
int y1,
int x2,
int y2,
int x3,
int y3,
float[] colour,
double z,
double thickness)
Shape3D object from a routine description
of a Triangle.
display - the VisAD display for this Point.style - one of 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.colour - red green blue triple; each value in [0.0, 1.0].z - Virtual world value; larger z is in front.thickness - used for LINE and POINT node.
Shape3D.
public static Shape3D makeLineShape3D(DisplayImplJ3D display,
int style,
int x1,
int y1,
int x2,
int y2,
float[] colour,
double z,
double thickness)
Shape3D object from a routine description
of a Line.
display - the VisAD display for this Point.style - one of: 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.colour - red green blue triple; each value in [0.0, 1.0].z - Virtual world value; larger z is in front.thickness - for the line.
Shape3D.
public static Shape3D makePointShape3D(DisplayImplJ3D display,
int x1,
int y1,
float[] colour,
double z,
double thickness)
Shape3D object from a routine description
of a Point.
display - the VisAD display for this Point.x1 - x screen coordinate of the point.y1 - y screen coordinate of the point.colour - red green blue triple; each value in [0.0, 1.0].z - Virtual world value; larger z is in front.thickness - gives the size of the Point.
Shape3D.
public static Point3d[] screenToVworld(int[][] screenXY,
Canvas3D canvas)
canvas - for the virtual world of interest.screenXY - the screen points in x, y pairs.
Point3d values representing the
Virtual World values for the Screen points.
public static int[][] vworldToScreen(Point3d[] points,
Canvas3D canvas)
canvas - for the virtual world of interest.points - array of Point3d of Vworld coordinates.
public static void ditherPoints(Canvas3D canvas,
double frac,
Point3d[] points)
canvas - where the points are displayed.frac - amount of interpoint spacing to use for adjustment;
it is clamped between [0.1, 0.9].points - array of values to have their x, y values adjusted.
public static Shape3D makeImageShape3D(DisplayImplJ3D display,
Image image,
int position,
int x,
int y,
int width,
int height,
double zValue,
double scale)
throws VisADException
Shape3D. The image
object may be scaled.
display - the VisAD display for this Point.image - to be converted to Shape3D.position - how to place the image relative to (x, y);
one of: x - x screen coordinate to place the image.y - y screen coordinate to place the image.width - of image in pixels.height - of image in pixels.zValue - Virtual world value; larger z is in front.scale - scale factor for image magnification; greater
than 0.0.
Shape3D.
VisADException - if the image can't be accessed
for some reason.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||