00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __WXMARKER_H__
00017 #define __WXMARKER_H__
00018
00019 #ifndef WX_PRECOMP
00020 #include "wx/wx.h"
00021 #endif
00022
00023 #include "wx/curves/meta.h"
00024
00025
00026
00027
00028
00029
00030
00031 class A2DCURVESDLLEXP a2dBaseMarker: public a2dCurveObject
00032 {
00033 public:
00034
00035 a2dBaseMarker( const wxString& format = _T("%f") );
00036
00037 a2dBaseMarker( const wxString& format, double atx, double height = 0 );
00038
00039 a2dBaseMarker( const wxString& format, double atx, const a2dFont& font);
00040
00041 a2dBaseMarker( const a2dBaseMarker &other, CloneOptions options );
00042
00043 virtual ~a2dBaseMarker();
00044
00045 virtual a2dObject* Clone( CloneOptions options ) const;
00046
00047
00048
00049 void SetTextHeight (double height) { m_textheight = height; SetPending(true); }
00050
00051
00052
00053
00054
00055
00056
00057
00058 void Set(double xt, double yt, double l1, double l2, double b);
00059
00060
00061
00062
00063
00064
00065 void Set( double l1, double l2, double b);
00066
00067 void SetFont( const a2dFont& font) {
00068 m_font = font; SetPending(true);}
00069
00070 void SetStep( double step ) { m_step = step; SetPending(true); }
00071
00072 void SetPrompt( a2dText* prompttext);
00073
00074 a2dSmrtPtr<a2dText> GetPrompt() const {
00075 return m_promptText;}
00076
00077 void SetPromptFormat( const wxString& promptFromat) {
00078 m_promptFormat = promptFromat; SetPending(true);}
00079 virtual const wxString& GetMarkerString();
00080
00081 double GetL1() const { return m_l1; }
00082
00083 double GetL2() const { return m_l2; }
00084
00085 double GetBase() const { return m_b; }
00086
00087 bool GetSpline() const { return m_spline; }
00088
00089 void SetPosition( double position ) { m_position = position; SetPending(true); }
00090
00091 double GetPosition() const { return m_position; }
00092
00093 DECLARE_DYNAMIC_CLASS(a2dBaseMarker)
00094
00095 A2D_DECLARE_EVENT_TABLE()
00096
00097 protected:
00098
00099 #if wxART2D_USE_CVGIO
00100 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
00101
00102 void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
00103 #endif //wxART2D_USE_CVGIO
00104
00105 void OnEnterObject(a2dCanvasObjectMouseEvent &event);
00106 void OnLeaveObject(a2dCanvasObjectMouseEvent &event);
00107
00108 a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
00109
00110 bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
00111
00112 bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
00113
00114 void DoRender( a2dIterC& ic, OVERLAP clipparent );
00115
00116 wxString m_format;
00117
00118 double m_textheight;
00119
00120
00121 double m_l1;
00122
00123
00124 double m_l2;
00125
00126
00127 double m_b;
00128
00129
00130 bool m_spline;
00131
00132
00133 a2dFont m_font;
00134
00135
00136 double m_step;
00137
00138
00139 bool m_prompting;
00140
00141
00142 double m_position;
00143
00144 a2dSmrtPtr<a2dText> m_promptText;
00145 wxString m_promptString;
00146 wxString m_promptFormat;
00147
00148 public:
00149
00150 static a2dPropertyIdDouble* PROPID_PositionMarker;
00151
00152 DECLARE_PROPERTIES()
00153
00154 private:
00155
00156 a2dBaseMarker( const a2dBaseMarker &other );
00157 };
00158
00159 #if defined(WXART2D_USINGDLL)
00160 template class A2DCURVESDLLEXP a2dSmrtPtr<a2dBaseMarker>;
00161 template class A2DCURVESDLLEXP std::allocator<class a2dSmrtPtr<class a2dBaseMarker> >;
00162 template class A2DCURVESDLLEXP std::allocator< std::_List_nod<class a2dSmrtPtr<class a2dBaseMarker>, std::allocator<class a2dSmrtPtr<class a2dBaseMarker> > >::_Node >;
00163 template class A2DCURVESDLLEXP std::allocator< std::_List_ptr<class a2dSmrtPtr<class a2dBaseMarker>, std::allocator<class a2dSmrtPtr<class a2dBaseMarker> > >::_Nodeptr >;
00164 template class A2DCURVESDLLEXP std::list<class a2dSmrtPtr<class a2dBaseMarker> >;
00165 template class A2DCURVESDLLEXP a2dlist<class a2dSmrtPtr<class a2dBaseMarker> >;
00166 template class A2DCURVESDLLEXP a2dSmrtPtrList<a2dBaseMarker>;
00167 #endif
00168
00169
00170
00171
00172
00173
00174
00175 class A2DCURVESDLLEXP a2dAxisMarker : public a2dBaseMarker
00176 {
00177 public:
00178
00179 a2dAxisMarker( const wxString& format = _T("%f") , a2dCurveAxis* axis = 0 );
00180
00181 a2dAxisMarker( const wxString& format, a2dCurveAxis* curve, double atx, double height = 0 );
00182
00183 a2dAxisMarker( const wxString& format, a2dCurveAxis* curve , double atx, const a2dFont& font);
00184
00185 a2dAxisMarker( const a2dAxisMarker &other, CloneOptions options );
00186
00187 virtual ~a2dAxisMarker();
00188
00189 virtual a2dObject* Clone( CloneOptions options ) const;
00190
00191 void SetAxis( a2dCurveAxis* curve ) { m_axis = curve; SetPending(true); }
00192
00193 a2dCurveAxis* GetAxis() const { return m_axis; }
00194
00195 virtual const wxString& GetMarkerString();
00196
00197 DECLARE_DYNAMIC_CLASS(a2dAxisMarker)
00198
00199 A2D_DECLARE_EVENT_TABLE()
00200
00201 public:
00202 static a2dPropertyIdCanvasObject* PROPID_axis;
00203
00204 DECLARE_PROPERTIES()
00205
00206 protected:
00207
00208 void DoWalker( wxObject* parent, a2dWalkerIOHandler& handler );
00209
00210 void DoAddPending( a2dIterC& ic );
00211
00212
00213
00214
00215
00216 void OnCanvasObjectMouseEvent( a2dCanvasObjectMouseEvent& event );
00217
00218 #if wxART2D_USE_CVGIO
00219 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
00220
00221 void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
00222 #endif //wxART2D_USE_CVGIO
00223
00224 void DependencyPending( a2dWalkerIOHandler* WXUNUSED(handler) );
00225
00226 bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
00227
00228 a2dSmrtPtr<a2dCurveAxis> m_axis;
00229
00230 private:
00231
00232 a2dAxisMarker( const a2dAxisMarker &other );
00233 };
00234
00235
00236
00237
00238
00239
00240
00241
00242 class A2DCURVESDLLEXP a2dMarker : public a2dBaseMarker
00243 {
00244 public:
00245
00246
00247
00248
00249
00250
00251 a2dMarker( const wxString& format = _T("%f %f") , a2dCurve* curve = 0 );
00252
00253
00254
00255
00256
00257
00258
00259
00260 a2dMarker( const wxString& format, a2dCurve* curve, double atx, double height = 0 );
00261
00262
00263
00264
00265
00266
00267
00268
00269 a2dMarker( const wxString& format, a2dCurve* curve , double atx, const a2dFont& font);
00270
00271
00272 a2dMarker( const a2dMarker &other, CloneOptions options );
00273
00274 virtual ~a2dMarker();
00275
00276 void CalculatePositionMarker( double& xw, double& yw );
00277
00278
00279
00280
00281
00282
00283 bool GetPositionCurvePoint( a2dPoint2D& point );
00284
00285 virtual a2dObject* Clone( CloneOptions options ) const;
00286
00287 void SetCurve( a2dCurve* curve ) { m_curve = curve; }
00288
00289
00290 a2dCurve* GetCurve() const { return m_curve; }
00291
00292
00293 virtual const wxString& GetMarkerString();
00294
00295 DECLARE_DYNAMIC_CLASS(a2dMarker)
00296
00297 A2D_DECLARE_EVENT_TABLE()
00298
00299 public:
00300 static a2dPropertyIdCanvasObject* PROPID_curve;
00301
00302 DECLARE_PROPERTIES()
00303
00304 protected:
00305
00306 void OnChar(wxKeyEvent& event);
00307
00308 void DoWalker( wxObject* parent, a2dWalkerIOHandler& handler );
00309
00310 void DoAddPending( a2dIterC& ic );
00311
00312
00313
00314
00315
00316 void OnCanvasObjectMouseEvent( a2dCanvasObjectMouseEvent& event );
00317
00318 #if wxART2D_USE_CVGIO
00319 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
00320
00321 void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
00322 #endif //wxART2D_USE_CVGIO
00323
00324 void DependencyPending( a2dWalkerIOHandler* WXUNUSED(handler) );
00325
00326 bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
00327
00328 a2dSmrtPtr<a2dCurve> m_curve;
00329
00330 private:
00331
00332 a2dMarker( const a2dMarker &other );
00333 };
00334
00335 #if defined(WXART2D_USINGDLL)
00336 template class A2DCURVESDLLEXP a2dSmrtPtr<a2dMarker>;
00337 #endif
00338
00339
00340
00341
00342
00343
00344 class A2DCURVESDLLEXP a2dBandMarker : public a2dMarker
00345 {
00346 public:
00347
00348 a2dBandMarker( const wxString& format = _T("%f") , a2dBandCurve* curve = 0 );
00349
00350 a2dBandMarker( const wxString& format, a2dBandCurve* curve, double atx, double height = 0 );
00351
00352 a2dBandMarker( const wxString& format, a2dBandCurve* curve , double atx, const a2dFont& font);
00353
00354 a2dBandMarker( const a2dBandMarker &other, CloneOptions options );
00355
00356 virtual ~a2dBandMarker();
00357
00358
00359 void SetMarkerUpLow( bool markerUpLow ) { m_markerUpLow = markerUpLow; }
00360
00361 void CalculatePositionMarker( double& xw, double& yw );
00362
00363
00364
00365
00366
00367
00368 bool GetPositionCurvePoint( a2dPoint2D& point );
00369
00370 virtual a2dObject* Clone( CloneOptions options ) const;
00371
00372 DECLARE_DYNAMIC_CLASS(a2dBandMarker)
00373
00374 protected:
00375
00376 #if wxART2D_USE_CVGIO
00377 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
00378
00379 void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
00380 #endif //wxART2D_USE_CVGIO
00381
00382 private:
00383
00384 void DoRender( a2dIterC& ic, OVERLAP clipparent );
00385
00386
00387 a2dBandMarker( const a2dBandMarker &other );
00388
00389 bool m_markerUpLow;
00390
00391 a2dSmrtPtr<a2dBandCurve> m_curveBand;
00392 };
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402 class A2DCURVESDLLEXP a2dMarkerShow: public a2dCanvasObject
00403 {
00404 public:
00405
00406 a2dMarkerShow( double x = 0, double y = 0,
00407 const wxString& XLabel = _T("X = "), const wxString& YLabel = _T("Y = "),
00408 const wxString& XValueformat = _T("%f"), const wxString& YValueformat = _T("%f"),
00409 a2dMarker* marker = 0, double height = 0 );
00410
00411 a2dMarkerShow( const a2dMarkerShow &other, CloneOptions options );
00412
00413 virtual ~a2dMarkerShow();
00414
00415 virtual a2dObject* Clone( CloneOptions options ) const;
00416
00417 void SetMarker( a2dMarker* marker ) { m_marker = marker; }
00418
00419 a2dMarker* GetMarker() const { return m_marker; }
00420
00421
00422 void SetTextHeight (double height) { m_textheight = height; SetPending(true); }
00423
00424 a2dSmrtPtr<a2dText>& GetXLabel() { return m_Xlabel; }
00425 a2dSmrtPtr<a2dText>& GetYLabel() { return m_Ylabel; }
00426 a2dSmrtPtr<a2dText>& GetXText() { return m_xText; }
00427 a2dSmrtPtr<a2dText>& GetYText() { return m_yText; }
00428
00429
00430 void OnPropertyChanged( const a2dPropertyId* id);
00431
00432 DECLARE_DYNAMIC_CLASS(a2dMarkerShow)
00433
00434 A2D_DECLARE_EVENT_TABLE()
00435
00436 protected:
00437
00438 void DoWalker( wxObject* parent, a2dWalkerIOHandler& handler );
00439
00440 bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
00441
00442 void OnCanvasObjectMouseEvent( a2dCanvasObjectMouseEvent& event );
00443
00444 #if wxART2D_USE_CVGIO
00445 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
00446
00447 void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
00448 #endif //wxART2D_USE_CVGIO
00449
00450 a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
00451
00452 void DependencyPending( a2dWalkerIOHandler* WXUNUSED(handler) );
00453
00454 bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
00455
00456 void DoRender( a2dIterC& ic, OVERLAP clipparent );
00457
00458 bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
00459
00460 wxString m_XValueformat;
00461
00462 wxString m_YValueformat;
00463
00464 double m_textheight;
00465
00466 a2dSmrtPtr<a2dMarker> m_marker;
00467
00468 a2dSmrtPtr<a2dText> m_xText;
00469
00470 a2dSmrtPtr<a2dText> m_yText;
00471
00472 a2dSmrtPtr<a2dText> m_Xlabel;
00473
00474 a2dSmrtPtr<a2dText> m_Ylabel;
00475
00476 public:
00477 static a2dPropertyIdCanvasObject* PROPID_marker;
00478 static a2dPropertyIdCanvasObject* PROPID_xText;
00479 static a2dPropertyIdCanvasObject* PROPID_yText;
00480 static a2dPropertyIdCanvasObject* PROPID_Xlabel;
00481 static a2dPropertyIdCanvasObject* PROPID_Ylabel;
00482
00483 DECLARE_PROPERTIES()
00484
00485 private:
00486
00487 a2dMarkerShow( const a2dMarkerShow &other );
00488 };
00489
00490
00491
00492
00493
00494 class A2DCURVESDLLEXP a2dCursorMarkerList: public a2dSmrtPtrList<a2dBaseMarker>
00495 {
00496 public:
00497 a2dCursorMarkerList();
00498
00499 ~a2dCursorMarkerList();
00500
00501 a2dCursorMarkerList* Clone( a2dObject::CloneOptions options ) const;
00502
00503 };
00504
00505
00506 class A2DCURVESDLLEXP a2dCursor : public a2dCanvasObject
00507 {
00508 public:
00509 a2dCursor( double csize = 0. );
00510
00511 a2dCursor( const a2dCursor &other, CloneOptions options );
00512
00513 virtual ~a2dCursor();
00514
00515 virtual a2dObject* Clone( CloneOptions options ) const;
00516
00517 void SetHSize(double hsize) {
00518 if(m_hsize != hsize) {
00519 m_hsize = hsize;
00520 SetPending(true);}}
00521 void SetWSize(double wsize) {
00522 if(m_wsize != wsize) {
00523 m_wsize = wsize;
00524 SetPending(true);}}
00525
00526 void SetCSize(double csize) {
00527 if(m_csize != csize) {
00528 m_csize = csize;
00529 SetPending(true);}}
00530
00531 void AddMarker(a2dBaseMarker* marker );
00532
00533 void RemoveMarker(a2dBaseMarker* marker );
00534
00535 void RemoveMarkers();
00536
00537 void SetPosition(double posx, double posy, const a2dAffineMatrix& mat );
00538
00539 bool GetPosition(double& posx, double& posy);
00540
00541
00542 void SetIntPosX(bool onlyIntPosX) {m_onlyIntPosX = onlyIntPosX; }
00543
00544 void SetIntPosY(bool onlyIntPosY) {m_onlyIntPosY = onlyIntPosY; }
00545
00546 double ConvertAxis2World( double percentValue );
00547
00548 bool CheckPosition(double posx);
00549
00550 virtual void UpdatePosition(double minx, double miny, const a2dAffineMatrix& mat );
00551
00552 virtual void SetPending( bool pending );
00553
00554 DECLARE_DYNAMIC_CLASS(a2dCursor)
00555
00556 A2D_DECLARE_EVENT_TABLE()
00557
00558 protected:
00559
00560 a2dBoundingBox DoGetUnTransformedBbox(a2dBboxFlags flags = a2dCANOBJ_BBOX_NON);
00561 void DoUpdateViewDependentTransform( a2dIterC& ic );
00562
00563 void DoRender( a2dIterC& ic, OVERLAP clipparent );
00564
00565 double m_csize;
00566 double m_hsize;
00567 double m_wsize;
00568 double m_posx;
00569 double m_posy;
00570
00571
00572 bool m_onlyIntPosX;
00573
00574 bool m_onlyIntPosY;
00575
00576
00577 a2dCursorMarkerList m_markers;
00578
00579
00580 a2dBoundingBox m_untransbbox;
00581
00582 private:
00583
00584 a2dCursor( const a2dCursor &other );
00585 };
00586
00587 typedef a2dSmrtPtr<a2dCursor> a2dCursorPtr;
00588
00589 class A2DCURVESDLLEXP a2dCursorAxisMarker : public a2dAxisMarker
00590 {
00591 public:
00592
00593 a2dCursorAxisMarker( const wxString& format = _T("%f") , a2dCurveAxis* axis = 0, a2dCursor* cursor = 0);
00594
00595 a2dCursorAxisMarker( const wxString& format, a2dCurveAxis* curve, a2dCursor* cursor, double atx, double aty, double height = 0 );
00596
00597 a2dCursorAxisMarker( const wxString& format, a2dCurveAxis* curve, a2dCursor* cursor, double atx, double aty, const a2dFont& font);
00598
00599 a2dCursorAxisMarker( const a2dCursorAxisMarker &other, CloneOptions options );
00600
00601 virtual ~a2dCursorAxisMarker();
00602
00603 virtual a2dObject* Clone( CloneOptions options ) const;
00604
00605 void SetCursor( a2dCursor* cursor ) { m_cursor = cursor; SetPending(true); }
00606
00607 a2dCursor* GetCursor() const { return m_cursor; }
00608
00609 void SetPositionY(double posY) { m_positionY = posY;}
00610
00611 DECLARE_DYNAMIC_CLASS(a2dCursorAxisMarker)
00612
00613 static a2dPropertyIdCanvasObject* PROPID_cursor;
00614
00615 DECLARE_PROPERTIES()
00616
00617 protected:
00618
00619 #if wxART2D_USE_CVGIO
00620 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
00621
00622 void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
00623 #endif //wxART2D_USE_CVGIO
00624
00625 void DependencyPending( a2dWalkerIOHandler* WXUNUSED(handler) );
00626
00627 bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
00628
00629 double m_positionY;
00630 a2dSmrtPtr<a2dCursor> m_cursor;
00631
00632 private:
00633
00634 a2dCursorAxisMarker( const a2dCursorAxisMarker &other );
00635 };
00636
00637 #endif
00638