wxShapeFramework
1.13.0 beta
|
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>
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. |
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.
wxSFPolygonShape::wxSFPolygonShape | ( | void | ) |
Default constructor.
wxSFPolygonShape::wxSFPolygonShape | ( | int | n, |
const wxRealPoint | pts[], | ||
const wxRealPoint & | pos, | ||
wxSFDiagramManager * | manager | ||
) |
User constructor.
n | Number of the polygon vertices |
pts | Array of the polygon vertices |
pos | Relative position of the polygon shape |
manager | Pointer of parent diagram manager |
wxSFPolygonShape::wxSFPolygonShape | ( | const wxSFPolygonShape & | obj | ) |
Copy constructor.
obj | Reference to a source object |
virtual wxSFPolygonShape::~wxSFPolygonShape | ( | void | ) | [virtual] |
Destructor.
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.
node | Pointer to a source XML node containig the shape's property nodes |
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.
dc | Reference 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.
dc | Reference 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.
dc | Reference to device context where the shape will be drawn to |
Reimplemented from wxSFRectShape.
void wxSFPolygonShape::DrawPolygonShape | ( | wxDC & | dc | ) | [protected] |
Draw the polygon shape.
dc | Refernece 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.
dc | Reference to device context where the shadow will be drawn to |
Reimplemented from wxSFRectShape.
void wxSFPolygonShape::FitBoundingBoxToVertices | ( | ) | [protected] |
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.
void wxSFPolygonShape::FitVerticesToBoundingBox | ( | ) | [protected] |
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.
start | Starting point of the virtual intersection line |
end | Ending point of the virtual intersection line |
Reimplemented from wxSFRectShape.
void wxSFPolygonShape::GetExtents | ( | double * | minx, |
double * | miny, | ||
double * | maxx, | ||
double * | maxy | ||
) | [protected] |
Get polygon extents.
minx | Position of the left side of polygon's bounding box |
miny | Position of the top side of polygon's bounding box |
maxx | Position of the right side of polygon's bounding box |
maxy | Position of the bottom side of polygon's bounding box |
void wxSFPolygonShape::GetTranslatedVerices | ( | wxRealPoint | pts[] | ) | [protected] |
Get absolute positions of the polygon's vertices.
pts | Array of translated polygon's verices |
void wxSFPolygonShape::GetTranslatedVerices | ( | wxPoint | pts[] | ) | [protected] |
Get absolute positions of the polygon's vertices.
pts | Array of translated polygon's verices |
bool wxSFPolygonShape::IsConnectedToVertex | ( | ) | [inline] |
Get status of connecting mode.
void wxSFPolygonShape::MarkSerializableDataMembers | ( | ) | [private] |
Initialize serializable properties.
Reimplemented from wxSFRectShape.
void wxSFPolygonShape::NormalizeVertices | ( | ) | [protected] |
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).
handle | Reference 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).
x | Horizontal scale factor |
y | Vertical scale factor |
children | TRUE 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.
node | Pointer to XML node where the shape's property nodes will be appended to |
Reimplemented from wxSFShapeBase.
void wxSFPolygonShape::SetConnectToVertex | ( | bool | enable | ) | [inline] |
Set connecting mode.
enable | Set 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.
n | Number of the vertices |
pts | Array of the vertices |
wxXS::RealPointArray wxSFPolygonShape::m_arrVertices [protected] |
bool wxSFPolygonShape::m_fConnectToVertex [protected] |