wxArt2D
canprim.h
Go to the documentation of this file.
1 /*! \file wx/canvas/canprim.h
2  \brief all basic primitives derived from a2dCanvasObject
3 
4  Circle rectangle arc line arrow etc. or placed in here.
5  And Pins and pin classes to connect objects.
6 
7  \author Klaas Holwerda
8 
9  Copyright: 2000-2004 (c) Klaas Holwerda
10 
11  Licence: wxWidgets Licence
12 
13  RCS-ID: $Id: canprim.h,v 1.37 2009/07/17 16:03:34 titato Exp $
14 */
15 
16 #ifndef __WXCANPRIM_H__
17 #define __WXCANPRIM_H__
18 
19 #ifndef WX_PRECOMP
20 #include "wx/wx.h"
21 #endif
22 
23 #include "wx/image.h"
24 #include "wx/canvas/candefs.h"
25 #include "wx/canvas/canobj.h"
26 
27 class A2DARTBASEDLLEXP a2dVpath;
28 
29 //! a2dOrigin stays at World Coordinate Zero (0,0) not matter what.
30 /*! You can define width and Height of the cross. \ingroup canvasobject */
31 class A2DCANVASDLLEXP a2dOrigin: public a2dCanvasObject
32 {
33 public:
34 
35 
36  //! constructor
37  a2dOrigin();
38 
39  //! constructor
40  /*!
41  \param w width in pixels of origin
42  \param h height in pixels of origin
43  */
44  a2dOrigin( double w, double h );
45 
46  a2dOrigin( const a2dOrigin& other, CloneOptions options, a2dRefMap* refs );
47 
48  ~a2dOrigin();
49 
50  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
51 
52  //!return width
53  double GetWidth() { return m_width; }
54 
55  //!return height
56  double GetHeight() { return m_height; }
57 
58  //!set width
59  /*!
60  \param width width of origin
61  */
62  void SetWidth( double width ) { m_width = width; SetPending( true ); }
63 
64  //!set height
65  /*!
66  \param height height origin
67  */
68  void SetHeight( double height ) { m_height = height; SetPending( true ); }
69 
70 #if wxART2D_USE_CVGIO
71  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
72 #endif //wxART2D_USE_CVGIO
73 
74  DECLARE_DYNAMIC_CLASS( a2dOrigin )
75 
76 protected:
77  void DoRender( a2dIterC& ic, OVERLAP clipparent );
78 
79  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
80  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
81 
82  //! width in pixels
83  double m_width;
84 
85  //! height in pixels
86  double m_height;
87 
88 private:
89  //!this is a not implemented copy constructor that avoids automatic creation of one
90  a2dOrigin( const a2dOrigin& other );
91 };
92 
93 //! a2dRectC is a centered rectangle
94 /*!
95  Rectangle around a center point.
96 
97  \ingroup canvasobject
98 */
99 class A2DCANVASDLLEXP a2dRectC: public a2dCanvasObject
100 {
101 public:
102 
103  //! constructor
104  a2dRectC();
105 
106  //! construct a centered rectangle
107  /*!
108  \param xc center x
109  \param yc center y
110  \param w width of rectangle
111  \param h height of rectangle
112  \param angle angle of rotation of rectangle
113  \param radius for a rounded rectangle
114  */
115  a2dRectC( double xc, double yc, double w, double h, double angle = 0 , double radius = 0 );
116 
117  //! constructor
118  a2dRectC( const a2dRectC& ori, CloneOptions options, a2dRefMap* refs );
119 
120  //! destructor
121  ~a2dRectC();
122 
123  //! set all paramters for the centered rectangle
124  /*!
125  \param xc center x
126  \param yc center y
127  \param w width of rectangle
128  \param h height of rectangle
129  \param angle angle of rotation of rectangle
130  \param radius for a rounded rectangle
131  */
132  void Set( double xc, double yc, double w, double h, double angle = 0 , double radius = 0 );
133 
134  //!set width of rectangle
135  /*!
136  \param w width of rectangle
137  */
138  void SetWidth( double w ) { m_width = w; SetPending( true ); }
139 
140  //!set height of rectangle
141  /*!
142  \param h height of rectangle
143  */
144  void SetHeight( double h ) { m_height = h; SetPending( true ); }
145 
146  //!return width
147  double GetWidth() const { return m_width; }
148  //!return height
149  double GetHeight() const { return m_height; }
150  //!return radius
151  double GetRadius() const { return m_height; }
152 
153 #if wxART2D_USE_CVGIO
154  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
155 #endif //wxART2D_USE_CVGIO
156 
157  virtual a2dVertexList* GetAsVertexList( bool& returnIsPolygon ) const;
158 
159 
160  a2dCanvasObjectList* GetAsCanvasVpaths( bool transform = true ) const;
161 
162  DECLARE_DYNAMIC_CLASS( a2dRectC )
163 
164 protected:
165 
166  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
167  void DoRender( a2dIterC& ic, OVERLAP clipparent );
168  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
169  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
170 
171  //! width of rectangle
172  double m_width;
173  //! height of rectangle
174  double m_height;
175  //!radius in case of rounded rectangle
176  double m_radius;
177 
178 public:
179 
180  static a2dPropertyIdDouble* PROPID_Width;
181  static a2dPropertyIdDouble* PROPID_Height;
182  static a2dPropertyIdDouble* PROPID_Radius;
183 
185 
186 private:
187  //!this is a not implemented copy constructor that avoids automatic creation of one
188  a2dRectC( const a2dRectC& ori );
189 };
190 
191 //!a2dArrow is used for having line begin and ends on specific objects.
192 /*! Those objects do position the arrow at the right place, and scale if needed.
193  \sa a2dEndsLine
194  \sa a2dPolylineL
195 
196  \ingroup canvasobject
197 */
198 class A2DCANVASDLLEXP a2dArrow: public a2dCanvasObject
199 {
200 public:
201 
202  //! constructor
203  /*!
204  \param xt x top of arrow (normal 0)
205  \param yt y top of arrow (normal 0)
206  \param l1 How long is the arrow.
207  \param l2 Distance from top to the inside of the arrow.
208  \param b How broad is the basis of the arrow.
209  \param spline Draw the arrow in a spline fashion
210  */
211  a2dArrow( double xt, double yt, double l1, double l2, double b, bool spline = false );
212 
213  //! constructor
214  a2dArrow();
215 
216  //! copy constructor
217  a2dArrow( const a2dArrow& ori, CloneOptions options, a2dRefMap* refs );
218 
219  ~a2dArrow();
220 
221  //! Sets top, length, height and broad parameters
222  /*!
223  \param xt: x top of arrow (normal 0)
224  \param yt: y top of arrow (normal 0)
225  \param l1: How long is the arrow.
226  \param l2: Distance from top to the inside of the arrow.
227  \param b: How broad is the basis of the arrow.
228  */
229  void Set( double xt, double yt, double l1, double l2, double b, bool spline = false );
230 
231  //! Sets length, height and broad parameters
232  /*!
233  \param l1: How long is the arrow.
234  \param l2: Distance from top to the inside of the arrow.
235  \param b: How broad is the basis of the arrow.
236  */
237  void Set( double l1, double l2, double b, bool spline = false );
238 
239  //! Returns the arrow length.
240  double GetL1() { return m_l1; }
241 
242  //! return Distance from top to the inside of the arrow.
243  double GetL2() { return m_l2; }
244 
245  //! return how broad the basis of the arrow is.
246  double GetBase() { return m_b; }
247 
248  //! is the arrwo drawn as a splined polygon?
249  bool GetSpline() { return m_spline; }
250 
251  //! return the arrow converted to a polygon.
252  virtual a2dVertexList* GetAsVertexList( bool& returnIsPolygon ) const;
253 
254 
255  //! return the arrow converted to a vector path.
256  a2dCanvasObjectList* GetAsCanvasVpaths( bool transform = true ) const;
257 
258  DECLARE_DYNAMIC_CLASS( a2dArrow )
259 
260 protected:
261 
262  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
263 
264 #if wxART2D_USE_CVGIO
265  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
266 
267  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
268 #endif //wxART2D_USE_CVGIO
269 
270  void DoRender( a2dIterC& ic, OVERLAP clipparent );
271 
272  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
273 
274  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
275 
276  //! length from top of arrow to outside points in X
277  double m_l1;
278 
279  //! length from top of arrow to inside point in X
280  double m_l2;
281 
282  //! base of arrow
283  double m_b;
284 
285  //! draw splined?
286  bool m_spline;
287 
288 
289 private:
290  //!this is a not implemented copy constructor that avoids automatic creation of one
291  a2dArrow( const a2dArrow& ori );
292 };
293 
294 //! a2dWH
295 /*!
296  Virtual base class for canvas objects with width and height parameters.
297  The object has an extension from (x,y) to (x+w,y+h).
298 
299  \ingroup canvasobject
300 */
301 class A2DCANVASDLLEXP a2dWH: public a2dCanvasObject
302 {
303  DECLARE_EVENT_TABLE()
304 
305 public:
306  //!default constructor
307  a2dWH();
308 
309  //!standard constructor
310  /*!
311  \param x: x minimum
312  \param y: y minimum
313  \param w: Width of object
314  \param h: Heigth of object
315  */
316  a2dWH( double x, double y, double w, double h );
317 
318  //!destructor
319  ~a2dWH();
320 
321  //!copy constructor
322  a2dWH( const a2dWH& other, CloneOptions options, a2dRefMap* refs );
323 
324  //!set width of rectangle
325  /*!
326  \param w width of rectangle
327  */
328  void SetWidth( double w ) { m_width = w; SetPending( true ); }
329 
330  //!set height of rectangle
331  /*!
332  \param h height of rectangle
333  */
334  void SetHeight( double h ) { m_height = h; SetPending( true ); }
335 
336  //!return width
337  double GetWidth() const { return m_width; }
338  //!return height
339  double GetHeight() const { return m_height; }
340 
341 #if wxART2D_USE_CVGIO
342  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
343 
344  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
345 #endif //wxART2D_USE_CVGIO
346 
347  a2dCanvasObjectList* GetAsCanvasVpaths( bool transform = true ) const;
348 
349  virtual bool RestrictToObject( a2dIterC& ic, const a2dPoint2D& pointToSnapTo, a2dPoint2D& bestPointSofar, a2dSnapToWhatMask snapToWhat, double thresHoldWorld );
350 
351  DECLARE_CLASS( a2dWH )
352 
353 protected:
354 
355  //! This is here so that this class cannot be used directly
356  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const = 0;
357 
358  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
359  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
360  bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
361  void OnHandleEvent( a2dHandleMouseEvent& event );
362 
363  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
364  void OnResizeObjectToChildBox( a2dCanvasObjectEvent& event );
365 
366  //! width of rectangle
367  double m_width;
368  //! height of rectangle
369  double m_height;
370 
371 public:
372 
373  //! property to get m_width
374  static a2dPropertyIdDouble* PROPID_Width;
375  //! property to get m_height
376  static a2dPropertyIdDouble* PROPID_Height;
377 
379 
380 private:
381  //!this is a not implemented copy constructor that avoids automatic creation of one
382  a2dWH( const a2dWH& other );
383 };
384 
385 //! a2dWHCenter
386 /*!
387  Virtual base class for canvas objects with width and height parameters.
388  The object has an extension from (x-w/2,y-h/2) to (x+w/2,y+h/2).
389 
390  \ingroup canvasobject
391 */
392 class A2DCANVASDLLEXP a2dWHCenter: public a2dWH
393 {
394  DECLARE_EVENT_TABLE()
395 
396 public:
397  //!default constructor
398  a2dWHCenter();
399 
400  //!standard constructor
401  /*!
402  \param xc: x center
403  \param yc: y center
404  \param w: Width (double radius) of object.
405  \param h: Heigth (double radius) of object
406  */
407  a2dWHCenter( double xc, double yc, double w, double h );
408 
409  //!destructor
410  ~a2dWHCenter();
411 
412  //!copy constructor
413  a2dWHCenter( const a2dWHCenter& other, CloneOptions options, a2dRefMap* refs );
414 
415  DECLARE_CLASS( a2dWHCenter )
416 
417 public:
418 
419  static a2dPropertyIdDouble* PROPID_Width;
420  static a2dPropertyIdDouble* PROPID_Height;
421 
423 
424 protected:
425 
426  //! This is here so that this class cannot be used directly
427  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const = 0;
428 
429 private:
430  //!this is a not implemented copy constructor that avoids automatic creation of one
431  a2dWHCenter( const a2dWHCenter& other );
432 };
433 
434 //! a2dRect
435 /*!
436  Rectangle with radius
437 
438  \ingroup canvasobject
439 */
440 class A2DCANVASDLLEXP a2dRect: public a2dWH
441 {
442 
443  DECLARE_EVENT_TABLE()
444 
445 public:
446 
447  a2dRect();
448 
449  //!constructor
450  /*!
451  \param x: x minimum
452  \param y: y minimum
453  \param w: Width of rectangle.
454  \param h: Heigth of rectangle
455  \param radius Radius at corners (negatif inwards positif outwards).
456  \param contourwidth contour around rectangle.
457  */
458  a2dRect( double x, double y, double w, double h , double radius = 0, double contourwidth = 0 );
459 
460  //!constructor
461  /*!
462  \param p1 one point of rectangle
463  \param p2 second point on diagonal
464  \param radius Radius at corners (negatif inwards positif outwards).
465  \param contourwidth contour around rectangle.
466  */
467  a2dRect( const a2dPoint2D& p1, const a2dPoint2D& p2, double radius = 0, double contourwidth = 0 );
468 
469  //!constructor
470  /*!
471  \param bbox used for size of rectangle
472  \param radius Radius at corners (negatif inwards positif outwards).
473  \param contourwidth contour around rectangle.
474  */
475  a2dRect( const a2dBoundingBox& bbox, double radius = 0, double contourwidth = 0 );
476 
477  a2dRect( const a2dRect& rec, CloneOptions options, a2dRefMap* refs );
478 
479  ~a2dRect();
480 
481  //!set the Contour width of the shape
482  void SetContourWidth( double width ) { m_contourwidth = width; SetPending( true ); }
483 
484  //!get the Contour width of the shape
485  double GetContourWidth() const { return m_contourwidth; }
486 
487  //!set corner radius of rectangle
488  /*!
489  \param radius rounded corner radius of rectangle
490  */
491  void SetRadius( double radius ) { m_radius = radius; SetPending( true ); }
492 
493  //!return radius
494  double GetRadius() const { return m_radius; }
495 
496  //! GDSII compatible to sub identify types of rectangles.
497  /*! you can use it as a special tagged rectangle */
498  void SetBoxType( int type ) { m_boxtype = type; }
499 
500  //! GDSII compatible to sub identify types of rectangles.
501  /*! you can use it as a special tagged rectangle */
502  int GetBoxType() const { return m_boxtype; }
503 
504 #if wxART2D_USE_CVGIO
505  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
506 
507  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
508 #endif //wxART2D_USE_CVGIO
509 
510  virtual a2dVertexList* GetAsVertexList( bool& returnIsPolygon ) const;
511 
512 
513  a2dCanvasObjectList* GetAsCanvasVpaths( bool transform = true ) const;
514 
515  bool GeneratePins( a2dPinClass* toConnectTo, a2dConnectTask task, double x, double y, double margin = 0 );
516 
517  void OnHandleEvent( a2dHandleMouseEvent& event );
518 
519  DECLARE_DYNAMIC_CLASS( a2dRect )
520 
521 protected:
522 
523  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
524  virtual bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
525 
526  void DoRender( a2dIterC& ic, OVERLAP clipparent );
527  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
528  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
529 
530  //! GDSII compatible to sub identify types of rectangles.
531  int m_boxtype;
532 
533  //!radius in case of rounded rectangle (negatif inwards positif outwards)
534  double m_radius;
535 
536  //! if != 0 you get a contour around the rectangle ( donut like ).
537  double m_contourwidth;
538 
539 public:
540 
541  static a2dPropertyIdDouble* PROPID_Radius;
542 
544 
545 private:
546  //!this is a not implemented copy constructor that avoids automatic creation of one
547  a2dRect( const a2dRect& other );
548 };
549 
550 //! a2dCircle at x,y, and with radius
551 /*!
552  \ingroup canvasobject
553 */
554 class A2DCANVASDLLEXP a2dCircle: public a2dCanvasObject
555 {
556 public:
557  a2dCircle( const a2dCircle& ori, CloneOptions options, a2dRefMap* refs );
558 
559  a2dCircle();
560 
561  //! constructor
562  /*!
563  \param x center X
564  \param y center Y
565  \param radius radius of circle
566  \param width contour width
567  */
568  a2dCircle( double x, double y, double radius, double width = 0 );
569 
570  //! destructor
571  ~a2dCircle();
572 
573  //!set radius
574  /*!
575  \remark As side-effect this circle is set pending for redraw
576  \param radius radius of circle
577  */
578  void SetRadius( double radius ) { m_radius = radius; SetPending( true ); }
579 
580  //! return radius
581  double GetRadius() const { return m_radius; }
582 
583  //!set the Contour width of the shape
584  void SetContourWidth( double width ) { m_contourwidth = width; SetPending( true ); }
585 
586  //!get the Contour width of the shape
587  double GetContourWidth() const { return m_contourwidth; }
588 
589 #if wxART2D_USE_CVGIO
590  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
591 
592  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
593 #endif //wxART2D_USE_CVGIO
594 
595  virtual a2dVertexList* GetAsVertexList( bool& returnIsPolygon ) const;
596 
597 
598  a2dCanvasObjectList* GetAsCanvasVpaths( bool transform = true ) const;
599 
600  bool GeneratePins( a2dPinClass* toConnectTo, a2dConnectTask task, double x, double y, double margin = 0 );
601 
602  DECLARE_DYNAMIC_CLASS( a2dCircle )
603 
604 protected:
605 
606  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
607  virtual bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
608 
609  void DoRender( a2dIterC& ic, OVERLAP clipparent );
610  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
611  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
612  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
613 
614  //!radius of circle
615  double m_radius;
616 
617  //! if != 0 you get a donut
618  double m_contourwidth;
619 
620 public:
621 
622  static a2dPropertyIdDouble* PROPID_Radius;
623 
625 
626 private:
627  //!this is a not implemented copy constructor that avoids automatic creation of one
628  a2dCircle( const a2dCircle& other );
629 };
630 
631 //! a2dEllipse centered at x,y.
632 /*!
633  \ingroup canvasobject
634 */
635 class A2DCANVASDLLEXP a2dEllipse: public a2dWHCenter
636 {
637 public:
638 
639  a2dEllipse();
640 
641  //! constructor for ellipse
642  /*!
643  \param xc x center
644  \param yc y center
645  \param width Width of ellipse.
646  \param height Heigth of ellipse.
647  \param contourwidth contour around rectangle.
648  */
649  a2dEllipse( double xc, double yc, double width, double height, double contourwidth = 0 );
650  a2dEllipse( const a2dEllipse& ori, CloneOptions options, a2dRefMap* refs );
651  ~a2dEllipse();
652 
653 #if wxART2D_USE_CVGIO
654  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
655 
656  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
657 #endif //wxART2D_USE_CVGIO
658 
659  virtual a2dVertexList* GetAsVertexList( bool& returnIsPolygon ) const;
660 
661 
662  a2dCanvasObjectList* GetAsCanvasVpaths( bool transform = true ) const;
663 
664  //!set the Contour width of the shape
665  void SetContourWidth( double width ) { m_contourwidth = width; SetPending( true ); }
666 
667  //!get the Contour width of the shape
668  double GetContourWidth() const { return m_contourwidth; }
669 
670  bool GeneratePins( a2dPinClass* toConnectTo, a2dConnectTask task, double x, double y, double margin = 0 );
671 
672  DECLARE_DYNAMIC_CLASS( a2dEllipse )
673 
674 protected:
675 
676  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
677  virtual bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
678 
679  void DoRender( a2dIterC& ic, OVERLAP clipparent );
680  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
681  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
682  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
683 
684 private:
685  //!this is a not implemented copy constructor that avoids automatic creation of one
686  a2dEllipse( const a2dEllipse& other );
687 
688  //! if != 0 you get a contour around the rectangle ( donut like ).
689  double m_contourwidth;
690 
691 };
692 
693 //! a2dEllipticArc centered at x,y
694 /*!
695  \ingroup canvasobject
696 */
697 class A2DCANVASDLLEXP a2dEllipticArc: public a2dWHCenter
698 {
699  DECLARE_EVENT_TABLE()
700 
701 public:
702 
703  //! constructor
704  a2dEllipticArc();
705 
706  //! Constructor.
707  /*!
708  \param xc: x center
709  \param yc: y center
710  \param width: Width of Arc
711  \param height: Heigth of Arc
712  \param start: Start Angle degrees
713  \param end: End Angle in degrees
714  \param chord if true only show outline.
715  \param contourwidth to give a width to the cord
716  */
717  a2dEllipticArc( double xc, double yc, double width, double height, double start, double end, bool chord = false, double contourwidth = 0 );
718 
719  //! constructor for cloning
720  a2dEllipticArc( const a2dEllipticArc& ori, CloneOptions options, a2dRefMap* refs );
721 
722  //! destructor
723  ~a2dEllipticArc();
724 
725  //!set start angle
726  /*!
727  \remark As side-effect the ellipse is set pending for redraw
728  \param start start angle in degrees
729  */
730  void SetStart( double start ) { m_start = start; SetPending( true ); }
731 
732  //!return start angle
733  double GetStart() { return m_start; }
734 
735  //!set end angle
736  /*!
737  \remark As side-effect the ellipse is set pending for redraw
738  \param end end angle in degrees
739  */
740  void SetEnd( double end ) { m_end = end; SetPending( true ); }
741 
742  //!return end angle
743  double GetEnd() { return m_end; }
744 
745  //! if true draw as a chord ( no fill end no lines to center )
746  void SetChord( bool chord );
747 
748  //! get chord setting
749  bool GetChord() { return m_chord; }
750 
751 #if wxART2D_USE_CVGIO
752  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
753 
754  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
755 #endif //wxART2D_USE_CVGIO
756 
757  virtual a2dVertexList* GetAsVertexList( bool& returnIsPolygon ) const;
758 
759 
760  a2dCanvasObjectList* GetAsCanvasVpaths( bool transform = true ) const;
761 
762  //!set the Contour width of the shape
763  void SetContourWidth( double width ) { m_contourwidth = width; SetPending( true ); }
764 
765  //!get the Contour width of the shape
766  double GetContourWidth() const { return m_contourwidth; }
767 
768  DECLARE_DYNAMIC_CLASS( a2dEllipticArc )
769 
770 protected:
771 
772  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
773  virtual bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
774 
775  void OnChar( wxKeyEvent& event );
776 
777  void OnHandleEvent( a2dHandleMouseEvent& event );
778 
779  void DoRender( a2dIterC& ic, OVERLAP clipparent );
780  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
781  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
782  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
783 
784  //! drawn as a chord ( no fill end no lines to center )
785  bool m_chord;
786 
787  //! start angle
788  double m_start;
789 
790  //! end angle
791  double m_end;
792 
793  //! if != 0 you get a contour around the rectangle ( donut like ).
794  double m_contourwidth;
795 
796 public:
797 
798  static a2dPropertyIdDouble* PROPID_StartAngle;
799  static a2dPropertyIdDouble* PROPID_EndAngle;
800  static a2dPropertyIdBool* PROPID_Chord;
801 
803 
804 private:
805  //!this is a not implemented copy constructor that avoids automatic creation of one
806  a2dEllipticArc( const a2dEllipticArc& other );
807 };
808 
809 #if (defined(__WXMSW__) && defined(WXUSINGDLL) )
810 template class A2DCANVASDLLEXP a2dSmrtPtr<a2dEllipticArc>;
811 #endif
812 
813 //! a2dArc centered at x,y
814 /*!
815  The Arc is defined by three vertexes, one for the center and two for the start and end point of
816  the arc.
817  The arc is drawn in an anticlockwise direction from the start point to the end point when Y axis is down
818  else clockwise direction.
819 
820 
821  \ingroup canvasobject
822 */
823 class A2DCANVASDLLEXP a2dArc: public a2dCanvasObject
824 {
825  DECLARE_EVENT_TABLE()
826 
827 public:
828 
829  //! constructor
830  a2dArc();
831 
832  //!constructor
833  /*!
834  \param xc x center
835  \param yc y center
836  \param radius radius of the Arc.
837  \param start Start Angle .
838  \param end End Angle .
839  \param chord When only the arc contour is shown, not the lines to the center and no fill.
840  \param contourwidth to give a width to the cord
841 
842  \remark The angles are transfered to x,y positions only once.
843  */
844  a2dArc( double xc, double yc, double radius, double start, double end, bool chord = false, double contourwidth = 0 );
845 
846  //!constructor
847  /*!
848  \param x1 x1 used for starting angle and radius
849  \param y1 y1 used for starting angle and radius
850  \param x2 x2 used for end angle
851  \param y2 y2 used for end angle
852  \param xc x center
853  \param yc y center
854  \param chord When only the arc contour is shown, not the lines to the center and no fill.
855  \param contourwidth to give a width to the cord
856  */
857  a2dArc( double x1, double y1, double x2, double y2, double xc, double yc, bool chord = false, double contourwidth = 0 );
858 
859  //! copy constructor
860  a2dArc( const a2dArc& ori, CloneOptions options, a2dRefMap* refs );
861 
862  //! destructor
863  ~a2dArc();
864 
865  //! Get X1 of arc being begin point of arc
866  double GetX1() const { return m_x1; }
867  //! Get Y1 of arc being begin point of arc
868  double GetY1() const { return m_y1; }
869  //! Get X2 of arc being end point of arc
870  double GetX2() const { return m_x2; }
871  //! Get Y2 of arc being end point of arc
872  double GetY2() const { return m_y2; }
873  //! Get the start angle (calculated form x1/y1)
874  double GetStartAngle() const;
875  //! Get the end angle (calculated form x2/y2)
876  double GetEndAngle() const;
877 
878  //! get point in between begin and end
879  a2dPoint2D GetMidPoint() const;
880 
881  //! Set X1 of arc being begin point of arc
882  void SetX1( double x1 ) { m_x1 = x1; SetPending( true ); }
883  //! Set Y1 of arc being begin point of arc
884  void SetY1( double y1 ) { m_y1 = y1; SetPending( true ); }
885  //! Set X2 of arc being end point of arc
886  void SetX2( double x2 ) { m_x2 = x2; SetPending( true ); }
887  //! Set Y2 of arc being end point of arc
888  void SetY2( double y2 ) { m_y2 = y2; SetPending( true ); }
889  //! Set the start angle (actually sets x1/y1)
890  void SetStartAngle( double a );
891  //! Set the end angle (actually sets x2/y2)
892  void SetEndAngle( double a );
893 
894  //! set arc using begin, end and middle point.
895  void Set( double xs, double ys, double xm, double ym, double xe, double ye );
896 
897  //! set radius of the Arc
898  void SetRadius( double radius );
899 
900  //! get radius of the Arc
901  double GetRadius() const;
902 
903  //! if true draw as a chord ( no fill end no lines to center )
904  void SetChord( bool chord );
905 
906  //! get chord setting
907  bool GetChord() const { return m_chord; }
908 
909 #if wxART2D_USE_CVGIO
910  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
911 
912  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
913 #endif //wxART2D_USE_CVGIO
914 
915  //! convert to a polygon and return the vertexlist.
916  virtual a2dVertexList* GetAsVertexList( bool& returnIsPolygon ) const;
917 
918 
919  a2dCanvasObjectList* GetAsCanvasVpaths( bool transform = true ) const;
920 
921  void SetContourWidth( double width ) { m_contourwidth = width; SetPending( true ); }
922 
923  //!get the Contour width of the shape
924  double GetContourWidth() const { return m_contourwidth; }
925 
926  DECLARE_DYNAMIC_CLASS( a2dArc )
927 
928 protected:
929 
930  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
931  virtual bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
932 
933  void OnChar( wxKeyEvent& event );
934 
935  void OnHandleEvent( a2dHandleMouseEvent& event );
936 
937  void DoRender( a2dIterC& ic, OVERLAP clipparent );
938  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
939  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
940  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
941 
942  //! drawn as a chord ( no fill end no lines to center )
943  bool m_chord;
944 
945  //! x of begin point
946  double m_x1;
947  //! y of begin point
948  double m_y1;
949 
950  //! x of end point
951  double m_x2;
952 
953  //! y of end point
954  double m_y2;
955 
956  //! if != 0 the line is contoured at distance m_contourwidth/2
957  double m_contourwidth;
958 
959 public:
960 
961  //! property for class member
962  static a2dPropertyIdDouble* PROPID_X1;
963  //! property for class member
964  static a2dPropertyIdDouble* PROPID_X2;
965  //! property for class member
966  static a2dPropertyIdDouble* PROPID_Y1;
967  //! property for class member
968  static a2dPropertyIdDouble* PROPID_Y2;
969  //! property for class member
970  static a2dPropertyIdBool* PROPID_Chord;
971  //! property for class member
972  static a2dPropertyIdDouble* PROPID_StartAngle;
973  //! property for class member
974  static a2dPropertyIdDouble* PROPID_EndAngle;
975 
977 
978 private:
979  //!this is a not implemented copy constructor that avoids automatic creation of one
980  a2dArc( const a2dArc& other );
981 };
982 
983 //! a2dSLine
984 /*!
985  \ingroup canvasobject
986 */
987 class A2DCANVASDLLEXP a2dSLine: public a2dCanvasObject
988 {
989  DECLARE_EVENT_TABLE()
990 
991 public:
992 
993  a2dSLine();
994 
995  //!constructor
996  /*!
997  \param x1 x line start
998  \param y1 y line start
999  \param x2 x line end
1000  \param y2 y line end
1001  \param contourwidth to give the line a width
1002  */
1003  a2dSLine( double x1, double y1, double x2, double y2, double contourwidth = 0 );
1004 
1005  //! constructor
1006  a2dSLine( const a2dSLine& ori, CloneOptions options, a2dRefMap* refs );
1007 
1008 
1009  //! destructor
1010  ~a2dSLine();
1011 
1012  //! Get (transformed) position of X1
1013  /*!
1014  \param transform if true return x transformed with local matrix
1015  */
1016  double GetPosX1( bool transform = true ) const;
1017 
1018  //! Get (transformed) position of Y1
1019  /*!
1020  \param transform if true return y transformed with local matrix
1021  */
1022  double GetPosY1( bool transform = true ) const;
1023 
1024  //! Get (transformed) position of X2
1025  /*!
1026  \param transform if true return x transformed with local matrix
1027  */
1028  double GetPosX2( bool transform = true ) const;
1029 
1030  //! Get (transformed) position of Y2
1031  /*!
1032  \param transform if true return y transformed with local matrix
1033  */
1034  double GetPosY2( bool transform = true ) const;
1035 
1036  //! Returns length of line
1037  /*!
1038  \return line length
1039  */
1040  double GetLength() const;
1041 
1042  //! reduce matrix to identity without replacing object
1043  bool EliminateMatrix();
1044 
1045  //! sets position of first point
1046  /*!
1047  \param x new x for the first point
1048  \param y new y for the first point
1049  \param afterinversion if true the input x,y or first inverted with the local matrix of the object.
1050  The inverted values are used to set the point.
1051 
1052  \remark afterinversion = true should be used if you have x,y relative to the line object,
1053  while afterinversion = false should be used when x,y are relative to the point in the line
1054  */
1055  void SetPosXY1( double x, double y, bool afterinversion = true );
1056 
1057  //! sets position of second point
1058  /*!
1059  \param x new x for the second point
1060  \param y new y for the second point
1061  \param afterinversion if true the input x,y or first inverted with the local matrix of the object.
1062  The inverted values are used to set the point.
1063 
1064  \remark afterinversion = true should be used if you have x,y relative to the line object,
1065  while afterinversion = false should be used when x,y are relative to the point in the line
1066  */
1067  void SetPosXY2( double x, double y, bool afterinversion = true );
1068 
1069  //! sets both positions of line
1070  /*!
1071  \param x1 new x for the first point
1072  \param y1 new y for the first point
1073  \param x2 new x for the second point
1074  \param y2 new y for the second point
1075  \param afterinversion if true the input x,y or first inverted with the local matrix of the object.
1076  The inverted values are used to set the point.
1077 
1078  \remark afterinversion = true should be used if you have x,y relative to the line object,
1079  while afterinversion = false should be used when x,y are relative to the point in the line
1080  */
1081  void SetPosXY12( double x1, double y1, double x2, double y2, bool afterinversion = true );
1082 
1083  //! dummies to be compatible with a2dEndsLine
1084  virtual void SetBegin( a2dCanvasObject* WXUNUSED( begin ) ) {}
1085  //! dummies to be compatible with a2dEndsLine
1086  virtual void SetEnd( a2dCanvasObject* WXUNUSED( end ) ) {}
1087 
1088  //! dummies to be compatible with a2dEndsLine
1089  virtual a2dCanvasObject* GetBegin() { return NULL; }
1090 
1091  //! dummies to be compatible with a2dEndsLine
1092  virtual a2dCanvasObject* GetEnd() { return NULL; }
1093 
1094  //! dummies to be compatible with a2dEndsLine
1095  virtual void SetEndScaleX( double WXUNUSED( xs ) ) {}
1096  //! dummies to be compatible with a2dEndsLine
1097  virtual void SetEndScaleY( double WXUNUSED( ys ) ) {}
1098 
1099  //! dummies to be compatible with a2dEndsLine
1100  double GetEndScaleX() { return 1; }
1101  //! dummies to be compatible with a2dEndsLine
1102  double GetEndScaleY() { return 1; }
1103 
1104  //! set a contour width
1105  void SetContourWidth( double width ) { m_contourwidth = width; SetPending( true ); }
1106 
1107  //!get the Contour width of the shape
1108  double GetContourWidth() const { return m_contourwidth; }
1109 
1110  //! Set when m_contourwidth != 0 what is the end of the line should be.
1111  void SetPathType( a2dPATH_END_TYPE pathtype ) { m_pathtype = pathtype; }
1112 
1113  //! get when m_contourwidth != 0 what is the end of the line looks like.
1114  a2dPATH_END_TYPE GetPathType() { return m_pathtype; }
1115 
1116  a2dCanvasObjectList* GetAsCanvasVpaths( bool transform = true ) const;
1117 
1118  virtual bool RestrictToObject( a2dIterC& ic, const a2dPoint2D& pointToSnapTo, a2dPoint2D& bestPointSofar, a2dSnapToWhatMask snapToWhat, double thresHoldWorld );
1119 
1120 #if wxART2D_USE_CVGIO
1121  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
1122 
1123  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
1124 #endif //wxART2D_USE_CVGIO
1125 
1126  DECLARE_DYNAMIC_CLASS( a2dSLine )
1127 
1128 protected:
1129 
1130 
1131  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
1132  virtual bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
1133 
1134  void OnChar( wxKeyEvent& event );
1135 
1136  void OnHandleEvent( a2dHandleMouseEvent& event );
1137 
1138  void DoRender( a2dIterC& ic, OVERLAP clipparent );
1139  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
1140  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
1141 
1142  //! start x
1143  double m_x1;
1144  //! start y
1145  double m_y1;
1146  //! end x
1147  double m_x2;
1148  //! end y
1149  double m_y2;
1150 
1151  //! if != 0 the line is contoured at distance m_contourwidth/2
1152  double m_contourwidth;
1153 
1154  //! when m_contourwidth != 0 what is the end of the line looking like.
1155  a2dPATH_END_TYPE m_pathtype;
1156 
1157 public:
1158  static a2dPropertyIdDouble* PROPID_X1;
1159  static a2dPropertyIdDouble* PROPID_X2;
1160  static a2dPropertyIdDouble* PROPID_Y1;
1161  static a2dPropertyIdDouble* PROPID_Y2;
1162 
1164 
1165 private:
1166  //!this is a not implemented copy constructor that avoids automatic creation of one
1167  a2dSLine( const a2dSLine& other );
1168 };
1169 
1170 //! a2dEndsLine with begin and/or end object.
1171 /*!
1172  \ingroup canvasobject
1173 */
1174 class A2DCANVASDLLEXP a2dEndsLine: public a2dSLine
1175 {
1176 public:
1177 
1178  a2dEndsLine();
1179 
1180  //!constructor
1181  /*!
1182  \param x1: x line start
1183  \param y1: y line start
1184  \param x2: x line end
1185  \param y2: y line end
1186  */
1187  a2dEndsLine( double x1, double y1, double x2, double y2, double contourwidth = 0 );
1188 
1189 
1190  //! constructor using a a2dEndsLine as input
1191  a2dEndsLine( const a2dEndsLine& ori, CloneOptions options, a2dRefMap* refs );
1192 
1193  //! constructor using a a2dSLine as input (end and begin are set to NULL )
1194  a2dEndsLine( const a2dSLine& ori, CloneOptions options, a2dRefMap* refs );
1195 
1196  ~a2dEndsLine();
1197 
1198  //! set object to draw as begin point
1199  void SetBegin( a2dCanvasObject* begin );
1200 
1201  a2dCanvasObject* GetBegin() { return m_begin; }
1202 
1203  //! set object to draw as end point
1204  void SetEnd( a2dCanvasObject* end );
1205 
1206  a2dCanvasObject* GetEnd() { return m_end; }
1207 
1208  //! Scale begin and end object with this factor in X
1209  /*!
1210  \remark As side-effect this object is set pending for redraw
1211  */
1212  void SetEndScaleX( double xs ) { m_xscale = xs; SetPending( true ); }
1213 
1214  double GetEndScaleX() { return m_xscale; }
1215 
1216  //! Scale begin and end object with this factor in Y
1217  /*!
1218  \remark As side-effect this object is set pending for redraw
1219  */
1220  void SetEndScaleY( double ys ) { m_yscale = ys; SetPending( true ); }
1221 
1222  double GetEndScaleY() { return m_yscale; }
1223 
1224  //! if set take style changes on line to the arrow objects
1225  void SetStyleToArrow( bool takeStyleToArrow ) { m_takeStyleToArrow = takeStyleToArrow; }
1226  //! if true take style changes on line to the arrow objects
1227  bool GetStyleToArrow() { return m_takeStyleToArrow; }
1228 
1229 #if wxART2D_USE_CVGIO
1230  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
1231 
1232  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
1233 #endif //wxART2D_USE_CVGIO
1234 
1235  virtual void DoWalker( wxObject* parent, a2dWalkerIOHandler& handler );
1236 
1237  DECLARE_DYNAMIC_CLASS( a2dEndsLine )
1238 
1239 protected:
1240 
1241  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
1242  void DoRender( a2dIterC& ic, OVERLAP clipparent );
1243  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
1244  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
1245  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
1246 
1247  //! object drawn at begin point
1249 
1250  //! object drawn at end point
1252 
1253  //!scale begin and end object with this factor in X
1254  double m_xscale;
1255 
1256  //!scale begin and end object with this factor in Y
1257  double m_yscale;
1258 
1259  //! if set take style changes on line to the arrow objects
1260  bool m_takeStyleToArrow;
1261 
1262 private:
1263  //!this is a not implemented copy constructor that avoids automatic creation of one
1264  a2dEndsLine( const a2dEndsLine& other );
1265 };
1266 
1267 
1268 //! a2dScaledEndLine
1269 /*!
1270  The begin and end object on the line are scaled to the contour width.
1271  In case of a a2dArrow derived object, rendering is optimized to look good.
1272  All types of end objects are scalled up m_contourwidth.
1273  If m_contourwidth is zero, there will be no endpoints drawn.
1274 
1275  \ingroup canvasobject
1276 */
1277 class A2DCANVASDLLEXP a2dScaledEndLine: public a2dEndsLine
1278 {
1279  DECLARE_EVENT_TABLE()
1280 
1281 public:
1282 
1283  a2dScaledEndLine();
1284 
1285  //!constructor
1286  /*!
1287  \param x1 x line start
1288  \param y1 y line start
1289  \param x2 x line end
1290  \param y2 y line end
1291  \param contourwidth to give the line a width
1292  */
1293  a2dScaledEndLine( double x1, double y1, double x2, double y2, double contourwidth = 0 );
1294 
1295  //! constructor using a a2dEndsLine as input
1296  a2dScaledEndLine( const a2dScaledEndLine& ori, CloneOptions options, a2dRefMap* refs );
1297 
1298  //! constructor
1299  a2dScaledEndLine( const a2dSLine& ori, CloneOptions options, a2dRefMap* refs );
1300 
1301  //! destructor
1302  ~a2dScaledEndLine();
1303 
1304  //! set begin shape factors if it is a2dArrow derived
1305  void SetBegin( double l1, double l2, double b, bool spline = false );
1306  //! set end shape factors if it is a2dArrow derived
1307  void SetEnd( double l1, double l2, double b, bool spline = false );
1308 
1309  DECLARE_DYNAMIC_CLASS( a2dScaledEndLine )
1310 
1311 protected:
1312 
1313  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
1314  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
1315 
1316  void DoRender( a2dIterC& ic, OVERLAP clipparent );
1317 
1318 private:
1319  //!this is a not implemented copy constructor that avoids automatic creation of one
1320  a2dScaledEndLine( const a2dScaledEndLine& other );
1321 };
1322 
1323 //! a2dEndsEllipticChord with begin and/or end object.
1324 /*!
1325  \ingroup canvasobject
1326 */
1327 class A2DCANVASDLLEXP a2dEndsEllipticChord: public a2dEllipticArc
1328 {
1329 public:
1330 
1331  //! constructor
1333 
1334  //!constructor
1335  /*!
1336  \param xc x cord start
1337  \param yc y cord start
1338  \param width width of cord
1339  \param height height of cord
1340  \param start start angle
1341  \param end end angle
1342  */
1343  a2dEndsEllipticChord( double xc, double yc, double width, double height, double start, double end );
1344 
1345 
1346  //! constructor using a a2dEndsEllipticChord as input
1347  a2dEndsEllipticChord( const a2dEndsEllipticChord& ori, CloneOptions options, a2dRefMap* refs );
1348 
1349  //! destructor
1351 
1352  //! set object to draw as begin point
1353  void SetBeginObj( a2dCanvasObject* begin );
1354 
1355  //! return begin object
1356  a2dCanvasObject* GetBeginObj() { return m_beginobj; }
1357 
1358  //! set object to draw as end point
1359  void SetEndObj( a2dCanvasObject* endob );
1360 
1361  //! return end object
1362  a2dCanvasObject* GetEndObj() { return m_endobj; }
1363 
1364  //! Scale begin and end object with this factor in X
1365  /*!
1366  \remark As side-effect this object is set pending for redraw
1367  */
1368  void SetEndScaleX( double xs ) { m_xscale = xs; SetPending( true ); }
1369 
1370  //! see SetEndScaleX()
1371  double GetEndScaleX() { return m_xscale; }
1372 
1373  //! Scale begin and end object with this factor in Y
1374  /*!
1375  \remark As side-effect this object is set pending for redraw
1376  */
1377  void SetEndScaleY( double ys ) { m_yscale = ys; SetPending( true ); }
1378 
1379  //! see SetEndScaleY()
1380  double GetEndScaleY() { return m_yscale; }
1381 
1382  void DoWalker( wxObject* parent, a2dWalkerIOHandler& handler );
1383 
1384 #if wxART2D_USE_CVGIO
1385  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
1386 
1387  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
1388 #endif //wxART2D_USE_CVGIO
1389 
1390  DECLARE_DYNAMIC_CLASS( a2dEndsEllipticChord )
1391 
1392 protected:
1393 
1394  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
1395  void DoRender( a2dIterC& ic, OVERLAP clipparent );
1396  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
1397  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
1398  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
1399 
1400  //! Get the coordinate transform for the begin object
1401  a2dAffineMatrix GetBeginTransform() const;
1402  //! Get the coordinate transform for the end object
1403  a2dAffineMatrix GetEndTransform() const;
1404 
1405  //! object drawn at begin point
1407 
1408  //! object drawn at end point
1410 
1411  //!scale begin and end object with this factor in X
1412  double m_xscale;
1413 
1414  //!scale begin and end object with this factor in Y
1415  double m_yscale;
1416 public:
1417 
1418 private:
1419  //!this is a not implemented copy constructor that avoids automatic creation of one
1421 };
1422 
1423 //! a2dControl captures a wxWindow inside
1424 /*!
1425  \ingroup canvasobject
1426 */
1427 class A2DCANVASDLLEXP a2dControl: public a2dRect
1428 {
1429 public:
1430 
1431  //! constructor
1432  /*!
1433  \param x: x left top
1434  \param y: y left top
1435  \param width: width of the control drawing
1436  \param height: height of the control drawing
1437  \param control pointer to wxWindow derived control
1438  */
1439  a2dControl( double x, double y, double width, double height, wxWindow* control );
1440  //! constructor
1441  a2dControl( const a2dControl& ori, CloneOptions options, a2dRefMap* refs );
1442  //! destructor
1443  ~a2dControl();
1444 
1445  //! Get control pointer
1446  wxWindow* GetControl() {return m_control;}
1447 
1448  DECLARE_CLASS( a2dControl )
1449 
1450 protected:
1451 
1452  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
1453  virtual bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
1454 
1455  virtual void DoEndEdit();
1456 
1457  void DoRender( a2dIterC& ic, OVERLAP clipparent );
1458  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
1459  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
1460 
1461  //! control with a a2dCanvas as parent.
1462  wxWindow* m_control;
1463 
1464 private:
1465 
1466  //!this is a not implemented copy constructor that avoids automatic creation of one
1467  a2dControl( const a2dControl& other );
1468 };
1469 
1470 
1471 //! a2dWires is used to generate wires to Connect other a2dCanvasObject's
1472 /*!
1473  a2dWires is not just one wire, but a set of wires.
1474  This is done by taking the position of the pins of the conncted a2dCanvasObject's,
1475  and based on that generate the wires.
1476  When Connected Objects are moved and the wire set is not frozen,
1477  The wires will automatically be resized to keep the objects connected via the wire set.
1478 
1479  \ingroup canvasobject
1480  \sa a2dWirePolylineL
1481 */
1482 class A2DCANVASDLLEXP a2dWires: public a2dCanvasObject
1483 {
1484 public:
1485 
1486  //! constructor
1487  a2dWires();
1488 
1489  //! constructor
1490  a2dWires( a2dCanvasObject* toconnect, const wxString& pinname );
1491 
1492  //! constructor
1493  a2dWires( a2dCanvasObject* toconnect, a2dPin* pinc );
1494 
1495  //! destructor
1496  ~a2dWires();
1497 
1498  //! type of wire
1499  virtual bool IsConnect() const;
1500 
1501  bool NeedsUpdateWhenConnected() const { return !m_frozen; }
1502 
1503  bool ConnectWith( a2dCanvasObject* parent, a2dCanvasObject* graph, const wxString& pinname, double margin = 1, bool undo = false );
1504 
1505  bool ConnectWith( a2dCanvasObject* parent, a2dPin* pin, double margin = 1, bool undo = false );
1506 
1507  bool GetFrozen() { return m_frozen; }
1508  void SetFrozen( bool freeze ) { m_frozen = freeze; }
1509 
1510  DECLARE_DYNAMIC_CLASS( a2dWires )
1511 
1512 protected:
1513 
1514  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
1515  virtual void CreateWires();
1516  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
1517  void DoRender( a2dIterC& ic, OVERLAP clipparent );
1518 
1519  //!are the wires frozen (means will not resize)
1520  bool m_frozen;
1521 };
1522 
1523 #endif /* __WXCANPRIM_H__ */
1524 
a2dCircle at x,y, and with radius
Definition: canprim.h:554
void SetContourWidth(double width)
set the Contour width of the shape
Definition: canprim.h:665
wxPoint2DDouble a2dPoint2D
this to define if coordinate numbers are integer or doubles
Definition: artglob.h:47
a2dPATH_END_TYPE
defines the way a polyline with a contour width is ended.
Definition: polyver.h:31
void SetBoxType(int type)
GDSII compatible to sub identify types of rectangles.
Definition: canprim.h:498
virtual bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
Definition: canobj.cpp:3713
double GetContourWidth() const
get the Contour width of the shape
Definition: canprim.h:766
void SetWidth(double width)
set width
Definition: canprim.h:62
void SetEndScaleY(double ys)
Scale begin and end object with this factor in Y.
Definition: canprim.h:1377
a2dWH
Definition: canprim.h:301
a2dConnectTask
flags for searching a connecting a2dpinClass, for the connecting task at hand.
Definition: connectgen.h:40
void SetEndScaleX(double xs)
Scale begin and end object with this factor in X.
Definition: canprim.h:1368
double GetWidth() const
return width
Definition: canprim.h:147
virtual void SetEndScaleY(double ys)
dummies to be compatible with a2dEndsLine
Definition: canprim.h:1097
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: canobj.cpp:1426
void SetRadius(double radius)
set corner radius of rectangle
Definition: canprim.h:491
class to map references to objects stored in XML, in order to make the connection later on...
Definition: gen.h:3462
void SetEndScaleX(double xs)
Scale begin and end object with this factor in X.
Definition: canprim.h:1212
virtual void SetBegin(a2dCanvasObject *begin)
dummies to be compatible with a2dEndsLine
Definition: canprim.h:1084
void SetContourWidth(double width)
set the Contour width of the shape
Definition: canprim.h:921
void SetRadius(double radius)
set radius
Definition: canprim.h:578
double GetRadius() const
return radius
Definition: canprim.h:581
void SetContourWidth(double width)
set a contour width
Definition: canprim.h:1105
void SetWidth(double w)
set width of rectangle
Definition: canprim.h:138
a2dPin is used in a2dCanvasObject to add pins to it.
Definition: canpin.h:233
This is a class/type description for a2dPin&#39;s.
Definition: canpin.h:628
Ref Counted base object.
Definition: gen.h:1045
double GetRadius() const
return radius
Definition: canprim.h:151
double GetContourWidth() const
get the Contour width of the shape
Definition: canprim.h:485
double GetY2() const
Get Y2 of arc being end point of arc.
Definition: canprim.h:872
double GetBase()
return how broad the basis of the arrow is.
Definition: canprim.h:246
Input and output handler for the XmlSer format.
Definition: genxmlpars.h:819
UpdateMode
Various mode flags for Update.
Definition: canobj.h:1091
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
a2dRectC is a centered rectangle
Definition: canprim.h:99
double m_l1
length from top of arrow to outside points in X
Definition: canprim.h:277
The base class for all drawable objects in a a2dCanvasDocument.
double GetEndScaleY()
dummies to be compatible with a2dEndsLine
Definition: canprim.h:1102
#define DECLARE_PROPERTIES()
check if class has the given id as a valid id for this object
Definition: gen.h:835
double GetWidth() const
return width
Definition: canprim.h:337
a2dCanvasObject * GetEnd()
dummies to be compatible with a2dEndsLine
Definition: canprim.h:1206
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
Definition: canobj.cpp:5728
bool m_spline
draw splined?
Definition: canprim.h:286
a2dCanvasObject is the base class for Canvas Objects.
Definition: canobj.h:371
void SetX1(double x1)
Set X1 of arc being begin point of arc.
Definition: canprim.h:882
double GetContourWidth() const
get the Contour width of the shape
Definition: canprim.h:924
void SetWidth(double w)
set width of rectangle
Definition: canprim.h:328
vertex list of line and arc segments.
Definition: polyver.h:600
defenitions an no more
virtual void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
Definition: canobj.cpp:4695
double GetStart()
return start angle
Definition: canprim.h:733
Io handler to iterate through a a2dDocument.
Definition: gen.h:3911
void SetHeight(double h)
set height of rectangle
Definition: canprim.h:334
a2dCanvasObject * GetBeginObj()
return begin object
Definition: canprim.h:1356
double GetWidth()
return width
Definition: canprim.h:53
see a2dCanvasObjectMouseEvent
Definition: canglob.h:161
bool NeedsUpdateWhenConnected() const
used in case of flexible canvas objects (wires).
Definition: canprim.h:1501
a2dOrigin stays at World Coordinate Zero (0,0) not matter what.
Definition: canprim.h:31
a2dCanvasObject * GetEndObj()
return end object
Definition: canprim.h:1362
a2dControl captures a wxWindow inside
Definition: canprim.h:1427
a2dEllipse centered at x,y.
Definition: canprim.h:635
virtual a2dCanvasObjectList * GetAsCanvasVpaths(bool transform=true) const
when implemented the object without its children, is converted to
Definition: canobj.cpp:1505
bool GetChord() const
get chord setting
Definition: canprim.h:907
double GetL2()
return Distance from top to the inside of the arrow.
Definition: canprim.h:243
double GetL1()
Returns the arrow length.
Definition: canprim.h:240
a2dSLine
Definition: canprim.h:987
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
double m_l2
length from top of arrow to inside point in X
Definition: canprim.h:280
Input and output handler for the XmlSer format.
Definition: genxmlpars.h:862
void SetEndScaleY(double ys)
Scale begin and end object with this factor in Y.
Definition: canprim.h:1220
void SetHeight(double height)
set height
Definition: canprim.h:68
a2dArrow is used for having line begin and ends on specific objects.
Definition: canprim.h:198
wxUint32 a2dSnapToWhatMask
mask for a2dSnapToWhat flags
Definition: restrict.h:26
virtual a2dCanvasObject * GetEnd()
dummies to be compatible with a2dEndsLine
Definition: canprim.h:1092
int GetBoxType() const
GDSII compatible to sub identify types of rectangles.
Definition: canprim.h:502
double GetX1() const
Get X1 of arc being begin point of arc.
Definition: canprim.h:866
a2dScaledEndLine
Definition: canprim.h:1277
bool GetSpline()
is the arrwo drawn as a splined polygon?
Definition: canprim.h:249
A 2x3 affine matrix class for 2D transformations.
Definition: afmatrix.h:53
virtual a2dCanvasObject * GetBegin()
dummies to be compatible with a2dEndsLine
Definition: canprim.h:1089
bool GetChord()
get chord setting
Definition: canprim.h:749
virtual void SetEnd(a2dCanvasObject *end)
dummies to be compatible with a2dEndsLine
Definition: canprim.h:1086
while iterating a a2dCanvasDocument, this holds the context.
Definition: canobj.h:3212
double GetContourWidth() const
get the Contour width of the shape
Definition: canprim.h:1108
virtual a2dVertexList * GetAsVertexList(bool &returnIsPolygon) const
convert to a polygon.
Definition: canobj.h:2491
double GetEndScaleX()
see SetEndScaleX()
Definition: canprim.h:1371
a2dWires is used to generate wires to Connect other a2dCanvasObject&#39;s
Definition: canprim.h:1482
a2dEndsLine with begin and/or end object.
Definition: canprim.h:1174
a2dCanvasObject * GetBegin()
dummies to be compatible with a2dEndsLine
Definition: canprim.h:1201
double m_b
base of arrow
Definition: canprim.h:283
void SetY2(double y2)
Set Y2 of arc being end point of arc.
Definition: canprim.h:888
virtual void SetEndScaleX(double xs)
dummies to be compatible with a2dEndsLine
Definition: canprim.h:1095
void SetPathType(a2dPATH_END_TYPE pathtype)
Set when m_contourwidth != 0 what is the end of the line should be.
Definition: canprim.h:1111
a2dEndsEllipticChord with begin and/or end object.
Definition: canprim.h:1327
void SetHeight(double h)
set height of rectangle
Definition: canprim.h:144
double GetRadius() const
return radius
Definition: canprim.h:494
a2dRect
Definition: canprim.h:440
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
Definition: bbox.h:39
double GetX2() const
Get X2 of arc being end point of arc.
Definition: canprim.h:870
void SetX2(double x2)
Set X2 of arc being end point of arc.
Definition: canprim.h:886
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
double GetEnd()
return end angle
Definition: canprim.h:743
void SetContourWidth(double width)
set the Contour width of the shape
Definition: canprim.h:763
a2dArc centered at x,y
Definition: canprim.h:823
double GetEndScaleY()
see SetEndScaleY()
Definition: canprim.h:1380
void SetStart(double start)
set start angle
Definition: canprim.h:730
wxWindow * GetControl()
Get control pointer.
Definition: canprim.h:1446
double GetY1() const
Get Y1 of arc being begin point of arc.
Definition: canprim.h:868
bool GetStyleToArrow()
if true take style changes on line to the arrow objects
Definition: canprim.h:1227
This template class is for property ids with a known data type.
Definition: id.h:477
void SetStyleToArrow(bool takeStyleToArrow)
if set take style changes on line to the arrow objects
Definition: canprim.h:1225
Vector Path.
Definition: polyver.h:1211
double GetContourWidth() const
get the Contour width of the shape
Definition: canprim.h:668
double GetHeight() const
return height
Definition: canprim.h:339
void SetContourWidth(double width)
set the Contour width of the shape
Definition: canprim.h:482
list of a2dObject&#39;s
Definition: gen.h:3157
void SetContourWidth(double width)
set the Contour width of the shape
Definition: canprim.h:584
a2dWHCenter
Definition: canprim.h:392
double GetEndScaleX()
dummies to be compatible with a2dEndsLine
Definition: canprim.h:1100
void SetY1(double y1)
Set Y1 of arc being begin point of arc.
Definition: canprim.h:884
double GetHeight() const
return height
Definition: canprim.h:149
CloneOptions
options for cloning
Definition: gen.h:1200
double GetContourWidth() const
get the Contour width of the shape
Definition: canprim.h:587
structure to give as parameter to member functions of a2dCanvasObject
Definition: canobj.h:252
a2dEllipticArc centered at x,y
Definition: canprim.h:697
double GetHeight()
return height
Definition: canprim.h:56
void SetEnd(double end)
set end angle
Definition: canprim.h:740
wxEditStyle
Definition: canobj.h:109
a2dPATH_END_TYPE GetPathType()
get when m_contourwidth != 0 what is the end of the line looks like.
Definition: canprim.h:1114
canprim.h Source File -- Sun Oct 12 2014 17:04:14 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation