Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

jpicedt.graphic.model
Class PicRectangle  view PicRectangle download PicRectangle.java

java.lang.Object
  extended byjpicedt.graphic.model.AbstractElement
      extended byjpicedt.graphic.model.PicRectangle
All Implemented Interfaces:
jpicedt.graphic.toolkit.CustomizerFactory, Element, PicObjectConstants
Direct Known Subclasses:
PicEllipse

public class PicRectangle
extends AbstractElement
implements jpicedt.graphic.toolkit.CustomizerFactory

A class implementing a rectangle, defined geomtrically by 2 diagonal points.

[pending] add "rounded corner" capacity to PicRectangle

Since:
PicEdt 1.0

Nested Class Summary
(package private)  class PicRectangle.Customizer
          geometry customizer
 
Nested classes inherited from class jpicedt.graphic.model.AbstractElement
AbstractElement.DefaultPointIterator
 
Nested classes inherited from class jpicedt.graphic.model.Element
Element.PointIterator
 
Field Summary
static int FIRST_PT
           
static int LAST_PT
           
static int P_BL
           
static int P_BR
           
static int P_CENTER
           
static int P_TL
           
static int P_TR
           
static int P_X1Y1
           
static int P_X1Y2
           
static int P_X2Y1
           
static int P_X2Y2
           
 
Fields inherited from class jpicedt.graphic.model.AbstractElement
attributeSet, parent, ptsX, ptsY, view
 
Fields inherited from interface jpicedt.graphic.model.PicObjectConstants
CROSSHATCH, CROSSHATCH_FILLED, DASH_OPAQUE, DASH_TRANSPARENT, DASH1, DASH2, DASH3, DASHED, DIMEN, DOT_SEP, DOT_SEP1, DOT_SEP2, DOT_SEP3, DOTTED, DOUBLE_COLOR, DOUBLE_LINE, DOUBLE_SEP, FILL_COLOR, FILL_STYLE, HATCH_ANGLE, HATCH_COLOR, HATCH_SEP, HATCH_WIDTH, HLINES, HLINES_FILLED, INNER, LEFT_ARROW, LINE_COLOR, LINE_STYLE, LINE_WIDTH, MaxAttributeNameIndex, MIDDLE, NONE, OUTER, POLYGON_DOTS, POLYGON_SOLID, POLYGON_STYLE, PS_POINT, RIGHT_ARROW, SHADOW, SHADOW_ANGLE, SHADOW_COLOR, SHADOW_SIZE, SOLID, VLINES, VLINES_FILLED
 
Constructor Summary
PicRectangle()
          Creates a new PicRectangle reduced to (0,0)
PicRectangle(PicAttributeSet set)
          Creates a new PicRectangle reduced to (0,0), with the given attribute set
PicRectangle(jpicedt.graphic.PicPoint pt, PicAttributeSet set)
          Create a new PicRectangle reduced to a point located at the given position
PicRectangle(jpicedt.graphic.PicPoint pt1, jpicedt.graphic.PicPoint pt2, PicAttributeSet set)
          Create a new PicRectangle object using the two given points as the diagonal of the rectangle.
PicRectangle(PicRectangle rect)
          "cloning" constructor (to be used by clone())
 
