Table Of Contents

Previous topic

LineControlPoint

Next topic

_oglmisc

This Page

phoenix_title LineShape

LineShape may be attached to two nodes; it may be segmented, in which case a control point is drawn for each joint.

A wxLineShape may have arrows at the beginning, end and centre.

Derived from:
Shape

class_hierarchy Inheritance Diagram

Inheritance diagram for class LineShape

Inheritance diagram of LineShape


super_classes Known Superclasses

lib.ogl._basic.Shape


method_summary Methods Summary

__init__  
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
Delete  
DeleteArrowHead Delete arrowhead by position and name.
DeleteArrowHeadId Delete arrowhead by id.
DeleteLineControlPoint Delete an arbitary point on the line.
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 at this x, y.
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  
GetAlignmentOrientation  
GetAlignmentStart  
GetAlignmentType  
GetArrows  
GetAttachmentFrom Return the attachment point on the ‘from’ node.
GetAttachmentTo Return the attachment point on the ‘to’ node.
GetBoundingBoxMin  
GetEnds Get the visible endpoints of the lines for drawing between two objects.
GetFrom Return the ‘from’ object.
GetLabelPosition Get the reference point for a label.
GetLineControlPoints  
GetNextControlPoint Find the next control point in the line after the start / end point,
GetTo Return the ‘to’ object.
HitTest  
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 TRUE if a spline is drawn through the control points.
MakeControlPoints Make handle control points.
MakeLineControlPoints Make a given number of control points (minimum of two).
OnBeginDragLeft  
OnCreateLabelShape  
OnDragLeft  
OnDraw  
OnDrawContents  
OnDrawControlPoints  
OnDrawOutline  
OnEndDragLeft  
OnErase  
OnEraseControlPoints  
OnLabelMovePre  
OnMoveLink Called when a connected object has moved, to move the link to
OnMoveMiddleControlPoint  
OnMovePre  
OnSizingBeginDragLeft  
OnSizingDragLeft  
OnSizingEndDragLeft  
ResetControlPoints  
Select  
SetAlignmentOrientation  
SetAlignmentType  
SetAttachmentFrom Set the ‘from’ shape attachment.
SetAttachments Specify which object attachment points should be used at each end
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)

LineShape may be attached to two nodes; it may be segmented, in which case a control point is drawn for each joint.

A wxLineShape may have arrows at the beginning, end and centre.

Derived from:
Shape

Methods



__init__(self)


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 may currently be one of:

ARROW_HOLLOW_CIRCLE
Hollow circle.
ARROW_FILLED_CIRCLE
Filled circle.
ARROW_ARROW
Conventional arrowhead.
ARROW_SINGLE_OBLIQUE
Single oblique stroke.
ARROW_DOUBLE_OBLIQUE
Double oblique stroke.
ARROW_DOUBLE_METAFILE
Custom arrowhead.

end may currently be one of:

ARROW_POSITION_END
Arrow appears at the end.
ARROW_POSITION_START
Arrow appears at the start.

arrowSize specifies the length of the arrow.

xOffset specifies the offset from the end of the line.

name specifies a name for the arrow.

mf can be a wxPseduoMetaFile, perhaps loaded from a simple Windows metafile.

arrowId is 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.



ClearArrow(self, name)

Delete the arrow with the given name.



ClearArrowsAtPosition(self, end)

Delete the arrows at the specified position, or at any position if position is -1.



Delete(self)


DeleteArrowHead(self, position, name)

Delete arrowhead by position and name.

if position is -1, matches any position.



DeleteArrowHeadId(self, id)

Delete arrowhead by id.



DeleteLineControlPoint(self)

Delete an arbitary point on the line.



Draggable(self)


DrawArrow(self, dc, arrow, XOffset, proportionalOffset)

Draw the given arrowhead (or annotation).



DrawArrows(self, dc)

Draw all arrows.



DrawRegion(self, dc, region, x, y)

Format one region at this position.



EraseRegion(self, dc, region, x, y)

Erase one region at this position.



FindArrowHead(self, position, name)

Find arrowhead by position and name.

if position is -1, matches any position.



FindArrowHeadId(self, arrowId)

Find arrowhead by id.



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 at this x, y.

Returns ARROW_POSITION_START, ARROW_POSITION_MIDDLE, 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.



FormatText(self, dc, s, i)

Format a text string according to the region size, adding strings with positions to region text list.



GetAlignmentEnd(self)


GetAlignmentOrientation(self, isEnd)


GetAlignmentStart(self)


GetAlignmentType(self, isEnd)


GetArrows(self)


GetAttachmentFrom(self)

Return the attachment point on the ‘from’ node.



GetAttachmentTo(self)

Return the attachment point on the ‘to’ node.



GetBoundingBoxMin(self)


GetEnds(self)

Get the visible endpoints of the lines for drawing between two objects.



GetFrom(self)

Return the ‘from’ object.



GetLabelPosition(self, position)

Get the reference point for a label.

Region x and y are offsets from this. position is 0 (middle), 1 (start), 2 (end).



GetLineControlPoints(self)


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.



GetTo(self)

Return the ‘to’ object.



HitTest(self, x, y)


Initialise(self)

Initialise the line object.



InsertLineControlPoint(self, dc = None, point = None)

Insert a control point at an optional given position.



IsEnd(self, nodeObject)

TRUE if shape is at the end of the line.



IsSpline(self)

TRUE if a spline is drawn through the control points.



MakeControlPoints(self)

Make handle control points.



MakeLineControlPoints(self, n)

Make a given number of control points (minimum of two).



OnBeginDragLeft(self, x, y, keys = 0, attachment = 0)


OnCreateLabelShape(self, parent, region, w, h)


OnDragLeft(self, draw, x, y, keys = 0, attachment = 0)


OnDraw(self, dc)


OnDrawContents(self, dc)


OnDrawControlPoints(self, dc)


OnDrawOutline(self, dc, x, y, w, h)


OnEndDragLeft(self, x, y, keys = 0, attachment = 0)


OnErase(self, dc)


OnEraseControlPoints(self, dc)


OnLabelMovePre(self, dc, labelShape, x, y, old_x, old_y, display)


Called when a connected object has moved, to move the link to correct position



OnMoveMiddleControlPoint(self, dc, lpt, pt)


OnMovePre(self, dc, x, y, old_x, old_y, display = True)


OnSizingBeginDragLeft(self, pt, x, y, keys = 0, attachment = 0)


OnSizingDragLeft(self, pt, draw, x, y, keys = 0, attachment = 0)


OnSizingEndDragLeft(self, pt, x, y, keys = 0, attachment = 0)


ResetControlPoints(self)


Select(self, select, dc = None)


SetAlignmentOrientation(self, isEnd, isHoriz)


SetAlignmentType(self, isEnd, alignType)


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.



SetAttachmentTo(self, attach)

Set the ‘to’ shape attachment.



SetEnds(self, x1, y1, x2, y2)

Set the end positions of the line.



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.



SetTo(self, object)

Set the ‘to’ object for the line.



Straighten(self, dc = None)

Straighten verticals and horizontals.



Unlink the line from the nodes at either end.