The LineShape class may be attached to two nodes, it may be segmented, in which case a control point is drawn for each joint.
A LineShape
may have arrows at the beginning, end and centre.
Default class constructor. |
|
Add an arrow (or annotation) to the line. |
|
Add an arrowhead in the position indicated by the reference list |
|
Delete the arrow with the given name. |
|
Delete the arrows at the specified position, or at any position if position is -1. |
|
Delete the line, unlink it first. |
|
Delete arrowhead by position and name. |
|
Delete arrowhead by id. |
|
Delete an arbitrary point on the line. |
|
Line is not draggable. |
|
Draw the given arrowhead (or annotation). |
|
Draw all arrows. |
|
Format one region at this position. |
|
Erase one region at this position. |
|
Find arrowhead by position and name. |
|
Find arrowhead by id. |
|
Finds the x, y points at the two ends of the line. |
|
Find which position we’re talking about. |
|
Find the horizontal width for drawing a line with arrows in |
|
Find the position of the line on the given object. |
|
Format a text string according to the region size, adding |
|
Get alignment end. |
|
Get the alignment orientation. |
|
Get alignment start |
|
Get the alignment type. |
|
Get the defined arrows. |
|
Get the attachment point on the ‘from’ node. |
|
Get the attachment point on the ‘to’ node. |
|
Get the minimum bounding box. |
|
Get the visible endpoints of the lines for drawing between two objects. |
|
Get the ‘from’ object. |
|
Get the reference point for a label. |
|
Get the line control points. |
|
Find the next control point in the line after the start / end point, |
|
Get the ‘to’ object. |
|
Line hit test. |
|
Initialise the line object. |
|
Insert a control point at an optional given position. |
|
True if shape is at the end of the line. |
|
If True a spline is drawn through the control points. |
|
Make handle control points. |
|
Make a given number of control points. |
|
not implemented??? |
|
Create label shape handler. |
|
not implemented??? |
|
The draw handler. |
|
The draw contents handler. |
|
The draw control points handler. |
|
The draw outline handler. |
|
not implemented??? |
|
The erase handler. |
|
The erase control points handler. |
|
Label move ‘pre’ handler. ??? |
|
The move link handler, called when a connected object has moved, to move the link to |
|
The move middle control point handler. |
|
The move ‘pre’ handler. ??? |
|
The sizing begin drag left handler. |
|
The sizing drag left handler. |
|
The sizing end drag left handler. |
|
Reset the control points. |
|
Overridden select, to create / delete temporary label-moving objects. |
|
Set the alignment orientation. |
|
Set the alignment type. |
|
Set the ‘from’ shape attachment. |
|
Specify which object attachment points should be used at each end of the line. |
|
Set the ‘to’ shape attachment. |
|
Set the end positions of the line. |
|
Set the ‘from’ object for the line. |
|
Set whether to ignore offsets from the end of the line when drawing. |
|
Specifies whether a spline is to be drawn through the control points. |
|
Set the ‘to’ object for the line. |
|
Straighten verticals and horizontals. |
|
Unlink the line from the nodes at either end. |
LineShape
(Shape)¶The LineShape class may be attached to two nodes, it may be segmented, in which case a control point is drawn for each joint.
A LineShape
may have arrows at the beginning, end and centre.
__init__
(self)¶Default class constructor.
AddArrow
(self, type, end = ARROW_POSITION_END, size = 10.0, xOffset = 0.0, name = "", mf = None, arrowId = -1)¶Add an arrow (or annotation) to the line.
type – an arrow head type, one of the following
Arrow head type |
Description |
---|---|
|
a hollow circle |
|
a filled circle |
|
an arrow |
|
a single oblique |
|
a double oblique |
|
custom, define in metafile |
end – may be one of the following
Arrow head type |
Description |
---|---|
|
arrow appears at the end |
|
arrow appears at the start |
size – specifies the length of the arrow
xOffset – specifies the offset from the end of the line
name – specifies a name
mf – mf can be a wxPseduoMetaFile, perhaps loaded from a simple Windows metafile.
arrowId – the id for the arrow
AddArrowOrdered
(self, arrow, referenceList, end)¶Add an arrowhead in the position indicated by the reference list of arrowheads, which contains all legal arrowheads for this line, in the correct order. E.g.
Reference list: a b c d e Current line list: a d
Add c, then line list is: a c d.
If no legal arrowhead position, return FALSE. Assume reference list is for one end only, since it potentially defines the ordering for any one of the 3 positions. So we don’t check the reference list for arrowhead position.
arrow – an instance of ArrowHead
referenceList – ???
end – ???
ClearArrow
(self, name)¶Delete the arrow with the given name.
name – name of arrow to delete
ClearArrowsAtPosition
(self, end)¶Delete the arrows at the specified position, or at any position if position is -1.
end – position to clear arrow from
Delete
(self)¶Delete the line, unlink it first.
DeleteArrowHead
(self, position, name)¶Delete arrowhead by position and name.
if position is -1, matches any position.
position – position of arrow to delete or -1
name – name of arrow to delete
DeleteArrowHeadId
(self, arrowId)¶Delete arrowhead by id.
arrowId – id of arrow to delete
DeleteLineControlPoint
(self)¶Delete an arbitrary point on the line.
Draggable
(self)¶Line is not draggable.
Note
This is really to distinguish between lines and other images. For lines we want to pass drag to canvas, since lines tend to prevent dragging on a canvas (they get in the way.)
DrawArrow
(self, dc, arrow, XOffset, proportionalOffset)¶Draw the given arrowhead (or annotation).
dc – an instance of wx.MemoryDC
arrow – an instannce of ArrowHead
XOffset – the x offset ???
proportionalOffset – ???
DrawArrows
(self, dc)¶Draw all arrows.
DrawRegion
(self, dc, region, x, y)¶Format one region at this position.
dc – an instance of wx.MemoryDC
dc – an instance of ShapeRegion
x – the x position
y – the y position
EraseRegion
(self, dc, region, x, y)¶Erase one region at this position.
dc – an instance of wx.MemoryDC
dc – an instance of ShapeRegion
x – the x position
y – the y position
FindArrowHead
(self, position, name)¶Find arrowhead by position and name.
if position is -1, matches any position.
position – position of arrow to find or -1
name – name of arrow to find
FindArrowHeadId
(self, arrowId)¶Find arrowhead by id.
arrowId – id of arrow to find
FindLineEndPoints
(self)¶Finds the x, y points at the two ends of the line.
This function can be used by e.g. line-routing routines to get the actual points on the two node images where the lines will be drawn to / from.
FindLinePosition
(self, x, y)¶Find which position we’re talking about.
x – x position
y – y position
ARROW_POSITION_START or ARROW_POSITION_MIDDLE or ARROW_POSITION_END.
FindMinimumWidth
(self)¶Find the horizontal width for drawing a line with arrows in minimum space. Assume arrows at end only.
FindNth
(self, image, incoming)¶Find the position of the line on the given object.
Specify whether incoming or outgoing lines are being considered with incoming.
image – a node image
incoming – True
to get incoming lines ???
nth line, number of lines ???
FormatText
(self, dc, s, i)¶Format a text string according to the region size, adding strings with positions to region text list.
dc – an instance of wx.MemoryDC
s (str) – the text string
i (int) – index to the region to be used???
GetAlignmentEnd
(self)¶Get alignment end.
GetAlignmentOrientation
(self, isEnd)¶Get the alignment orientation.
isEnd – if True
get the type for the begin, else for the end ???
GetAlignmentStart
(self)¶Get alignment start
GetAlignmentType
(self, isEnd)¶Get the alignment type.
isEnd – if True
get the type for the begin, else for the end ???
GetArrows
(self)¶Get the defined arrows.
GetAttachmentFrom
(self)¶Get the attachment point on the ‘from’ node.
GetAttachmentTo
(self)¶Get the attachment point on the ‘to’ node.
GetBoundingBoxMin
(self)¶Get the minimum bounding box.
GetEnds
(self)¶Get the visible endpoints of the lines for drawing between two objects.
GetFrom
(self)¶Get the ‘from’ object.
GetLabelPosition
(self, position)¶Get the reference point for a label.
position – 0 = middle, 1 = start, 2 = end, Region x and y are offsets from this.
GetLineControlPoints
(self)¶Get the line control points.
GetNextControlPoint
(self, shape)¶Find the next control point in the line after the start / end point, depending on whether the shape is at the start or end.
shape – an instance of Shape
???
GetTo
(self)¶Get the ‘to’ object.
HitTest
(self, x, y)¶Line hit test.
x – x position
y – y position
Initialise
(self)¶Initialise the line object.
InsertLineControlPoint
(self, dc = None, point = None)¶Insert a control point at an optional given position.
dc – an instance of wx.MemoryDC
point – an optional point, otherwise will use _lineControlPoints
IsEnd
(self, nodeObject)¶True if shape is at the end of the line.
IsSpline
(self)¶If True a spline is drawn through the control points.
MakeControlPoints
(self)¶Make handle control points.
MakeLineControlPoints
(self, n)¶Make a given number of control points.
n (int) – number of control points, minimum of two
OnBeginDragLeft
(self, x, y, keys = 0, attachment = 0)¶not implemented???
OnCreateLabelShape
(self, parent, region, w, h)¶Create label shape handler.
OnDragLeft
(self, draw, x, y, keys = 0, attachment = 0)¶not implemented???
OnDraw
(self, dc)¶The draw handler.
OnDrawContents
(self, dc)¶The draw contents handler.
OnDrawControlPoints
(self, dc)¶The draw control points handler.
OnDrawOutline
(self, dc, x, y, w, h)¶The draw outline handler.
OnEndDragLeft
(self, x, y, keys = 0, attachment = 0)¶not implemented???
OnErase
(self, dc)¶The erase handler.
OnEraseControlPoints
(self, dc)¶The erase control points handler.
OnLabelMovePre
(self, dc, labelShape, x, y, old_x, old_y, display)¶Label move ‘pre’ handler. ???
OnMoveLink
(self, dc, moveControlPoints = True)¶The move link handler, called when a connected object has moved, to move the link to correct position.
OnMoveMiddleControlPoint
(self, dc, lpt, pt)¶The move middle control point handler.
OnMovePre
(self, dc, x, y, old_x, old_y, display = True)¶The move ‘pre’ handler. ???
OnSizingBeginDragLeft
(self, pt, x, y, keys = 0, attachment = 0)¶The sizing begin drag left handler.
OnSizingDragLeft
(self, pt, draw, x, y, keys = 0, attachment = 0)¶The sizing drag left handler.
OnSizingEndDragLeft
(self, pt, x, y, keys = 0, attachment = 0)¶The sizing end drag left handler.
ResetControlPoints
(self)¶Reset the control points.
Select
(self, select, dc = None)¶Overridden select, to create / delete temporary label-moving objects.
SetAlignmentOrientation
(self, isEnd, isHoriz)¶Set the alignment orientation.
isEnd – True
or False
???
isHoriz – True
of False
???
SetAlignmentType
(self, isEnd, alignType)¶Set the alignment type.
isEnd – if True
set the type for the begin, else for the end ???
alignType – one of the following
Arrow head type |
Description |
---|---|
|
Align horizontally |
|
Align vertically |
|
Align to next handle |
|
vertical by default |
SetAttachmentFrom
(self, attach)¶Set the ‘from’ shape attachment.
SetAttachments
(self, from_attach, to_attach)¶Specify which object attachment points should be used at each end of the line.
from_attach – the from points ???
to_attach – the to points ???
SetAttachmentTo
(self, attach)¶Set the ‘to’ shape attachment.
SetEnds
(self, x1, y1, x2, y2)¶Set the end positions of the line.
x1: x1 position
y1: y1 position
x2: x2 position
y2: y2 position
SetFrom
(self, object)¶Set the ‘from’ object for the line.
SetIgnoreOffsets
(self, ignore)¶Set whether to ignore offsets from the end of the line when drawing.
SetSpline
(self, spline)¶Specifies whether a spline is to be drawn through the control points.
spline (boolean) – True
draw a spline through control points.
SetTo
(self, object)¶Set the ‘to’ object for the line.
Straighten
(self, dc = None)¶Straighten verticals and horizontals.
dc – an instance of wx.MemoryDC
or None
Unlink
(self)¶Unlink the line from the nodes at either end.