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

Quick Search    Search Deep

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

java.lang.Object
  extended byjpicedt.graphic.model.AbstractElement
      extended byjpicedt.graphic.model.PicPolygon
All Implemented Interfaces:
jpicedt.graphic.toolkit.ActionFactory, jpicedt.graphic.toolkit.CustomizerFactory, Element, PicObjectConstants

public class PicPolygon
extends AbstractElement
implements jpicedt.graphic.toolkit.ActionFactory, jpicedt.graphic.toolkit.CustomizerFactory

A polygon, either closed or not, with a variable number of points that can be added/inserted/deleted by the user.

For a PicPolygon, each control point is also an anchor point (e.g. for grid alignment).

Since:
picedt 1.1
Version:
>=JDK1.1.x

Nested Class Summary
(package private)  class PicPolygon.ClosePolygonAction
          Closes the path of this polygon.
(package private)  class PicPolygon.CoordinateCellEditor
          PolygonJTable's cell editor is based on a DecimalNumberField
(package private)  class PicPolygon.Customizer
          geometry customizer
(package private)  class PicPolygon.PolygonJTable
          an implementation of JTable for PicPolygon's
(package private)  class PicPolygon.PolygonTableModel
          a class that specifies the methods the JTable will use to interrogate a tabular data model.
 
Nested classes inherited from class jpicedt.graphic.model.AbstractElement
AbstractElement.DefaultPointIterator
 
Nested classes inherited from class jpicedt.graphic.model.Element
Element.PointIterator
 
Field Summary
private  boolean isClosed
           
 
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
PicPolygon()
          Create a new empty polygon
PicPolygon(PicAttributeSet set)
          Create a new empty polygon with the given set of attribute
PicPolygon(jpicedt.graphic.PicPoint[] pts, PicAttributeSet set)
          Create a new polygon filled with the given array of PicPoint's.
PicPolygon(jpicedt.graphic.PicPoint pt1, jpicedt.graphic.PicPoint pt2)
          Create a new polygon with the two given points, and a default attribute set.
PicPolygon(jpicedt.graphic.PicPoint pt1, jpicedt.graphic.PicPoint pt2, PicAttributeSet set)
          Create a new polygon with the two given points and attribute set
PicPolygon(PicPolygon curve)
          "cloning" constructor (to be used by clone())
 
Method Summary
 void addPoint(int pos, jpicedt.graphic.PicPoint pt)
          Inserts the given point at the given position in this PicPolygon, then fires a changed-update.
 void addPoint(jpicedt.graphic.PicPoint pt)
          adds the given point at the end of this PicPolygon.
 java.lang.Object clone()
          Overload Object.clone() method
 PicPolygon[] convertToLines()
          converts this polygon to an array of 2-point polygons
 jpicedt.graphic.toolkit.PEAction[] createActions(jpicedt.graphic.toolkit.ActionDispatcher actionDispatcher, jpicedt.graphic.toolkit.ActionLocalizer localizer)
          Create an array of Action's related to this object
 jpicedt.graphic.toolkit.AbstractCustomizer createCustomizer()
           
 java.lang.String getName()
          Returns a non-localised string representing this object's name This default implementation returns the class name.
 boolean isClosed()
           
 void removeLastPoint()
          removes the last point.
 void removePoint(int pos)
          Remove a point at the given position from this PicPolygon, then fire a changed-update.
 void setClosed(boolean status)
          set close path status, then fires a changed-update.
 java.lang.String toString()
          debugging
 
Methods inherited from class jpicedt.graphic.model.AbstractElement
anchorPointsIterator, fireChangedUpdate, getAttribute, getAttributeSet, getBoundingBox, getDrawing, getFirstPointIndex, getLastPointIndex, getParent, getPoint, getPointX, getPointY, getView, removeView, scale, scale, setAttribute, setAttributeSet, setParent, setPoint, setViewFromFactory, translate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

isClosed

private boolean isClosed
Constructor Detail

PicPolygon

public PicPolygon()
Create a new empty polygon


PicPolygon

public PicPolygon(PicAttributeSet set)
Create a new empty polygon with the given set of attribute


PicPolygon

public PicPolygon(jpicedt.graphic.PicPoint pt1,
                  jpicedt.graphic.PicPoint pt2)
Create a new polygon with the two given points, and a default attribute set. This is aimed at replacing PicLine.

Since:
PicEdt 1.1

PicPolygon

public PicPolygon(jpicedt.graphic.PicPoint pt1,
                  jpicedt.graphic.PicPoint pt2,
                  PicAttributeSet set)
Create a new polygon with the two given points and attribute set

Since:
PicEdt 1.1

PicPolygon

public PicPolygon(jpicedt.graphic.PicPoint[] pts,
                  PicAttributeSet set)
Create a new polygon filled with the given array of PicPoint's.

Since:
PicEdt 1.1

PicPolygon

public PicPolygon(PicPolygon curve)
"cloning" constructor (to be used by clone())

Since:
PicEdt 1.1
Method Detail

clone

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

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

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

addPoint

public void addPoint(jpicedt.graphic.PicPoint pt)
adds the given point at the end of this PicPolygon. This is a convenience call to addPoint(ptsX.length,pt).


addPoint

public void addPoint(int pos,
                     jpicedt.graphic.PicPoint pt)
Inserts the given point at the given position in this PicPolygon, then fires a changed-update. In terms of where the point is inserted, this works like ArrayList.add(i,object). In particular, position must be positive, and LOWER OR EQUAL to ptsX.length ("EQUAL" leading to an insertion at the end of the array of points).


removePoint

public void removePoint(int pos)
Remove a point at the given position from this PicPolygon, then fire a changed-update. This shifts any subsequent points to the left.

Nothing is done if this polygon has only one point.


removeLastPoint

public void removeLastPoint()
removes the last point. This is a convenience call to removePoint(ptsX.length-1).


convertToLines

public PicPolygon[] convertToLines()
converts this polygon to an array of 2-point polygons

Since:
jPicEdt 1.3.1

setClosed

public void setClosed(boolean status)
set close path status, then fires a changed-update.


isClosed

public boolean isClosed()

toString

public java.lang.String toString()
debugging

Overrides:
toString in class AbstractElement

createActions

public jpicedt.graphic.toolkit.PEAction[] createActions(jpicedt.graphic.toolkit.ActionDispatcher actionDispatcher,
                                                        jpicedt.graphic.toolkit.ActionLocalizer localizer)
Create an array of Action's related to this object

Specified by:
createActions in interface jpicedt.graphic.toolkit.ActionFactory

createCustomizer

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