Method Summary
 java.lang.Object clone()
          Overrides Object.clone() method
 PicPolygon convertToPolygon()
          converts this rectangle to a closed polygon (i.e.
 PicPolygon[] convertToPolygons()
          converts this rectangle to an array of four 2-points polygons
 jpicedt.graphic.toolkit.AbstractCustomizer createCustomizer()
           
 jpicedt.graphic.PicPoint getCenter(jpicedt.graphic.PicPoint src)
           
 double getCenterX()
           
 double getCenterY()
           
 int getFirstPointIndex()
          Returns the index of the first point that can be retrieved by getPoint This default implementation returns 0.
 double getHeight()
           
 int getLastPointIndex()
          Returns the index of the last point that can be retrieved by getPoint This default implementation returns the greater index allowed in ptsX (or ptsY).
 java.lang.String getName()
          Returns a non-localised string representing this object's name This default implementation returns the class name.
 double getPointX(int numPoint)
          This default implementation returns ptsX[numPoint].
 double getPointY(int numPoint)
          This default implementation returns ptsY[numPoint].This might be a valid implementation as long as subclasses don't have other control points.
 double getWidth()
           
 boolean isSquare()
           
 void setHeight(double height)
          Set the height of the surrounding rectangle to the "height" value ; the ellipse center doesn't move in this operation.
 void setPoint(int numPoint, jpicedt.graphic.PicPoint pt)
          Set the coordinate of the point indexed by "numPoint" to the given value.
 void setPointFromCenter(int numPoint, jpicedt.graphic.PicPoint pt)
          Set the point indexed by "numPoint" to the given value, keeping the center of the bounding box fixed.
 void setWidth(double width)
          Set the width of the surrounding rectangle to the "width" value ; the ellipse center doesn't move during this operation.
 void transformToSquare(boolean useWidth)
          Transform this rectangle to a square
 
Methods inherited from class jpicedt.graphic.model.AbstractElement
anchorPointsIterator, fireChangedUpdate, getAttribute, getAttributeSet, getBoundingBox, getDrawing, getParent, getPoint, getView, removeView, scale, scale, setAttribute, setAttributeSet, setParent, setViewFromFactory, toString, translate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FIRST_PT

public static final int FIRST_PT
See Also:
Constant Field Values

P_CENTER

public static final int P_CENTER
See Also:
Constant Field Values

P_X1Y1

public static final int P_X1Y1
See Also:
Constant Field Values

P_X2Y2

public static final int P_X2Y2
See Also:
Constant Field Values

P_X2Y1

public static final int P_X2Y1
See Also:
Constant Field Values

P_X1Y2

public static final int P_X1Y2
See Also:
Constant Field Values

LAST_PT

public static final int LAST_PT
See Also:
Constant Field Values

P_BL

public static final int P_BL
See Also:
Constant Field Values

P_BR

public static final int P_BR
See Also:
Constant Field Values

P_TL

public static final int P_TL
See Also:
Constant Field Values

P_TR

public static final int P_TR
See Also:
Constant Field Values
Constructor Detail

PicRectangle

public PicRectangle()
Creates a new PicRectangle reduced to (0,0)


PicRectangle

public PicRectangle(PicAttributeSet set)
Creates a new PicRectangle reduced to (0,0), with the given attribute set


PicRectangle

public PicRectangle(jpicedt.graphic.PicPoint pt1,
                    jpicedt.graphic.PicPoint pt2,
                    PicAttributeSet set)
Create a new PicRectangle object using the two given points as the diagonal of the rectangle.


PicRectangle

public PicRectangle(jpicedt.graphic.PicPoint pt,
                    PicAttributeSet set)
Create a new PicRectangle reduced to a point located at the given position

Since:
PicEdt 1.2.a

PicRectangle

public PicRectangle(PicRectangle rect)
"cloning" constructor (to be used by clone())

Since:
PicEdt 1.0
Method Detail

clone

public java.lang.Object clone()
Overrides Object.clone() method

Specified by:
clone in interface Element
Specified by:
clone in class AbstractElement
Since:
PicEdt 1.0

getName

public java.lang.String getName()
Description copied from class: AbstractElement
Returns a non-localised string representing this object's name This default implementation returns the class name.

Specified by:
getName in interface Element
Overrides:
getName in class AbstractElement

getPointX

public double getPointX(int numPoint)
Description copied from class: AbstractElement
This default implementation returns ptsX[numPoint]. This might be a valid implementation as long as subclasses don't have other control points.

Specified by:
getPointX in interface Element
Overrides:
getPointX in class AbstractElement
Since:
PicEdt 1.0

getPointY

public double getPointY(int numPoint)
Description copied from class: AbstractElement
This default implementation returns ptsY[numPoint].This might be a valid implementation as long as subclasses don't have other control points.

Specified by:
getPointY in interface Element
Overrides:
getPointY in class AbstractElement
Since:
PicEdt 1.0

getFirstPointIndex

public int getFirstPointIndex()
Description copied from class: AbstractElement
Returns the index of the first point that can be retrieved by getPoint This default implementation returns 0.

Specified by:
getFirstPointIndex in interface Element
Overrides:
getFirstPointIndex in class AbstractElement

getLastPointIndex

public int getLastPointIndex()
Description copied from class: AbstractElement
Returns the index of the last point that can be retrieved by getPoint This default implementation returns the greater index allowed in ptsX (or ptsY).

Specified by:
getLastPointIndex in interface Element
Overrides:
getLastPointIndex in class AbstractElement

setPoint

public void setPoint(int numPoint,
                     jpicedt.graphic.PicPoint pt)
Set the coordinate of the point indexed by "numPoint" to the given value.

Specified by:
setPoint in interface Element
Overrides:
setPoint in class AbstractElement

setPointFromCenter

public void setPointFromCenter(int numPoint,
                               jpicedt.graphic.PicPoint pt)
Set the point indexed by "numPoint" to the given value, keeping the center of the bounding box fixed.


getCenterX

public double getCenterX()

getCenterY

public double getCenterY()

getCenter

public jpicedt.graphic.PicPoint getCenter(jpicedt.graphic.PicPoint src)

getWidth

public double getWidth()

getHeight

public double getHeight()

setWidth

public void setWidth(double width)
Set the width of the surrounding rectangle to the "width" value ; the ellipse center doesn't move during this operation.

Since:
PicEdt 1.0

setHeight

public void setHeight(double height)
Set the height of the surrounding rectangle to the "height" value ; the ellipse center doesn't move in this operation.

Since:
PicEdt 1.0

convertToPolygons

public PicPolygon[] convertToPolygons()
converts this rectangle to an array of four 2-points polygons

Since:
jPicEdt 1.3.1

convertToPolygon

public PicPolygon convertToPolygon()
converts this rectangle to a closed polygon (i.e. a 4 points polygon)


isSquare

public boolean isSquare()
Since:
PicEdt 1.0

transformToSquare

public void transformToSquare(boolean useWidth)
Transform this rectangle to a square

Since:
PicEdt 1.2

createCustomizer

public jpicedt.graphic.toolkit.AbstractCustomizer createCustomizer()
Specified by:
createCustomizer in interface jpicedt.graphic.toolkit.CustomizerFactory