wxShapeFramework  1.13.0 beta
wxSFLineShape Class Reference

Basic class encapsulating the multiline consisting of several line segments. More...

#include <LineShape.h>

Inheritance diagram for wxSFLineShape:
Collaboration diagram for wxSFLineShape:

List of all members.

Public Member Functions

 XS_DECLARE_CLONABLE_CLASS (wxSFLineShape)
 wxSFLineShape (void)
 Default constructor.
 wxSFLineShape (long src, long trg, const wxXS::RealPointList &path, wxSFDiagramManager *manager)
 User constructor.
 wxSFLineShape (const wxRealPoint &src, const wxRealPoint &trg, const wxXS::RealPointList &path, wxSFDiagramManager *manager)
 User constructor.
 wxSFLineShape (const wxSFLineShape &obj)
 Copy constructor.
virtual ~wxSFLineShape (void)
 Destructor.
void SetSrcShapeId (long id)
 Set line source.
long GetSrcShapeId ()
 Get line source.
void SetTrgShapeId (long id)
 Set line target.
long GetTrgShapeId ()
 Get line target.
void SetSrcPoint (const wxRealPoint &src)
 Set user-defined starting line point.
wxRealPoint GetSrcPoint ()
 Get first line point.
void SetTrgPoint (const wxRealPoint &trg)
 Set user-defined ending point.
wxRealPoint GetTrgPoint ()
 Get last line point.
void GetDirectLine (wxRealPoint &src, wxRealPoint &trg)
 Get starting and ending line points.
void SetSrcArrow (wxSFArrowBase *arrow)
 Set source arrow object.
void SetTrgArrow (wxSFArrowBase *arrow)
 Set target arrow object.
wxSFArrowBaseSetSrcArrow (wxClassInfo *arrowInfo)
 Set source arrow object created from its class info.
wxSFArrowBaseGetSrcArrow ()
 Get object of source arrow.
wxSFArrowBaseSetTrgArrow (wxClassInfo *arrowInfo)
 Set target arrow object created from its class info.
wxSFArrowBaseGetTrgArrow ()
 Get object of target arrow.
void SetLinePen (const wxPen &pen)
 Set line style.
wxPen GetLinePen () const
 Get line style.
void SetDockPoint (int index)
 Set the line dock point. It is a zerro based index of the line control point which will act as the shape position (value returned by GetRelativePosition() function).
int GetDockPoint ()
 Get the line dock point. It is a zerro based index of the line control point which will act as the shape position (value returned by GetRelativePosition() function).
wxXS::RealPointList & GetControlPoints ()
 Get a list of the line's contol points (their positions).
wxRealPoint GetDockPointPosition (int dp)
 Get a position of given line dock point.
void SetStartingConnectionPoint (const wxSFConnectionPoint *cp)
 Initialize line's starting point with existing fixed connection point.
void SetEndingConnectionPoint (const wxSFConnectionPoint *cp)
 Initialize line's ending point with existing fixed connection point.
bool GetLineSegment (size_t index, wxRealPoint &src, wxRealPoint &trg)
 Get starting and ending point of line segment defined by its index.
void SetStandAlone (bool enab)
 Set stand-alone line mode.
bool IsStandAlone ()
 Get stand-alone line mode.
virtual wxRect GetBoundingBox ()
 Get line's bounding box. The function can be overrided if neccessary.
virtual wxRealPoint GetAbsolutePosition ()
 Get the shape's absolute position in the canvas.
virtual wxRealPoint GetBorderPoint (const wxRealPoint &start, const wxRealPoint &end)
 Get intersection point of the shape border and a line leading from 'start' point to 'end' point. The function can be overrided if neccessary.
virtual bool Contains (const wxPoint &pos)
 Test whether the given point is inside the shape. The function can be overrided if neccessary.
virtual void MoveTo (double x, double y)
 Move the shape to the given absolute position. The function can be overrided if neccessary.
virtual void MoveBy (double x, double y)
 Move the shape by the given offset. The function can be overrided if neccessary.
