org.omegahat.Graphics.Primitives
Class DynamicGraphicalContainer

java.lang.Object
  |
  +--org.omegahat.Graphics.Primitives.GraphicalObject
        |
        +--org.omegahat.Graphics.Primitives.RGO
              |
              +--org.omegahat.Graphics.Primitives.GraphicalContainer
                    |
                    +--org.omegahat.Graphics.Primitives.DynamicGraphicalContainer
All Implemented Interfaces:
Addable, Copyable, GraphicalComponentInt, GraphicalContainerInt, MathOperable, ScaledComponentInt, SimpleGraphicalContainerInt, Subsettable, Tree

public class DynamicGraphicalContainer
extends GraphicalContainer

Extension of basic graphical container that caches its current dimensions when it is drawn so that it can draw any of its children individually without redrawing itself. This is used in dynamic or incremental plots when we add new values.


Field Summary
static int X_ID
          Constant identifying that the dimension in question is horizontal.
static int Y_ID
          Constant identifying that the dimension in question is vertical.
 
Fields inherited from class org.omegahat.Graphics.Primitives.GraphicalContainer
allocator, children, origin, parent, scaleX, scaleY
 
Fields inherited from class org.omegahat.Graphics.Primitives.RGO
region
 
Fields inherited from class org.omegahat.Graphics.Primitives.GraphicalObject
ACTIVE, fontSize, lastDevice, lastHeightCM, lastRegion, lastWidthCM, parents, status, VISIBLE
 
Fields inherited from interface org.omegahat.Environment.DataStructures.MathOperable
DIVIDE, MINUS, MULTIPLY, PLUS
 
Constructor Summary
DynamicGraphicalContainer()
           
DynamicGraphicalContainer(double x, double y, double width, double height, int unit)
           
DynamicGraphicalContainer(DynamicGraphicalContainer el)
           
DynamicGraphicalContainer(DynamicGraphicalContainer el, boolean deep)
           
DynamicGraphicalContainer(ScaleInt xscale, ScaleInt yscale)
           
DynamicGraphicalContainer(UDouble x, UDouble y, UDouble width, UDouble height)
           
 
Method Summary
 void draw(GraphicalComponentInt child)
          Draw the specified child using the last device and previously cached dimensions of this container from earlier calls to draw.
 void draw(GraphicalComponentInt child, OutputDevice device)
          Draw the specified child in the specified device using the previously cached dimensions of this container from earlier calls to draw.
 void drawChildren()
          (Re) Draw the children using the previously cached values of the last computed region, device, absolute dimensions, etc.
protected  double transformNDCToNative(double val, int which)
          Convert the specified value, specified in NDC, to Native coordinates based on the scale of the appropriate dimension identified by the argument which.
 double transformXNDCToNative(double x)
          Convert the value to Native coordinates of the XScale.
 double transformYNDCToNative(double y)
          Convert the value to Native coordinates of the YScale.
 
Methods inherited from class org.omegahat.Graphics.Primitives.GraphicalContainer
add, addGraphicalObject, addGraphicalObject, addGraphicalObject, addGraphicalObject, addGraphicalObject, addGraphicalObject, addGraphicalObject, addGraphicalObject, addGraphicalObject, addGraphicalObject, addValue, copy, copy, draw, drawChildren, get, getChild, getChildCount, getChildren, getDevice, getOrigin, getRegionAllocator, getXScale, getYScale, parent, parent, remove, removeGraphicalObject, removeGraphicalObject, setOrigin, setRegionAllocator, setXScale, setYScale, subset, subset, transform, transform
 
Methods inherited from class org.omegahat.Graphics.Primitives.RGO
center, centre, createRegionDescription, createRegionDescription, getRegion, height, height, setHJust, setRegion, setVJust, width, width, x, x, y, y
 
Methods inherited from class org.omegahat.Graphics.Primitives.GraphicalObject
cacheSize, getFontSize, getFontSize, getParameters, getParents, getStatus, isActive, isVisible, lastHeightCM, lastRegion, lastWidthCM, parents, setActive, setParameters, setParents, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.omegahat.Graphics.Primitives.GraphicalComponentInt
getParameters, getRegion, isActive, isVisible, parents, setActive, setParameters, setRegion, setVisible
 

Field Detail

X_ID

public static final int X_ID
Constant identifying that the dimension in question is horizontal.

Y_ID

public static final int Y_ID
Constant identifying that the dimension in question is vertical.
Constructor Detail

DynamicGraphicalContainer

public DynamicGraphicalContainer()

DynamicGraphicalContainer

public DynamicGraphicalContainer(double x,
                                 double y,
                                 double width,
                                 double height,
                                 int unit)

DynamicGraphicalContainer

public DynamicGraphicalContainer(UDouble x,
                                 UDouble y,
                                 UDouble width,
                                 UDouble height)

DynamicGraphicalContainer

public DynamicGraphicalContainer(ScaleInt xscale,
                                 ScaleInt yscale)

DynamicGraphicalContainer

public DynamicGraphicalContainer(DynamicGraphicalContainer el)

DynamicGraphicalContainer

public DynamicGraphicalContainer(DynamicGraphicalContainer el,
                                 boolean deep)
Method Detail

drawChildren

public void drawChildren()
(Re) Draw the children using the previously cached values of the last computed region, device, absolute dimensions, etc. This is used when we change the GraphicsParameters of one or more children and want to update. Computes the default device if no cached device is available.
See Also:
TableSelectionHandler

draw

public void draw(GraphicalComponentInt child)
Draw the specified child using the last device and previously cached dimensions of this container from earlier calls to draw.

draw

public void draw(GraphicalComponentInt child,
                 OutputDevice device)
Draw the specified child in the specified device using the previously cached dimensions of this container from earlier calls to draw. Updates the Graphics first, so that the drawing is in the correct context.

transformXNDCToNative

public double transformXNDCToNative(double x)
Convert the value to Native coordinates of the XScale.

transformYNDCToNative

public double transformYNDCToNative(double y)
Convert the value to Native coordinates of the YScale.

transformNDCToNative

protected double transformNDCToNative(double val,
                                      int which)
Convert the specified value, specified in NDC, to Native coordinates based on the scale of the appropriate dimension identified by the argument which.
Parameters:
val - value to be converted, specified in Normalized Device coordinates
which - identifier for the dimension to relative to which the conversion should be performed.
See Also:
X_ID, Y_ID