wxArt2D
curvegroup.h
Go to the documentation of this file.
1 /*! \file wx/curves/curvegroup.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: curvegroup.h,v 1.27 2008/09/05 19:01:12 titato Exp $
14 */
15 
16 #ifndef __WXCURVEGROUP_H__
17 #define __WXCURVEGROUP_H__
18 
19 #ifndef WX_PRECOMP
20 #include "wx/wx.h"
21 #endif
22 
23 #include "wx/curves/meta.h"
24 
25 WX_DECLARE_STRING_HASH_MAP_WITH_DECL( a2dBoundingBox, _a2dBoundingBoxHash, class A2DCURVESDLLEXP );
26 
27 class A2DCURVESDLLEXP a2dBboxHash : public _a2dBoundingBoxHash, public a2dObject
28 {
29 public:
30  a2dBboxHash( void );
31  a2dBboxHash( const a2dBboxHash& other, CloneOptions options, a2dRefMap* refs );
32 
33 protected:
34 #if wxART2D_USE_CVGIO
35  //! Save settings.
36  virtual void DoSave( wxObject* WXUNUSED( parent ), a2dIOHandlerXmlSerOut& WXUNUSED( out ), a2dXmlSer_flag WXUNUSED( xmlparts ), a2dObjectList* WXUNUSED( towrite ) ) {}
37  //! Load settings.
38  virtual void DoLoad( wxObject* WXUNUSED( parent ), a2dIOHandlerXmlSerIn& WXUNUSED( parser ), a2dXmlSer_flag WXUNUSED( xmlparts ) ) {}
39 #endif
40 private:
41  a2dBboxHash( const a2dBboxHash& other );
42 
43 
44 private:
45  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
46 };
47 
48 //! base class for curve area in a a2dCurvesAreaList, like used in a2dCanvasXYDisplayGroups
49 /*!
50  A curve area is a rectangular area in curve coordinates that is displayed in e.g. a a2dCanvasXYDisplayGroups.
51  The curve is defined in curve coordinates, and a curve area holds several curves.
52  The range of curve coordinates in X and Y is choosen here.
53 
54  \ingroup canvasobject meta curve
55 */
56 class A2DCURVESDLLEXP a2dCurvesArea : public a2dPolygonLClipper
57 {
58  friend class a2dCurvesAreaList;
59  DECLARE_DYNAMIC_CLASS( a2dCurvesArea )
60 public:
61 
62  //! constructor
63  /*!
64  Construct a curve area, used to place a2dCurve objects.
65 
66  \param curvesAreaName name of the curve arae
67  */
68  a2dCurvesArea( const wxString curvesAreaName = wxT( "" ) );
69 
70  //! constructor for cloning
71  a2dCurvesArea( const a2dCurvesArea& other, CloneOptions options, a2dRefMap* refs );
72 
73  ~a2dCurvesArea();
74 
75  //! get text to display for axis label
76  wxString GetAxisText() const;
77 
78  //! set text to display for axis label
79  bool SetAxisText( const wxString& name );
80 
81  //! size of object in world coordinates, as displayed in the drawing.
82  void SetBoundaries( const a2dBoundingBox& extbox );
83 
84  bool IsRecursive() { return true; }
85 
86  //! update conversion matrix to/from curve to world coordinates
87  /*
88  Based on the given values, the mapping of world coordinates to the plot its
89  internal curve coordinates is calculated.
90  */
91  void UpdateInternalBoundaries( const a2dBoundingBox& extbox );
92 
93  //! set the internal curve boundaries, and update conversion to world matrix
94  void SetInternalBoundaries( const a2dBoundingBox& extbox, const a2dBoundingBox& intbox )
95  {
96  m_intrect = intbox;
97  UpdateInternalBoundaries( extbox );
98  }
99 
100  //! set the internal curve boundaries, and update conversion to world matrix
101  void SetInternalBoundaries( const a2dBoundingBox& extbox, double ximin, double yimin, double ximax, double yimax )
102  {
103  SetInternalBoundaries( extbox, a2dBoundingBox( ximin, yimin, ximax, yimax ) );
104  }
105 
106  //! get the plotting rectangle in curve coordinates
107  const a2dBoundingBox& GetInternalBoundaries() const { return m_intrect; }
108 
109  //! get the plotting matrix in curve coordinates as matrix.
110  //! The matrix is used to plot curve in m_intrect
111  const a2dAffineMatrix& GetCurveAreaTransform() { return m_iworld; }
112 
113  //! add a curve to the end of the exisiting curves.
114  /*
115  \param curve pointer to a curve object
116  \param curvename if not empty, the curve will be named this.
117  */
118  void AddCurve( a2dCurve* curve, const wxString curvename = _T( "" ) );
119 
120  //! add a marker
121  /*
122  \param marker pointer to a marker object
123  */
124  void AddMarker( a2dMarker* marker );
125 
126  //! remove a marker
127  /*
128  \param marker pointer to a marker object
129  */
130  void RemoveMarker( a2dMarker* marker );
131 
132  //! add a curve to the end of the existing curves.
133  /*
134  \param before place this curve before the given index of another curve
135  \param curve pointer to a curve object
136  \param curvename if not empty, the curve will be named this.
137  */
138  void InsertCurve( size_t before, a2dCurve* curve, const wxString curvename = _T( "" ) );
139 
140  //! return curve named curvename, if not available returns NULL
141  a2dCurve* GetCurve( const wxString curvename );
142 
143  //! returns the list where the curves are stored in.
144  /*!
145  Can be used to iterate over the curves, and/or add curves etc.
146  */
148  {
149  return GetChildObjectList();
150  }
151  //! returns the list where the curves are stored in.
152  /*!
153  Can be used to iterate over the curves, and/or add curves etc.
154  */
156  {
157  return GetChildObjectList();
158  }
159 
160  //! used by a2dCurve to transform its own curve coordinates to the curve plotting area
161  void World2Curve( double xw, double yw, double& xcurve, double& ycurve );
162 
163  //! used by a2dCurve to transform its own curve coordinates to the curve plotting area
164  void Curve2World( double xcurve, double ycurve, double& xw, double& yw );
165 
166  //! get the boundingbox in internal curve coordinates of all the curves
167  a2dBoundingBox GetCurvesBoundaries();
168 
169  //! get Y axis of this curve area
170  a2dCurveAxis* GetAxisY() { return m_axisY; }
171 
172  //! set Y axis of this curve area
173  void SetAxisY( a2dCurveAxis* axisY ) { m_axisY = axisY; }
174 
175  //! set show yaxis
176  void SetShowYaxis( bool showyaxis );
177  //! get show yaxis
178  bool GetShowYaxis( void ) { return m_showyaxis; }
179 
180  //! sets m_axisY values
181  void SetAxes( const a2dBoundingBox& extbox, double x, double y, double& zerox, double& zeroy, double& ixmin, double& ixmax );
182 
183  //!if a curve in this area is set, true returned
184  bool IsCurvesHighlighted() const;
185 
186  void SetMarkerShow( a2dMarkerShow* showm );
187  void SetMarkerShow2( a2dMarkerShow* showm );
188  a2dMarkerShow* GetMarkerShow( void ) const { return m_markerShow; }
189  a2dMarkerShow* GetMarkerShow2( void ) const { return m_markerShow2; }
190 
191  //! set color of axis text
192  void SetColor( const wxColour& color ) { m_colour = color; }
193  //! get color of axis text
194  const wxColour& GetColor() const { return m_colour;}
195 
196  //! search a marker ( placed to show a position on a curve )
197  /*!
198  A a2dMarker is added as a child object on a a2dCurveArea.
199  */
200  a2dMarker* GetCursorMarker() const;
201 
202  //! the group of which the area is a part
203  a2dCanvasXYDisplayGroupAreas* GetGroup( void ) { return m_group; }
204  //! the group of which the area is a part
205  void SetGroup( a2dCanvasXYDisplayGroupAreas* aGroup );
206 
207  a2dBoundingBox& Expand( a2dBoundingBox& bbox );
208  void DoAddPending( a2dIterC& ic );
209  bool ProcessCanvasObjectEvent( a2dIterC& ic, a2dHitEvent& hitEvent );
210  void DoWalker( wxObject* parent, a2dWalkerIOHandler& handler );
211  a2dCanvasObject* IsHitCurvesWorld ( a2dIterC& ic, a2dHitEvent& hitEvent );
212  void DependencyPending( a2dWalkerIOHandler* handler );
213  bool Update( UpdateMode mode );
214 
215 protected:
216 
217  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
219  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
220 #if wxART2D_USE_CVGIO
221  //! Save settings.
222  virtual void DoSave( wxObject* WXUNUSED( parent ), a2dIOHandlerXmlSerOut& WXUNUSED( out ), a2dXmlSer_flag WXUNUSED( xmlparts ), a2dObjectList* WXUNUSED( towrite ) );
223  //! Load settings.
224  virtual void DoLoad( wxObject* WXUNUSED( parent ), a2dIOHandlerXmlSerIn& WXUNUSED( parser ), a2dXmlSer_flag WXUNUSED( xmlparts ) ) ;
225 #endif
226 
227  //! if true show the Y axis object
229 
230  //! y axis object
232 
233  //internal coordinates defined as rectangle
234  a2dBoundingBox m_intrect;
235  //! internal coordinates used for curve plotting expressed as matrix
237 
238  a2dSmrtPtr<a2dMarkerShow> m_markerShow;
239  a2dSmrtPtr<a2dMarkerShow> m_markerShow2;
240 
241  //! color of axis text
242  wxColour m_colour;
243 
244  //! the group of which the area is a part
246 
247 public:
248  static a2dPropertyIdCanvasObject* PROPID_curvesarea;
249  static a2dPropertyIdString* PROPID_text;
250 
252 
253 };
254 
255 template class A2DCURVESDLLEXP a2dSmrtPtr<a2dCurvesArea>;
256 
257 #include <wx/dynarray.h>
258 WX_DECLARE_OBJARRAY_WITH_DECL( a2dSmrtPtr<a2dCurvesArea>, a2dCurvesAreaListBase, class A2DCURVESDLLEXP );
259 
260 //! list for a2dCurvesArea objects
261 /*!
262  A list of curve areas, one of them can be set as Yaxis Left and as Yaxis Right.
263 */
264 class A2DCURVESDLLEXP a2dCurvesAreaList : public a2dCurvesAreaListBase, public a2dObject
265 {
266  DECLARE_DYNAMIC_CLASS( a2dCurvesAreaList )
267 public:
269 
271 
273 
274  // a2dCurvesAreaList& operator=( const a2dCurvesAreaList &other);
275 
276  //! get a2dCurvesArea with the given name
277  a2dCurvesArea* GetCurvesArea( const wxString& curvesAreaName );
278  //! get a2dCurvesArea with the given name
279  a2dCurvesArea* GetCurvesArea( const wxString& curvesAreaName ) const;
280 
281  //! this object is recursive (has children ).
282  bool IsRecursive() { return true; }
283 
284  //! sets for all curve areas in the list the same boundaries
285  void SetBoundaries( const a2dBoundingBox& extbox );
286 
287  //Each a2dCurvesArea is shown in an X range and Y range as defined by SetBoundaries.
288  void SetClippingFromBox( a2dBoundingBox& bbox = wxNonValidBbox );
289 
290 
291  //! fills a2dBboxHash with rectangles representing the plotting area of a curve
292  int AppendInternalBoundaries( a2dBboxHash* irectHash );
293  //! fills a2dBboxHash with rectangles representing the plotting area of a curve
294  int AppendCurvesBoundaries( a2dBboxHash* irectHash );
295 
296  a2dBoundingBox& Expand( a2dBoundingBox& bbox ) const;
297 
298  void AddPending( a2dIterC& ic );
299 
300  bool Update( a2dCanvasObject::UpdateMode mode );
301 
302  //! sets m_axisY values
303  void SetAxes( const a2dBoundingBox& extbox, double x, double y, double& zerox, double& zeroy, double& ixmin, double& ixmax );
304 
305  //! tic distance in Y for the m_leftAxisY area
306  double GetTicY() const
307  {
308  wxASSERT_MSG( m_leftAxisY != ( a2dCurvesArea* )NULL, wxT( "left axis was not defined" ) );
309  return m_leftAxisY->m_axisY->GetTic();
310  }
311 
312  //! the a2dCurveArea which has bin set to be the m_leftAxisY
313  /*!
314  This area is called the base, and is used for drawing the grid and cursor lines etc.
315  The base area is created by a2dCurvesAreaList at construction.
316  */
317  a2dSmrtPtr<a2dCurvesArea> GetBaseCurvesArea() const
318  {
319  wxASSERT_MSG( m_leftAxisY != ( a2dCurvesArea* )NULL, wxT( "left axis was not defined" ) );
320  return m_leftAxisY;
321  }
322 
323  //! render all Yaxis objects ( of Left and Right a2dCurveArea )
324  void RenderAxesY ( a2dIterC& ic, OVERLAP clipparent );
325 
326  void Render ( a2dIterC& ic, OVERLAP clipparent );
327 
328  //! the a2dCurveArea with the given name is set as holding the left Yaxis
329  void SetShowLeftYaxis( const wxString& curveAreaName, bool showyaxis );
330 
331  //! the a2dCurveArea with the given name is set as holding the rigth Yaxis
332  void SetShowRightYaxis( const wxString& curveAreaName, bool showyaxis );
333 
334  void SetTicY( int numLines );
335 
336 // a2dBoundingBox SetMarkersPos(const a2dBoundingBox& bbox);
337 // virtual void ChangeCursorPos(double shift);
338  void SetCursor( a2dCursor* cursor );
339 
340  void DependencyPending( a2dWalkerIOHandler* handler );
341  bool GetPending( void );
342  void UpdateViewDependentObjects( a2dIterC& ic );
343 
344  //! selected object itself or one of its recursive children
346  bool GetHasToolObjectsBelow();
347 
348  a2dCanvasXYDisplayGroupAreas* GetGroup( void ) { return m_group; }
349 
350  void SetGroup( a2dCanvasXYDisplayGroupAreas* aGroup );
351 
352  void SetAutoShowYAxes( bool autoshowyaxes ) { m_autoshowyaxes = autoshowyaxes; }
353 
354  bool GetAutoShowYAxes( void ) { return m_autoshowyaxes; }
355 
356  bool ProcessCanvasObjectEvent( a2dIterC& ic, a2dHitEvent& hitEvent );
357  void DoWalker( wxObject* parent, a2dWalkerIOHandler& handler );
358  a2dCanvasObject* IsHitCurvesWorld ( a2dCurvesArea* &area, a2dIterC& ic, a2dHitEvent& hitEvent );
359 
360  //! the curve area to display the left Y axis
361  a2dSmrtPtr<a2dCurvesArea> m_leftAxisY;
362  //! the curve area to display the right Y axis
363  a2dSmrtPtr<a2dCurvesArea> m_rightAxisY;
364 
365 private:
366  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
367 
368 #if wxART2D_USE_CVGIO
369  //! Save settings.
370  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts, a2dObjectList* towrite );
371  //! Load settings.
372  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts ) ;
373 #endif
374 
375  bool m_autoshowyaxes;
376 
377  //! the group of which this object is a part
379 };
380 
381 template class A2DCURVESDLLEXP a2dSmrtPtr<a2dCurvesAreaList>;
382 
383 WX_DECLARE_STRING_HASH_MAP( a2dBoundingBox, a2dCurvesBboxes );
384 
385 //! Special object group to plot a2dCurve Objects but also any other a2dCanvasObject.
386 /*!
387  The class has special functions to make it easy to plot curves on a grid with tics etc.
388 
389  There is a list a2dCurvesAreaList with a2dCurvesArea objects, where each can contain a set of curves.
390  Each a2dCurvesArea has his own drawing coordinates for the curve that are drawn on it.
391 
392  \ingroup canvasobject meta curve
393 */
394 class A2DCURVESDLLEXP a2dCanvasXYDisplayGroupAreas: public a2dCanvasObject
395 {
396 public:
397 
398  //!construct a new a2dCanvasXYDisplayGroup at given position
399  /*!
400  \param x X position
401  \param y Y position
402  */
403  a2dCanvasXYDisplayGroupAreas( double x = 0 , double y = 0 );
404 
405  //! constructor to clone
407 
408  //! return reference to list of all a2dCurveArea objects used
409  const a2dCurvesAreaList& GetCurvesAreaList() const { return *m_axesarealist;}
410 
411  //! set list of all a2dCurveArea objects
413  {
414  m_axesarealist = areaList;
415  m_axesarealist->SetGroup( this );
416  }
417 
418  //! set the minimum and maximum values
419  /*!
420  this defines the size of the plot in world coordinates.
421  The position is in the transformMatrix of the object, this here
422  defines how it is placed relative to that matrix.
423 
424  \remark the data plotted in this are from curves etc., is set by SetInternalBoundaries()
425  */
426  void SetBoundaries( const a2dBoundingBox& extbox );
427  //! see SetBoundaries(const a2dBoundingBox& extbox)
428  void SetBoundaries( double xmin, double ymin, double xmax, double ymax )
429  {
430  SetBoundaries( a2dBoundingBox( xmin, ymin, xmax, ymax ) );
431  }
432 
433  //! set the minimum and maximum values to be displayed in the axisarea
434  /*
435  Based on the given values, the mapping of world coordinates to the plot its
436  internal coordinates is calculated and visa versa.
437  For instance the curves in the plot use this data to convert its data and plot itself.
438 
439  \param ximin minimum x curve coordinate
440  \param yimin minimum y curve coordinate
441  \param ximax maximum x curve coordinate
442  \param yimax maximum y curve coordinate
443  \param curveAreaName name of a2dCurveArea to set, if empty use the only
444  */
445  void SetInternalBoundaries( double ximin, double yimin, double ximax, double yimax, const wxString& curveAreaName = wxEmptyString );
446 
447  //! set the minimum and maximum values for axis X for all axisareas to be displayed
448  /*
449  changed X-axis bounds for all areas
450  */
451  void SetInternalXBoundaries( double ximin, double ximax );
452 
453  //! return curve coordinate boundaries of a given curve area
454  a2dBoundingBox GetInternalBoundaries( const wxString& curveAreaName = wxEmptyString ) const;
455 
456  //! return plotting rectangle in world coordinates
457  a2dBoundingBox GetPlotAreaBbox() const;
458 
459  //! fills a2dBboxHash with rectangles representing the plotting area of a curve
460  int AppendInternalBoundaries( a2dBboxHash* irectHash );
461  //! fills a2dBboxHash with rectangles representing the plotting area of a curve
462  int AppendCurvesBoundaries( a2dBboxHash* irectHash );
463 
464  a2dAffineMatrix GetCurvesAreaTransform( const wxString& curveAreaName );
465 
466  a2dCurvesArea* GetCurvesArea( const wxString& curveAreaName = wxEmptyString )
467  { return m_axesarealist->GetCurvesArea( curveAreaName ); }
468 
469  //! add a2dCurveArea with this name, if not already available
470  a2dCurvesArea* AddCurvesArea( const wxString& curveAreaName );
471 
472  //! add a curve to the end of the existing curves in a given a2dCurveArea
473  /*
474  \param curveAreaName name of the curve area to add the curve object
475  \param curve pointer to a curve object
476  \param curvename if not empty, the curve will be named this.
477  */
478  void AddCurveToArea( const wxString& curveAreaName, a2dCurve* curve, const wxString curvename = _T( "" ) );
479 
480  //! add a marker
481  /*
482  \param curveAreaName name of the curve area to add the curve object
483  \param marker pointer to a marker object
484  */
485  void AddMarkerToArea( const wxString& curveAreaName, a2dMarker* marker );
486 
487  //! remove a marker
488  /*
489  \param curveAreaName name of the curve area to add the curve object
490  \param marker pointer to a marker object
491  */
492  void RemoveMarkerFromArea( const wxString& curveAreaName, a2dMarker* marker );
493 
494  void SetCursor( a2dCursor* cursor );
495 
496  a2dCursor* GetCursor()
497  {
498  return m_cursor;
499  }
500 
501  void ChangeCursorPos( double step );
502 
503 
504  //! add a curve to the end of the exisiting curves.
505  /*
506  \param curveAreaName name of the curve area to add the curve object
507  \param before place this curve before the given index of another curve
508  \param curve pointer to a curve object
509  \param curvename if not empty, the curve will be named this.
510  */
511  void InsertCurveToArea( const wxString& curveAreaName, size_t before, a2dCurve* curve, const wxString curvename = _T( "" ) );
512 
513  //! return curve named curvename, if not available returns NULL
514  /*
515  \param curveAreaName name of the curve area to add the curve object
516  \param curvename the curve to search
517  */
518  a2dCurve* GetCurveFromArea( const wxString& curveAreaName, const wxString curvename );
519 
520  //! returns the list where the curves are stored in.
521  /*!
522  Can be used to iterate over the curves, and/or add curves etc.
523 
524  \param curveAreaName name of the curve area to add the curve object
525  */
526  a2dCanvasObjectList* GetCurvesFromArea( const wxString& curveAreaName );
527 
528  //! get the boundingbox in relative world coordinates of the plot area
529  /*!
530  This is the area in world coordinates that is used to plot the data.
531  This is different from the total boundingbox, since that contains tics and text etc.
532  */
533  const a2dBoundingBox& GetPlotAreaRect() const { return m_plotrect; }
534 
535  //! get the boundingbox in internal curve coordinates of all the curves in a given area
536  /*!
537  \param curveAreaName name of the curve area to add the curve object
538  */
539  a2dBoundingBox GetCurvesBoundariesFromArea( const wxString& curveAreaName );
540 
541  //!destructor
542  virtual ~a2dCanvasXYDisplayGroupAreas();
543 
544  //! get X axis object
545  a2dCurveAxis* GetAxisX() const { return m_axisX; }
546 
547  //! set X axis object
548  void SetAxisX( a2dCurveAxis* axisX ) { m_axisX = axisX; SetPending( true ); }
549 
550  //! get Y axis object for given curve area
551  a2dCurveAxis* GetAreaAxisY( const wxString& curveAreaName ) const;
552 
553  //! show xaxis
554  void SetShowXaxis( bool showxaxis ) { m_showxaxis = showxaxis; SetPending( true ); }
555 
556  //! show yaxis
557  void SetShowYaxis( const wxString& curveAreaName, bool showyaxis )
558  {
559  SetShowLeftYaxis( curveAreaName, showyaxis );
560  }
561 
562  //! set Y axis object for given curve area
563  void SetAreaAxisY( const wxString& curveAreaName, a2dCurveAxis* axisY );
564 
565  //! show yaxis
566  void SetShowLeftYaxis( const wxString& curveAreaName, bool showyaxis );
567  //! show yaxis
568  void SetShowRightYaxis( const wxString& curveAreaName, bool showyaxis );
569 
570  //! set
571  void SetAutoTicYPrecision( bool autoPrecision ) { m_autoTicYPrecision = autoPrecision; SetPending( true );}
572 
573  //! get
574  bool IsAutoTicYPrecision() const { return m_autoTicYPrecision; }
575 
576  //! show grid
577  void SetShowGrid( bool showgrid ) { m_showgrid = showgrid; SetPending( true ); }
578 
579  //!Set a stroke for grid.
580  void SetGridStroke( const a2dStroke& stroke );
581 
582  //!Set a fill for axis area
583  void SetAxisAreaFill( const a2dFill& fill );
584 
585  //!Set a stroke around axis area
586  void SetAxisAreaStroke( const a2dStroke& fill );
587 
588  virtual void DoWalker( wxObject* parent, a2dWalkerIOHandler& handler );
589 
590  bool ProcessCanvasObjectEvent( a2dIterC& ic, a2dHitEvent& hitEvent );
591 
592  //! if left axis a2dCurveArea is set, the label text will be set to this
593  wxString GetLeftAxisText() const ;
594 
595  //! if right a2dCurveArea is set, the label text will be set to this
596  wxString GetRightAxisText() const ;
597 
598  //! set axis text for given curve area
599  /*!
600  \param curveAreaName name of the curve area to add the curve object
601  \param text text to placed at axis
602  \param color color of the label
603  */
604  void SetAxisText( const wxString& curveAreaName, const wxString& text, const wxColour& color );
605 
606  void ClearCurvesAreas();
607 
608  void SetAreaMarkerShow( const wxString& curveAreaName, a2dMarkerShow* showm );
609  void SetAreaMarkerShow2( const wxString& curveAreaName, a2dMarkerShow* showm );
610 
611  a2dMarkerShow* GetAreaMarkerShow( const wxString& curveAreaName ) const;
612  a2dMarkerShow* GetAreaMarkerShow2( const wxString& curveAreaName ) const;
613 
614  void SetTicY( int numLines );
615 
616  virtual int SetAxisTicPrecision( a2dCurveAxis* axisY, double newMinY, double newMaxY );
617  virtual void SetCommonTicPrecision( int precision );
618 
619  void SetAutoShowYAxes( bool autoshowyaxes ) { m_axesarealist->SetAutoShowYAxes( autoshowyaxes ); SetPending( true );}
620 
621  void SetCursorOnlyByCurves( bool cursorOnlyByCurves ) { m_cursorOnlyByCurves = cursorOnlyByCurves; SetPending( true );}
622  bool GetCursorOnlyByCurves( void ) { return m_cursorOnlyByCurves; }
623 
624  void OnChar( wxKeyEvent& event );
625 
626  DECLARE_DYNAMIC_CLASS( a2dCanvasXYDisplayGroupAreas )
627 
628  DECLARE_EVENT_TABLE()
629 
630 protected:
631 
632  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
633 
634  virtual void DrawGrid( a2dIterC& ic );
635 
636  void DependencyPending( a2dWalkerIOHandler* WXUNUSED( handler ) );
637 
638  void DoUpdateViewDependentObjects( a2dIterC& ic );
639 
640  bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
641 
642  void OnCanvasObjectMouseEvent( a2dCanvasObjectMouseEvent& event );
643 
644  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
645 
646 #if wxART2D_USE_CVGIO
647  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
648 
649  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
650 #endif //wxART2D_USE_CVGIO
651 
652  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
653 
654  void DoAddPending( a2dIterC& ic );
655 
656  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
657 
658  void DoRender( a2dIterC& ic, OVERLAP clipparent );
659 
660  bool m_showgrid;
661  bool m_showxaxis;
662  bool m_autoTicYPrecision;
663 
664  a2dStroke m_strokegrid;
665  a2dFill m_fillAxisArea;
666  a2dStroke m_strokeAxisArea;
667 
668  //!placement in world coordinates
670 
671  //! internal object used to display the curves in internal coordinates
672  a2dSmrtPtr<a2dCurvesAreaList> m_axesarealist;
673 
674  //! x axis object
676 
677  //! cursor object
679 
680  static const a2dPropertyIdRefObject PROPID_strokegrid;
681  static const a2dPropertyIdRefObject PROPID_fillAxisArea;
682 
683 // static const a2dPropertyIdCanvasObject PROPID_axesarea;
684 
685  bool m_cursorOnlyByCurves;
686 
687 private:
688  //!this is a not implemented copy constructor that avoids automatic creation of one
690 };
691 
692 #if defined(WXART2D_USINGDLL)
693 template class A2DCURVESDLLEXP a2dSmrtPtr<a2dCanvasXYDisplayGroupAreas>;
694 #endif
695 
696 //! simple curve group with just one a2dCurvesArea in use
698 {
699 public:
700 
701  //!construct a new a2dCanvasXYDisplayGroup at given position
702  /*!
703  \param x X position
704  \param y Y position
705  */
706  a2dCanvasXYDisplayGroup( double x = 0 , double y = 0 );
707 
709 
710  //! add a curve to the end of the exisiting curves.
711  /*
712  \param curve pointer to a curve object
713  \param curvename if not empty, the curve will be named this.
714  */
715  void AddCurve( a2dCurve* curve, const wxString curvename = _T( "" ) )
716  {
717  AddCurveToArea( ( const wxString& )wxEmptyString, curve, curvename );
718  }
719 
720  //! add a marker
721  /*
722  \param marker pointer to a marker object
723  */
724  void AddMarker( a2dMarker* marker )
725  {
726  AddMarkerToArea( ( const wxString& )wxEmptyString, marker );
727  }
728 
729  //! remove a marker
730  /*
731  \param marker pointer to a marker object
732  */
733  void RemoveMarker( a2dMarker* marker )
734  {
735  RemoveMarkerFromArea( ( const wxString& )wxEmptyString, marker );
736  }
737 
738  //! add a curve to the end of the exisiting curves.
739  /*
740  \param before place this curve before the given index of another curve
741  \param curve pointer to a curve object
742  \param curvename if not empty, the curve will be named this.
743  */
744  void InsertCurve( size_t before, a2dCurve* curve, const wxString curvename = _T( "" ) )
745  {
746  InsertCurveToArea( ( const wxString& )wxEmptyString, before, curve, curvename );
747  }
748 
749  //! return curve named curvename, if not available returns NULL
750  a2dCurve* GetCurve( const wxString curvename )
751  {
752  return GetCurveFromArea( ( const wxString& )wxEmptyString, curvename );
753  }
754 
755  //! returns the list where the curves are stored in.
756  /*!
757  Can be used to iterate over the curves, and/or add curves etc.
758  */
760  {
761  return GetCurvesFromArea( ( const wxString& )wxEmptyString );
762  }
763 
764 
765  //! get the boundingbox in internal curve coordinates of all the curves
767  {
768  return GetCurvesBoundariesFromArea( ( const wxString& )wxEmptyString );
769  }
770 
771  //!destructor
772  virtual ~a2dCanvasXYDisplayGroup();
773 
774  a2dCurveAxis* GetAxisY( void )
775  {
776  return GetAreaAxisY( ( const wxString& )wxEmptyString );
777  }
778 
779  void SetAxisY( a2dCurveAxis* axisY )
780  {
781  SetAreaAxisY( ( const wxString& )wxEmptyString, axisY );
782  }
783 
784  //! show yaxis
785  void SetShowYaxis( bool showyaxis )
786  {
787  SetShowLeftYaxis( wxEmptyString, showyaxis );
788  }
789 
790  DECLARE_DYNAMIC_CLASS( a2dCanvasXYDisplayGroup )
791 
792 protected:
793  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
794 
795 #if wxART2D_USE_CVGIO
796 // virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
797 
798 // void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
799 #endif //wxART2D_USE_CVGIO
800 
801 private:
802  //!this is a not implemented copy constructor that avoids automatic creation of one
804 };
805 
806 #if defined(WXART2D_USINGDLL)
807 template class A2DCURVESDLLEXP a2dSmrtPtr<a2dCanvasXYDisplayGroup>;
808 #endif
809 
810 extern A2DCURVESDLLEXP double a2dBoundsRound( double val );
811 extern A2DCURVESDLLEXP double a2dTicsRound( double val );
812 
813 #endif
814 
cursor on curve plot as a vertical line with markers
Definition: marker.h:512
virtual bool ProcessCanvasObjectEvent(a2dIterC &ic, a2dHitEvent &hitEvent)
Hit objects will receive the event.
Definition: canobj.cpp:3964
Base class for all types of strokes, understood by a2dDrawer2D classes.
Definition: stylebase.h:378
classes for plotting curve and pie data, and editing them.
void SetShowRightYaxis(const wxString &curveAreaName, bool showyaxis)
the a2dCurveArea with the given name is set as holding the rigth Yaxis
Definition: curvegroup.cpp:863
bool IsAutoTicYPrecision() const
get
Definition: curvegroup.h:574
mouse event sent from a2dCanvasObject to itself
Definition: canglob.h:223
For Markers on a Curve.
Definition: marker.h:248
class to map references to objects stored in XML, in order to make the connection later on...
Definition: gen.h:3462
void AddCurve(a2dCurve *curve, const wxString curvename=_T(""))
add a curve to the end of the exisiting curves.
Definition: curvegroup.h:715
a2dSmrtPtr< a2dCurvesArea > m_rightAxisY
the curve area to display the right Y axis
Definition: curvegroup.h:363
bool IsRecursive()
returns if this object does have nested objects
Definition: curvegroup.h:84
void SetInternalBoundaries(const a2dBoundingBox &extbox, double ximin, double yimin, double ximax, double yimax)
set the internal curve boundaries, and update conversion to world matrix
Definition: curvegroup.h:101
a2dSmrtPtr< a2dCurvesArea > m_leftAxisY
the curve area to display the left Y axis
Definition: curvegroup.h:361
bool GetHasSelectedObjectsBelow()
selected object itself or one of its recursive children
Ref Counted base object.
Definition: gen.h:1045
void SetAxisY(a2dCurveAxis *axisY)
set Y axis of this curve area
Definition: curvegroup.h:173
a2dSmrtPtr< a2dCurvesArea > GetBaseCurvesArea() const
the a2dCurveArea which has bin set to be the m_leftAxisY
Definition: curvegroup.h:317
void SetAxisX(a2dCurveAxis *axisX)
set X axis object
Definition: curvegroup.h:548
a2dSmrtPtr< a2dCurveAxis > m_axisY
y axis object
Definition: curvegroup.h:231
virtual void DependencyPending(a2dWalkerIOHandler *handler)
called by to check if this object becomes pending as a result of other objects
Definition: canobj.cpp:4680
Input and output handler for the XmlSer format.
Definition: genxmlpars.h:819
UpdateMode
Various mode flags for Update.
Definition: canobj.h:1091
OVERLAP
Result of a a2dBoundingBox intersection or hittest.
Definition: bbox.h:24
double GetTic() const
get distance of tic lines in X/Y (curve coords)
Definition: axis.h:181
void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
Definition: curvegroup.cpp:620
For Showing Marker position of Markers on a Curve.
Definition: marker.h:408
#define DECLARE_PROPERTIES()
check if class has the given id as a valid id for this object
Definition: gen.h:835
const a2dCanvasObjectList * GetCurves() const
returns the list where the curves are stored in.
Definition: curvegroup.h:147
base class for axis in a2dCanvasXYDisplayGroup
Definition: axis.h:102
a2dCanvasObject is the base class for Canvas Objects.
Definition: canobj.h:371
a2dCurveAxis * GetAxisX() const
get X axis object
Definition: curvegroup.h:545
a2dBoundingBox wxNonValidBbox
global non valid boundingbox to use as default argument etc.
Definition: bbox.cpp:23
bool GetShowYaxis(void)
get show yaxis
Definition: curvegroup.h:178
a2dCanvasObjectList * GetChildObjectList()
get the list where the child objects are stored in.
Definition: canobj.cpp:2551
bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
Definition: polygon.cpp:1544
a2dSmrtPtr< a2dCurvesAreaList > m_axesarealist
internal object used to display the curves in internal coordinates
Definition: curvegroup.h:672
void SetShowYaxis(const wxString &curveAreaName, bool showyaxis)
show yaxis
Definition: curvegroup.h:557
simple curve group with just one a2dCurvesArea in use
Definition: curvegroup.h:697
void RemoveMarker(a2dMarker *marker)
remove a marker
Definition: curvegroup.h:733
void RenderAxesY(a2dIterC &ic, OVERLAP clipparent)
render all Yaxis objects ( of Left and Right a2dCurveArea )
Definition: curvegroup.cpp:815
void SetBoundaries(const a2dBoundingBox &extbox)
sets for all curve areas in the list the same boundaries
Definition: curvegroup.cpp:601
void SetBoundaries(double xmin, double ymin, double xmax, double ymax)
see SetBoundaries(const a2dBoundingBox&amp; extbox)
Definition: curvegroup.h:428
Io handler to iterate through a a2dDocument.
Definition: gen.h:3911
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
Load settings.
Definition: curvegroup.h:38
void AddMarker(a2dMarker *marker)
add a marker
Definition: curvegroup.h:724
list for a2dCurvesArea objects
Definition: curvegroup.h:264
void SetCurvesAreaList(a2dCurvesAreaList *areaList)
set list of all a2dCurveArea objects
Definition: curvegroup.h:412
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
clone it
Definition: polygon.cpp:3245
bool IsRecursive()
this object is recursive (has children ).
Definition: curvegroup.h:282
int AppendInternalBoundaries(a2dBboxHash *irectHash)
fills a2dBboxHash with rectangles representing the plotting area of a curve
Definition: curvegroup.cpp:647
clips all children to a polygon
Definition: polygon.h:617
const a2dBoundingBox & GetPlotAreaRect() const
get the boundingbox in relative world coordinates of the plot area
Definition: curvegroup.h:533
virtual void DoUpdateViewDependentObjects(a2dIterC &ic)
update derived objects
Definition: canobj.cpp:4657
const a2dAffineMatrix & GetCurveAreaTransform()
Definition: curvegroup.h:111
a2dCurveAxis * GetAxisY()
get Y axis of this curve area
Definition: curvegroup.h:170
a2dCanvasXYDisplayGroupAreas * GetGroup(void)
the group of which the area is a part
Definition: curvegroup.h:203
void InsertCurve(size_t before, a2dCurve *curve, const wxString curvename=_T(""))
add a curve to the end of the exisiting curves.
Definition: curvegroup.h:744
const wxColour & GetColor() const
get color of axis text
Definition: curvegroup.h:194
a2dCurve * GetCurve(const wxString curvename)
return curve named curvename, if not available returns NULL
Definition: curvegroup.h:750
Special object group to plot a2dCurve Objects but also any other a2dCanvasObject. ...
Definition: curvegroup.h:394
Input and output handler for the XmlSer format.
Definition: genxmlpars.h:862
WX_DECLARE_STRING_HASH_MAP(a2dPropertyId *, a2dPropertyIdHashMap)
Declaration of the hash map type to convert prop names to prop id objects.
void SetShowXaxis(bool showxaxis)
show xaxis
Definition: curvegroup.h:554
a2dBoundingBox m_plotrect
placement in world coordinates
Definition: curvegroup.h:669
A 2x3 affine matrix class for 2D transformations.
Definition: afmatrix.h:53
Base class for curves.
Definition: curve.h:107
void SetShowLeftYaxis(const wxString &curveAreaName, bool showyaxis)
the a2dCurveArea with the given name is set as holding the left Yaxis
Definition: curvegroup.cpp:840
a2dCanvasXYDisplayGroupAreas * m_group
the group of which the area is a part
Definition: curvegroup.h:245
void SetAutoTicYPrecision(bool autoPrecision)
set
Definition: curvegroup.h:571
while iterating a a2dCanvasDocument, this holds the context.
Definition: canobj.h:3212
void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
Definition: polygon.cpp:1700
double GetTicY() const
tic distance in Y for the m_leftAxisY area
Definition: curvegroup.h:306
const a2dCurvesAreaList & GetCurvesAreaList() const
return reference to list of all a2dCurveArea objects used
Definition: curvegroup.h:409
a2dCurvesArea * GetCurvesArea(const wxString &curvesAreaName)
get a2dCurvesArea with the given name
Definition: curvegroup.cpp:573
void SetShowYaxis(bool showyaxis)
show yaxis
Definition: curvegroup.h:785
void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
Definition: polygon.cpp:1662
void SetColor(const wxColour &color)
set color of axis text
Definition: curvegroup.h:192
a2dBoundingBox GetCurvesBbox(void)
get the boundingbox in internal curve coordinates of all the curves
Definition: curvegroup.h:766
void SetShowGrid(bool showgrid)
show grid
Definition: curvegroup.h:577
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
Save settings.
Definition: curvegroup.h:36
virtual void DoAddPending(a2dIterC &ic)
called by addPending
Definition: canobj.cpp:4601
const a2dBoundingBox & GetInternalBoundaries() const
get the plotting rectangle in curve coordinates
Definition: curvegroup.h:107
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
Definition: bbox.h:39
a2dAffineMatrix m_iworld
internal coordinates used for curve plotting expressed as matrix
Definition: curvegroup.h:236
bool m_showyaxis
if true show the Y axis object
Definition: curvegroup.h:228
wxColour m_colour
color of axis text
Definition: curvegroup.h:242
a2dCanvasObjectList * GetCurves(void)
returns the list where the curves are stored in.
Definition: curvegroup.h:759
This template class is for property ids with a known data type.
Definition: id.h:477
void SetAxes(const a2dBoundingBox &extbox, double x, double y, double &zerox, double &zeroy, double &ixmin, double &ixmax)
sets m_axisY values
Definition: curvegroup.cpp:787
a2dCanvasObjectList * GetCurves()
returns the list where the curves are stored in.
Definition: curvegroup.h:155
a2dSmrtPtr< a2dCursor > m_cursor
cursor object
Definition: curvegroup.h:678
void SetInternalBoundaries(const a2dBoundingBox &extbox, const a2dBoundingBox &intbox)
set the internal curve boundaries, and update conversion to world matrix
Definition: curvegroup.h:94
list of a2dObject&#39;s
Definition: gen.h:3157
virtual bool Update(UpdateMode mode)
Update the state of the object according to its current position etc.
Definition: polygon.cpp:3272
CloneOptions
options for cloning
Definition: gen.h:1200
a2dSmrtPtr< a2dCurveAxis > m_axisX
x axis object
Definition: curvegroup.h:675
structure to give as parameter to member functions of a2dCanvasObject
Definition: canobj.h:252
int AppendCurvesBoundaries(a2dBboxHash *irectHash)
fills a2dBboxHash with rectangles representing the plotting area of a curve
Definition: curvegroup.cpp:658
virtual void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
Definition: canobj.cpp:5504
base class for curve area in a a2dCurvesAreaList, like used in a2dCanvasXYDisplayGroups ...
Definition: curvegroup.h:56
wxEditStyle
Definition: canobj.h:109
curvegroup.h Source File -- Sun Oct 12 2014 17:04:15 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation