KiCad PCB EDA Suite
|
Functions | |
KICOMMON_API double | ToUserUnit (const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnit, double aValue) |
Function To_User_Unit convert aValue in internal units to the appropriate user units defined by aUnit. | |
KICOMMON_API wxString | StringFromValue (const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, double aValue, bool aAddUnitsText=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) |
Returns the string from aValue according to aUnits (inch, mm ...) for display. | |
KICOMMON_API wxString | MessageTextFromValue (const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, double aValue, bool aAddUnitsText=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) |
A helper to convert the double length aValue to a string in inches, millimeters, or unscaled units. | |
KICOMMON_API wxString | MessageTextFromValue (const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, int aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) |
Convert a value to a string using double notation. | |
KICOMMON_API wxString | MessageTextFromValue (const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, long long int aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) |
KICOMMON_API wxString | MessageTextFromValue (EDA_ANGLE aValue, bool aAddUnitLabel=true) |
KICOMMON_API wxString | MessageTextFromMinOptMax (const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const MINOPTMAX< int > &aValue) |
KICOMMON_API double | FromUserUnit (const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnit, double aValue) |
Return in internal units the value aValue given in a real unit such as "in", "mm", or "deg". | |
KICOMMON_API double | DoubleValueFromString (const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) |
Function DoubleValueFromString converts aTextValue to a double. | |
KICOMMON_API double | DoubleValueFromString (const wxString &aTextValue) |
KICOMMON_API long long int | ValueFromString (const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) |
Function ValueFromString converts aTextValue in aUnits to internal units used by the application. | |
KICOMMON_API long long int | ValueFromString (const wxString &aTextValue) |
double EDA_UNIT_UTILS::UI::DoubleValueFromString | ( | const EDA_IU_SCALE & | aIuScale, |
EDA_UNITS | aUnits, | ||
const wxString & | aTextValue, | ||
EDA_DATA_TYPE | aType = EDA_DATA_TYPE::DISTANCE |
||
) |
Function DoubleValueFromString converts aTextValue to a double.
aIuScale | The internal units scale for the current frame/app. |
aUnits | The units of aTextValue. |
aTextValue | A reference to a wxString object containing the string to convert. |
Definition at line 576 of file eda_units.cpp.
References AREA, CENTIMETRES, DEGREES, DISTANCE, FromUserUnit(), INCHES, KI_FALLTHROUGH, MICROMETRES, MILLIMETRES, MILS, UNITLESS, and VOLUME.
Referenced by UNITS_PROVIDER::AngleValueFromString(), PCBEXPR_UNIT_RESOLVER::Convert(), PROPERTIES_FRAME::CopyPrmsFromPanelToItem(), PANEL_PREVIEW_3D_MODEL::doIncrementOffset(), PANEL_PREVIEW_3D_MODEL::doIncrementRotation(), PANEL_PREVIEW_3D_MODEL::doIncrementScale(), LIBEVAL::COMPILER::generateUCode(), UNIT_BINDER::GetDoubleValue(), DIALOG_BOARD_REANNOTATE::GetParameters(), DIALOG_EXPORT_STEP::GetXOrg(), DIALOG_EXPORT_IDF3::GetXRef(), DIALOG_EXPORT_VRML::GetXRef(), DIALOG_EXPORT_STEP::GetYOrg(), DIALOG_EXPORT_IDF3::GetYRef(), DIALOG_EXPORT_VRML::GetYRef(), GRID::MessageText(), PANEL_PREVIEW_3D_MODEL::onMouseWheelOffset(), PANEL_PREVIEW_3D_MODEL::onMouseWheelRot(), PANEL_PREVIEW_3D_MODEL::onMouseWheelScale(), PANEL_PREVIEW_3D_MODEL::onUnitsChanged(), UNITS_PROVIDER::OptionalValueFromString(), COMMON_TOOLS::Reset(), rotationFromString(), GRID::ToDouble(), PANEL_3D_RAYTRACING_OPTIONS::TransferDataFromWindow(), DIALOG_IMPORT_GFX_SCH::TransferDataFromWindow(), DIALOG_CREATE_ARRAY::TransferDataFromWindow(), DIALOG_IMPORT_GRAPHICS::TransferDataFromWindow(), PANEL_PREVIEW_3D_MODEL::updateOrientation(), ValueFromString(), UNITS_PROVIDER::ValueFromString(), DIALOG_IMPORT_GFX_SCH::~DIALOG_IMPORT_GFX_SCH(), and DIALOG_IMPORT_GRAPHICS::~DIALOG_IMPORT_GRAPHICS().
double EDA_UNIT_UTILS::UI::DoubleValueFromString | ( | const wxString & | aTextValue | ) |
Definition at line 539 of file eda_units.cpp.
double EDA_UNIT_UTILS::UI::FromUserUnit | ( | const EDA_IU_SCALE & | aIuScale, |
EDA_UNITS | aUnit, | ||
double | aValue | ||
) |
Return in internal units the value aValue given in a real unit such as "in", "mm", or "deg".
Definition at line 510 of file eda_units.cpp.
References CENTIMETRES, DEGREES, IN_TO_IU, INCHES, MICROMETRES, MILLIMETRES, MILS, MILS_TO_IU, MM_TO_IU, PERCENT, and UNSCALED.
Referenced by DoubleValueFromString(), DRAWING_TOOL::DrawBoardCharacteristics(), fromMM(), FOOTPRINT_EDITOR_SETTINGS::MigrateFromLegacy(), PCBNEW_SETTINGS::MigrateFromLegacy(), UNIT_BINDER::setPrecision(), and UNIT_BINDER::Validate().
wxString EDA_UNIT_UTILS::UI::MessageTextFromMinOptMax | ( | const EDA_IU_SCALE & | aIuScale, |
EDA_UNITS | aUnits, | ||
const MINOPTMAX< int > & | aValue | ||
) |
Definition at line 479 of file eda_units.cpp.
References _, MINOPTMAX< T >::HasMax(), MINOPTMAX< T >::HasMin(), MINOPTMAX< T >::HasOpt(), MINOPTMAX< T >::Max(), MessageTextFromValue(), MINOPTMAX< T >::Min(), and MINOPTMAX< T >::Opt().
Referenced by UNITS_PROVIDER::MessageTextFromMinOptMax().
wxString EDA_UNIT_UTILS::UI::MessageTextFromValue | ( | const EDA_IU_SCALE & | aIuScale, |
EDA_UNITS | aUnits, | ||
double | aValue, | ||
bool | aAddUnitsText = true , |
||
EDA_DATA_TYPE | aType = EDA_DATA_TYPE::DISTANCE |
||
) |
A helper to convert the double length aValue to a string in inches, millimeters, or unscaled units.
Should be used only to display a coordinate in status, but not in dialogs, files, etc., because the mantissa of the number displayed has 4 digits max for readability. The actual internal value could need up to 8 digits to preserve precision.
aUnits | Units (INCHES, MILLIMETRE ..) |
aValue | The double value to convert. |
aAddUnitsText | If true, adds the unit label to the end of the string |
aType | DISTANCE, AREA, or VOLUME |
Definition at line 408 of file eda_units.cpp.
References AREA, CENTIMETRES, DEGREES, DISTANCE, EDA_UNIT_UTILS::GetText(), INCHES, EDA_IU_SCALE::IU_PER_MM, KI_FALLTHROUGH, MICROMETRES, MILLIMETRES, MILS, SCH_IU_PER_MM, text, ToUserUnit(), UNITLESS, UNSCALED, and VOLUME.
Referenced by EDIT_TOOL::DragArcTrack(), DRC_ENGINE::EvalRules(), DS_DRAW_ITEM_BASE::GetMsgPanelInfo(), GRID::MessageText(), MessageTextFromMinOptMax(), MessageTextFromValue(), UNITS_PROVIDER::MessageTextFromValue(), EDA_SHAPE::ShapeGetMsgPanelInfo(), and PCB_TUNING_PATTERN::Update().
wxString EDA_UNIT_UTILS::UI::MessageTextFromValue | ( | const EDA_IU_SCALE & | aIuScale, |
EDA_UNITS | aUnits, | ||
int | aValue, | ||
bool | aAddUnitLabel = true , |
||
EDA_DATA_TYPE | aType = EDA_DATA_TYPE::DISTANCE |
||
) |
Convert a value to a string using double notation.
For readability, the mantissa has 0, 1, 3 or 4 digits, depending on units for unit = inch the mantissa has 3 digits (Eeschema) or 4 digits for unit = mil the mantissa has 0 digits (Eeschema) or 1 digits for unit = mm the mantissa has 3 digits (Eeschema) or 4 digits Should be used only to display info in status, but not in dialogs, because 4 digits only could truncate the actual value
Definition at line 379 of file eda_units.cpp.
References MessageTextFromValue().
wxString EDA_UNIT_UTILS::UI::MessageTextFromValue | ( | const EDA_IU_SCALE & | aIuScale, |
EDA_UNITS | aUnits, | ||
long long int | aValue, | ||
bool | aAddUnitLabel = true , |
||
EDA_DATA_TYPE | aType = EDA_DATA_TYPE::DISTANCE |
||
) |
Definition at line 389 of file eda_units.cpp.
References MessageTextFromValue().
wxString EDA_UNIT_UTILS::UI::MessageTextFromValue | ( | EDA_ANGLE | aValue, |
bool | aAddUnitLabel = true |
||
) |
Definition at line 398 of file eda_units.cpp.
References EDA_ANGLE::AsDegrees().
wxString EDA_UNIT_UTILS::UI::StringFromValue | ( | const EDA_IU_SCALE & | aIuScale, |
EDA_UNITS | aUnits, | ||
double | aValue, | ||
bool | aAddUnitsText = false , |
||
EDA_DATA_TYPE | aType = EDA_DATA_TYPE::DISTANCE |
||
) |
Returns the string from aValue according to aUnits (inch, mm ...) for display.
Convert a value to a string using double notation.
For readability, if the mantissa has 3 or more digits then any trailing 0's are removed. This function should be used to display values in dialogs because a value entered in mm (for instance 2.0 mm) could need up to 8 digits mantissa to preserve precision.
aUnits | Units (INCHES, MILLIMETRE ..) |
aValue | Value in internal units |
aAddUnitsText | Add units text with appropriate separators |
aType | DISTANCE, AREA, or VOLUME |
For readability, the mantissa has 3 or more digits, the trailing 0 are removed if the mantissa has more than 3 digits and some trailing 0 This function should be used to display values in dialogs because a value entered in mm (for instance 2.0 mm) could need up to 8 digits mantissa if displayed in inch to avoid truncation or rounding made just by the printf function. otherwise the actual value is rounded when read from dialog and converted in internal units, and therefore modified.
Definition at line 300 of file eda_units.cpp.
References AREA, DEGREES, DISTANCE, EDA_UNIT_UTILS::GetText(), INCHES, EDA_IU_SCALE::IU_PER_MM, KI_FALLTHROUGH, MILS, removeTrailingZeros(), SCH_IU_PER_MM, text, ToUserUnit(), UNITLESS, and VOLUME.
Referenced by BuildStackupReport(), DRAWING_TOOL::DrawBoardCharacteristics(), DRAWING_TOOL::DrawSpecificationStackup(), UNIT_BINDER::getTextForDoubleValue(), UNIT_BINDER::getTextForValue(), PANEL_SETUP_FORMATTING::ImportSettingsFrom(), DIALOG_PLOT::init_Dialog(), PCB_IO_EAGLE::loadClasses(), PANEL_3D_RAYTRACING_OPTIONS::loadSettings(), FOOTPRINT_EDITOR_SETTINGS::MigrateFromLegacy(), PCBNEW_SETTINGS::MigrateFromLegacy(), PANEL_SETUP_BOARD_STACKUP::onUnitsChanged(), UNIT_BINDER::SetDoubleValue(), UNIT_BINDER::SetValue(), UNITS_PROVIDER::StringFromOptionalValue(), UNITS_PROVIDER::StringFromValue(), DIALOG_GRID_SETTINGS::TransferDataFromWindow(), and UNIT_BINDER::Validate().
double EDA_UNIT_UTILS::UI::ToUserUnit | ( | const EDA_IU_SCALE & | aIuScale, |
EDA_UNITS | aUnit, | ||
double | aValue | ||
) |
Function To_User_Unit convert aValue in internal units to the appropriate user units defined by aUnit.
aUnit | The units to convert aValue to. |
aValue | The value in internal units to convert. |
Definition at line 259 of file eda_units.cpp.
References CENTIMETRES, DEGREES, INCHES, IU_TO_IN, IU_TO_MILS, IU_TO_MM, MICROMETRES, MILLIMETRES, and MILS.
Referenced by ComboBoxUnits(), KIGFX::PREVIEW::DimensionLabel(), PL_EDITOR_FRAME::DisplayGridMsg(), RC_ITEM::GetJsonViolation(), GERBER_DRAW_ITEM::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetValueText(), MessageTextFromValue(), UNIT_BINDER::setPrecision(), StringFromValue(), toMM(), and PL_EDITOR_FRAME::UpdateStatusBar().
long long int EDA_UNIT_UTILS::UI::ValueFromString | ( | const EDA_IU_SCALE & | aIuScale, |
EDA_UNITS | aUnits, | ||
const wxString & | aTextValue, | ||
EDA_DATA_TYPE | aType = EDA_DATA_TYPE::DISTANCE |
||
) |
Function ValueFromString converts aTextValue in aUnits to internal units used by the application.
aIuScale | The internal units scale for the current frame/app. |
aUnits | The units of aTextValue. |
aTextValue | A reference to a wxString object containing the string to convert. |
Definition at line 671 of file eda_units.cpp.
References DoubleValueFromString().
Referenced by DIALOG_ANNOTATE::GetStartNumber(), UNIT_BINDER::GetValue(), UNIT_BINDER::onComboBox(), UNIT_BINDER::onUnitsChanged(), PANEL_SETUP_BOARD_STACKUP::onUnitsChanged(), and PANEL_EESCHEMA_ANNOTATION_OPTIONS::TransferDataFromWindow().
long long int EDA_UNIT_UTILS::UI::ValueFromString | ( | const wxString & | aTextValue | ) |
Definition at line 680 of file eda_units.cpp.
References DoubleValueFromString().