|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jpicedt.graphic.model.AbstractElement jpicedt.graphic.model.PicNodeConnection
public class PicNodeConnection
This class represents a connection between two DefaultLeafElement
's. It directly inherits from
AbstractElement
because BranchElement
(after thinking it over carefully) is not
the most appropriate choice in many respects:
DefaultLeafElement
's is definitely
not a parent/child one, seeing that a node may be linked to more than one connection (which is forbidden
in a parent/child relation as in BranchElement)
fireChangedUpdate()
method in
DefaultLeafElement
(april'05) whereby, in addition to standard child-parent event dispatching,
change events are also dispatched to every appropriate connection, if any, irrespective of the nature of
the (real) parent (e.g., Drawing.RootElement
or PicGroup
). In particular, this
means that one DefaultLeafElement may belong to a given group A, while the other DefaultLeafElement may
belong to another group B, and at the same time both DefaultLeafElement's may share the same connection
(now, this also implies that a PicNodeConnection
may have "dangling" bonds if we cut/delete
one of the groups [pending] the view might get confused ?).
Field Summary | |
---|---|
protected boolean |
changeLock
a semaphor that signals a change of state is underway in this PicNodeConnection and it shouldn't process events coming from its node before the change is completed (hence this is used inside forwardChangedUpdate() );
set it to true each time you start modifying nodes AND edge simulatneously and you don't want
events to be forwarded to the root of the hierarchy before everything is completed (e.g. to
get rid of side-effects, or to reduce the burden for the repaint manager). |
static int |
CONTROL_A
index of control point A |
static int |
CONTROL_B
index of control point B |
static String |
EDGE_NCCURVE
|
static String |
EDGE_NCLINE
|
Fields inherited from class jpicedt.graphic.model.AbstractElement |
---|
attributeSet, name, parent, view |
Constructor Summary | |
---|---|
PicNodeConnection(NodeableElement nodeA,
NodeableElement nodeB,
String edgeType,
PicAttributeSet set)
|
|
PicNodeConnection(PicNodeConnection src)
|
Method Summary | |
---|---|
PicNodeConnection |
clone()
Returns a clone of this Element |
Shape |
createShape()
Returns a Shape that holds the geometry of the connection. |
void |
forwardChangedUpdate(Element node,
DrawingEvent.EventType eventType)
Called by a child-node (=a DefaultLeafElement) to inform this connection of some change that occured to one of its nodes. |
Rectangle2D |
getBoundingBox(Rectangle2D r)
Returns the bounding box (i.e. the surrounding rectangle) in double precision Used e.g. to determine the arguments of the \\begin{picture} command. |
PicPoint |
getCtrlPt(int index,
PicPoint src)
Return the user-controlled point having the given index. |
String |
getDefaultName()
|
PicPoint |
getEndPointA(PicPoint pt)
Returns the coordinates of the edge's end-point at node A |
PicPoint |
getEndPointB(PicPoint pt)
Returns the coordinates of the edge's end-point at node B |
int |
getFirstPointIndex()
Return the index of the first user-controlled point that can be retrieved by getCtrlPt() |
int |
getLastPointIndex()
Return the index of the last user-controlled point that can be retrieved by getCtrlPt() |
NodeableElement |
getNodeA()
Returns the first node. |
NodeableElement |
getNodeB()
Returns the second node. |
int |
getNodeIndex(NodeableElement o)
Returns the index (0 or 1) of the given node, or -1 if the given node is not connected to this edge. |
PicVector |
getTangentA(PicVector v)
Return the tangent to the node connection at node A. |
PicVector |
getTangentB(PicVector v)
Return the tangent to the node connection at node B. |
void |
mirror(PicPoint ptOrg,
PicVector normalVector)
Effectue une réflexion sur this relativement à l'axe
défini par ptOrg et normalVector . |
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,
UserConfirmationCache ucc)
Scale children by (sx,sy) using (ptOrgX,ptOrgY) as origin ; sx and sy can be negative. |
void |
setCtrlPt(int index,
PicPoint pt)
convenience call to setCtrlPt(int, PicPoint, null) |
void |
setCtrlPt(int index,
PicPoint pt,
EditPointConstraint constraint)
Set the user-controlled point indexed by "index" to the given value, using the specified geometrical constraint. |
void |
setNodeA(NodeableElement o)
Sets the first node. |
void |
setNodeB(NodeableElement o)
Sets the second node. |
void |
shear(PicPoint ptOrg,
double shx,
double shy,
UserConfirmationCache ucc)
Shear this Element by the given params wrt to the given origin |
void |
syncArrowGeometry(ArrowView v,
ArrowView.Direction d)
Helper for the associated View. |
String |
toString()
Returns a String representation of the attribute set for this AbstractElement |
void |
translate(double dx,
double dy)
Translate both nodes and connections by the given vector |
Methods inherited from class jpicedt.graphic.model.AbstractElement |
---|
anchorPointsIterator, createActions, fireChangedUpdate, getAttribute, getAttributeSet, getCtrlPtSubset, getDrawing, getName, getParent, getView, pullOutOfGroup, removeView, replaceBy, scale, scale, scale, setAttribute, setAttributeSet, setName, setParent, setViewFromFactory, shear |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String EDGE_NCLINE
public static final String EDGE_NCCURVE
public static final int CONTROL_A
public static final int CONTROL_B
protected boolean changeLock
forwardChangedUpdate()
);
set it to true each time you start modifying nodes AND edge simulatneously and you don't want
events to be forwarded to the root of the hierarchy before everything is completed (e.g. to
get rid of side-effects, or to reduce the burden for the repaint manager).
Example of use : whenever we call translate()
on this PicNodeConnection
Constructor Detail |
---|
public PicNodeConnection(NodeableElement nodeA, NodeableElement nodeB, String edgeType, PicAttributeSet set)
public PicNodeConnection(PicNodeConnection src)
Method Detail |
---|
public PicNodeConnection clone()
AbstractElement
clone
in interface Element
clone
in class AbstractElement
public String getDefaultName()
getDefaultName
in class AbstractElement
public Shape createShape()
createShape
in interface Element
createShape
in class AbstractElement
public PicPoint getEndPointA(PicPoint pt)
public PicPoint getEndPointB(PicPoint pt)
public PicVector getTangentA(PicVector v)
public PicVector getTangentB(PicVector v)
public void syncArrowGeometry(ArrowView v, ArrowView.Direction d)
syncArrowGeometry
in interface Element
syncArrowGeometry
in class AbstractElement
public NodeableElement getNodeA()
public NodeableElement getNodeB()
public int getNodeIndex(NodeableElement o)
public void setNodeA(NodeableElement o)
public void setNodeB(NodeableElement o)
public PicPoint getCtrlPt(int index, PicPoint src)
Element
setPoint
method.
index
- the point index, should be greater or equal to the value returned by
getFirstPointIndex
, and lower or equal to getLastPointIndex
.
index
;
if dest
is null, concrete implementation of this method should
allocate a new PicPoint and return it,
otherwise directly modify dest
and return it as well for convenience.public int getFirstPointIndex()
Element
public int getLastPointIndex()
Element
public void setCtrlPt(int index, PicPoint pt)
AbstractElement
setCtrlPt(int, PicPoint, null)
setCtrlPt
in interface Element
setCtrlPt
in class AbstractElement
public void setCtrlPt(int index, PicPoint pt, EditPointConstraint constraint)
Element
constraint
- a geometry constraint, or null if no particular constraint is being imposed (aka default).public Rectangle2D getBoundingBox(Rectangle2D r)
public void forwardChangedUpdate(Element node, DrawingEvent.EventType eventType)
eventType
- the event typenode
- the node that sent the change-event.public void translate(double dx, double dy)
dx
- The X coordinate of translation vectordy
- The Y coordinate of translation vectorpublic void scale(double ptOrgX, double ptOrgY, double sx, double sy, UserConfirmationCache ucc)
ucc
- une valeur UserConfirmationCache
permettant de demander à l'utilisateur
confirmation, de se souvenir de la dernière confirmation qu'il a donné, ou de ses préférences.public void rotate(PicPoint ptOrg, double angle)
angle
- rotation angle in radianspublic void mirror(PicPoint ptOrg, PicVector normalVector)
this
relativement à l'axe
défini par ptOrg
et normalVector
.
ptOrg
- le PicPoint
par lequel passe l'axe de réflexion.normalVector
- le PicVector
normal à l'axe de réflexion.public void shear(PicPoint ptOrg, double shx, double shy, UserConfirmationCache ucc)
ucc
- une valeur UserConfirmationCache
permettant de demander à l'utilisateur
confirmation, de se souvenir de la dernière confirmation qu'il a donné, ou de ses préférences.public String toString()
AbstractElement
String
representation of the attribute set for this AbstractElement
toString
in class AbstractElement
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |