Unit Conversion

:Associate with "Unit Conversions" More...

Functions

GEOMLIBEXPORT double ConvertUnit (double val, const UNITCONV *c)
GEOMLIBEXPORT double ConvertUnitInv (double val, const UNITCONV *conv)
GEOMLIBEXPORT char * ConvertUnitStr (char *str, int len, double val, const UNITCONV *conv)
GEOMLIBEXPORT double ConvertUnitStrInv (char *str, const UNITCONV *conv)
GEOMLIBEXPORT UNITCONVGetUnitConversion (int type, int fromcode, int tocode, UNITCONV *conv)
GEOMLIBEXPORT UNITCONVGetUnitConversionIdentity (int type, UNITCONV *conv)
GEOMLIBEXPORT const MISTRINGGetUnitName (int type, int num)
GEOMLIBEXPORT const MISTRINGGetUnitSymbol (int type, int num)
MENUITEMMxCreateUnitMenuItems (int type, int dft, XtCallbackProc cbfunc, UINT32 flags=0)
Widget MxCreateUnitOptionMenu (Widget pwidget, const char *label, int type, int dft, XtCallbackProc cbfunc, void *udata, UINT32 flags=0, const Arg *arglist=0, int argcount=0)
Widget MxCreateUnitOptionMenuExt (Widget pwidget, const char *label, int type, int dft, XtCallbackProc cbfunc, void *udata, UINT32 flags, const Arg *arglist, int argcount)
Widget MxCreateUnitOptionMenuF (Widget pwidget, const char *label, int type, int dft, XtCallbackProc cbfunc, void *udata, UINT32 flags)

Detailed Description

:Associate with "Unit Conversions"


Function Documentation

GEOMLIBEXPORT double ConvertUnit ( double  val,
const UNITCONV c 
)

Perform unit conversion on numeric value.

Returns:
Converted value
Parameters:
val Value to convert
GEOMLIBEXPORT double ConvertUnitInv ( double  val,
const UNITCONV conv 
)

Perform inverse unit conversion on numeric value.

Returns:
Converted unit
Parameters:
val Value to convert
GEOMLIBEXPORT char* ConvertUnitStr ( char *  str,
int  len,
double  val,
const UNITCONV conv 
)

Special unit conversion for string data types (number to string).

Returns:
str Currently only implements conversion for UNIT_TYPE_DATE. the "to" field of the conv can be any of the following ORd together
  • DATECONV_NoCent 2 digit year instead of 4 digit
  • DATECONV_YMD Year Month Day order
  • DATECONV_YDM Year Day Month order
  • DATECONV_MDY Month Day Year order
  • DATECONV_DMY Day Month Year order
  • DATECONV_MonthNum Numeric month values
  • DATECONV_MonthAbbr Use 3 letter month abbreviation
  • DATECONV_MonthName Use full month names
  • DATECONV_SepNone No seperator
  • DATECONV_SepSpace Use space for seperator
  • DATECONV_SepDash Use dash for seperator
  • DATECONV_SepDot Use dot for seperator
  • DATECONV_SepSlash Use slash for seperator
  • DATECONV_SepComma Use comma for seperator
GEOMLIBEXPORT double ConvertUnitStrInv ( char *  str,
const UNITCONV conv 
)

Special unit conversion for string data types (string to number).

Returns:
The date as a double in YYYYMMDD format Currently only implements conversion for UNIT_TYPE_DATE. the "to" field of the conv can be any of the following.
  • DATECONV_YMD Year Month Day order
  • DATECONV_YDM Year Day Month order
  • DATECONV_MDY Month Day Year order
  • DATECONV_DMY Day Month Year order

Other DATECONV flags can be ORd in too, but will be ignored. It copes with any type of month representation and seperator.

GEOMLIBEXPORT UNITCONV* GetUnitConversion ( int  type,
int  fromcode,
int  tocode,
UNITCONV conv 
)

Setup unit conversion structure between units of given type.

Returns:
Pointer to specified unit conversion structure
Parameters:
type Unit type (UNIT_TYPE_...)
fromcode Unit code to convert from
tocode Unit code to convert to
conv Unit conversion structure to fill in
GEOMLIBEXPORT UNITCONV* GetUnitConversionIdentity ( int  type,
UNITCONV conv 
)

