tpp
Class Rectangle

java.lang.Object
  extended by tpp.Rectangle

public class Rectangle
extends java.lang.Object

A 'rubber band' rectangle used to select points in a ScatterPlotViewPanel. All coordinates are in data (rather than device) space


Constructor Summary
Rectangle(double x1, double y1, double x2, double y2)
           
Rectangle(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
           
 
Method Summary
 double centerX()
          The x coordinate of the center of the rectangle
 double centerY()
          The y coordinate of the center of the rectangle
 boolean contains(double x, double y)
          Is (x,y) inside the rectangle?
 void draw(java.awt.Graphics2D g)
           
 void expandToInclude(double x, double y)
          Expand rectangle as required to include a point.
 double getX1()
           
 double getX2()
           
 double getY1()
           
 double getY2()
           
 double height()
           
 RectangleMovementListener initialiseListener(ScatterPlotModel model)
          Create a listener that is capable of updating a model in response to changes to this rectangle.
 boolean onCorner(double x, double y, double margin)
          Is the given point on a corner, given the error margin.
 void scale(double zx, double zy)
          Increase the size of the rectangle by zx in the x direction, zy in the y.
 void scale(double ox, double oy, double dx, double dy)
          Scale the rectangle, by moving a corner from its original location (ox,oy) by a displacement of (dx,dy).
 void setX1(double x1)
           
 void setX2(double x2)
           
 void setY1(double y1)
           
 void setY2(double y2)
           
 java.lang.String toString()
           
 void translate(double dx, double dy)
          Translate the position of the rectangle by the given amount
 double width()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Rectangle

public Rectangle(double x1,
                 double y1,
                 double x2,
                 double y2)

Rectangle

public Rectangle(java.awt.geom.Point2D p1,
                 java.awt.geom.Point2D p2)
Method Detail

getX1

public double getX1()

setX1

public void setX1(double x1)

getX2

public double getX2()

setX2

public void setX2(double x2)

getY1

public double getY1()

setY1

public void setY1(double y1)

getY2

public double getY2()

setY2

public void setY2(double y2)

expandToInclude

public void expandToInclude(double x,
                            double y)
Expand rectangle as required to include a point.


translate

public void translate(double dx,
                      double dy)
Translate the position of the rectangle by the given amount


scale

public void scale(double ox,
                  double oy,
                  double dx,
                  double dy)
Scale the rectangle, by moving a corner from its original location (ox,oy) by a displacement of (dx,dy).


scale

public void scale(double zx,
                  double zy)
Increase the size of the rectangle by zx in the x direction, zy in the y. (expand if zx,y>0, shrink if zx,zy<0)


centerX

public double centerX()
The x coordinate of the center of the rectangle


centerY

public double centerY()
The y coordinate of the center of the rectangle


contains

public boolean contains(double x,
                        double y)
Is (x,y) inside the rectangle?


width

public double width()

height

public double height()

draw

public void draw(java.awt.Graphics2D g)

onCorner

public boolean onCorner(double x,
                        double y,
                        double margin)
Is the given point on a corner, given the error margin.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

initialiseListener

public RectangleMovementListener initialiseListener(ScatterPlotModel model)
Create a listener that is capable of updating a model in response to changes to this rectangle. Until this method is called then changes to the rectangle will not have any effect on the projection