diva.canvas.interactor
Class BoundsGeometry

java.lang.Object
  extended by diva.canvas.interactor.BoundsGeometry
All Implemented Interfaces:
Geometry

public class BoundsGeometry
extends Object
implements Geometry

BoundsGeometry is a class that provides support for manipulating the bounds of a figure.

Version:
$Revision: 1.14 $
Author:
John Reekie

Nested Class Summary
 class BoundsGeometry.BoundsSite
          BoundsSite is the local class that implements editable sites of Rectangle objects.
 
Constructor Summary
BoundsGeometry(Figure figure, Rectangle2D bounds)
          Create a new geometry object on the given figure and with the given initial bounds.
 
Method Summary
 Rectangle2D getBounds()
          Get the current rectangle that defines this geometry.
 Site getE()
          Get the east site.
 Figure getFigure()
          Get the figure to which this geometry object is attached.
 double getMinimumSize()
          Get the minimum size of the rectangle.
 Site getN()
          Get the north site.
 Site getNE()
          Get the north-east site.
 Site getNW()
          Get the north-west site.
 Site getS()
          Get the south site.
 Site getSE()
          Get the south-east site.
 Shape getShape()
          Get the current shape that defines this geometry
 Site getSite(int id)
          Get the single site with the given ID.
 Site getSW()
          Get the south-west site.
 Site getW()
          Get the west site.
 void setBounds(Rectangle2D rect)
          Set the rectangle that defines this geometry object.
 void setMinimumSize(double minimumSize)
          Set the minimum size of the rectangle.
 void setShape(Shape shape)
          Set the shape that defines this geometry object.
 Iterator sites()
          Return an iteration over the sites in this geometry object.
 void translate(double x, double y)
          Translate the geometry object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoundsGeometry

public BoundsGeometry(Figure figure,
                      Rectangle2D bounds)
Create a new geometry object on the given figure and with the given initial bounds.

Method Detail

getSite

public Site getSite(int id)
Get the single site with the given ID.


getMinimumSize

public double getMinimumSize()
Get the minimum size of the rectangle.


getNE

public Site getNE()
Get the north-east site.


getNW

public Site getNW()
Get the north-west site.


getSE

public Site getSE()
Get the south-east site.


getSW

public Site getSW()
Get the south-west site.


getN

public Site getN()
Get the north site.


getS

public Site getS()
Get the south site.


getE

public Site getE()
Get the east site.


getW

public Site getW()
Get the west site.


getFigure

public Figure getFigure()
Get the figure to which this geometry object is attached. Returns null if there isn't one.

Specified by:
getFigure in interface Geometry

getShape

public Shape getShape()
Get the current shape that defines this geometry

Specified by:
getShape in interface Geometry

getBounds

public Rectangle2D getBounds()
Get the current rectangle that defines this geometry. This returns the same shape as getShape(), but as a Rectangle2D type.


setMinimumSize

public void setMinimumSize(double minimumSize)
Set the minimum size of the rectangle. The default is 1.0.


setShape

public void setShape(Shape shape)
Set the shape that defines this geometry object. The shape must be a Rectangle2D, or an exception will be thrown.

Specified by:
setShape in interface Geometry

setBounds

public void setBounds(Rectangle2D rect)
Set the rectangle that defines this geometry object. This is the same as setShape(), but does not need to perform the type check.


sites

public Iterator sites()
Return an iteration over the sites in this geometry object.


translate

public void translate(double x,
                      double y)
Translate the geometry object

Specified by:
translate in interface Geometry


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