Setup "identity" unit conversion for given type.

Returns:
Pointer to specified unit conversion structure
Parameters:
type Unit type (UNIT_TYPE_...)
conv Unit conversion structure to fill in
GEOMLIBEXPORT const MISTRING& GetUnitName ( int  type,
int  num 
)

Get name for given unit type/number.

Returns:
Localized unit name.
Parameters:
type Unit type (UNIT_TYPE_...)
num Unit number within type
GEOMLIBEXPORT const MISTRING& GetUnitSymbol ( int  type,
int  num 
)

Get "symbol" for given unit type/number.

Returns:
Localized unit "symbol".
Parameters:
type Unit type (UNIT_TYPE_...)
num Unit number within type
MENUITEM* MxCreateUnitMenuItems ( int  type,
int  dft,
XtCallbackProc  cbfunc,
UINT32  flags = 0 
)

Create MENUITEM array for all defined units of a specified type.

Returns:
MENUITEM array containing unit names Flags
  • UNITMENU_UseSymbol Use symbol instead of name for unit
  • UNITMENU_OneOfMany Set MxMENU_ONE_OF_MANY in each MENUITEM
  • UNITMENU_NameSingular Use singular (eg meter, foot) for unit name instead of plural
  • UNITMENU_AddNone Add "None" item to menu array Returns an array of MENUITEMs for units of the specified type. If flags is MxONE_OF_MANY, the array will contain radio buttons. The callback function will get as its 2nd parameter a number. This number (call it "unit") represents the unit type AND the unit number. unit/256 is the unit type, unit256 is the unit number.
Parameters:
type Unit type
dft Default unit number
cbfunc Callback function
flags Flags (UNITMENU_...)
Widget MxCreateUnitOptionMenu ( Widget  pwidget,
const char *  label,
int  type,
int  dft,
XtCallbackProc  cbfunc,
void *  udata,
UINT32  flags = 0,
const Arg *  arglist = 0,
int  argcount = 0 
)

Create OptionMenu for specifying units (feet, meters, etc.

..).

Returns:
OptionMenu widget, unmanaged if no arglist provided, otherwise managed. Returns an OptionMenu widget for selecting units of a given type. The callback function will get as its 2nd parameter a number. This number (call it "unit") represents the unit type AND the unit number. unit/256 is the unit type, unit256 is the unit number. Flags
  • UNITMENU_UseSymbol Use symbol instead of name for unit
  • UNITMENU_OneOfMany Set MxMENU_ONE_OF_MANY in each MENUITEM
  • UNITMENU_NameSingular Use singular (eg meter, foot) for unit name instead of plural
  • UNITMENU_AddNone Add "None" item to menu array
Parameters:
pwidget Parent widget to contain OptionMenu
label Label of OptionMenu
type Unit type
dft Default unit number
cbfunc Callback function
udata Value to use for menu item XmNuserData resource
flags Flags (UNITMENU_...)
arglist Arguments for widget attachment
argcount Number of arguments
Widget MxCreateUnitOptionMenuExt ( Widget  pwidget,
const char *  label,
int  type,
int  dft,
XtCallbackProc  cbfunc,
void *  udata,
UINT32  flags,
const Arg *  arglist,
int  argcount 
) [inline]

Create OptionMenu for specifying units (feet, meters, etc.

..).

See also:
MxCreateUnitOptionMenu.
Parameters:
pwidget Parent widget to contain OptionMenu
label Label of OptionMenu
type Unit type
dft Default unit number
cbfunc Callback function
udata Value to use for menu item XmNuserData resource
flags Flags (UNITMENU_...)
arglist Arguments for widget attachment
argcount Number of arguments
Widget MxCreateUnitOptionMenuF ( Widget  pwidget,
const char *  label,
int  type,
int  dft,
XtCallbackProc  cbfunc,
void *  udata,
UINT32  flags 
) [inline]

Create OptionMenu for specifying units (feet, meters, etc.

..).

See also:
MxCreateUnitOptionMenu.
Parameters:
pwidget Parent widget
label Label of OptionMenu
type Unit type
dft Default unit number
cbfunc Callback function
udata Value to use for menu item XmNuserData resource
flags Flags (UNITMENU_...)

Generated on Sun Oct 7 21:33:04 2012 for TNTsdk 2012 by  doxygen 1.6.1