wxArt2D
curve.h
Go to the documentation of this file.
1 /*! \file wx/curves/curve.h
2  \brief classes for plotting curve and pie data, and editing them.
3 
4  Data stored in a derived a2dCanvasObject, can be plotted as a curve of pie chart.
5  One can add markers on the curves, and several curves can be plot as a group in one plot.
6 
7  \author Klaas Holwerda
8 
9  Copyright: 2000-2004 (c) Klaas Holwerda
10 
11  Licence: wxWidgets Licence
12 
13  RCS-ID: $Id: curve.h,v 1.16 2009/10/01 19:22:35 titato Exp $
14 */
15 
16 #ifndef __WXCURVE_H__
17 #define __WXCURVE_H__
18 
19 #ifndef WX_PRECOMP
20 #include "wx/wx.h"
21 #endif
22 
23 #include "wx/curves/meta.h"
24 #include <wx/general/a2dlist.h>
25 
26 // ----------------------------------------------------------------------------
27 // constants
28 // ----------------------------------------------------------------------------
29 
30 //! a2dCurveObject for objects needing to know its parent a2dCurvesArea.
31 /*!
32  a2dCurveObject is the base class for curves and markers etc. The m_curvesArea is set from
33  a2dCanvasXYDisplayGroup to which it be longs. This happens in its OnUpdate() function.
34  The m_curveGroup can be used to clip the curves and makers to the plotting area.
35  Next to that conversion of curve data from and to plotting area coordinates is done from the
36  m_curveGroup. The data stored in derived object ( like coordinates of a curve ), can be in their own units.
37  They can be converted to world coordinates ( as used in the a2dCanvasDocument ), and m_curveGroup
38  supplies the functions to do this.
39 
40  \ingroup canvasobject
41 */
42 class A2DCURVESDLLEXP a2dCurveObject: public a2dCanvasObject
43 {
44 
45 public:
46  //!default constructor
48 
49  //!destructor
50  ~a2dCurveObject();
51 
52  //!copy constructor
53  a2dCurveObject( const a2dCurveObject& other, CloneOptions options, a2dRefMap* refs );
54 
55  //! used for conversion of curve data to curvegroup area
56  /*!
57 
58  */
59  void SetCurvesArea( a2dCurvesArea* curvesArea ) { m_curvesArea = curvesArea; }
60 
61  //! used by a2dCurve to transform its own curve coordinates to the curve plotting area
62  /*!
63  In general m_curvesArea is used to covert the curve coordinates to the plotting area coordinates.
64  Meaning that the m_curvesArea has the same coordinates system as the curve itself.
65  Like for instance the grid and axis of the curveArea are fiiting the curve coordinates.
66  But if the curve coordinates would be logarithmic etc., one will need an extra consversion.
67  This can be done here.
68  */
69  virtual void World2Curve( double xw, double yw, double& xcurve, double& ycurve ) const;
70 
71  //! used by a2dCurve to transform its own curve coordinates to the curve plotting area
72  /*!
73  In general m_curvesArea is used to covert the curve coordinates to the plotting area coordinates.
74  Meaning that the m_curvesArea has the same coordinates system as the curve itself.
75  Like for instance the grid and axis of the curveArea are fiiting the curve coordinates.
76  But if the curve coordinates would be logarithmic etc., one will need an extra consversion.
77  This can be done here.
78  */
79  virtual void Curve2World( double xcurve, double ycurve, double& xw, double& yw ) const;
80 
81  DECLARE_CLASS( a2dCurveObject )
82 
83 protected:
84  //! This is here so that this class cannot be used directly
85  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const = 0;
86 
87  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
88 
89  //! parent of curve
90  a2dCurvesArea* m_curvesArea;
91 
92  //! Untransformed bounding box.
93  a2dBoundingBox m_untransbbox;
94 
95 private:
96  //!this is a not implemented copy constructor that avoids automatic creation of one
97  a2dCurveObject( const a2dCurveObject& other );
98 };
99 
100 //! Base class for curves
101 /*! Use this as a base class for Curve classes.
102 
103  A Curve is defined as a function or set of points that can be plotted in X/Y plot.
104 
105  \ingroup canvasobject meta curve
106 */
107 class A2DCURVESDLLEXP a2dCurve: public a2dCurveObject
108 {
109 public:
110 
111  //! these flags define how curves are drawn
113  {
114  a2dCURVES_RENDER_NO_POINTS = 0x0001, /*!< show no points on the curve */
115  a2dCURVES_RENDER_NORMAL = 0x0002, /*!< normal curve */
116  a2dCURVES_RENDER_FILL_LINE = 0x0004, /*!< curve filled with lines */
117  a2dCURVES_RENDER_FILL = 0x0008, /*!< curve filled completely */
118  a2dCURVES_RENDER_3D = 0x0010, /*!< 3d bars or 3d look */
119  a2dCURVES_RENDER_DEFAULT = a2dCURVES_RENDER_NORMAL /*!< like normal curve */
120  };
121 
122  //! these flags define how (points on) curves can be moved/edited
124  {
125  a2dCURVES_EDIT_NORMAL = 0x0001, /*!< points can be moved in any direction */
126  a2dCURVES_EDIT_FIXED_X = 0x0002, /*!< points have fixed x coord. */
127  a2dCURVES_EDIT_FIXED_Y = 0x0004, /*!< points have fixed y coord. */
128  a2dCURVES_EDIT_ALLOW_ADD = 0x0008, /*!< allow adding new points to curve */
129  a2dCURVES_EDIT_DEFAULT = a2dCURVES_EDIT_NORMAL
130  };
131 
132  a2dCurve();
133 
134  virtual ~a2dCurve();
135 
136  a2dCurve( const a2dCurve& other, CloneOptions options, a2dRefMap* refs );
137 
138  //! define which part of the curve will be displayed.
139  void SetBoundaries( double xmin, double ymin, double xmax, double ymax );
140 
141 
142  //! get clipped boundary box of plot boundary in curve coordinates
143  /*!
144  The highest of clipping box and curve box and curve group box is returned.
145  */
146  a2dBoundingBox GetClippedCurveBoundaries();
147 
148  //! get boundary box of plot boundary in curve coordinates
149  /*!
150  The highest of curve box is returned.
151  */
152  a2dBoundingBox GetCurveBoundaries();
153 
154 #if 0
155  //! get miminum X of plot boundary in curve coordinates
156  /*!
157  The highest of clipping and minx curve and minx curve group is returned.
158  */
159  virtual double GetBoundaryMinX();
160 
161  //! get maximum X of plot boundary in curve coordinates
162  /*!
163  The lowest of clipping and maxx curve and maxx curve group is returned.
164  */
165  virtual double GetBoundaryMaxX();
166 
167  //! get miminum Y of plot boundary in curve coordinates
168  /*!
169  The highest of clipping and miny curve and miny curve group is returned.
170  */
171  virtual double GetBoundaryMinY();
172 
173  //! get maximum Y of plot boundary in curve coordinates
174  /*!
175  The lowest of clipping and maxy curve and maxy curve group is returned.
176  */
177  virtual double GetBoundaryMaxY();
178 #endif
179 
180  //! return Points in plot at the value of sweep parameter.
181  /*!
182  In general the sweep parameter is the x value in the plot data, and returned will be the x,y and that x.
183  But in case of complex data x,y = Function( freq ), this here will return the x,y and freq.
184 
185  \return false when the sweep is outside of range.
186  */
187  virtual bool GetXyAtSweep( double sweepValue, a2dPoint2D& point ) const = 0;
188 
189  a2dlist< a2dFill >& GetPointFillList() { return m_pointsFill; }
190 
191  void SetPointFillList( const a2dlist< a2dFill >& fillList ) { m_pointsFill = fillList; }
192 
193  bool IsHighlighted() const { return m_highlightmode == 1; }
194 
195  void SetRenderLogicalFunction( wxRasterOperationMode logFunction ) { m_logFunction = logFunction; SetPending( true );}
196 
197  wxRasterOperationMode GetRenderLogicalFunction() { return m_logFunction; }
198 
199 
200  DECLARE_CLASS( a2dCurve )
201 
202 protected:
203 
204 #if wxART2D_USE_CVGIO
205  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
206 
207  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
208 #endif //wxART2D_USE_CVGIO
209 
210  int m_highlightmode;
211  wxRasterOperationMode m_logFunction;
212 
213  //! defines boundaries in which the curve will be calculated / displayed
215 
216  //! defines boundaries in which the curve has points
218 
219  a2dlist< a2dFill > m_pointsFill;
220 
221 private:
222  //!this is a not implemented copy constructor that avoids automatic creation of one
223  a2dCurve( const a2dCurve& other );
224 };
225 
226 #if defined(WXART2D_USINGDLL)
227 template class A2DCURVESDLLEXP a2dSmrtPtr<a2dCurve>;
228 #endif
229 
230 //! Object to plot a Curve defined by a Function in form of a string
231 /*!
232 The Function string will be evaluated for each X to get Y on the Curve
233 
234  \ingroup canvasobject meta curve
235 */
236 class A2DCURVESDLLEXP a2dFunctionCurve: public a2dCurve
237 {
238 public:
239 
240  a2dFunctionCurve( const wxString& curve = _T( "Not Specified" ) );
241 
242  a2dFunctionCurve( const a2dFunctionCurve& other, CloneOptions options, a2dRefMap* refs );
243 
244  virtual ~a2dFunctionCurve();
245 
246  void SetXstep( double xstep ) { m_xstep = xstep; SetPending( true ); }
247 
248  virtual bool GetXyAtSweep( double sweepValue, a2dPoint2D& point ) const;
249 
250  DECLARE_DYNAMIC_CLASS( a2dFunctionCurve )
251 
252 protected:
253 
254  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
255 
256 #if wxART2D_USE_CVGIO
257  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
258 
259  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
260 #endif //wxART2D_USE_CVGIO
261 
262  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
263 
264  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
265 
266  void DoRender( a2dIterC& ic, OVERLAP clipparent );
267 
268  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
269 
270  wxString m_curve;
271 
272  double m_xstep;
273 
274  double m_xstart;
275 
276  double m_xstop;
277 
278 private:
279 
280 #if wxART2D_USE_CANEXTOBJ
281  mutable a2dEval m_toeval;
282 #endif //wxART2D_USE_CANEXTOBJ
283 
284 private:
285  //!this is a not implemented copy constructor that avoids automatic creation of one
286  a2dFunctionCurve( const a2dFunctionCurve& other );
287 };
288 
289 //! Curve represented by a number of vertexes.
290 /*!
291 
292  \ingroup canvasobject meta curve
293 */
294 class A2DCURVESDLLEXP a2dVertexCurve: public a2dCurve
295 {
296  DECLARE_EVENT_TABLE()
297 
298 public:
299 
300  a2dVertexCurve( a2dVertexArray* points );
301 
302  a2dVertexCurve( );
303 
304  a2dVertexCurve( const a2dVertexCurve& other, CloneOptions options, a2dRefMap* refs );
305 
306  virtual ~a2dVertexCurve();
307 
308  //! calculate Y at X
309  virtual bool GetXyAtSweep( double sweepValue, a2dPoint2D& point ) const;
310 
311  //! return the array of points.
312  a2dVertexArray* GetPoints() { return m_points; }
313 
314  //! return the number of point in the curve
315  int GetNumberOfPoints() { return m_points->size(); }
316 
317  //!modify point at index to x,y
318  /*!
319  Set the coordinates of the point at index to x,y.
320  \param index the index of the point to change
321  \param x new x for the point in curve coordinates
322  \param y new y for the point in curve coordinates
323 
324  \remark afterinversion = true should be used if you have x,y relative to the polygon object,
325  while afterinversion = false should be used when x,y are relative to the point in the polygon.
326  */
327  void SetPosXYPoint( int index, double x, double y );
328 
329  //! get point x and y at index
330  /*!
331  \param index the index of the point to change
332  \param x new x for the point in curve coordinates
333  \param y new y for the point in curve coordinates
334  */
335  void GetPosXYPoint( int index, double& x, double& y );
336 
337  //! get point x and y at index in world coordinates
338  /*!
339  \param index the index of the point to change
340  \param x new x for the point in world coordinates
341  \param y new y for the point in world coordinates
342  \param transform if true return x y transformed with local matrix
343  */
344  void GetPosXYPointWorld( int index, double& x, double& y, bool transform );
345 
346  //!removes point at index
347  /*!
348  \param x x value of removed point in curve coordinates
349  \param y y value of removed point in curve coordinates
350  \param index index of point to remove (-1 means last point)
351  */
352  void RemovePoint( double& x, double& y , int index = -1 );
353 
354  //!removes point at index
355  /*!
356  \param x x value of removed point in world coordinates
357  \param y y value of removed point in world coordinates
358  \param index index of point to remove (-1 means last point)
359  \param transformed if true returned values x,y are transformed with local matrix
360  */
361  void RemovePointWorld( double& x, double& y , int index = -1, bool transformed = true );
362 
363  //! reduce matrix to identity without replacing object
364  bool EliminateMatrix();
365 
366  //! set to true, the polygon will be drawn as a spline
367  void SetSpline( bool on ) { m_spline = on; SetPending( true ); }
368 
369  //! Get the polygon spline setting
370  bool GetSpline() { return m_spline; }
371 
372  //!Append a new point in curve coordinates
373  void AddPoint( const a2dPoint2D& P, int index = -1 );
374 
375  //!Append a new point in curve coordinates
376  void AddPoint( double x, double y, int index = -1 );
377 
378  //!Preallocates memory for a given number of array elements.
379  /*!
380  It is worth calling when the number of items which are going to be added to the array
381  is known in advance because it will save unneeded memory reallocation.
382  If the array already has enough memory for the given number of items, nothing happens.
383  */
384  void Alloc( size_t count ) { m_points->reserve( count ); }
385 
386  //!This function does the same as Empty() and additionally frees the memory allocated to the array.
387  void Clear() { m_points->clear(); }
388 
389  //!Returns true if the array is empty, false otherwise.
390  bool IsEmpty() const { return m_points->empty(); }
391 
392  //! get i'th point
393  a2dLineSegmentPtr operator[]( size_t index ) const { return m_points->operator[]( index ); }
394 
395  //!Returns the point pointer at the given position in the array.
396  /*!
397  If index is out of bounds, an assert failure is raised in
398  the debug builds but nothing special is done in the release build.
399  */
400  a2dLineSegmentPtr Item( size_t index ) const { return m_points->operator[]( index ); }
401 
402  //!Returns the last element in the array.
403  /*!
404  I.e. is the same as Item(GetCount() - 1).
405  An assert failure is raised in the debug mode if the array is empty.
406  */
407  a2dLineSegmentPtr Last() const { return m_points->back(); }
408 
409  //!Removes a point from the array by index.
410  /*!
411  When a point is removed
412  it is deleted - use Detach() if you don't want this to happen.
413  */
414  void RemoveAt( size_t index ) { m_points->RemoveAt( index ); }
415 
416  //! test if a point is on the curve.
417  bool PointOnCurve( const a2dPoint2D& P, double marge );
418 
419  //! sets which parts or how the curve is rendered
420  /*!
421  See wxCurveRenderFlags for flags in the mask.
422  */
423  void SetRenderMode( wxUint32 rendermode ) { m_rendermode = rendermode; }
424 
425  //! get which parts or how the curve is rendered
426  int GetRenderMode() { return m_rendermode; }
427 
428  //! sets how the curve is edited
429  /*!
430  See wxCurveEditFlags for flags in the mask.
431  */
432  void SetEditMode( wxUint32 editmode ) { m_editmode = editmode; }
433 
434  //! get how the curve is edited
435  int GetEditMode() { return m_editmode; }
436 
437  DECLARE_DYNAMIC_CLASS( a2dVertexCurve )
438 
439 protected:
440 
441  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
442 
443  bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
444 
445  void OnHandleEvent( a2dHandleMouseEvent& event );
446 
447  void OnEnterObject( a2dCanvasObjectMouseEvent& event );
448  void OnLeaveObject( a2dCanvasObjectMouseEvent& event );
449 
450  void OnCanvasObjectMouseEvent( a2dCanvasObjectMouseEvent& event );
451 
452 #if wxART2D_USE_CVGIO
453  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
454 
455  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
456 #endif //wxART2D_USE_CVGIO
457 
458  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
459 
460  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
461 
462  void DoRender( a2dIterC& ic, OVERLAP clipparent );
463 
464  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
465 
466  bool m_spline;
467 
468  wxUint32 m_rendermode, m_editmode;
469 
470  a2dVertexArray* m_points;
471 
472 private:
473  //!this is a not implemented copy constructor that avoids automatic creation of one
474  a2dVertexCurve( const a2dVertexCurve& other );
475 };
476 
477 //! old a complex point at a sweep value
478 /*!
479  e.g. x,y = function( sweep )
480 */
481 class A2DCURVESDLLEXP a2dSweepPoint
482 {
483 public:
484  a2dSweepPoint( double sweep, double a, double b );
485 
486  a2dPoint2D GetPoint() { return a2dPoint2D( m_a, m_b ); }
487  a2dPoint2D GetPointUp() { return a2dPoint2D( m_sweep, m_a ); }
488  a2dPoint2D GetPointLow() { return a2dPoint2D( m_sweep, m_b ); }
489  double m_sweep;
490  double m_a;
491  double m_b;
492 };
493 
494 WX_DECLARE_OBJARRAY_WITH_DECL( a2dSweepPoint, a2dSweepPointArray, class A2DCURVESDLLEXP );
495 
496 //! Curve represented by a number of vertexes.
497 /*!
498 
499  \ingroup canvasobject meta curve
500 */
501 class A2DCURVESDLLEXP a2dSweepCurve: public a2dCurve
502 {
503  DECLARE_EVENT_TABLE()
504 
505 public:
506 
507  a2dSweepCurve( a2dSweepPointArray* points );
508 
509  a2dSweepCurve( );
510 
511  a2dSweepCurve( const a2dSweepCurve& other, CloneOptions options, a2dRefMap* refs );
512 
513  virtual ~a2dSweepCurve();
514 
515  //! calculate Y at X
516  virtual bool GetXyAtSweep( double sweepValue, a2dPoint2D& point ) const;
517 
518  //! return the array of points.
519  a2dSweepPointArray* GetPoints() { return m_points; }
520 
521  //! return the number of point in the curve
522  int GetNumberOfPoints() { return m_points->GetCount(); }
523 
524  //!modify point at index to x,y
525  /*!
526  Set the coordinates of the point at index to x,y.
527  \param index the index of the point to change
528  \param x new x for the point in curve coordinates
529  \param y new y for the point in curve coordinates
530 
531  \remark afterinversion = true should be used if you have x,y relative to the polygon object,
532  while afterinversion = false should be used when x,y are relative to the point in the polygon.
533  */
534  void SetPosXYPoint( int index, double x, double y );
535 
536  //! get point x and y at index
537  /*!
538  \param index the index of the point to change
539  \param x new x for the point in curve coordinates
540  \param y new y for the point in curve coordinates
541  */
542  void GetPosXYPoint( int index, double& x, double& y );
543 
544  //! get point x and y at index in world coordinates
545  /*!
546  \param index the index of the point to change
547  \param x new x for the point in world coordinates
548  \param y new y for the point in world coordinates
549  \param transform if true return x y transformed with local matrix
550  */
551  void GetPosXYPointWorld( int index, double& x, double& y, bool transform );
552 
553  //!removes point at index
554  /*!
555  \param x x value of removed point in curve coordinates
556  \param y y value of removed point in curve coordinates
557  \param index index of point to remove (-1 means last point)
558  */
559  void RemovePoint( double& x, double& y , int index = -1 );
560 
561  //!removes point at index
562  /*!
563  \param x x value of removed point in world coordinates
564  \param y y value of removed point in world coordinates
565  \param index index of point to remove (-1 means last point)
566  \param transformed if true returned values x,y are transformed with local matrix
567  */
568  void RemovePointWorld( double& x, double& y , int index = -1, bool transformed = true );
569 
570  //! reduce matrix to identity without replacing object
571  bool EliminateMatrix();
572 
573  //! set to true, the polygon will be drawn as a spline
574  void SetSpline( bool on ) { m_spline = on; SetPending( true ); }
575 
576  //! Get the polygon spline setting
577  bool GetSpline() { return m_spline; }
578 
579  //!Append a new point in curve coordinates
580  void AddPoint( double sweep, const a2dPoint2D& P );
581 
582  //!Append a new point in curve coordinates
583  void AddPoint( double sweep, double x, double y );
584 
585  //!Preallocates memory for a given number of array elements.
586  /*!
587  It is worth calling when the number of items which are going to be added to the array
588  is known in advance because it will save unneeded memory reallocation.
589  If the array already has enough memory for the given number of items, nothing happens.
590  */
591  void Alloc( size_t count ) { m_points->Alloc( count ); }
592 
593  //!This function does the same as Empty() and additionally frees the memory allocated to the array.
594  void Clear() { m_points->Clear(); }
595 
596  //! Removes the element from the array, but, unlike, Remove() doesn't delete it.
597  //! The function returns the pointer to the removed element.
598  a2dSweepPoint* Detach( size_t index ) { return m_points->Detach( index ); }
599 
600  //!Empties the array. For wxObjArray classes, this destroys all of the array elements.
601  //!this function does not free the allocated memory, use Clear() for this.
602  void Empty() { m_points->Empty(); }
603 
604  //!Insert a new point into the array before the point n - thus, Insert(something, 0u)
605  //!will insert a point in such way that it will become the first array element.
606  void Insert( a2dSweepPoint* item, size_t n ) { m_points->Insert( item, n ); }
607 
608  //!Returns true if the array is empty, false otherwise.
609  bool IsEmpty() const { return m_points->IsEmpty(); }
610 
611  //! get i'th point
612  a2dSweepPoint* operator[]( size_t index ) const { return &( m_points->Item( index ) ); }
613 
614  //!Returns the point pointer at the given position in the array.
615  //!If index is out of bounds, an assert failure is raised in
616  //!the debug builds but nothing special is done in the release build.
617  a2dSweepPoint* Item( size_t index ) const { return &( m_points->Item( index ) ); }
618 
619  //!Returns the last element in the array, i.e. is the same as
620  //!Item(GetCount() - 1). An assert failure is raised in the debug mode if the array is empty.
621  a2dSweepPoint* Last() const { return &( m_points->Last() ); }
622 
623  //!Removes a point from the array by index. When a point is removed
624  //!it is deleted - use Detach() if you don't want this to happen.
625  void RemoveAt( size_t index ) { m_points->RemoveAt( index ); }
626 
627  //!Frees all memory unused by the array.
628  /*!If the program knows that no new items will be added to the
629  array it may call Shrink() to reduce its memory usage. However, if a
630  new item is added to the array, some extra memory will be allocated again.
631  */
632  void Shrink() { m_points->Shrink(); }
633 
634  //! test if a point is on the curve.
635  bool PointOnCurve( const a2dPoint2D& P, double marge );
636 
637  //! sets which parts or how the curve is rendered
638  /*!
639  See wxCurveRenderFlags for flags in the mask.
640  */
641  void SetRenderMode( wxUint32 rendermode ) { m_rendermode = rendermode; }
642 
643  //! get which parts or how the curve is rendered
644  int GetRenderMode() { return m_rendermode; }
645 
646  //! sets how the curve is edited
647  /*!
648  See wxCurveEditFlags for flags in the mask.
649  */
650  void SetEditMode( wxUint32 editmode ) { m_editmode = editmode; }
651 
652  //! get how the curve is edited
653  int GetEditMode() { return m_editmode; }
654 
655  DECLARE_DYNAMIC_CLASS( a2dSweepCurve )
656 
657 protected:
658 
659  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
660 
661  bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
662 
663  void OnHandleEvent( a2dHandleMouseEvent& event );
664 
665  void OnEnterObject( a2dCanvasObjectMouseEvent& event );
666  void OnLeaveObject( a2dCanvasObjectMouseEvent& event );
667 
668  void OnCanvasObjectMouseEvent( a2dCanvasObjectMouseEvent& event );
669 
670 #if wxART2D_USE_CVGIO
671  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
672 
673  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
674 #endif //wxART2D_USE_CVGIO
675 
676  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
677 
678  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
679 
680  void DoRender( a2dIterC& ic, OVERLAP clipparent );
681 
682  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
683 
684  bool m_spline;
685 
686  wxUint32 m_rendermode, m_editmode;
687 
688  a2dSweepPointArray* m_points;
689 
690 private:
691  //!this is a not implemented copy constructor that avoids automatic creation of one
692  a2dSweepCurve( const a2dSweepCurve& other );
693 };
694 
695 #if defined(WXART2D_USINGDLL)
696 template class A2DCURVESDLLEXP a2dSmrtPtr<a2dSweepCurve>;
697 #endif
698 //! Curve represented by a number of vertexes.
699 /*!
700 
701  \ingroup canvasobject meta curve
702 */
703 class A2DCURVESDLLEXP a2dBandCurve: public a2dCurve
704 {
705  DECLARE_EVENT_TABLE()
706 
707 public:
708 
709  a2dBandCurve( a2dSweepPointArray* points );
710 
711  a2dBandCurve( );
712 
713  a2dBandCurve( const a2dBandCurve& other, CloneOptions options, a2dRefMap* refs );
714 
715  virtual ~a2dBandCurve();
716 
717  //! calculate Y at X
718  virtual bool GetXyAtSweep( double sweepValue, a2dPoint2D& point ) const;
719 
720  //! return the array of points.
721  a2dSweepPointArray* GetPoints() { return m_points; }
722 
723  //! return the number of point in the curve
724  int GetNumberOfPoints() { return m_points->GetCount(); }
725 
726  //! return of GetXyAtSweep() is upper side of curve if true, else low
727  void SetMarkerUpLow( bool markerUpLow ) { m_markerUpLow = markerUpLow; }
728 
729  //!modify point at index to x,y
730  /*!
731  Set the coordinates of the point at index to x,y.
732  \param index the index of the point to change
733  \param sweep new sweep for the point in curve coordinates
734  \param y new y for the point in curve coordinates
735 
736  \remark afterinversion = true should be used if you have x,y relative to the polygon object,
737  while afterinversion = false should be used when x,y are relative to the point in the polygon.
738  */
739  void SetPosXYPoint( int index, double sweep, double y, bool upper );
740 
741  //! get point x and y at index
742  /*!
743  \param index the index of the point to change
744  \param sweep new sweep for the point in curve coordinates
745  \param y new y for the point in curve coordinates
746  */
747  void GetPosXYPoint( int index, double& sweep, double& y, bool upper );
748 
749  //! get point x and y at index in world coordinates
750  /*!
751  \param index the index of the point to change
752  \param sweep new sweep for the point in world coordinates
753  \param y new y for the point in world coordinates
754  \param transform if true return x y transformed with local matrix
755  */
756  void GetPosXYPointWorld( int index, double& sweep, double& y, bool upper, bool transform );
757 
758  //!removes point at index
759  /*!
760  \param sweep sweep value of removed point in curve coordinates
761  \param y y value of removed point in curve coordinates
762  \param index index of point to remove (-1 means last point)
763  */
764  void RemovePoint( double& sweep, double& y , bool upper, int index = -1 );
765 
766  //!removes point at index
767  /*!
768  \param sweep sweep value of removed point in world coordinates
769  \param y y value of removed point in world coordinates
770  \param index index of point to remove (-1 means last point)
771  \param transformed if true returned values x,y are transformed with local matrix
772  */
773  void RemovePointWorld( double& sweep, double& y , bool upper, int index = -1, bool transformed = true );
774 
775  //! reduce matrix to identity without replacing object
776  bool EliminateMatrix();
777 
778  //! set to true, the polygon will be drawn as a spline
779  void SetSpline( bool on ) { m_spline = on; SetPending( true ); }
780 
781  //! Get the polygon spline setting
782  bool GetSpline() { return m_spline; }
783 
784  //!Append a new point in curve coordinates
785  void AddPoint( double sweep, const a2dPoint2D& P );
786 
787  //!Append a new point in curve coordinates
788  void AddPoint( double sweep, double x, double y );
789 
790  //!Preallocates memory for a given number of array elements.
791  /*!
792  It is worth calling when the number of items which are going to be added to the array
793  is known in advance because it will save unneeded memory reallocation.
794  If the array already has enough memory for the given number of items, nothing happens.
795  */
796  void Alloc( size_t count ) { m_points->Alloc( count ); }
797 
798  //!This function does the same as Empty() and additionally frees the memory allocated to the array.
799  void Clear() { m_points->Clear(); }
800 
801  //! Removes the element from the array, but, unlike, Remove() doesn't delete it.
802  //! The function returns the pointer to the removed element.
803  a2dSweepPoint* Detach( size_t index ) { return m_points->Detach( index ); }
804 
805  //!Empties the array. For wxObjArray classes, this destroys all of the array elements.
806  //!this function does not free the allocated memory, use Clear() for this.
807  void Empty() { m_points->Empty(); }
808 
809  //!Insert a new point into the array before the point n - thus, Insert(something, 0u)
810  //!will insert a point in such way that it will become the first array element.
811  void Insert( a2dSweepPoint* item, size_t n ) { m_points->Insert( item, n ); }
812 
813  //!Returns true if the array is empty, false otherwise.
814  bool IsEmpty() const { return m_points->IsEmpty(); }
815 
816  //! get i'th point
817  a2dSweepPoint* operator[]( size_t index ) const { return &( m_points->Item( index ) ); }
818 
819  //!Returns the point pointer at the given position in the array.
820  //!If index is out of bounds, an assert failure is raised in
821  //!the debug builds but nothing special is done in the release build.
822  a2dSweepPoint* Item( size_t index ) const { return &( m_points->Item( index ) ); }
823 
824  //!Returns the last element in the array, i.e. is the same as
825  //!Item(GetCount() - 1). An assert failure is raised in the debug mode if the array is empty.
826  a2dSweepPoint* Last() const { return &( m_points->Last() ); }
827 
828  //!Removes a point from the array by index. When a point is removed
829  //!it is deleted - use Detach() if you don't want this to happen.
830  void RemoveAt( size_t index ) { m_points->RemoveAt( index ); }
831 
832  //!Frees all memory unused by the array.
833  /*!If the program knows that no new items will be added to the
834  array it may call Shrink() to reduce its memory usage. However, if a
835  new item is added to the array, some extra memory will be allocated again.
836  */
837  void Shrink() { m_points->Shrink(); }
838 
839  //! test if a point is on the curve.
840  bool PointOnCurve( const a2dPoint2D& P, double marge );
841 
842  //! sets which parts or how the curve is rendered
843  /*!
844  See wxCurveRenderFlags for flags in the mask.
845  */
846  void SetRenderMode( wxUint32 rendermode ) { m_rendermode = rendermode; }
847 
848  //! get which parts or how the curve is rendered
849  int GetRenderMode() { return m_rendermode; }
850 
851  //! sets how the curve is edited
852  /*!
853  See wxCurveEditFlags for flags in the mask.
854  */
855  void SetEditMode( wxUint32 editmode ) { m_editmode = editmode; }
856 
857  //! get how the curve is edited
858  int GetEditMode() { return m_editmode; }
859 
860  DECLARE_DYNAMIC_CLASS( a2dBandCurve )
861 
862 protected:
863 
864  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
865 
866  bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
867 
868  void SyncHandlesWithLineSegments();
869 
870  void OnHandleEvent( a2dHandleMouseEvent& event );
871 
872  void OnEnterObject( a2dCanvasObjectMouseEvent& event );
873  void OnLeaveObject( a2dCanvasObjectMouseEvent& event );
874 
875  void OnCanvasObjectMouseEvent( a2dCanvasObjectMouseEvent& event );
876 
877 #if wxART2D_USE_CVGIO
878  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
879 
880  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
881 #endif //wxART2D_USE_CVGIO
882 
883  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
884 
885  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
886 
887  void DoRender( a2dIterC& ic, OVERLAP clipparent );
888 
889  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
890 
891  bool m_spline;
892 
893  wxUint32 m_rendermode, m_editmode;
894 
895  a2dSweepPointArray* m_points;
896 
897  //! return of GetXyAtSweep() is upper side of curve if true, else low
899 
900 private:
901  //!this is a not implemented copy constructor that avoids automatic creation of one
902  a2dBandCurve( const a2dBandCurve& other );
903 };
904 
905 #if defined(WXART2D_USINGDLL)
906 template class A2DCURVESDLLEXP a2dSmrtPtr<a2dBandCurve>;
907 #endif
908 
909 //! handle holds a pointer to a polygon/polyline segment
910 /*! this class is used for editing, to quickly update handles from vertexes.
911 */
912 class A2DCURVESDLLEXP a2dCanvasBandCurveHandle: public a2dHandle
913 {
914 public:
915 
916  DECLARE_DYNAMIC_CLASS( a2dCanvasBandCurveHandle )
917 
918  //! constructor
920 
921  //! construct for use in a2dVertexArray
922  /*!
923  index based handle
924 
925  \param parent polygon that contains this handle
926  \param index index of segment for which this handle is generated.
927  \param arcMid if true this handle is placed on the middle of an arc segment
928  \param xc center x
929  \param yc center y
930  \param name name of handle
931  */
932  a2dCanvasBandCurveHandle( a2dBandCurve* parent, unsigned int index, bool arcMid, double xc, double yc, const wxString& name = wxT( "" ) );
933 
934  //! copy constructor
936 
937  //! destructor
939 
940  //! handle for middle point of arc
941  bool m_arcMid;
942 
943  unsigned int GetIndex() { return m_index; }
944 
945 private:
946 
947  //! in case of vertex array
948  unsigned int m_index;
949 };
950 
951 
952 // instantiate
953 #if defined(WXART2D_USINGDLL)
954 template class A2DCURVESDLLEXP a2dSmrtPtr<a2dCanvasBandCurveHandle>;
955 #endif
956 
957 //! Bars in a Curve represented by a number of vertexes.
958 /*!
959 
960  \ingroup canvasobject meta curve
961 */
962 class A2DCURVESDLLEXP a2dBarCurve: public a2dVertexCurve
963 {
964 
965 public:
966 
967  //! these flags define how curves are drawn
969  {
970  a2dBAR_RENDER_NO_POINTS = 0x0001, /*!< show no points on the curve */
971  a2dBAR_RENDER_NORMAL = 0x0002, /*!< rectangular bar */
972  a2dBAR_RENDER_3D = 0x0004, /*!< 3d bars or 3d look */
973  a2dBAR_RENDER_LINE = 0x0008, /*!< just one line */
974  a2dBAR_RENDER_DEFAULT = a2dCURVES_RENDER_NORMAL /*!< like normal curve */
975  };
976 
977  a2dBarCurve( a2dVertexArray* points );
978 
979  a2dBarCurve( );
980 
981  ~a2dBarCurve( );
982 
983  a2dBarCurve( const a2dBarCurve& other, CloneOptions options, a2dRefMap* refs );
984 
985  void SetBarWidth( double barwidth ) { m_barwidth = barwidth; }
986 
987  double GetBarWidth() { return m_barwidth; }
988 
989  double GetExtrudeDepth() { return m_depth; }
990  double GetExtrudeAngle() { return wxRadToDeg( m_angle3d ); }
991 
992  void SetExtrudeDepth( double depth ) { m_depth = depth; SetPending( true ); }
993  void SetExtrudeAngle( double angle3d ) { m_angle3d = wxDegToRad( angle3d ); SetPending( true ); }
994 
995  void SetExtrudeFill( const a2dFill& fill );
996 
997  const a2dFill& GetExtrudeFill() { return m_extrudeFill; }
998 
999  DECLARE_DYNAMIC_CLASS( a2dBarCurve )
1000 
1001 protected:
1002 
1003  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
1004 
1005  void DoWalker( wxObject* parent, a2dWalkerIOHandler& handler );
1006 
1007 #if wxART2D_USE_CVGIO
1008  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
1009 
1010  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
1011 #endif //wxART2D_USE_CVGIO
1012 
1013  void DoRender( a2dIterC& ic, OVERLAP clipparent );
1014 
1015  double m_barwidth;
1016  double m_depth;
1017  double m_angle3d;
1018 
1019  a2dFill m_extrudeFill;
1020 
1021  static const a2dPropertyIdRefObject PROPID_extrudeFill;
1022 
1023 
1024 private:
1025  //!this is a not implemented copy constructor that avoids automatic creation of one
1026  a2dBarCurve( const a2dBarCurve& other );
1027 };
1028 
1029 //! Curve represented by a number of vertexes in a List.
1030 /*!
1031  Use this for time running curves, since vertexes can be added and removed
1032  at both sides quickly.
1033 
1034  \ingroup canvasobject meta curve
1035 */
1036 class A2DCURVESDLLEXP a2dVertexListCurve: public a2dCurve
1037 {
1038  DECLARE_EVENT_TABLE()
1039 
1040 public:
1041 
1042  a2dVertexListCurve( a2dVertexList* points );
1043 
1044  a2dVertexListCurve( );
1045 
1046  a2dVertexListCurve( const a2dVertexListCurve& other, CloneOptions options, a2dRefMap* refs );
1047 
1048  virtual ~a2dVertexListCurve();
1049 
1050  //! calculate Y at X
1051  virtual bool GetXyAtSweep( double sweepValue, a2dPoint2D& point ) const;
1052 
1053  //! return the array of points.
1054  a2dVertexList* GetPoints() { return m_lpoints; }
1055 
1056  //! return the number of point in the curve
1057  int GetNumberOfPoints() { return m_lpoints->size(); }
1058 
1059  //!Append a new point
1060  void AddPoint( const a2dPoint2D& P, int index = -1, bool afterinversion = true );
1061 
1062  //!Append a new point, which is owned by this class now
1063  void AddPoint( double x, double y, int index = -1, bool afterinversion = true );
1064 
1065  //!removes point at index
1066  /*!
1067  \param x x value of removed point
1068  \param y y value of removed point
1069  \param index index of point to remove (-1 means last point)
1070  \param transformed if true returned values x,y are transformed with local matrix
1071  */
1072  void RemovePoint( double& x, double& y , int index = -1, bool transformed = true );
1073 
1074  //! reduce matrix to identity without replacing object
1075  bool EliminateMatrix();
1076 
1077  //!modify point at index to x,y
1078  /*!
1079  Set the coordinates of the point at index to x,y.
1080  \param index the index of the point to change
1081  \param x new x for the point
1082  \param y new y for the point
1083  \param afterinversion if true the input x,y or first inverted with the local matrix of the object.
1084  The inverted values are used to set the point.
1085 
1086  \remark afterinversion = true should be used if you have x,y relative to the polygon object,
1087  while afterinversion = false should be used when x,y are relative to the point in the polygon.
1088  */
1089  void SetPosXYPoint( int index, double x, double y, bool afterinversion = true );
1090 
1091  //! get point x and y at index
1092  /*!
1093  \param index the index of the point to change
1094  \param x new x for the point
1095  \param y new y for the point
1096  \param transform if true return x y transformed with local matrix
1097  */
1098  void GetPosXYPoint( int index, double& x, double& y, bool transform = true );
1099 
1100  //! set to true, the polygon will be drawn as a spline
1101  void SetSpline( bool on ) { m_spline = on; SetPending( true ); }
1102 
1103  //! Get the polygon spline setting
1104  bool GetSpline() { return m_spline; }
1105 
1106  //! test if a point is on the curve.
1107  bool PointOnCurve( const a2dPoint2D& P, double marge );
1108 
1109  //! sets which parts or how the curve is rendered
1110  /*!
1111  See wxCurveRenderFlags for flags in the mask.
1112  */
1113  void SetRenderMode( wxUint32 rendermode ) { m_rendermode = rendermode; }
1114 
1115  //! get which parts or how the curve is rendered
1116  int GetRenderMode() { return m_rendermode; }
1117 
1118  //! sets how the curve is edited
1119  /*!
1120  See wxCurveEditFlags for flags in the mask.
1121  */
1122  void SetEditMode( wxUint32 editmode ) { m_editmode = editmode; }
1123 
1124  //! get how the curve is edited
1125  int GetEditMode() { return m_editmode; }
1126 
1127  DECLARE_DYNAMIC_CLASS( a2dVertexListCurve )
1128 
1129 protected:
1130 
1131  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
1132 
1133  bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
1134 
1135  void OnHandleEvent( a2dHandleMouseEvent& event );
1136 
1137  void OnEnterObject( a2dCanvasObjectMouseEvent& event );
1138  void OnLeaveObject( a2dCanvasObjectMouseEvent& event );
1139 
1140  void OnCanvasObjectMouseEvent( a2dCanvasObjectMouseEvent& event );
1141 
1142 #if wxART2D_USE_CVGIO
1143  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
1144 
1145  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
1146 #endif //wxART2D_USE_CVGIO
1147 
1148  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
1149 
1150  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
1151 
1152  void DoRender( a2dIterC& ic, OVERLAP clipparent );
1153 
1154  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
1155 
1156  bool m_spline;
1157 
1158  int m_rendermode, m_editmode;
1159 
1160  a2dVertexList* m_lpoints;
1161 
1162 private:
1163  //!this is a not implemented copy constructor that avoids automatic creation of one
1164  a2dVertexListCurve( const a2dVertexListCurve& other );
1165 };
1166 
1167 //! Curve represented by a number of vertexes.
1168 /*!
1169 
1170  \ingroup canvasobject meta curve
1171 */
1172 class A2DCURVESDLLEXP a2dPieCurve: public a2dCurve
1173 {
1174  DECLARE_EVENT_TABLE()
1175 
1176 public:
1177 
1178  a2dPieCurve( a2dVertexArray* points );
1179 
1180  a2dPieCurve( );
1181 
1182  a2dPieCurve( const a2dPieCurve& other, CloneOptions options, a2dRefMap* refs );
1183 
1184  virtual ~a2dPieCurve();
1185 
1186  //! calculate Y at X
1187  virtual bool GetXyAtSweep( double sweepValue, a2dPoint2D& point ) const;
1188 
1189  //! return the array of points.
1190  a2dVertexArray* GetPoints() { return m_points; }
1191 
1192  //! return the number of point in the curve
1193  int GetNumberOfPoints() { return m_points->size(); }
1194 
1195  //! get point x and y at index in world coordinates
1196  /*!
1197  \param index the index of the point to change
1198  \param x new x for the point in world coordinates
1199  \param y new y for the point in world coordinates
1200  \param transform if true return x y transformed with local matrix
1201  */
1202  void GetPosXYPointWorld( int index, double& x, double& y, bool transform );
1203 
1204  //!removes point at index
1205  /*!
1206  \param x x value of removed point in world coordinates
1207  \param y y value of removed point in world coordinates
1208  \param index index of point to remove (-1 means last point)
1209  \param transformed if true returned values x,y are transformed with local matrix
1210  */
1211  void RemovePointWorld( double& x, double& y , int index = -1, bool transformed = true );
1212 
1213 
1214  //!Append a new point in curve coordinates
1215  void AddPoint( const a2dPoint2D& P, int index = -1 );
1216 
1217  //!Append a new point in curve coordinates
1218  void AddPoint( double x, double y, int index = -1 );
1219 
1220  //!Preallocates memory for a given number of array elements.
1221  /*!
1222  It is worth calling when the number of items which are going to be added to the array
1223  is known in advance because it will save unneeded memory reallocation.
1224  If the array already has enough memory for the given number of items, nothing happens.
1225  */
1226  void Alloc( size_t count ) { m_points->reserve( count ); }
1227 
1228  //!This function does the same as Empty() and additionally frees the memory allocated to the array.
1229  void Clear() { m_points->clear(); }
1230 
1231  //!Returns true if the array is empty, false otherwise.
1232  bool IsEmpty() const { return m_points->empty(); }
1233 
1234  //!Returns the point pointer at the given position in the array.
1235  /*!
1236  If index is out of bounds, an assert failure is raised in
1237  the debug builds but nothing special is done in the release build.
1238  */
1239  a2dLineSegmentPtr Item( size_t index ) const { return m_points->operator[]( index ); }
1240 
1241  //!Returns the last element in the array.
1242  /*!
1243  I.e. is the same as Item(GetCount() - 1).
1244  An assert failure is raised in the debug mode if the array is empty.
1245  */
1246  a2dLineSegmentPtr Last() const { return m_points->back(); }
1247 
1248  //!Removes a point from the array by index.
1249  /*!
1250  When a point is removed
1251  it is deleted - use Detach() if you don't want this to happen.
1252  */
1253  void RemoveAt( size_t index ) { m_points->RemoveAt( index ); }
1254 
1255  //! sets which parts or how the curve is rendered
1256  /*!
1257  See wxCurveRenderFlags for flags in the mask.
1258  */
1259  void SetRenderMode( wxUint32 rendermode ) { m_rendermode = rendermode; }
1260 
1261  //! get which parts or how the curve is rendered
1262  int GetRenderMode() { return m_rendermode; }
1263 
1264  DECLARE_DYNAMIC_CLASS( a2dPieCurve )
1265 
1266 protected:
1267 
1268  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
1269 
1270  bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
1271 
1272  void OnHandleEvent( a2dHandleMouseEvent& event );
1273 
1274  void OnEnterObject( a2dCanvasObjectMouseEvent& event );
1275  void OnLeaveObject( a2dCanvasObjectMouseEvent& event );
1276 
1277  void OnCanvasObjectMouseEvent( a2dCanvasObjectMouseEvent& event );
1278 
1279 #if wxART2D_USE_CVGIO
1280  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
1281 
1282  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
1283 #endif //wxART2D_USE_CVGIO
1284 
1285  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
1286 
1287  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
1288 
1289  void DoRender( a2dIterC& ic, OVERLAP clipparent );
1290 
1291  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
1292 
1293  wxUint32 m_rendermode;
1294 
1295  a2dVertexArray* m_points;
1296 
1297  double m_width;
1298  double m_height;
1299 
1300 private:
1301  //!this is a not implemented copy constructor that avoids automatic creation of one
1302  a2dPieCurve( const a2dPieCurve& other );
1303 };
1304 
1305 #endif
1306 
wxPoint2DDouble a2dPoint2D
this to define if coordinate numbers are integer or doubles
Definition: artglob.h:47
a2dVertexArray * GetPoints()
return the array of points.
Definition: curve.h:312
a2dSweepPointArray * GetPoints()
return the array of points.
Definition: curve.h:519
void SetSpline(bool on)
set to true, the polygon will be drawn as a spline
Definition: curve.h:1101
handle holds a pointer to a polygon/polyline segment
Definition: curve.h:912
virtual bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
Definition: canobj.cpp:3713
classes for plotting curve and pie data, and editing them.
a2dHandle is used inside editing versions of a certain objects.
Definition: canpin.h:30
mouse event sent from a2dCanvasObject to itself
Definition: canglob.h:223
void SetSpline(bool on)
set to true, the polygon will be drawn as a spline
Definition: curve.h:574
int GetEditMode()
get how the curve is edited
Definition: curve.h:1125
int GetNumberOfPoints()
return the number of point in the curve
Definition: curve.h:724
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: canobj.cpp:1426
int GetRenderMode()
get which parts or how the curve is rendered
Definition: curve.h:1116
void SetRenderMode(wxUint32 rendermode)
sets which parts or how the curve is rendered
Definition: curve.h:423
class to map references to objects stored in XML, in order to make the connection later on...
Definition: gen.h:3462
void SetCurvesArea(a2dCurvesArea *curvesArea)
used for conversion of curve data to curvegroup area
Definition: curve.h:59
Bars in a Curve represented by a number of vertexes.
Definition: curve.h:962
Curve represented by a number of vertexes.
Definition: curve.h:501
void SetSpline(bool on)
set to true, the polygon will be drawn as a spline
Definition: curve.h:367
int GetEditMode()
get how the curve is edited
Definition: curve.h:653
void SetEditMode(wxUint32 editmode)
sets how the curve is edited
Definition: curve.h:1122
void Alloc(size_t count)
Preallocates memory for a given number of array elements.
Definition: curve.h:1226
a2dSweepPointArray * GetPoints()
return the array of points.
Definition: curve.h:721
Ref Counted base object.
Definition: gen.h:1045
void SetEditMode(wxUint32 editmode)
sets how the curve is edited
Definition: curve.h:855
int GetRenderMode()
get which parts or how the curve is rendered
Definition: curve.h:644
double wxDegToRad(double deg)
conversion from degrees to radians
Definition: artglob.cpp:30
void Shrink()
Frees all memory unused by the array.
Definition: curve.h:632
void Clear()
This function does the same as Empty() and additionally frees the memory allocated to the array...
Definition: curve.h:387
Input and output handler for the XmlSer format.
Definition: genxmlpars.h:819
UpdateMode
Various mode flags for Update.
Definition: canobj.h:1091
void RemoveAt(size_t index)
Definition: curve.h:625
void RemoveAt(size_t index)
Definition: curve.h:830
virtual void SetPending(bool pending)
set this object pending for update
Definition: canobj.cpp:2585
OVERLAP
Result of a a2dBoundingBox intersection or hittest.
Definition: bbox.h:24
int GetNumberOfPoints()
return the number of point in the curve
Definition: curve.h:1193
void Clear()
This function does the same as Empty() and additionally frees the memory allocated to the array...
Definition: curve.h:594
void SetRenderMode(wxUint32 rendermode)
sets which parts or how the curve is rendered
Definition: curve.h:641
a2dSweepPoint * Last() const
Definition: curve.h:826
bool IsEmpty() const
Returns true if the array is empty, false otherwise.
Definition: curve.h:390
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
Definition: canobj.cpp:5728
vertex array of line and arc segments.
Definition: polyver.h:494
a2dCanvasObject is the base class for Canvas Objects.
Definition: canobj.h:371
a2dLineSegmentPtr Item(size_t index) const
Returns the point pointer at the given position in the array.
Definition: curve.h:1239
Object to plot a Curve defined by a Function in form of a string.
Definition: curve.h:236
void RemoveAt(size_t index)
Removes a point from the array by index.
Definition: curve.h:414
a2dLineSegmentPtr Last() const
Returns the last element in the array.
Definition: curve.h:1246
void Empty()
Definition: curve.h:602
int GetNumberOfPoints()
return the number of point in the curve
Definition: curve.h:1057
vertex list of line and arc segments.
Definition: polyver.h:600
virtual void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
Definition: canobj.cpp:4695
void Empty()
Definition: curve.h:807
a2dCurveObject for objects needing to know its parent a2dCurvesArea.
Definition: curve.h:42
void Insert(a2dSweepPoint *item, size_t n)
Definition: curve.h:606
Curve represented by a number of vertexes.
Definition: curve.h:1172
Io handler to iterate through a a2dDocument.
Definition: gen.h:3911
void SetEditMode(wxUint32 editmode)
sets how the curve is edited
Definition: curve.h:432
a2dSweepPoint * Item(size_t index) const
Definition: curve.h:617
void SetRenderMode(wxUint32 rendermode)
sets which parts or how the curve is rendered
Definition: curve.h:1113
void SetMarkerUpLow(bool markerUpLow)
return of GetXyAtSweep() is upper side of curve if true, else low
Definition: curve.h:727
a2dSweepPoint * operator[](size_t index) const
get i&#39;th point
Definition: curve.h:817
bool IsEmpty() const
Returns true if the array is empty, false otherwise.
Definition: curve.h:609
a2dVertexArray * GetPoints()
return the array of points.
Definition: curve.h:1190
a2dLineSegmentPtr Last() const
Returns the last element in the array.
Definition: curve.h:407
void SetEditMode(wxUint32 editmode)
sets how the curve is edited
Definition: curve.h:650
void SetSpline(bool on)
set to true, the polygon will be drawn as a spline
Definition: curve.h:779
bool IsEmpty() const
Returns true if the array is empty, false otherwise.
Definition: curve.h:1232
a2dBarRenderFlags
these flags define how curves are drawn
Definition: curve.h:968
a2dCurveEditFlags
these flags define how (points on) curves can be moved/edited
Definition: curve.h:123
bool m_markerUpLow
return of GetXyAtSweep() is upper side of curve if true, else low
Definition: curve.h:898
double wxRadToDeg(double rad)
conversion from radians to degrees
Definition: artglob.cpp:31
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
Definition: canobj.cpp:5569
general event sent from a2dHandle to its parent a2dCanvasObject
Definition: canglob.h:273
void Alloc(size_t count)
Preallocates memory for a given number of array elements.
Definition: curve.h:384
void Clear()
This function does the same as Empty() and additionally frees the memory allocated to the array...
Definition: curve.h:799
Input and output handler for the XmlSer format.
Definition: genxmlpars.h:862
int GetRenderMode()
get which parts or how the curve is rendered
Definition: curve.h:426
int GetEditMode()
get how the curve is edited
Definition: curve.h:858
void RemoveAt(size_t index)
Removes a point from the array by index.
Definition: curve.h:1253
a2dCurveRenderFlags
these flags define how curves are drawn
Definition: curve.h:112
int GetNumberOfPoints()
return the number of point in the curve
Definition: curve.h:315
basic list class based on STL containers.
Base class for curves.
Definition: curve.h:107
expression(s) evaluation based on a string.
Definition: eval.h:143
int GetRenderMode()
get which parts or how the curve is rendered
Definition: curve.h:1262
void Alloc(size_t count)
Preallocates memory for a given number of array elements.
Definition: curve.h:796
while iterating a a2dCanvasDocument, this holds the context.
Definition: canobj.h:3212
Curve represented by a number of vertexes.
Definition: curve.h:294
void Clear()
This function does the same as Empty() and additionally frees the memory allocated to the array...
Definition: curve.h:1229
void Insert(a2dSweepPoint *item, size_t n)
Definition: curve.h:811
a2dBoundingBox m_clipdata
defines boundaries in which the curve will be calculated / displayed
Definition: curve.h:214
void SetRenderMode(wxUint32 rendermode)
sets which parts or how the curve is rendered
Definition: curve.h:846
void SetRenderMode(wxUint32 rendermode)
sets which parts or how the curve is rendered
Definition: curve.h:1259
int GetNumberOfPoints()
return the number of point in the curve
Definition: curve.h:522
bool GetSpline()
Get the polygon spline setting.
Definition: curve.h:782
a2dBoundingBox m_curveBox
defines boundaries in which the curve has points
Definition: curve.h:217
a2dSweepPoint * Last() const
Definition: curve.h:621
a2dSweepPoint * operator[](size_t index) const
get i&#39;th point
Definition: curve.h:612
bool m_arcMid
handle for middle point of arc
Definition: curve.h:941
virtual bool EliminateMatrix()
reduce matrix to identity
Definition: canobj.cpp:6191
a2dSweepPoint * Detach(size_t index)
Definition: curve.h:803
a2dLineSegmentPtr Item(size_t index) const
Returns the point pointer at the given position in the array.
Definition: curve.h:400
Curve represented by a number of vertexes.
Definition: curve.h:703
bool IsEmpty() const
Returns true if the array is empty, false otherwise.
Definition: curve.h:814
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
Definition: bbox.h:39
int GetRenderMode()
get which parts or how the curve is rendered
Definition: curve.h:849
a2dVertexList * GetPoints()
return the array of points.
Definition: curve.h:1054
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...
Definition: canobj.cpp:5031
a2dSweepPoint * Item(size_t index) const
Definition: curve.h:822
virtual bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
Definition: canobj.cpp:5098
a2dSweepPoint * Detach(size_t index)
Definition: curve.h:598
This template class is for property ids with a known data type.
Definition: id.h:477
void Alloc(size_t count)
Preallocates memory for a given number of array elements.
Definition: curve.h:591
Curve represented by a number of vertexes in a List.
Definition: curve.h:1036
void Shrink()
Frees all memory unused by the array.
Definition: curve.h:837
bool GetSpline()
Get the polygon spline setting.
Definition: curve.h:577
bool GetSpline()
Get the polygon spline setting.
Definition: curve.h:1104
list of a2dObject&#39;s
Definition: gen.h:3157
CloneOptions
options for cloning
Definition: gen.h:1200
structure to give as parameter to member functions of a2dCanvasObject
Definition: canobj.h:252
int GetEditMode()
get how the curve is edited
Definition: curve.h:435
bool GetSpline()
Get the polygon spline setting.
Definition: curve.h:370
base class for curve area in a a2dCurvesAreaList, like used in a2dCanvasXYDisplayGroups ...
Definition: curvegroup.h:56
old a complex point at a sweep value
Definition: curve.h:481
wxEditStyle
Definition: canobj.h:109
a2dLineSegmentPtr operator[](size_t index) const
get i&#39;th point
Definition: curve.h:393
curve.h Source File -- Sun Oct 12 2014 17:04:15 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation