15 #ifndef __WXPOLYGON_H__
16 #define __WXPOLYGON_H__
23 #include "wx/geometry.h"
79 a2dLineSegment* AddPoint(
double x,
double y,
int index,
bool afterinversion =
true );
97 virtual void RemoveSegment(
double& x,
double& y ,
a2dLineSegmentPtr seg = NULL,
bool transformed =
true );
106 void RemoveSegment(
double& x,
double& y ,
int index = -1,
bool transformed =
true );
126 void SetPosXYSegment(
int index,
double x,
double y,
bool afterinversion =
true );
140 virtual void SetPosXYSegment(
a2dLineSegmentPtr seg,
double x,
double y,
bool afterinversion =
true );
155 void SetPosXYMidSegment(
a2dLineSegmentPtr seg,
double x,
double y,
bool afterinversion =
true );
169 void SetPosXYMidSegment(
int index,
double x,
double y,
bool afterinversion =
true );
178 void GetPosXYSegment(
int index,
double& x,
double& y,
bool transform =
true )
const;
187 virtual void GetPosXYSegment(
a2dLineSegmentPtr seg,
double& x,
double& y,
bool transform =
true )
const;
196 void GetPosXYMidSegment(
int index,
double& x,
double& y,
bool transform =
true )
const;
205 void GetPosXYMidSegment(
a2dLineSegmentPtr seg,
double& x,
double& y,
bool transform =
true )
const;
216 virtual bool AdjustAfterChange(
bool final );
249 virtual void SetHandleToIndex(
a2dPolyHandleL* handle,
unsigned int index );
253 virtual a2dVertexList::iterator GetSegmentAtIndex(
unsigned int index );
255 virtual a2dVertexList* GetSegmentListAtIndex(
unsigned int index );
257 #if wxART2D_USE_CVGIO
261 #endif //wxART2D_USE_CVGIO
265 static void SetAllowCrossAtVertex(
bool allowCrossAtVertex ) { m_allowCrossAtVertex = allowCrossAtVertex; }
273 void SyncHandlesWithLineSegments();
275 virtual
bool DoStartEdit( wxUint16 editmode,
wxEditStyle editstyle );
279 void OnChar( wxKeyEvent& event );
294 a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
299 static
bool m_allowCrossAtVertex;
302 bool m_crossAtVertex: 1;
304 wxPolygonFillMode m_oddeven;
307 double m_contourwidth;
314 #if defined(WXART2D_USINGDLL)
334 DECLARE_EVENT_TABLE()
360 void Remove180DegPoints(
a2dCanvasObject* sendCommandsTo = NULL,
bool removeZeroFirst =
true );
362 #if wxART2D_USE_CVGIO
366 #endif //wxART2D_USE_CVGIO
415 bool FindNearPoint( const
a2dAffineMatrix* cworld,
double xIn,
double yIn,
double* xOut,
double* yOut );
424 bool FindNearPointOrtho( const
a2dAffineMatrix* cworld,
double xIn,
double yIn,
double* xOut,
double* yOut );
428 bool MoveDynamicPinCloseTo(
a2dPin* pin, const
a2dPoint2D& point,
bool final );
439 a2dPin* FindPin(
int* i );
447 int FindPinSegmentIndex(
a2dPin* pinToFind,
double margin = a2dACCUR );
453 static
bool SetDefaultGeneratePins(
bool value ) { m_generatePins = value; }
470 void OnChar( wxKeyEvent& event );
478 static bool m_generatePins;
488 #if defined(WXART2D_USINGDLL)
504 DECLARE_EVENT_TABLE()
558 #if wxART2D_USE_CVGIO
562 #endif //wxART2D_USE_CVGIO
571 void SetHandleToIndex(
a2dPolyHandleL* handle,
unsigned int index );
575 virtual a2dVertexList::iterator GetSegmentAtIndex(
unsigned int index );
577 virtual a2dVertexList* GetSegmentListAtIndex(
unsigned int index );
579 void RemoveSegment(
double& x,
double& y ,
a2dLineSegmentPtr seg = NULL,
bool transformed =
true );
583 void GetPosXYSegment(
a2dLineSegmentPtr seg,
double& x,
double& y,
bool transform =
true )
const;
585 void SetPosXYSegment(
a2dLineSegmentPtr seg,
double x,
double y,
bool afterinversion =
true );
592 bool DoStartEdit( wxUint16 editmode,
wxEditStyle editstyle );
601 a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
667 #if defined(WXART2D_USINGDLL)
705 #if defined(WXART2D_USINGDLL)
735 a2dVertexList::iterator segNode,
736 a2dVertexList::iterator segNodeOrg,
739 const wxString& name = wxT(
"" ) );
755 a2dVertexList::iterator segNode,
756 a2dVertexList::iterator segNodeOrg,
759 double xc,
double yc,
const wxString& name = wxT(
"" ) );
767 a2dVertexList::iterator GetNode() {
return m_segNode; }
769 void SetNode(
const a2dVertexList::iterator& iter ) { m_segNode = iter; }
771 a2dVertexList::iterator GetNodeOrg() {
return m_segNodeOrg; }
773 void SetNodeOrg(
const a2dVertexList::iterator& iter ) { m_segNodeOrg = iter; }
831 #if defined(WXART2D_USINGDLL)
wxPoint2DDouble a2dPoint2D
this to define if coordinate numbers are integer or doubles
a2dPATH_END_TYPE
defines the way a polyline with a contour width is ended.
virtual void Render(a2dIterC &ic, OVERLAP clipparent)
Render this object to the active a2dDrawingPart.
double GetEndScaleY()
scale begin and end object with this factor in X
virtual bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
a2dVertexList * GetSegmentsOrg()
get to segments chain to which this handle belongs in the original ( not edit copy ) ...
a2dHandle is used inside editing versions of a certain objects.
mouse event sent from a2dCanvasObject to itself
a2dConnectTask
flags for searching a connecting a2dpinClass, for the connecting task at hand.
#define a2dACCUR
accuracy used to have some limit to calculation like hittesting
void SetEndScaleX(double xs)
scale begin and end object with this factor in X
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
virtual void InsertSegment(unsigned int index, a2dLineSegmentPtr segin)
insert segment after index given
class to map references to objects stored in XML, in order to make the connection later on...
a2dVertexList * GetSegments()
get to segments chain to which this handle belongs in the original ( not edit copy ) ...
a2dPin is used in a2dCanvasObject to add pins to it.
This is a class/type description for a2dPin's.
polygon defined with list of points.
void OnChar(wxKeyEvent &event)
default handler for character events
a2dPATH_END_TYPE m_pathtype
when m_contourwidth != 0 what is the end of the line looking like.
clips all children to a polygon
void SetContourWidth(double width)
set the Contour width of the shape
virtual bool Update(UpdateMode mode)
Update the state of the object according to its current position etc.
void SetSpline(bool on)
set to true, the polygon will be drawn as a spline
Input and output handler for the XmlSer format.
UpdateMode
Various mode flags for Update.
virtual void SetPending(bool pending)
set this object pending for update
OVERLAP
Result of a a2dBoundingBox intersection or hittest.
The base class for all drawable objects in a a2dCanvasDocument.
bool m_dragging
indicates dragging was/is going on
#define DECLARE_PROPERTIES()
check if class has the given id as a valid id for this object
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
a2dCanvasObject is the base class for Canvas Objects.
void SetFillRule(wxPolygonFillMode val)
Set Polygon filling mode wxODDEVEN_RULE or wxWINDING_RULE.
a2dAffineMatrix a2dIDENTITY_MATRIX
global a2dAffineMatrix to set/pass the identity matrix.
a2dBoundingBox wxNonValidBbox
global non valid boundingbox to use as default argument etc.
vertex list of line and arc segments.
handle holds a pointer to a polygon/polyline segment
virtual void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
virtual bool RestrictToObject(a2dIterC &ic, const a2dPoint2D &pointToSnapTo, a2dPoint2D &bestPointSofar, a2dSnapToWhatMask snapToWhat, double thresHoldWorld)
called from an a2dRestrictionEngine, to restrict vertexes, lines, object to this object.
a2dPATH_END_TYPE GetPathType()
get when m_contourwidth != 0 what is the end of the line looks like.
general vertexlist and array and vector path functions and classes.
void SetContourWidth(double width)
set the Contour width of the shape
Io handler to iterate through a a2dDocument.
void SetPathType(a2dPATH_END_TYPE pathtype)
Set when m_contourwidth != 0 what is the end of the line should be.
bool GetArcHandle()
is the handle on segment an arc modifier?
clips all children to a polygon
polyline defined with list of points.
double GetContourWidth() const
get the Contour width of the shape
virtual a2dCanvasObjectList * GetAsCanvasVpaths(bool transform=true) const
when implemented the object without its children, is converted to
bounding class for optimizing drawing speed.
a2dVertexListPtr GetSegments()
Get the list of points ( this is not a copy! )
Normal straight line segment in a2dVertexList and a2dVertexArray.
void SetEndScaleY(double ys)
scale begin and end object with this factor in Y
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
general event sent from a2dHandle to its parent a2dCanvasObject
Input and output handler for the XmlSer format.
bool GetSpline()
Get the polygon spline setting.
wxUint32 a2dSnapToWhatMask
mask for a2dSnapToWhat flags
virtual a2dCanvasObjectList * GetSnapVpath(a2dSnapToWhatMask snapToWhat)
return a vectorpath indicating on which point/segments the object likes to be snapped.
double GetContourWidth() const
get the Contour width of the shape
A 2x3 affine matrix class for 2D transformations.
while iterating a a2dCanvasDocument, this holds the context.
static bool GetDefaultGeneratePins()
new object willl generate pins or not based on this value
struct for how a single object on one layer was hit
polygon defined with list of points for outer contour plus a list of hole polygons ...
a2dVertexListPtr GetSegments()
Get the list of points ( this is not a copy! )
virtual a2dVertexList * GetAsVertexList(bool &returnIsPolygon) const
convert to a polygon.
virtual bool DoCanConnectWith(a2dIterC &ic, a2dPin *pin, double margin, bool autocreate)
prepare an object for being connected to a given pin
wxPolygonFillMode GetFillRule()
Get Polygon filling mode wxODDEVEN_RULE or wxWINDING_RULE.
a2dAffineMatrix m_ClipLworld
clipping matrix.
void SetPin(a2dPin *pin)
if handle is at the position of a pin, it can be set here, to make it easy moving it in sync with the...
size_t GetNumberOfSegments()
get the number of points in the pointlist
virtual bool EliminateMatrix()
reduce matrix to identity
a2dPin * GetPin()
see SetPin()
double GetEndScaleX()
scale begin and end object with this factor in X
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
virtual a2dBoundingBox DoGetUnTransformedBbox(a2dBboxFlags flags=a2dCANOBJ_BBOX_NON) const
In derived object this should be overriden to calculate the boundingbox of the object without its chi...
virtual bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
size_t GetNumberOfSegments()
get the number of points in the pointlist
virtual a2dCanvasObjectList * GetAsPolygons(bool transform=true) const
convert to a list of polygons.
This template class is for property ids with a known data type.
virtual a2dCanvasObjectList * GetAsPolylines(bool transform=true) const
convert to a list of polylines.
CloneOptions
options for cloning
structure to give as parameter to member functions of a2dCanvasObject
virtual void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
void SetArcHandle(bool arcHandle)
set handle on segment as arc modifier