24 WX_DEFINE_LIST( a2dClipRegionList );
25 WX_DEFINE_LIST( a2dAETList );
26 WX_DEFINE_LIST( a2dCriticalPointList );
28 const double wxPI = 3.1415926535897932384626433832795;
30 A2DARTBASEDLLEXP
double wxDegToRad(
double deg ) {
return ( deg *
wxPI ) / 180.0; }
31 A2DARTBASEDLLEXP
double wxRadToDeg(
double rad ) {
return ( rad * 180 ) /
wxPI; }
44 a2dGeneralGlobals->GetVariablesHash().SetVariableString( wxT(
"wxart2dlayers" ), wxT(
"wxart2dlayers.cvg" ) );
45 a2dGeneralGlobals->GetVariablesHash().SetVariableString( wxT(
"layerFileSavePath" ), wxGetHomeDir() );
49 bool a2dArtBaseModule::OnInit()
59 void a2dArtBaseModule::OnExit()
67 void Aberration(
double aber,
double angle,
double radius,
double& dphi,
unsigned int& segments )
72 dphi = 2.0 * acos( ( radius - aber ) / radius );
75 if ( dphi <
wxPI / 180.0 )
79 if ( dphi >
wxPI / 4 )
83 segments = (
unsigned int ) ceil( fabs( angle ) / dphi );
88 dphi = angle / segments;
102 double a2dGlobal::m_poly2arcaber = 0;
103 double a2dGlobal::m_displayaberration = 0;
104 double a2dGlobal::m_roundFactor = 1.5;
110 m_iconpath.Add( wxT(
"." ) );
111 m_iconpath.Add( wxT(
"./icon" ) );
112 m_iconpath.Add( wxT(
".." ) );
113 m_iconpath.Add( wxT(
"../common/icons" ) );
114 m_iconpath.Add( wxT(
"../../common/icons" ) );
116 m_imagepath.Add( wxT(
"." ) );
117 m_imagepath.Add( wxT(
"./images" ) );
118 m_imagepath.Add( wxT(
".." ) );
119 m_imagepath.Add( wxT(
"../common/images" ) );
120 m_imagepath.Add( wxT(
"../../common/images" ) );
123 wxGetEnv( wxT(
"TRUETYPE" ), &envValue );
125 m_fontpath.Add( envValue );
128 if ( ! art2dPath.IsEmpty() )
130 m_fontpath.Add( art2dPath +
"fonts" );
131 m_fontpath.Add( art2dPath +
"fonts/liberation-fonts-ttf-2.00.1" );
132 m_imagepath.Add( art2dPath +
"layers" );
134 m_fontpath.Add( wxT(
"./fonts" ) );
135 #if defined(__WXMSW__)
136 m_fontpath.Add( wxGetOSDirectory() + wxT(
"\\Fonts\\" ) );
138 m_fontpath.Add(
"/usr/share/fonts/truetype" );
139 #endif // defined(__WXMSW__)
144 m_drawingthreshold = 3;
145 m_polygonFillThreshold = 0;
146 m_asrectangle =
false;
147 m_displayaberration = 0.5;
172 a2dDoMu::a2dDoMu(
double number,
double multi,
bool normalize )
179 if ( multi >= 1e-12 && multi < 1e-9 )
184 else if ( multi >= 1e-9 && multi < 1e-6 )
189 else if ( multi >= 1e-6 && multi < 1e-3 )
194 else if ( multi >= 1e-3 && multi < 1e-2 )
199 else if ( multi >= 1e-2 && multi < 1e-1 )
204 else if ( multi >= 0.1 && multi < 1 )
209 else if ( multi >= 1 && multi < 1000 )
214 else if ( multi == 0.00254 )
219 else if ( multi == 0.0254 )
227 a2dDoMu::a2dDoMu(
double number,
const wxString& multi )
233 a2dDoMu::a2dDoMu(
const wxString& number,
const wxString& multi )
239 a2dDoMu::a2dDoMu(
const wxString& numberMulti )
264 wxString multistr = wxT(
"" );
266 if ( multi == 1e-12 )
267 multistr = wxT(
"pm" );
268 else if ( multi == 1e-9 )
269 multistr = wxT(
"nm" );
270 else if ( multi == 1e-6 )
271 multistr = wxT(
"um" );
272 else if ( multi == 1e-3 )
273 multistr = wxT(
"mm" );
274 else if ( multi == 1e-2 )
275 multistr = wxT(
"cm" );
276 else if ( multi == 1e-1 )
277 multistr = wxT(
"dm" );
278 else if ( multi == 1 )
279 multistr = wxT(
"m" );
280 else if ( multi == 0.00254 )
281 multistr = wxT(
"mil" );
282 else if ( multi == 0.0254 )
283 multistr = wxT(
"inch" );
287 multistr.Printf( wxT(
"%f" ), multi );
288 multistr = wxT(
"* " ) + multistr;
296 if ( !mul.IsEmpty() )
299 if ( mul == wxT(
"pm" ) )
303 else if ( mul == wxT(
"nm" ) )
307 else if ( mul == wxT(
"um" ) )
311 else if ( mul == wxT(
"mm" ) )
315 else if ( mul == wxT(
"cm" ) )
319 else if ( mul == wxT(
"dm" ) )
323 else if ( mul == wxT(
"m" ) )
327 else if ( mul == wxT(
"e" ) )
331 else if ( mul == wxT(
"mil" ) )
335 else if ( mul == wxT(
"inch" ) )
362 numstr.Printf( wxT(
"%f" ),
m_number );
378 int a2dDoMu::operator==(
const a2dDoMu& other )
const
385 int a2dDoMu::operator!=(
const a2dDoMu& other )
const
403 a2dDoMu::operator double()
const
413 if ( param.Len() == 0 )
419 wcstod( param, &endptr );
421 strtod( param, &endptr );
422 #endif // wxUSE_UNICODE
423 if ( endptr == param )
430 wxString number = param.Left( endptr - param.c_str() );
443 void a2dAET::CalculateLineParameters(
const wxRealPoint& p1 ,
const wxRealPoint& p2 )
445 double A = p2.y - p1.y;
454 m_horizontal =
false;
455 m_BdivA = ( p1.x - p2.x ) / A;
457 m_CdivA = ( ( p2.x * p1.y ) - ( p1.x * p2.y ) ) / A ;
461 void a2dAET::CalculateXs(
double y )
463 m_xs = ( int ) ( -m_BdivA * y - m_CdivA );
Stroke and fill base classes.
wxString GetValueString() const
get the number 1.1 um -> "1.1 um"
One Global instance of this class exists, in order to get to global needed objects.
static bool m_asrectangle
underneath the threshold draw rectangles if true else nothing
double wxDegToRad(double deg)
conversion from degrees to radians
a2dGlobal * a2dGlobals
global a2dCanvasGlobal to have easy access to global settings
void a2dCanvasInitializeStockObjects()
to initialize stock style ( a2dStroke a2dFill ) objects.
static int m_accuracy
how much fractional digits, when conversion to string
initiation module for the wxArt2D library
store and convert number to number with unit and visa versa. e.g. 1.23e-6 => 1.23 * 1e-6 ...
double GetNumber() const
get the number 1.1 um -> 1.1
bool Eval(const wxString ¶m)
compose a unit based a string "1.1um"
classes for initializing the artbase modules, and set paths to be used for fonts etc.
static wxUint16 m_polygonFillThreshold
get threshold at which polygon is drawn filled or only outline
double m_number
non multiplied number
double wxRadToDeg(double rad)
conversion from radians to degrees
A2DGENERALDLLEXP a2dSmrtPtr< a2dGeneralGlobal > a2dGeneralGlobals
a global pointer to get to global instance of important classes.
static bool GetMultiplierFromString(const wxString &mul, double &multi)
calculate how to get to meters from a multiplier string e.g. um => 1e-6
double GetValue() const
get value in meters
void Aberration(double angle, double radius, double &dphi, unsigned int &segments)
based on angle and radius and m_displayaberration calculate a proper delta phi and number of segments...
double GetMultiplier() const
get the number 1.1 um -> 1e-6
void Aberration(double aber, double angle, double radius, double &dphi, unsigned int &segments)
calculate number of segments in an arc such that a certain accuracy is maintained ...
a2dDoMu & operator=(const a2dDoMu &)
copy
double m_multi
multiplier e.g. "um" will be 1e-6
static wxUint16 m_drawingthreshold
object smaller than this value will not be rendered
wxString GetMultiplierString() const
get the number 1.1 um -> "um"
initiates Freetype library
virtual ~a2dGlobal()
destructor
wxString GetNumberString() const
get the number 1.1 um -> "1.1"
initializes the general module
void a2dCanvasDeleteStockObjects()
to delete stock style ( a2dStroke a2dFill ) objects.
const double wxPI
defines PI
static double m_arc2polyaber
conversion from arc into lines in database units
class for storing paths and settings, which are used within the artbase module.