Phoenix Logo

phoenix_title wx.lib.ogl.lines.LineShape

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.


class_hierarchy Class Hierarchy

Inheritance diagram for class LineShape:

super_classes Known Superclasses

wx.lib.ogl.basic.Shape


method_summary Methods Summary

__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.

api Class API



class 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.


Methods



__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:
  • type – an arrow head type, one of the following
    Arrow head type Description
    ARROW_HOLLOW_CIRCLE a hollow circle
    ARROW_FILLED_CIRCLE a filled circle
    ARROW_ARROW an arrow
    ARROW_SINGLE_OBLIQUE a single oblique
    ARROW_DOUBLE_OBLIQUE a double oblique
    ARROW_METAFILE custom, define in metafile
  • end – may be one of the following
    Arrow head type Description
    ARROW_POSITION_END arrow appears at the end
    ARROW_POSITION_START arrow appears at the start
  • size – specifies the lenght 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.

Parameters:
  • arrow – an instance of ArrowHead
  • referenceList – ???
  • end – ???


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:
  • position – position of arrow to delete or -1
  • name – name of arrow to delete


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:
  • 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.

Parameters:
  • 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.

Parameters:
  • 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.

Parameters:
  • position – position of arrow to find or -1
  • name – name of arrow to find


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:
  • x – x position
  • y – y position
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:
  • image – a node image
  • incomingTrue to get incoming lines ???
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:
  • 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.

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:
  • 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.

Parameters:
  • 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.

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. ???



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:
  • isEndTrue or False ???
  • isHorizTrue of False ???


SetAlignmentType(self, isEnd, alignType)

Set the alignment type.

Parameters:
  • isEnd – if True set the type for the begin, else for the end ???
  • alignType – one of the following
    Arrow head type Description
    LINE_ALIGNMENT_HORIZ Align horizontally
    LINE_ALIGNMENT_VERT Align vertically
    LINE_ALIGNMENT_TO_NEXT_HANDLE Align to next handle
    LINE_ALIGNMENT_NONE 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.

Parameters:
  • 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.

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 the line from the nodes at either end.