Contents Up Previous Next

wxLineShape

A wxLineShape 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

wxShape

Members

wxLineShape::wxLineShape
wxLineShape::~wxLineShape
wxLineShape::AddArrow
wxLineShape::AddArrowOrdered
wxLineShape::ClearArrow
wxLineShape::ClearArrowsAtPosition
wxLineShape::DrawArrow
wxLineShape::DeleteArrowHead
wxLineShape::DeleteLineControlPoint
wxLineShape::DrawArrows
wxLineShape::DrawRegion
wxLineShape::EraseRegion
wxLineShape::FindArrowHead
wxLineShape::FindLineEndPoints
wxLineShape::FindLinePosition
wxLineShape::FindMinimumWidth
wxLineShape::FindNth
wxLineShape::GetAttachmentFrom
wxLineShape::GetAttachmentTo
wxLineShape::GetEnds
wxLineShape::GetFrom
wxLineShape::GetLabelPosition
wxLineShape::GetNextControlPoint
wxLineShape::GetTo
wxLineShape::Initialise
wxLineShape::InsertLineControlPoint
wxLineShape::IsEnd
wxLineShape::IsSpline
wxLineShape::MakeLineControlPoints
wxLineShape::OnMoveLink
wxLineShape::SetAttachmentFrom
wxLineShape::SetAttachments
wxLineShape::SetAttachmentTo
wxLineShape::SetEnds
wxLineShape::SetFrom
wxLineShape::SetIgnoreOffsets
wxLineShape::SetSpline
wxLineShape::SetTo
wxLineShape::Straighten
wxLineShape::Unlink


wxLineShape::wxLineShape

wxLineShape()

Constructor.

Usually you will call wxLineShape::MakeLineControlPoints to specify the number of segments in the line.


wxLineShape::~wxLineShape

~wxLineShape()

Destructor.


wxLineShape::AddArrow

void AddArrow(WXTYPE type, bool end = ARROW_POSITION_END, double arrowSize = 10.0, double xOffset = 0.0, const wxString& name = "", wxPseudoMetaFile *mf = NULL, long arrowId = -1)

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


wxLineShape::AddArrowOrdered

void AddArrowOrdered(wxArrowHead *arrow, wxList& referenceList, int 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.


wxLineShape::ClearArrow

bool ClearArrow(const wxString& name)

Delete the arrow with the given name.


wxLineShape::ClearArrowsAtPosition

void ClearArrowsAtPosition(int position = -1)

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


wxLineShape::DrawArrow

void DrawArrow(ArrowHead *arrow, double xOffset, bool proportionalOffset)

Draws the given arrowhead (or annotation).


wxLineShape::DeleteArrowHead

bool DeleteArrowHead(long arrowId)

bool DeleteArrowHead(int position, const wxString& name)

Delete arrowhead by id or position and name.


wxLineShape::DeleteLineControlPoint

bool DeleteLineControlPoint()

Deletes an arbitary point on the line.


wxLineShape::DrawArrows

void DrawArrows(wxDC& dc)

Draws all arrows.


wxLineShape::DrawRegion

void DrawRegion(wxDC& dc, wxShapeRegion *region, double x, double y)

Format one region at this position.


wxLineShape::EraseRegion

void EraseRegion(wxDC& dc, wxShapeRegion *region, double x, double y)

Format one region at this position.


wxLineShape::FindArrowHead

wxArrowHead * FindArrowHead(long arrowId)

wxArrowHead * FindArrowHead(int position, const wxString& name)

Find arrowhead by id or position and name.


wxLineShape::FindLineEndPoints

void FindLineEndPoints(double *fromX, double *fromY, double *toX, double *toY)

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.


wxLineShape::FindLinePosition

int FindLinePosition(double x, double y)

Find which position we're talking about at this x, y. Returns ARROW_POSITION_START, ARROW_POSITION_MIDDLE, ARROW_POSITION_END.


wxLineShape::FindMinimumWidth

double FindMinimumWidth()

Finds the horizontal width for drawing a line with arrows in minimum space. Assume arrows at end only.


wxLineShape::FindNth

void FindNth(wxShape *image, int *nth, int *noArcs, bool incoming)

Finds the position of the line on the given object. Specify whether incoming or outgoing lines are being considered with incoming.


wxLineShape::GetAttachmentFrom

int GetAttachmentFrom() const

Returns the attachment point on the 'from' node.


wxLineShape::GetAttachmentTo

int GetAttachmentTo() const

Returns the attachment point on the 'to' node.


wxLineShape::GetEnds

void GetEnds(double *x1, double *y1, double *x2, double *y2)

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


wxLineShape::GetFrom

wxShape * GetFrom() const

Gets the 'from' object.


wxLineShape::GetLabelPosition

void GetLabelPosition(int position, double *x, double *y)

Get the reference point for a label. Region x and y are offsets from this. position is 0 (middle), 1 (start), 2 (end).


wxLineShape::GetNextControlPoint

wxPoint * GetNextControlPoint(wxShape *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.


wxLineShape::GetTo

wxShape * GetTo()

Gets the 'to' object.


wxLineShape::Initialise

void Initialise()

Initialises the line object.


wxLineShape::InsertLineControlPoint

void InsertLineControlPoint()

Inserts a control point at an arbitrary position.


wxLineShape::IsEnd

bool IsEnd(wxShape *shape)

Returns TRUE if shape is at the end of the line.


wxLineShape::IsSpline

bool IsSpline()

Returns TRUE if a spline is drawn through the control points, and FALSE otherwise.


wxLineShape::MakeLineControlPoints

void MakeLineControlPoints(int n)

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


wxLineShape::OnMoveLink

void OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE)

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


wxLineShape::SetAttachmentFrom

void SetAttachmentTo(int fromAttach)

Sets the 'from' shape attachment.


wxLineShape::SetAttachments

void SetAttachments(int fromAttach, int toAttach)

Specifies which object attachment points should be used at each end of the line.


wxLineShape::SetAttachmentTo

void SetAttachmentTo(int toAttach)

Sets the 'to' shape attachment.


wxLineShape::SetEnds

void SetEnds(double x1, double y1, double x2, double y2)

Sets the end positions of the line.


wxLineShape::SetFrom

void SetFrom(wxShape *object)

Sets the 'from' object for the line.


wxLineShape::SetIgnoreOffsets

void SetIgnoreOffsets(bool ignore)

Tells the shape whether to ignore offsets from the end of the line when drawing.


wxLineShape::SetSpline

void SetSpline(bool spline)

Specifies whether a spline is to be drawn through the control points (TRUE), or a line (FALSE).


wxLineShape::SetTo

void SetTo(wxShape *object)

Sets the 'to' object for the line.


wxLineShape::Straighten

void Straighten(wxDC* dc = NULL)

Straighten verticals and horizontals. dc is optional.


wxLineShape::Unlink

void Unlink()

Unlinks the line from the nodes at either end.