diva.canvas.toolbox
Class VectorFigure

java.lang.Object
  extended by diva.canvas.AbstractFigure
      extended by diva.canvas.toolbox.VectorFigure
All Implemented Interfaces:
CanvasComponent, Figure, VisibleComponent, UserObjectContainer

public class VectorFigure
extends AbstractFigure

A VectorFigure is a figure containing a list of objects that are drawn to produce the figure. The list of objects that are drawn includes both geometric objects and drawing control objects. Specifically:

Strings are not currently supported, but will be soon. Transforms are not supported, but may be at some time in the future. The figure is switched between line drawing mode and filling mode with the calls lineMode() and fillMode(). The default mode is line drawing with a 1-pixel black stroke.

Version:
$Revision: 1.4 $
Author:
John Reekie

Constructor Summary
VectorFigure()
          Create a new blank figure.
 
Method Summary
 void add(Composite c)
          Add a new compositioning operator to the list of drawn objects.
 void add(Figure f)
          Add a new figure to the list of drawn objects
 void add(Paint p)
          Add a new paint to the list of drawn objects.
 void add(Shape s)
          Add a new painted shape to the list of drawn objects.
 void add(Stroke s)
          Add a new stroke to the list of drawn objects.
 void fillMode()
          Add an object to the list that puts drawing into fill mode
 Rectangle2D getBounds()
          Get the bounding box of this figure.
 Shape getShape()
          Get the shape of this figure.
 void lineMode()
          Add an object to the list that puts drawing into line mode
 void paint(Graphics2D g)
          Paint the figure.
 void setShape(Shape s)
          Set the shape of this Figure.
 void transform(AffineTransform at)
          Transform the figure with the supplied transform.
 
Methods inherited from class diva.canvas.AbstractFigure
contains, getInteractor, getLayer, getOrigin, getParent, getToolTipText, getTransformContext, getUserObject, hit, intersects, isVisible, paint, repaint, repaint, setInteractor, setParent, setToolTipText, setUserObject, setVisible, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VectorFigure

public VectorFigure()
Create a new blank figure.

Method Detail

add

public void add(Shape s)
Add a new painted shape to the list of drawn objects.


add

public void add(Figure f)
Add a new figure to the list of drawn objects


add

public void add(Composite c)
Add a new compositioning operator to the list of drawn objects.


add

public void add(Paint p)
Add a new paint to the list of drawn objects.


add

public void add(Stroke s)
Add a new stroke to the list of drawn objects.


fillMode

public void fillMode()
Add an object to the list that puts drawing into fill mode


getBounds

public Rectangle2D getBounds()
Get the bounding box of this figure. If a bounding box has not yet been set (by calling the constructor that takes a Figure, or by calling _setBounds()), then a new bounding box will be computed by traversing the list of objects.

Specified by:
getBounds in interface Figure
Overrides:
getBounds in class AbstractFigure

getShape

public Shape getShape()
Get the shape of this figure. If a shape has not yet been set by calling setShape(), then the shape will be set to the bounding box.

Specified by:
getShape in interface Figure
Specified by:
getShape in class AbstractFigure

lineMode

public void lineMode()
Add an object to the list that puts drawing into line mode


paint

public void paint(Graphics2D g)
Paint the figure.

Specified by:
paint in interface VisibleComponent
Specified by:
paint in class AbstractFigure

setShape

public void setShape(Shape s)
Set the shape of this Figure. This is useful when the default of the bounding box is not the right thing -- such as when a circular shape is required, for instance.


transform

public void transform(AffineTransform at)
Transform the figure with the supplied transform. This can be used to perform arbitrary translation, scaling, shearing, and rotation operations.

Specified by:
transform in interface Figure
Specified by:
transform in class AbstractFigure


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.