|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjpicedt.graphic.model.AbstractElement
jpicedt.graphic.model.DefaultLeafElement
jpicedt.graphic.model.AbstractCurve
jpicedt.graphic.model.PicPsCurve
A multicurve, either closed or not, going through a set of control points. This is the implementation of the (somewhat obscure) pstricks \pscurve function. There are three coefficients a,b,c altering the curvature.
| Field Summary | |
protected static int |
A_SLIDER_MAX
Max value of curvature coefficient accessible to Jslider in the geometry editor |
protected static int |
A_SLIDER_MIN
Min value of curvature coefficient accessible to JSlider in the geometry editor |
protected static int |
B_SLIDER_MAX
|
protected static int |
B_SLIDER_MIN
|
protected static int |
C_SLIDER_MAX
|
protected static int |
C_SLIDER_MIN
|
protected double |
curvatureA
Curvature parameters a,b,c of pscurve. |
protected double |
curvatureB
|
protected double |
curvatureC
|
protected static double |
DEFAULT_CURVATURE_A
default values for the curvature parameters |
protected static double |
DEFAULT_CURVATURE_B
|
protected static double |
DEFAULT_CURVATURE_C
|
protected ArrayList |
polygonPts
An array of PicPoint's backing the geometry of the polygon. |
| Fields inherited from class jpicedt.graphic.model.AbstractCurve |
FIRST_CURVE_END_POINT, FIRST_SEGMENT_CONTROL_POINT, INVALID_POINT_INDEX, isClosed, LAST_CURVE_END_POINT, SECOND_SEGMENT_CONTROL_POINT, SUBDIVISION_POINT |
| Fields inherited from class jpicedt.graphic.model.DefaultLeafElement |
nodeConnections, nodeName, pts |
| Fields inherited from class jpicedt.graphic.model.AbstractElement |
attributeSet, parent, view |
| Constructor Summary | |
PicPsCurve()
Create a new empty open pscurve, with a default attribute set. |
|
PicPsCurve(boolean closed)
Create a new empty pscurve, open or closed, with a default attribute set bound to it. |
|
PicPsCurve(boolean closed,
PicAttributeSet set)
Create a new empty pscurve with the given attribute set. |
|
PicPsCurve(PicPoint[] polyPts,
boolean closed,
double a,
double b,
double c,
PicAttributeSet set)
Create a new pscurve initialized from the given array of PicPoint's. |
|
PicPsCurve(PicPoint[] polygonPts,
boolean closed,
PicAttributeSet set)
Create a new pscurve initialized from the given array of PicPoint's, using the default curvature values. |
|
PicPsCurve(PicPsCurve poly)
"cloning" constructor (to be used by clone()) |
|
| Method Summary | |
void |
addPoint(int ptIndex,
PicPoint pt)
Inserts the specified point at the specified index. |
void |
addPoint(PicPoint pt)
adds the given point at the end of this pscurve. |
Object |
clone()
Overide Object.clone() method |
PicMultiCurve |
convertToMultiCurve()
converts this PicPsCurve to a PicMultiCurve, by simply relying on the appropriate constructor in class PicMultiCurve. |
PEAction[] |
createActions(ActionDispatcher actionDispatcher,
ActionLocalizer localizer,
HitInfo hi)
Create an array of Action's related to this object |
AbstractCustomizer |
createCustomizer()
Returns a customizer (Swing) component |
Rectangle2D |
getBoundingBox(Rectangle2D r)
Returns the bounding box (ie the surrounding rectangle) in double precision This implementation compute the bb from the union of : the bb as computed by super-class and the smallest rectangle that encompasses all the polygon-points. |
double[] |
getCurvatures()
Return an array containing the three curvature coefficients in an array, namely [a b c]. |
PicPoint[] |
getFinalControlCurve()
Returns the 4 Bezier points of the final prolongation of the PsCurve. |
int |
getFirstPointIndex()
Returns the index of the first user-controlled point that can be retrieved by getPoint(). |
PicPoint[] |
getInitialControlCurve()
Returns the 4 Bezier points of the initial prolongation of the PsCurve. |
int |
getLastPointIndex()
Returns the index of the last user-controlled point that can be retrieved by getPoint(). |
String |
getName()
Returns a non-localised string representing this object's name This default implementation returns the class name. |
PicPoint |
getPoint(int numPoint,
PicPoint src)
Return the user-controlled point (ie a polygon point, not a bezier point) having the given index. |
double |
getPointX(int index)
This implementation returns the X-coord of the polygon-point with the same index. |
double |
getPointY(int index)
This implementation returns the Y-coord of the polygon-point with the same index. |
protected PicPoint |
getPolygonPoint(int numPoint)
Return a reference on the polygon point with the given index. |
void |
removeLastPoint()
removes the last point of this PicPsCurve. |
void |
removePoint(int pos)
Remove a point at the given position from this PicPsCurve, then fire a changed-update. |
void |
rotate(PicPoint ptOrg,
double angle)
Rotate this Element by the given angle along the given point |
void |
scale(double ptOrgX,
double ptOrgY,
double sx,
double sy)
Scale this object by (sx,sy) using (ptOrgX,ptOrgY) as the origin. |
void |
setClosed(boolean state)
set close path state, then fires a changed-update. |
void |
setPoint(int index,
PicPoint pt,
EditPointConstraint constraint)
Set the user-controlled point with the given index to the given value. |
void |
shear(PicPoint ptOrg,
double shx,
double shy)
Shear this Element by the given params wrt to the given origin |
int |
splitSegment(int segIdx,
PicPoint pt)
Split the given polygon segment (starting from 0), by inserting a new polygon point at the appropriate position. |
String |
toString()
Used for debugging purpose. |
void |
translate(double dx,
double dy)
Translate this Element by (dx,dy) ; this implementation translates the specification-points, then fires a changed-update event. |
| Methods inherited from class jpicedt.graphic.model.DefaultLeafElement |
addConnection, fireChangedUpdate, forwardChangedUpdate, getAllowsChildren, getNodeName, getNumberOfSpecificationPoints, getPoint, getSpecificationPoint, getSpecificationPointX, getSpecificationPointY, isNode, isNodeable, iterator, nodeConnectionOrigin, nodeReferencePoint, nodeReferencePointX, nodeReferencePointY, removeAllConnections, removeConnection, setNodeName, setPoint, setSpecificationPoint |
| Methods inherited from class jpicedt.graphic.model.AbstractElement |
anchorPointsIterator, getAttribute, getAttributeSet, getDrawing, getParent, getView, removeView, scale, setAttribute, setAttributeSet, setParent, setViewFromFactory |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected ArrayList polygonPts
protected double curvatureA
protected double curvatureB
protected double curvatureC
protected static double DEFAULT_CURVATURE_A
protected static double DEFAULT_CURVATURE_B
protected static double DEFAULT_CURVATURE_C
protected static int A_SLIDER_MIN
protected static int B_SLIDER_MIN
protected static int C_SLIDER_MIN
protected static int A_SLIDER_MAX
protected static int B_SLIDER_MAX
protected static int C_SLIDER_MAX
| Constructor Detail |
public PicPsCurve()
public PicPsCurve(boolean closed)
closed - whether the pscurve will be closed or not
public PicPsCurve(boolean closed,
PicAttributeSet set)
set - attribute set to be bound to this elementclosed - whether the generated multi-curve will be closed or not
public PicPsCurve(PicPoint[] polyPts,
boolean closed,
double a,
double b,
double c,
PicAttributeSet set)
polyPts - array of PicPoint's specifying the pscurve geometry.set - attribute set to be bound to this elementclosed - whether the generated multi-curve will be closed or nota - the a-curvature valueb - the b-curvature valuec - the c-curvature value
public PicPsCurve(PicPoint[] polygonPts,
boolean closed,
PicAttributeSet set)
polygonPts - array of PicPoint's specifying the polygon geometry.set - attribute set to be bound to this elementclosed - whether the generated multi-curve will be closed or notpublic PicPsCurve(PicPsCurve poly)
poly - PicPsCurve to be cloned| Method Detail |
public Object clone()
clone in interface Elementclone in class DefaultLeafElementpublic String getName()
DefaultLeafElement
getName in interface ElementgetName in class DefaultLeafElementpublic int getFirstPointIndex()
getPoint().
This implementation returns 0.
getFirstPointIndex in interface ElementgetFirstPointIndex in class DefaultLeafElementpublic int getLastPointIndex()
getPoint().
This default implementation returns the number of polygon-points minus one.
getLastPointIndex in interface ElementgetLastPointIndex in class DefaultLeafElement
public PicPoint getPoint(int numPoint,
PicPoint src)
setPoint method.
getPoint in interface ElementgetPoint in class DefaultLeafElementnumPoint - the point index, should be greater or equal to the value returned by
getFirstPointIndex, and lower or equal to getLastPointIndex.
numPoint ;
if src is null, allocates a new PicPoint and return it,
otherwise directly modifies src and returns it as well for convenience.protected final PicPoint getPolygonPoint(int numPoint)
public double getPointX(int index)
getPointX in interface ElementgetPointX in class DefaultLeafElementindex - the point index, should be greater or equal to the value returned by
getFirstPointIndex, and lower or equal to getLastPointIndex.
index.public double getPointY(int index)
getPointY in interface ElementgetPointY in class DefaultLeafElementindex - the point index, should be greater or equal to the value returned by
getFirstPointIndex, and lower or equal to getLastPointIndex.
index.
public void translate(double dx,
double dy)
translate in interface Elementtranslate in class DefaultLeafElementdx - The X coordinate of translation vectordy - The Y coordinate of translation vector
public void scale(double ptOrgX,
double ptOrgY,
double sx,
double sy)
sx and sy may be negative.
This method eventually fires a changed-update event.
scale in interface Elementscale in class DefaultLeafElement
public void rotate(PicPoint ptOrg,
double angle)
rotate in interface Elementrotate in class DefaultLeafElementangle - rotation angle in radians
public void shear(PicPoint ptOrg,
double shx,
double shy)
shear in interface Elementshear in class DefaultLeafElement
public void setPoint(int index,
PicPoint pt,
EditPointConstraint constraint)
setPoint in interface ElementsetPoint in class AbstractCurveconstraint - not used so farpublic void addPoint(PicPoint pt)
addPoint in class AbstractCurve
public void addPoint(int ptIndex,
PicPoint pt)
public int splitSegment(int segIdx,
PicPoint pt)
splitSegment in class AbstractCurvesegIdx - index of the polygon segment that must be split.pt - the PicPoint to be added
public void removePoint(int pos)
Nothing is done if this polygon has only one point.
removePoint in class AbstractCurvepos - index of point to be removedpublic void removeLastPoint()
removePoint(polygonPts.size()-1)
public PicMultiCurve convertToMultiCurve()
PicMultiCurve.
convertToMultiCurve in interface PicMultiCurveConvertablepublic PicPoint[] getInitialControlCurve()
public PicPoint[] getFinalControlCurve()
public void setClosed(boolean state)
setClosed in class AbstractCurvestate - The new closed valuepublic double[] getCurvatures()
public Rectangle2D getBoundingBox(Rectangle2D r)
getBoundingBox in interface ElementgetBoundingBox in class DefaultLeafElementpublic String toString()
toString in class AbstractCurve
public PEAction[] createActions(ActionDispatcher actionDispatcher,
ActionLocalizer localizer,
HitInfo hi)
createActions in interface ActionFactorycreateActions in class AbstractCurveactionDispatcher - dispatches events to the proper PECanvaslocalizer - i18n localizer for PEAction'spublic AbstractCustomizer createCustomizer()
CustomizerFactory
createCustomizer in interface CustomizerFactorycreateCustomizer in class AbstractCurve
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||