a2dDoMu Class Reference

store and convert number to number with unit and visa versa. e.g. 1.23e-6 => 1.23 * 1e-6 More...

#include <artglob.h>

List of all members.

Public Member Functions

 a2dDoMu (double number, double multi=1, bool normalize=true)
 constructor on number and multiplier 1.1 and 1e-6
 a2dDoMu (double number, const wxString &multi)
 constructor on number in meters and recalculate for multiplier as string
 a2dDoMu (const wxString &number, const wxString &multi)
 constructor on number string and multiplier string "1.1" "um"
 a2dDoMu (const wxString &numberMulti)
 constructor on string containing number and multiplier "1.1 um"
bool Eval (const wxString &param)
 compose a unit based a string "1.1um"
double GetValue () const
 get value in meters
double GetNumber () const
 get the number 1.1 um -> 1.1
double GetMultiplier () const
 get the number 1.1 um -> 1e-6
wxString GetValueString () const
 get the number 1.1 um -> "1.1 um"
wxString GetMultiplierString () const
 get the number 1.1 um -> "um"
wxString GetNumberString () const
 get the number 1.1 um -> "1.1"
a2dDoMuoperator= (const a2dDoMu &)
 copy
a2dDoMuoperator= (const wxChar *)
 as Eval
 operator double () const
 convert to double
a2dDoMuoperator= (double)
 double becomes the number
int operator== (const a2dDoMu &) const
int operator!= (const a2dDoMu &) const

Static Public Member Functions

static wxString GetMultiplierString (double multi)
 calculate from m_multi a string like "1e-6" => "um"
static bool GetMultiplierFromString (const wxString &mul, double &multi)
 calculate how to get to meters from a multiplier string e.g. um => 1e-6
static void SetAccuracy (int accur)
 when converting a number to a string this accuracy will be used

Protected Attributes

double m_multi
 multiplier e.g. "um" will be 1e-6
double m_number
 non multiplied number

Static Protected Attributes

static int m_accuracy = 3
 how much fractional digits, when conversion to string


Detailed Description

store and convert number to number with unit and visa versa. e.g. 1.23e-6 => 1.23 * 1e-6

This makes it easy to recover the unit as a string if needed. Als one can normalize the multiplier part to something that closest to a string multiplier.

Used often to convert to and from user units. If the default unit used by the user is in MicroMeters (um), numbers stored as doubles, need to be converted back and forth to this unit. The full number is stored as a number + multiplier part. The multiplier is always stored in metric. So if inch, it will be 0.0254, and mil will be 0.00254

Definition at line 208 of file artglob.h.


The documentation for this class was generated from the following files:
a2dDoMu Class Reference -- Tue Aug 31 18:23:12 2010 -- 31 Aug 2010 -- 1.5.5 -- wxArt2D -- . -- Main Page Reference Documentation