00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef __A2DARTGLOB_H__
00014 #define __A2DARTGLOB_H__
00015
00016 #ifndef WX_PRECOMP
00017 #include "wx/wx.h"
00018 #endif
00019
00020 #include <wx/module.h>
00021
00022 #include "wx/geometry.h"
00023 #include "wx/general/genmod.h"
00024
00025 #ifdef A2DARTBASEMAKINGDLL
00026 #define A2DARTBASEDLLEXP WXEXPORT
00027 #define A2DARTBASEDLLEXP_DATA(type) WXEXPORT type
00028 #define A2DARTBASEDLLEXP_CTORFN
00029 #elif defined(WXART2D_USINGDLL)
00030 #define A2DARTBASEDLLEXP WXIMPORT
00031 #define A2DARTBASEDLLEXP_DATA(type) WXIMPORT type
00032 #define A2DARTBASEDLLEXP_CTORFN
00033 #else // not making nor using DLL
00034 #define A2DARTBASEDLLEXP
00035 #define A2DARTBASEDLLEXP_DATA(type) type
00036 #define A2DARTBASEDLLEXP_CTORFN
00037 #endif
00038
00039
00040
00041 #define a2dACCUR 1e-6
00042
00043
00044 #ifdef wxUSE_INTPOINT
00045 typedef wxPoint2DInt a2dPoint2D;
00046 #else
00047 typedef wxPoint2DDouble a2dPoint2D;
00048 #endif
00049
00050
00051 A2DARTBASEDLLEXP_DATA( extern const double ) wxPI;
00052
00053
00054 extern A2DARTBASEDLLEXP double wxDegToRad( double deg );
00055
00056
00057 extern A2DARTBASEDLLEXP double wxRadToDeg( double rad );
00058
00059
00060 #define Round( x ) (int) floor( (x) + 0.5 )
00061
00062
00063 extern A2DARTBASEDLLEXP void Aberration( double aber, double angle, double radius, double& dphi, unsigned int& segments );
00064
00065
00066 inline double wxSqr( double x ) { return x * x; }
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 class A2DARTBASEDLLEXP a2dArtBaseModule : public wxModule
00077 {
00078 public:
00079
00080 a2dArtBaseModule();
00081
00082 virtual bool OnInit();
00083 virtual void OnExit();
00084
00085 private:
00086 DECLARE_DYNAMIC_CLASS( a2dArtBaseModule )
00087 };
00088
00089
00090 class A2DARTBASEDLLEXP a2dGlobal : public a2dGeneralGlobal
00091 {
00092
00093 DECLARE_CLASS( a2dGlobal )
00094
00095 public:
00096
00097
00098 a2dGlobal();
00099
00100
00101 virtual ~a2dGlobal();
00102
00103
00104
00105
00106
00107 void Aberration( double angle, double radius, double& dphi, unsigned int& segments );
00108
00109
00110
00111
00112
00113
00114 static void SetDisplayAberration( double aber ) { m_displayaberration = aber; }
00115
00116
00117
00118 static double GetDisplayAberration() { return m_displayaberration; }
00119
00120 static void SetRoundFactor( double roundFactor ) { m_roundFactor = roundFactor; }
00121
00122
00123
00124 static double GetRoundFactor() { return m_roundFactor; }
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134 inline static void SetPrimitiveThreshold( wxUint16 pixels, bool asrect = true ) { m_drawingthreshold = pixels; m_asrectangle = asrect; }
00135
00136
00137 inline void SetPolygonFillThreshold( wxUint16 pixels ) { m_polygonFillThreshold = pixels; }
00138
00139
00140 inline wxUint16 GetPolygonFillThreshold() { return m_polygonFillThreshold; }
00141
00142
00143 inline static wxUint16 GetPrimitiveThreshold() { return m_drawingthreshold; }
00144
00145
00146 inline static bool GetThresholdDrawRectangle() { return m_asrectangle; }
00147
00148
00149 a2dPathList& GetFontPathList() { return m_fontpath; }
00150
00151
00152 a2dPathList& GetImagePathList() { return m_imagepath; }
00153
00154
00155 a2dPathList& GetIconPathList() { return m_iconpath; }
00156
00157
00158 inline static void SetAberPolyToArc( double aber ) { m_poly2arcaber = aber; }
00159
00160
00161 inline static double GetAberPolyToArc() { return m_poly2arcaber; }
00162
00163
00164 inline static void SetAberArcToPoly( double aber ) { m_arc2polyaber = aber; }
00165
00166
00167 inline static double GetAberArcToPoly() { return m_arc2polyaber; }
00168
00169 protected:
00170
00171 static a2dPathList m_fontpath;
00172
00173 static a2dPathList m_imagepath;
00174
00175 static a2dPathList m_iconpath;
00176
00177
00178 static wxUint16 m_drawingthreshold;
00179
00180
00181 static wxUint16 m_polygonFillThreshold;
00182
00183
00184 static bool m_asrectangle;
00185
00186
00187 static double m_arc2polyaber;
00188
00189 static double m_poly2arcaber;
00190
00191 static double m_displayaberration;
00192
00193 static double m_roundFactor;
00194
00195 };
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208 class a2dDoMu
00209 {
00210 public:
00211 a2dDoMu();
00212 ~a2dDoMu();
00213
00214
00215 a2dDoMu( double number, double multi = 1, bool normalize = true);
00216
00217 a2dDoMu( double number, const wxString& multi );
00218
00219 a2dDoMu( const wxString& number, const wxString& multi );
00220
00221
00222 a2dDoMu( const wxString& numberMulti );
00223
00224
00225 bool Eval( const wxString& param );
00226
00227 double GetValue() const;
00228
00229 double GetNumber() const;
00230
00231 double GetMultiplier() const;
00232
00233 wxString GetValueString() const;
00234
00235 wxString GetMultiplierString() const;
00236
00237 wxString GetNumberString() const;
00238
00239
00240 static wxString GetMultiplierString( double multi );
00241
00242
00243 static bool GetMultiplierFromString( const wxString& mul, double& multi );
00244
00245
00246 a2dDoMu& operator=( const a2dDoMu& );
00247
00248 a2dDoMu& operator=( const wxChar* );
00249
00250 operator double() const;
00251
00252 a2dDoMu& operator=( double );
00253 int operator==( const a2dDoMu& ) const;
00254 int operator!=( const a2dDoMu& ) const;
00255
00256
00257 static void SetAccuracy( int accur ) { m_accuracy = accur; }
00258
00259 protected:
00260
00261 double m_multi;
00262
00263 double m_number;
00264
00265
00266 static int m_accuracy;
00267 };
00268
00269
00270 A2DARTBASEDLLEXP_DATA( extern a2dGlobal* ) a2dGlobals;
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280 enum a2dDrawStyle
00281 {
00282 a2dFILLED,
00283 a2dWIREFRAME,
00284 a2dWIREFRAME_ZERO_WIDTH,
00285 a2dWIREFRAME_INVERT,
00286 a2dWIREFRAME_INVERT_ZERO_WIDTH,
00287 a2dFIX_STYLE,
00288 a2dFIX_STYLE_INVERT
00289 };
00290
00291 #include <wx/dynarray.h>
00292
00293 #include <wx/listimpl.cpp>
00294
00295 #if defined(WXART2D_USINGDLL)
00296 template class A2DARTBASEDLLEXP std::allocator<wxPoint>;
00297 template class A2DARTBASEDLLEXP std::vector<wxPoint>;
00298 template class A2DARTBASEDLLEXP std::allocator<wxRealPoint>;
00299 template class A2DARTBASEDLLEXP std::vector<wxRealPoint>;
00300 #endif
00301
00302
00303
00304
00305
00306 class A2DARTBASEDLLEXP a2dAET
00307 {
00308 public:
00309 void CalculateLineParameters( const wxRealPoint& p1 , const wxRealPoint& p2 );
00310 void CalculateXs( double y );
00311
00312
00313 bool m_horizontal;
00314 double m_BdivA;
00315 double m_CdivA;
00316 int m_index;
00317 int m_direction;
00318
00319 int m_xs;
00320 };
00321
00322
00323 WX_DECLARE_LIST_WITH_DECL( a2dAET, a2dAETList, class A2DARTBASEDLLEXP );
00324
00325
00326 WX_DECLARE_LIST_WITH_DECL( int, a2dCriticalPointList, class A2DARTBASEDLLEXP );
00327
00328 #include <wx/listimpl.cpp>
00329
00330
00331 WX_DECLARE_LIST_WITH_DECL( wxRegion, a2dClipRegionList, class A2DARTBASEDLLEXP );
00332
00333
00334 const int SPLINE_STEP = 20;
00335
00336 #endif
00337