edu.mines.jtk.sgl
Class AxisAlignedFrame

java.lang.Object
  extended by edu.mines.jtk.sgl.Node
      extended by edu.mines.jtk.sgl.Group
          extended by edu.mines.jtk.sgl.AxisAlignedFrame

public class AxisAlignedFrame
extends Group

An axis-aligned frame is a group of axis-aligned panels. A frame's geometry is an axis-aligned quadrilateral defined by an axis and two corner points. The axis is perpendicular to the plane containing the quadrilateral. The corner points are a pair of opposite vertices of the quadrilateral. Each corner point has three (X,Y,Z) coordinate values. For the axis that is orthogonal to the plane of this frame, the corresponding coordinate values of the two corner points are equal.

By convention, axis-aligned panel children of axis-aligned frames honor their parent frame's geometry when drawing, picking, etc. This convention keeps multiple panel children consistent as their frame is moved and resized.

Panels do not typically control the geometry of their frame, but they may set a box constraint on the corner points of that frame. For example, a panel may constrain those corner points to lie on a sampling grid. Only one constraint, the last one set, is applied. A frame does not attempt to reconcile inconsistent constraints.

Version:
2006.06.01
Author:
Dave Hale, Colorado School of Mines

Constructor Summary
AxisAlignedFrame(Axis axis, Point3 pa, Point3 pb)
          Constructs a frame with specified axis and corner points.
 
Method Summary
 void addChild(Node node)
          Adds the specified child node to this group's list of children.
 Axis getAxis()
          Gets the axis for this frame.
 BoxConstraint getBoxConstraint()
          Gets the box constraint for this frame.
 Point3 getCorner(int index)
          Gets the corner point with specified index for this frame.
 Point3 getCornerMax()
          Gets the maximum corner point for this frame.
 Point3 getCornerMin()
          Gets the minimum corner point for this frame.
 void removeChild(Node node)
          Removes the specified child node from this group's list of children.
 void setBoxConstraint(BoxConstraint constraint)
          Sets the box constraint for this frame.
 void setCorners(Point3 pa, Point3 pb)
          Sets the corner points of (moves and/or resizes) this frame.
 
Methods inherited from class edu.mines.jtk.sgl.Group
computeBoundingSphere, countChildren, cull, draw, getAttributeBits, getChildren, pick
 
Methods inherited from class edu.mines.jtk.sgl.Node
countParents, cullApply, cullBegin, cullEnd, dirtyBoundingSphere, dirtyDraw, drawApply, drawBegin, drawEnd, getBoundingSphere, getParents, getWorld, isSelected, pickApply, pickBegin, pickEnd, selectedChanged, setSelected, setStates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AxisAlignedFrame

public AxisAlignedFrame(Axis axis,
                        Point3 pa,
                        Point3 pb)
Constructs a frame with specified axis and corner points.

Parameters:
axis - the axis.
pa - a corner point.
pb - a corner point.
Method Detail

getAxis

public Axis getAxis()
Gets the axis for this frame.

Returns:
the axis.

getCornerMin

public Point3 getCornerMin()
Gets the minimum corner point for this frame.

Returns:
the minimum corner point.

getCornerMax

public Point3 getCornerMax()
Gets the maximum corner point for this frame.

Returns:
the maximum corner point.

getCorner

public Point3 getCorner(int index)
Gets the corner point with specified index for this frame.

Parameters:
index - the index in [0,3].
Returns:
the corner point.

setCorners

public void setCorners(Point3 pa,
                       Point3 pb)
Sets the corner points of (moves and/or resizes) this frame. If this frame has a non-null box constraint, then this method first applies the constraint before settig the corner points.

The specified corner points must be opposite vertices of the quadrilateral that defines this frame. For the axis that is orthogonal to the plane of this frame, the corresponding (X, Y, or Z) coordinate values of the two points should be equal; this method moves this frame to the average of those two coordinate values.

Parameters:
pa - a corner point
pb - a corner point

getBoxConstraint

public BoxConstraint getBoxConstraint()
Gets the box constraint for this frame.

Returns:
the box constraint; null, if none.

setBoxConstraint

public void setBoxConstraint(BoxConstraint constraint)
Sets the box constraint for this frame. Typically, only panels in a frame call this method, because the constraint often depends on what is drawn by those panels. This frame uses only the last constraint set.

Parameters:
constraint - the box constraint.

addChild

public void addChild(Node node)
Description copied from class: Group
Adds the specified child node to this group's list of children. If the node is already a child of this group, then this method does nothing.

The child must not be a world (root) node, because a world has no parents. Also, if this group is in a world, the child must not already be in a different world. A node cannot be in more than one world at a time; it must be removed from one world before it can be added to another.

Overrides:
addChild in class Group
Parameters:
node - the child node.

removeChild

public void removeChild(Node node)
Description copied from class: Group
Removes the specified child node from this group's list of children. If the node is not a child of this group, then this method does nothing.

Overrides:
removeChild in class Group
Parameters:
node - the child node.