org.openbp.jaspira.gui.interaction
Class RectangleSegment

java.lang.Object
  extended by java.awt.geom.RectangularShape
      extended by org.openbp.jaspira.gui.interaction.RectangleSegment
All Implemented Interfaces:
java.awt.Shape, java.lang.Cloneable

public class RectangleSegment
extends java.awt.geom.RectangularShape

A rectangular shape that corresponds to one of the five main regions of a Rectangle (4 sides and center). Side segments are trapez-shaped, while the center is a rectangle.

Author:
Stephan Moritz

Field Summary
static java.lang.String CENTER
          Constraint: Center segment
static java.lang.String EAST
          Constraint: East segment
static java.lang.String NORTH
          Constraint: North segment
static java.lang.String SOUTH
          Constraint: South segment
static java.lang.String WEST
          Constraint: West segment
 
Constructor Summary
RectangleSegment(java.awt.Component comp, int width, java.lang.String constraint)
          Constructor.
RectangleSegment(int x, int y, int width, java.lang.String constraint)
          Constructor.
RectangleSegment(java.awt.Point p, int width, java.lang.String constraint)
          Constructor.
RectangleSegment(java.awt.Rectangle rectangle, int width, java.lang.String constraint)
          Constructor.
 
Method Summary
 boolean contains(double x, double y)
           
 boolean contains(double x, double y, double w, double h)
           
 java.awt.geom.Rectangle2D getBounds2D()
           
 double getHeight()
          Gets the height.
 java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
           
 double getWidth()
          Gets the width.
 double getX()
          Gets the left coordinate.
 double getY()
          Gets the top coordinate.
 boolean intersects(double x, double y, double w, double h)
           
 boolean isEmpty()
           
 void setFrame(double x, double y, double w, double h)
          We ignore the size part of setFrame and move it only to the given position.
 
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, getPathIterator, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CENTER

public static final java.lang.String CENTER
Constraint: Center segment

See Also:
Constant Field Values

NORTH

public static final java.lang.String NORTH
Constraint: North segment

See Also:
Constant Field Values

SOUTH

public static final java.lang.String SOUTH
Constraint: South segment

See Also:
Constant Field Values

EAST

public static final java.lang.String EAST
Constraint: East segment

See Also:
Constant Field Values

WEST

public static final java.lang.String WEST
Constraint: West segment

See Also:
Constant Field Values
Constructor Detail

RectangleSegment

public RectangleSegment(java.awt.Point p,
                        int width,
                        java.lang.String constraint)
Constructor.

Parameters:
p - Creates a rectangle segment of the rectangle between 0,0 and p
width - Controls the thickness of the border segements
constraint - Type of the segment (see above)

RectangleSegment

public RectangleSegment(java.awt.Component comp,
                        int width,
                        java.lang.String constraint)
Constructor.

Parameters:
comp - Creates a rectangle segment of the component's bounding box
width - Controls the thickness of the border segements
constraint - Type of the segment (see above)

RectangleSegment

public RectangleSegment(java.awt.Rectangle rectangle,
                        int width,
                        java.lang.String constraint)
Constructor.

Parameters:
rectangle - Creates a rectangle segment of the given rectangle
width - Controls the thickness of the border segements
constraint - Type of the segment (see above)

RectangleSegment

public RectangleSegment(int x,
                        int y,
                        int width,
                        java.lang.String constraint)
Constructor. Creates a rectangle segment using the given geometry

Parameters:
x - X coordinated
y - Y coordinated
width - Width of the rectangle
constraint - Type of the segment (see above)
Method Detail

getX

public double getX()
Gets the left coordinate.

Specified by:
getX in class java.awt.geom.RectangularShape

getY

public double getY()
Gets the top coordinate.

Specified by:
getY in class java.awt.geom.RectangularShape

getWidth

public double getWidth()
Gets the width.

Specified by:
getWidth in class java.awt.geom.RectangularShape

getHeight

public double getHeight()
Gets the height.

Specified by:
getHeight in class java.awt.geom.RectangularShape

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in class java.awt.geom.RectangularShape
See Also:
RectangularShape.isEmpty()

setFrame

public void setFrame(double x,
                     double y,
                     double w,
                     double h)
We ignore the size part of setFrame and move it only to the given position. ATTENTION: This is contrary to the RectangularShape interface!

Specified by:
setFrame in class java.awt.geom.RectangularShape
See Also:
RectangularShape.setFrame(double, double, double, double)

getBounds2D

public java.awt.geom.Rectangle2D getBounds2D()
See Also:
Shape.getBounds2D()

contains

public boolean contains(double x,
                        double y)
See Also:
Shape.contains(double, double)

intersects

public boolean intersects(double x,
                          double y,
                          double w,
                          double h)
See Also:
Shape.intersects(double, double, double, double)

contains

public boolean contains(double x,
                        double y,
                        double w,
                        double h)
See Also:
Shape.contains(double, double, double, double)

getPathIterator

public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
See Also:
Shape.getPathIterator(AffineTransform)


Copyright © 2011. All Rights Reserved.