wxShapeFramework  1.13.0 beta
wxSFPolygonShape Class Reference

Class extends the wxSFRectShape and encapsulates general polygon shape defined by a set of its vertices. The class can be used as it is or as a base class for shapes with more complex form and functionality. More...

#include <PolygonShape.h>

Inheritance diagram for wxSFPolygonShape:
Collaboration diagram for wxSFPolygonShape:

List of all members.

Public Member Functions

 XS_DECLARE_CLONABLE_CLASS (wxSFPolygonShape)
 wxSFPolygonShape (void)
 Default constructor.
 wxSFPolygonShape (int n, const wxRealPoint pts[], const wxRealPoint &pos, wxSFDiagramManager *manager)
 User constructor.
 wxSFPolygonShape (const wxSFPolygonShape &obj)
 Copy constructor.
virtual ~wxSFPolygonShape (void)
 Destructor.
void SetConnectToVertex (bool enable)
 Set connecting mode.
bool IsConnectedToVertex ()
 Get status of connecting mode.
void SetVertices (size_t n, const wxRealPoint pts[])
 Set the poly vertices which define its form.
virtual void FitToChildren ()
 Resize the rectangle to bound all child shapes. The function can be overrided if neccessary.
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 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).
virtual void OnHandle (wxSFShapeHandle &handle)
 Event handler called during dragging of the shape handle. The function can be overrided if necessary.

Protected Member Functions

void NormalizeVertices ()
 Move all vertices so the polygon's relative bounding box position will be located in the origin.
void FitVerticesToBoundingBox ()
 Scale polygon's vertices to fit into the rectangle bounding the polygon.
void FitBoundingBoxToVertices ()
 Scale the bounding rectangle to fit all polygons vertices.
void GetExtents (double *minx, double *miny, double *maxx, double *maxy)
 Get polygon extents.
void GetTranslatedVerices (wxRealPoint pts[])
 Get absolute positions of the polygon's vertices.
void GetTranslatedVerices (wxPoint pts[])
 Get absolute positions of the polygon's vertices.
void DrawPolygonShape (wxDC &dc)
 Draw the polygon shape.
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 DrawShadow (wxDC &dc)
 Draw shadow under the shape. The function can be overrided if neccessary.
virtual wxXmlNode * Serialize (wxXmlNode *node)
 Serialize shape's properties to the given XML node. The serialization routine is automatically called by the framework and should take care about serialization of all specific (non-standard) shape's properties.
virtual void Deserialize (wxXmlNode *node)
 Deserialize shape's properties from the given XML node. The routine is automatically called by the framework and should take care about deserialization of all specific (non-standard) shape's properties.

Protected Attributes

bool m_fConnectToVertex
wxXS::RealPointArray m_arrVertices

Private Member Functions

void MarkSerializableDataMembers ()
 Initialize serializable properties.

Detailed Description

Class extends the wxSFRectShape and encapsulates general polygon shape defined by a set of its vertices. The class can be used as it is or as a base class for shapes with more complex form and functionality.

See also:
wxSFDiamondShape

Constructor & Destructor Documentation

Default constructor.

wxSFPolygonShape::wxSFPolygonShape ( int  n,
const wxRealPoint  pts[],
const wxRealPoint &  pos,
wxSFDiagramManager manager 
)

User constructor.

Parameters:
nNumber of the polygon vertices
ptsArray of the polygon vertices
posRelative position of the polygon shape
managerPointer of parent diagram manager

Copy constructor.

Parameters:
objReference to a source object
virtual wxSFPolygonShape::~wxSFPolygonShape ( void  ) [virtual]

Destructor.


Member Function Documentation

virtual void wxSFPolygonShape::Deserialize ( wxXmlNode *  node) [protected, virtual]

Deserialize shape's properties from the given XML node. The routine is automatically called by the framework and should take care about deserialization of all specific (non-standard) shape's properties.

Parameters:
nodePointer to a source XML node containig the shape's property nodes
See also:
xsSerializable::Deserialize

Reimplemented from wxSFShapeBase.

virtual void wxSFPolygonShape::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 wxSFRectShape.

virtual void wxSFPolygonShape::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 wxSFRectShape.

virtual void wxSFPolygonShape::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 wxSFRectShape.

void wxSFPolygonShape::DrawPolygonShape ( wxDC &  dc) [protected]

Draw the polygon shape.

Parameters:
dcRefernece to the device context where the shape will be drawn to
virtual void wxSFPolygonShape::DrawShadow ( wxDC &  dc) [protected, virtual]

Draw shadow under the shape. The function can be overrided if neccessary.

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

Reimplemented from wxSFRectShape.

Scale the bounding rectangle to fit all polygons vertices.

virtual void wxSFPolygonShape::FitToChildren ( ) [virtual]

Resize the rectangle to bound all child shapes. The function can be overrided if neccessary.

Reimplemented from wxSFRectShape.

Scale polygon's vertices to fit into the rectangle bounding the polygon.

virtual wxRealPoint wxSFPolygonShape::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 wxSFRectShape.

void wxSFPolygonShape::GetExtents ( double *  minx,
double *  miny,
double *  maxx,
double *  maxy 
) [protected]

Get polygon extents.

Parameters:
minxPosition of the left side of polygon's bounding box
minyPosition of the top side of polygon's bounding box
maxxPosition of the right side of polygon's bounding box
maxyPosition of the bottom side of polygon's bounding box
void wxSFPolygonShape::GetTranslatedVerices ( wxRealPoint  pts[]) [protected]

Get absolute positions of the polygon's vertices.

Parameters:
ptsArray of translated polygon's verices
void wxSFPolygonShape::GetTranslatedVerices ( wxPoint  pts[]) [protected]

Get absolute positions of the polygon's vertices.

Parameters:
ptsArray of translated polygon's verices

Get status of connecting mode.

Returns:
TRUE if the line shapes will be connected to the polygon's vertices

Initialize serializable properties.

Reimplemented from wxSFRectShape.

Move all vertices so the polygon's relative bounding box position will be located in the origin.

virtual void wxSFPolygonShape::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 wxSFRectShape.

virtual void wxSFPolygonShape::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 wxSFRectShape.

virtual wxXmlNode* wxSFPolygonShape::Serialize ( wxXmlNode *  node) [protected, virtual]

Serialize shape's properties to the given XML node. The serialization routine is automatically called by the framework and should take care about serialization of all specific (non-standard) shape's properties.

Parameters:
nodePointer to XML node where the shape's property nodes will be appended to
See also:
xsSerializable::Serialize

Reimplemented from wxSFShapeBase.

void wxSFPolygonShape::SetConnectToVertex ( bool  enable) [inline]

Set connecting mode.

Parameters:
enableSet this parameter to TRUE if you want to connect line shapes to the polygons's vertices, otherwise the lines will be connected to the nearest point of the shape's border.
void wxSFPolygonShape::SetVertices ( size_t  n,
const wxRealPoint  pts[] 
)

Set the poly vertices which define its form.

Parameters:
nNumber of the vertices
ptsArray of the vertices

Member Data Documentation

wxXS::RealPointArray wxSFPolygonShape::m_arrVertices [protected]

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