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__ |
Default class constructor. |
AddArrow |
Add an arrow (or annotation) to the line. |
AddArrowOrdered |
Add an arrowhead in the position indicated by the reference list |
ClearArrow |
Delete the arrow with the given name. |
ClearArrowsAtPosition |
Delete the arrows at the specified position, or at any position if position is -1. |
Delete |
Delete the line, unlink it first. |
DeleteArrowHead |
Delete arrowhead by position and name. |
DeleteArrowHeadId |
Delete arrowhead by id. |
DeleteLineControlPoint |
Delete an arbitary point on the line. |
Draggable |
Line is not draggable. |
DrawArrow |
Draw the given arrowhead (or annotation). |
DrawArrows |
Draw all arrows. |
DrawRegion |
Format one region at this position. |
EraseRegion |
Erase one region at this position. |
FindArrowHead |
Find arrowhead by position and name. |
FindArrowHeadId |
Find arrowhead by id. |
FindLineEndPoints |
Finds the x, y points at the two ends of the line. |
FindLinePosition |
Find which position we’re talking about. |
FindMinimumWidth |
Find the horizontal width for drawing a line with arrows in |
FindNth |
Find the position of the line on the given object. |
FormatText |
Format a text string according to the region size, adding |
GetAlignmentEnd |
Get alignment end. |
GetAlignmentOrientation |
Get the alignment orientation. |
GetAlignmentStart |
Get alignment start |
GetAlignmentType |
Get the alignment type. |
GetArrows |
Get the defined arrows. |
GetAttachmentFrom |
Get the attachment point on the ‘from’ node. |
GetAttachmentTo |
Get the attachment point on the ‘to’ node. |
GetBoundingBoxMin |
Get the minimum bounding box. |
GetEnds |
Get the visible endpoints of the lines for drawing between two objects. |
GetFrom |
Get the ‘from’ object. |
GetLabelPosition |
Get the reference point for a label. |
GetLineControlPoints |
Get the line control points. |
GetNextControlPoint |
Find the next control point in the line after the start / end point, |
GetTo |
Get the ‘to’ object. |
HitTest |
Line hit test. |
Initialise |
Initialise the line object. |
InsertLineControlPoint |
Insert a control point at an optional given position. |
IsEnd |
True if shape is at the end of the line. |
IsSpline |
If True a spline is drawn through the control points. |
MakeControlPoints |
Make handle control points. |
MakeLineControlPoints |
Make a given number of control points. |
OnBeginDragLeft |
not implemented??? |
OnCreateLabelShape |
Create label shape handler. |
OnDragLeft |
not implemented??? |
OnDraw |
The draw handler. |
OnDrawContents |
The draw contents handler. |
OnDrawControlPoints |
The draw control points handler. |
OnDrawOutline |
The draw outline handler. |
OnEndDragLeft |
not implemented??? |
OnErase |
The erase handler. |
OnEraseControlPoints |
The erase control points handler. |
OnLabelMovePre |
Label move ‘pre’ handler. ??? |
OnMoveLink |
The move linke handler, called when a connected object has moved, to move the link to |
OnMoveMiddleControlPoint |
The move middle control point handler. |
OnMovePre |
The move ‘pre’ handler. ??? |
OnSizingBeginDragLeft |
The sizing begin drag left handler. |
OnSizingDragLeft |
The sizing drag left handler. |
OnSizingEndDragLeft |
The sizing end drag left handler. |
ResetControlPoints |
Reset the control points. |
Select |
Overridden select, to create / delete temporary label-moving objects. |
SetAlignmentOrientation |
Set the alignment orientation. |
SetAlignmentType |
Set the alignment type. |
SetAttachmentFrom |
Set the ‘from’ shape attachment. |
SetAttachments |
Specify which object attachment points should be used at each end of the line. |
SetAttachmentTo |
Set the ‘to’ shape attachment. |
SetEnds |
Set the end positions of the line. |
SetFrom |
Set the ‘from’ object for the line. |
SetIgnoreOffsets |
Set whether to ignore offsets from the end of the line when drawing. |
SetSpline |
Specifies whether a spline is to be drawn through the control points. |
SetTo |
Set the ‘to’ object for the line. |
Straighten |
Straighten verticals and horizontals. |
Unlink |
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.
Parameters: |
|
---|
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.
Parameters: |
|
---|
ClearArrow
(self, name)¶Delete the arrow with the given name.
Parameters: | name – name of arrow to delete |
---|
ClearArrowsAtPosition
(self, end)¶Delete the arrows at the specified position, or at any position if position is -1.
Parameters: | 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.
Parameters: |
|
---|
DeleteArrowHeadId
(self, arrowId)¶Delete arrowhead by id.
Parameters: | arrowId – id of arrow to delete |
---|
DeleteLineControlPoint
(self)¶Delete an arbitary 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).
Parameters: |
|
---|
DrawArrows
(self, dc)¶Draw all arrows.
DrawRegion
(self, dc, region, x, y)¶Format one region at this position.
Parameters: |
|
---|
EraseRegion
(self, dc, region, x, y)¶Erase one region at this position.
Parameters: |
|
---|
FindArrowHead
(self, position, name)¶Find arrowhead by position and name.
if position is -1, matches any position.
Parameters: |
|
---|
FindArrowHeadId
(self, arrowId)¶Find arrowhead by id.
Parameters: | 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.
Parameters: |
|
---|---|
Returns: | 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.
Parameters: |
|
---|---|
Returns: | 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.
Parameters: |
|
---|
GetAlignmentEnd
(self)¶Get alignment end.
GetAlignmentOrientation
(self, isEnd)¶Get the alignment orientation.
Parameters: | 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.
Parameters: | 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.
Parameters: | 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.
Parameters: | shape – an instance of Shape ??? |
---|
GetTo
(self)¶Get the ‘to’ object.
HitTest
(self, x, y)¶Line hit test.
Parameters: |
|
---|
Initialise
(self)¶Initialise the line object.
InsertLineControlPoint
(self, dc = None, point = None)¶Insert a control point at an optional given position.
Parameters: |
|
---|
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.
Parameters: | 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 linke 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.
Parameters: |
|
---|
SetAlignmentType
(self, isEnd, alignType)¶Set the alignment type.
Parameters: |
|
---|
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.
Parameters: |
|
---|
SetAttachmentTo
(self, attach)¶Set the ‘to’ shape attachment.
SetEnds
(self, x1, y1, x2, y2)¶Set the end positions of the line.
Param: | x1: x1 position |
---|---|
Param: | y1: y1 position |
Param: | x2: x2 position |
Param: | 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.
Parameters: | 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.
Parameters: | dc – an instance of wx.MemoryDC or None |
---|
Unlink
(self)¶Unlink the line from the nodes at either end.