virtual void CreateHandles ()
 Function called by the framework responsible for creation of shape handles at the creation time. The function can be overrided if neccesary.
virtual void OnHandle (wxSFShapeHandle &handle)
 Event handler called during dragging of the shape handle. The function can be overrided if necessary.
virtual void OnEndHandle (wxSFShapeHandle &handle)
 Event handler called when the user finished dragging of the shape handle. The function can be overrided if necessary.
virtual void OnBeginDrag (const wxPoint &pos)
 Event handler called at the begining of the shape dragging process. The function can be overrided if necessary.
virtual void OnLeftDoubleClick (const wxPoint &pos)
 Event handler called when the shape is double-clicked by the left mouse button. The function can be overrided if necessary.
virtual void Scale (double x, double y, bool children=sfWITHCHILDREN)
 Scale the shape size by in both directions. The function can be overrided if necessary (new implementation should call default one ore scale shape's children manualy if neccesary).

Protected Types

enum  LINEMODE { modeREADY, modeUNDERCONSTRUCTION, modeSRCCHANGE, modeTRGCHANGE }
 The modes in which the line shape can stay. More...

Protected Member Functions

virtual void DrawNormal (wxDC &dc)
 Draw the shape in the normal way. The function can be overrided if neccessary.
virtual void DrawHover (wxDC &dc)
 Draw the shape in the hower mode (the mouse cursor is above the shape). The function can be overrided if neccessary.
virtual void DrawHighlighted (wxDC &dc)
 Draw the shape in the highlighted mode (another shape is dragged over this shape and this shape will accept the dragged one if it will be dropped on it). The function can be overrided if neccessary.
virtual void DrawCompleteLine (wxDC &dc)
 Draw completed line.
virtual int GetHitLinesegment (const wxPoint &pos)
 Get index of the line segment intersecting the given point.
void SetLineMode (LINEMODE mode)
 Set line shape's working mode.
LINEMODE GetLineMode ()
 Get current working mode.
void SetUnfinishedPoint (const wxPoint &pos)
 Set next potential control point position (usefull in modeUNDERCONSTRUCTION working mode).
wxRealPoint GetModSrcPoint ()
 Get modified starting line point .
wxRealPoint GetModTrgPoint ()
 Get modified ending line point .

Protected Attributes

wxXS::RealPointList m_lstPoints
 List of the line's control points.
wxRealPoint m_nPrevPosition
wxPoint m_nUnfinishedPoint
LINEMODE m_nMode
int m_nDockPoint
 Index of the line dock point.
long m_nSrcShapeId
long m_nTrgShapeId
wxSFArrowBasem_pSrcArrow
wxSFArrowBasem_pTrgArrow
bool m_fStandAlone
wxRealPoint m_nSrcPoint
 Stand alone line's starting point.
wxRealPoint m_nTrgPoint
 Stand alone line's ending point.
wxRealPoint m_nSrcOffset
 Modification offset for starting line point.
wxRealPoint m_nTrgOffset
 Modification offset for ending line point.
wxPen m_Pen

Private Member Functions

void MarkSerializableDataMembers ()
 Initialize serializable properties.

Friends

class wxSFShapeCanvas

Detailed Description

Basic class encapsulating the multiline consisting of several line segments.


Member Enumeration Documentation

enum wxSFLineShape::LINEMODE [protected]

The modes in which the line shape can stay.

Enumerator:
modeREADY 
modeUNDERCONSTRUCTION 
modeSRCCHANGE 
modeTRGCHANGE 

Constructor & Destructor Documentation

Default constructor.

wxSFLineShape::wxSFLineShape ( long  src,
long  trg,
const wxXS::RealPointList &  path,
wxSFDiagramManager manager 
)

User constructor.

Parameters:
srcID of the source shape
trgID of the target shape
pathList of the line control points (can be empty)
managerPointer to parent shape manager
wxSFLineShape::wxSFLineShape ( const wxRealPoint &  src,
const wxRealPoint &  trg,
const wxXS::RealPointList &  path,
wxSFDiagramManager manager 
)

User constructor.

Parameters:
srcStarting line point
trgEnding line point
pathList of the line control points (can be empty)
managerPointer to parent shape manager

Copy constructor.

Parameters:
objReference to the source object
virtual wxSFLineShape::~wxSFLineShape ( void  ) [virtual]

Destructor.


Member Function Documentation

virtual bool wxSFLineShape::Contains ( const wxPoint &  pos) [virtual]

Test whether the given point is inside the shape. The function can be overrided if neccessary.

Parameters:
posExamined point
Returns:
TRUE if the point is inside the shape area, otherwise FALSE

Reimplemented from wxSFShapeBase.

virtual void wxSFLineShape::CreateHandles ( ) [virtual]

Function called by the framework responsible for creation of shape handles at the creation time. The function can be overrided if neccesary.

Reimplemented from wxSFShapeBase.

virtual void wxSFLineShape::DrawCompleteLine ( wxDC &  dc) [protected, virtual]

Draw completed line.

Reimplemented in wxSFCurveShape, and wxSFOrthoLineShape.

virtual void wxSFLineShape::DrawHighlighted ( wxDC &  dc) [protected, virtual]

Draw the shape in the highlighted mode (another shape is dragged over this shape and this shape will accept the dragged one if it will be dropped on it). The function can be overrided if neccessary.

Parameters:
dcReference to device context where the shape will be drawn to

Reimplemented from wxSFShapeBase.

virtual void wxSFLineShape::DrawHover ( wxDC &  dc) [protected, virtual]

Draw the shape in the hower mode (the mouse cursor is above the shape). The function can be overrided if neccessary.

Parameters:
dcReference to device context where the shape will be drawn to

Reimplemented from wxSFShapeBase.

virtual void wxSFLineShape::DrawNormal ( wxDC &  dc) [protected, virtual]

Draw the shape in the normal way. The function can be overrided if neccessary.

Parameters:
dcReference to device context where the shape will be drawn to

Reimplemented from wxSFShapeBase.

virtual wxRealPoint wxSFLineShape::GetAbsolutePosition ( ) [virtual]

Get the shape's absolute position in the canvas.

Returns:
Shape's position

Reimplemented from wxSFShapeBase.

virtual wxRealPoint wxSFLineShape::GetBorderPoint ( const wxRealPoint &  start,
const wxRealPoint &  end 
) [virtual]

Get intersection point of the shape border and a line leading from 'start' point to 'end' point. The function can be overrided if neccessary.

Parameters:
startStarting point of the virtual intersection line
endEnding point of the virtual intersection line
Returns:
Intersection point

Reimplemented from wxSFShapeBase.

virtual wxRect wxSFLineShape::GetBoundingBox ( ) [virtual]

Get line's bounding box. The function can be overrided if neccessary.

Returns:
Bounding rectangle

Reimplemented from wxSFShapeBase.

Reimplemented in wxSFCurveShape.

wxXS::RealPointList& wxSFLineShape::GetControlPoints ( ) [inline]

Get a list of the line's contol points (their positions).

Returns:
List of control points' positions
void wxSFLineShape::GetDirectLine ( wxRealPoint &  src,
wxRealPoint &  trg 
)

Get starting and ending line points.

Parameters:
srcReference to real point value where starting line point will be stored
trgReference to real point value where ending line point will be stored
int wxSFLineShape::GetDockPoint ( ) [inline]

Get the line dock point. It is a zerro based index of the line control point which will act as the shape position (value returned by GetRelativePosition() function).

Returns:
Zerro based index of the line control point (-1 means UNDEFINED)
wxRealPoint wxSFLineShape::GetDockPointPosition ( int  dp)

Get a position of given line dock point.

Parameters:
dpDock point
Returns:
The dock point's position if exists, otherwise the line center
virtual int wxSFLineShape::GetHitLinesegment ( const wxPoint &  pos) [protected, virtual]

Get index of the line segment intersecting the given point.

Parameters:
posExamined point
Returns:
Zero-based index of line segment located under the given point

Reimplemented in wxSFOrthoLineShape.

LINEMODE wxSFLineShape::GetLineMode ( ) [inline, protected]

Get current working mode.

Returns:
Current working mode
See also:
LINEMODE
wxPen wxSFLineShape::GetLinePen ( ) const [inline]

Get line style.

Returns:
wxPen class
bool wxSFLineShape::GetLineSegment ( size_t  index,
wxRealPoint &  src,
wxRealPoint &  trg 
)

Get starting and ending point of line segment defined by its index.

Parameters:
indexIndex of desired line segment
srcReference to variable where starting point will be stored
trgReference to variable where ending point will be stored
Returns:
TRUE if a line segment of given index exists, otherwise FALSE
wxRealPoint wxSFLineShape::GetModSrcPoint ( ) [protected]

Get modified starting line point .

Returns:
Modified starting line point
wxRealPoint wxSFLineShape::GetModTrgPoint ( ) [protected]

Get modified ending line point .

Returns:
Modified ending line point

Get object of source arrow.

Returns:
Pointer to the arrow object if exists, otherwise NULL
wxRealPoint wxSFLineShape::GetSrcPoint ( )

Get first line point.

Returns:
First line point
long wxSFLineShape::GetSrcShapeId ( ) [inline]

Get line source.

Returns:
ID of the source shape

Get object of target arrow.

Returns:
Pointer to the arrow object if exists, otherwise NULL
wxRealPoint wxSFLineShape::GetTrgPoint ( )

Get last line point.

Returns:
Last line point
long wxSFLineShape::GetTrgShapeId ( ) [inline]

Get line target.

Returns:
ID of the target shape
bool wxSFLineShape::IsStandAlone ( ) [inline]

Get stand-alone line mode.

Returns:
TRUE, if the line is stand-alone, otherwise FALSE

Initialize serializable properties.

Reimplemented from wxSFShapeBase.

virtual void wxSFLineShape::MoveBy ( double  x,
double  y 
) [virtual]

Move the shape by the given offset. The function can be overrided if neccessary.

Parameters:
xX offset
yY offset

Reimplemented from wxSFShapeBase.

virtual void wxSFLineShape::MoveTo ( double  x,
double  y 
) [virtual]

Move the shape to the given absolute position. The function can be overrided if neccessary.

Parameters:
xX coordinate
yY coordinate

Reimplemented from wxSFShapeBase.

virtual void wxSFLineShape::OnBeginDrag ( const wxPoint &  pos) [virtual]

Event handler called at the begining of the shape dragging process. The function can be overrided if necessary.

The function is called by the framework (by the shape canvas).

See also:
wxSFShapeCanvas

Reimplemented from wxSFShapeBase.

virtual void wxSFLineShape::OnEndHandle ( wxSFShapeHandle handle) [virtual]

Event handler called when the user finished dragging of the shape handle. The function can be overrided if necessary.

The function is called by the framework (by the shape canvas). Default implementation does nothing.

Parameters:
handleReference to dragged handle

Reimplemented from wxSFShapeBase.

virtual void wxSFLineShape::OnHandle ( wxSFShapeHandle handle) [virtual]

Event handler called during dragging of the shape handle. The function can be overrided if necessary.

The function is called by the framework (by the shape canvas).

Parameters:
handleReference to dragged handle

Reimplemented from wxSFShapeBase.

virtual void wxSFLineShape::OnLeftDoubleClick ( const wxPoint &  pos) [virtual]

Event handler called when the shape is double-clicked by the left mouse button. The function can be overrided if necessary.

The function is called by the framework (by the shape canvas).

Parameters:
posCurrent mouse position
See also:
wxSFShapeCanvas

Reimplemented from wxSFShapeBase.

virtual void wxSFLineShape::Scale ( double  x,
double  y,
bool  children = sfWITHCHILDREN 
) [virtual]

Scale the shape size by in both directions. The function can be overrided if necessary (new implementation should call default one ore scale shape's children manualy if neccesary).

Parameters:
xHorizontal scale factor
yVertical scale factor
childrenTRUE if the shape's children shoould be scaled as well, otherwise the shape will be updated after scaling via Update() function.

Reimplemented from wxSFShapeBase.

void wxSFLineShape::SetDockPoint ( int  index) [inline]

Set the line dock point. It is a zerro based index of the line control point which will act as the shape position (value returned by GetRelativePosition() function).

Parameters:
indexZerro based index of the line control point
See also:
sfdvLINESHAPE_DOCKPOINT_START, sfdvLINESHAPE_DOCKPOINT_END, sfdvLINESHAPE_DOCKPOINT_CENTER

Initialize line's ending point with existing fixed connection point.

Parameters:
cpPointer to connection point
void wxSFLineShape::SetLineMode ( LINEMODE  mode) [inline, protected]

Set line shape's working mode.

Parameters:
modeWorking mode
See also:
LINEMODE
void wxSFLineShape::SetLinePen ( const wxPen &  pen) [inline]

Set line style.

Parameters:
penReference to wxPen object

Set source arrow object.

Parameters:
arrowPointer to the arrow object which will be assigned to the begin of the line
wxSFArrowBase* wxSFLineShape::SetSrcArrow ( wxClassInfo *  arrowInfo)

Set source arrow object created from its class info.

Parameters:
arrowInfoClass info of the arrow class
Returns:
New arrow object
void wxSFLineShape::SetSrcPoint ( const wxRealPoint &  src) [inline]

Set user-defined starting line point.

Parameters:
srcStarting point
void wxSFLineShape::SetSrcShapeId ( long  id) [inline]

Set line source.

Parameters:
idID of the source shape
void wxSFLineShape::SetStandAlone ( bool  enab) [inline]

Set stand-alone line mode.

Parameters:
enabTRUE for stand-alone line, otherwise FALSE

Initialize line's starting point with existing fixed connection point.

Parameters:
cpPointer to connection point

Set target arrow object.

Parameters:
arrowPointer to the arrow object which will be assigned to the end of the line
wxSFArrowBase* wxSFLineShape::SetTrgArrow ( wxClassInfo *  arrowInfo)

Set target arrow object created from its class info.

Parameters:
arrowInfoClass info of the arrow class
Returns:
New arrow object
void wxSFLineShape::SetTrgPoint ( const wxRealPoint &  trg) [inline]

Set user-defined ending point.

Parameters:
trgEnding point
void wxSFLineShape::SetTrgShapeId ( long  id) [inline]

Set line target.

Parameters:
idID of the target shape
void wxSFLineShape::SetUnfinishedPoint ( const wxPoint &  pos) [inline, protected]

Set next potential control point position (usefull in modeUNDERCONSTRUCTION working mode).

Parameters:
posNew potential control point position
See also:
LINEMODE

Friends And Related Function Documentation

friend class wxSFShapeCanvas [friend]

Reimplemented from wxSFShapeBase.


Member Data Documentation

bool wxSFLineShape::m_fStandAlone [protected]
wxXS::RealPointList wxSFLineShape::m_lstPoints [protected]

List of the line's control points.

int wxSFLineShape::m_nDockPoint [protected]

Index of the line dock point.

wxRealPoint wxSFLineShape::m_nPrevPosition [protected]
wxRealPoint wxSFLineShape::m_nSrcOffset [protected]

Modification offset for starting line point.

wxRealPoint wxSFLineShape::m_nSrcPoint [protected]

Stand alone line's starting point.

long wxSFLineShape::m_nSrcShapeId [protected]
wxRealPoint wxSFLineShape::m_nTrgOffset [protected]

Modification offset for ending line point.

wxRealPoint wxSFLineShape::m_nTrgPoint [protected]

Stand alone line's ending point.

long wxSFLineShape::m_nTrgShapeId [protected]
wxPoint wxSFLineShape::m_nUnfinishedPoint [protected]
wxPen wxSFLineShape::m_Pen [protected]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines