00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __WXAXIS_H__
00017 #define __WXAXIS_H__
00018
00019 #ifndef WX_PRECOMP
00020 #include "wx/wx.h"
00021 #endif
00022
00023 #include "wx/curves/meta.h"
00024
00025 class A2DCURVESDLLEXP a2dCurveAxis;
00026
00027
00028
00029
00030
00031 class A2DCURVESDLLEXP a2dTicFormatter : public a2dCanvasObject
00032 {
00033
00034 public:
00035
00036 a2dTicFormatter();
00037
00038
00039 virtual ~a2dTicFormatter();
00040
00041 a2dTicFormatter( const a2dTicFormatter& other, CloneOptions options );
00042
00043 virtual a2dObject* Clone( CloneOptions options ) const;
00044
00045
00046 void SetAxis( a2dCurveAxis* axis ) { m_axis = axis; }
00047
00048
00049 virtual void SetTicFormat( const wxString& format ) { m_format = format; }
00050
00051
00052 virtual wxString GetTicText(double dTicValue) const;
00053
00054
00055 const wxString& GetTicFormat() const { return m_format;}
00056
00057 DECLARE_CLASS(a2dTicFormatter)
00058
00059 protected:
00060
00061
00062 a2dCurveAxis* m_axis;
00063
00064
00065 wxString m_format;
00066 };
00067
00068 #if defined(WXART2D_USINGDLL)
00069 template class A2DCURVESDLLEXP a2dSmrtPtr<a2dTicFormatter>;
00070 #endif
00071
00072 class A2DCURVESDLLEXP a2dTimeTicFormatter : public a2dTicFormatter
00073 {
00074
00075 public:
00076
00077 a2dTimeTicFormatter();
00078
00079
00080 virtual ~a2dTimeTicFormatter();
00081
00082
00083 void SetTicFormat( const wxString& format );
00084
00085 virtual wxString GetTicText(double dTicValue);
00086
00087 virtual bool CanRender() { return FALSE; }
00088
00089 virtual void DoRender( a2dIterC& WXUNUSED(ic), OVERLAP WXUNUSED(clipparent) ) {}
00090
00091 DECLARE_CLASS(a2dTimeTicFormatter)
00092
00093 };
00094
00095 #if defined(WXART2D_USINGDLL)
00096 template class A2DCURVESDLLEXP a2dSmrtPtr<a2dTimeTicFormatter>;
00097 #endif
00098
00099
00100
00101
00102
00103 class A2DCURVESDLLEXP a2dCurveAxis: public a2dCurveObject
00104 {
00105 public:
00106
00107 a2dCurveAxis( double length = 0, bool yaxis = false );
00108
00109 virtual ~a2dCurveAxis();
00110
00111 a2dCurveAxis( const a2dCurveAxis &other, CloneOptions options );
00112
00113 virtual a2dObject* Clone( CloneOptions options ) const;
00114
00115
00116
00117 void SetBoundaries( double min, double max );
00118
00119
00120
00121
00122
00123
00124
00125 void SetTicBoundaries( double min, double max );
00126
00127 double GetTicMin(void) const { return m_ticmin;}
00128
00129 double GetTicMax(void) const { return m_ticmax;}
00130
00131
00132
00133
00134
00135 double GetAxisMin() const { return wxMin( m_min, m_max ); }
00136
00137
00138
00139
00140
00141 double GetAxisMax() const { return wxMax( m_min, m_max ); }
00142
00143
00144
00145
00146
00147
00148 double GetBoundaryMin() const { return m_min; }
00149
00150
00151
00152
00153
00154
00155 double GetBoundaryMax() const { return m_max; }
00156
00157
00158
00159
00160
00161 void SetLength( double length );
00162
00163
00164 double GetLength() const { return m_length; }
00165
00166
00167 bool IsYAxis() const { return m_yaxis; }
00168
00169
00170
00171
00172
00173 void SetPosition( double position ) { m_position = position; SetPending(true); }
00174
00175
00176 double GetPosition() const { return m_position; }
00177
00178
00179 void SetShowTics(bool showtics) { m_showtics = showtics; SetPending(true); }
00180
00181
00182 void SetTic (double d) { m_tic = d; SetPending(true); }
00183
00184
00185 double GetTic() const { return ( m_tic == 0 ) ? (m_max-m_min)/10 : m_tic; }
00186
00187 double GetTicStart() const;
00188
00189
00190 void SetTicHeight (double height) { m_ticheight = height; SetPending(true); }
00191
00192 double GetTicHeight() const { return ( m_ticheight == 0 ) ? m_length/100 : m_ticheight; }
00193
00194
00195 void SetTicTextHeight (double height) { m_font.SetSize( height ); SetPending(true); }
00196
00197
00198 double GetTicTextHeight() const { return m_font.GetSize(); }
00199
00200
00201 void SetSideTic(bool sidetic) { m_sidetic = sidetic; SetPending(true); }
00202
00203
00204 void SetTicFormat( const wxString& format ) { m_pTicFormatter->SetTicFormat(format); SetPending(true); }
00205
00206
00207 void SetCommonTicFormat( const wxString& format ) { m_commonTicFormat = format; SetPending(true); }
00208
00209
00210 void SetTicStroke( const a2dStroke& stroke);
00211
00212
00213 void SetTicTextStroke( const a2dStroke& stroke);
00214
00215
00216 void SetFontTic( const a2dFont& font) { m_font = font;}
00217
00218
00219 void SetAxisStroke( const a2dStroke& stroke);
00220
00221
00222 void SetUnits(const wxString& units) { m_units = units; SetPending(true); }
00223
00224 void SetUnitsStroke( const a2dStroke& stroke);
00225
00226 void SetUnitsStroke(const wxColour& color, double width=0, a2dStrokeStyle style = a2dSTROKE_SOLID );
00227
00228 const wxString& GetUnits() const { return m_units; }
00229
00230 void SetInvertTic(bool inverttic);
00231
00232 void SetAutoSizedTic(bool autosized) { if (m_autosizedtic != autosized) { m_autosizedtic = autosized; SetPending(true); } }
00233
00234 virtual void AddLevel(const wxString& levelName, double val, a2dCanvasObject* object);
00235
00236 a2dCanvasObject* GetLevel(const wxString& levelName);
00237
00238 bool GetLevelValue(const wxString& levelName, double& val );
00239
00240 void MirrorLevels();
00241
00242 double ConvertWorld2Axis( double RelativeWorldValue );
00243
00244 double ConvertAxis2World( double AxisValue );
00245
00246
00247 void SetFormatter(a2dTicFormatter* pFormatter);
00248
00249
00250 a2dTicFormatter* GetFormatter() { return m_pTicFormatter; }
00251
00252 DECLARE_CLASS(a2dCurveAxis)
00253
00254 protected:
00255
00256 bool HasLevelMarkers() const;
00257
00258 a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
00259 void DoUpdateViewDependentObjects( a2dIterC& ic );
00260
00261 #if wxART2D_USE_CVGIO
00262 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
00263
00264 void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
00265 #endif //wxART2D_USE_CVGIO
00266
00267 protected:
00268
00269 a2dCurveAxis( const a2dCurveAxis &other );
00270
00271
00272 double m_length;
00273
00274
00275 double m_min;
00276
00277 double m_max;
00278
00279
00280 double m_ticmin;
00281
00282 double m_ticmax;
00283
00284
00285 double m_position;
00286
00287
00288 bool m_yaxis;
00289
00290
00291 bool m_showtics;
00292
00293
00294 double m_tic;
00295
00296
00297 double m_ticheight;
00298
00299
00300 bool m_sidetic;
00301
00302
00303 bool m_inverttic;
00304
00305
00306 bool m_autosizedtic;
00307
00308
00309 a2dFont m_font;
00310
00311
00312 wxString m_units;
00313
00314 a2dStroke m_stroketic;
00315 a2dStroke m_stroketictext;
00316 a2dStroke m_strokeaxis;
00317
00318 a2dStroke m_strokeunits;
00319
00320
00321 a2dSmrtPtr<a2dTicFormatter> m_pTicFormatter;
00322
00323
00324 wxString m_commonTicFormat;
00325
00326 mutable a2dBoundingBox m_untransbboxtictext;
00327
00328
00329
00330
00331
00332 };
00333
00334
00335 #if defined(WXART2D_USINGDLL)
00336 template class A2DCURVESDLLEXP a2dSmrtPtr<a2dCurveAxis>;
00337 #endif
00338
00339
00340
00341
00342
00343 class A2DCURVESDLLEXP a2dCurveAxisLin: public a2dCurveAxis
00344 {
00345 public:
00346
00347 a2dCurveAxisLin( double length = 0, bool yaxis = false );
00348
00349 virtual ~a2dCurveAxisLin();
00350
00351 virtual a2dObject* Clone( CloneOptions options ) const;
00352
00353 a2dCurveAxisLin( const a2dCurveAxisLin &other, CloneOptions options );
00354
00355 DECLARE_CLASS(a2dCurveAxisLin)
00356
00357 protected:
00358
00359 void DoRender( a2dIterC& ic, OVERLAP clipparent );
00360
00361 #if wxART2D_USE_CVGIO
00362 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
00363
00364 void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
00365 #endif //wxART2D_USE_CVGIO
00366
00367 private:
00368
00369 a2dCurveAxisLin( const a2dCurveAxisLin &other );
00370
00371 };
00372
00373
00374 #if 0
00375
00376
00377
00378
00379 class A2DCURVESDLLEXP a2dCurveAxisArea: public a2dCurveObject
00380 {
00381 public:
00382
00383 a2dCurveAxisArea();
00384
00385 virtual ~a2dCurveAxisArea();
00386
00387 a2dCurveAxisArea( const a2dCurveAxisArea &other, CloneOptions options );
00388
00389 virtual a2dObject* Clone( CloneOptions options ) const;
00390
00391 a2dCurveAxis* GetAxis( const wxString axisname );
00392 a2dCurveAxis* GetAxis( int nIndex );
00393
00394
00395
00396
00397
00398 void SetLength( double length );
00399
00400
00401 double GetLength() { return m_length; }
00402
00403 DECLARE_CLASS(a2dCurveAxisArea)
00404
00405 protected:
00406
00407 a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
00408
00409 bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
00410
00411 void DoRender( a2dIterC& ic, OVERLAP clipparent );
00412
00413 protected:
00414
00415
00416 double m_length;
00417
00418 };
00419 #endif // ifdef 0
00420
00421 #endif
00422