KiCad PCB EDA Suite
|
Functions | |
KICOMMON_API double | ToUserUnit (const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnit, double aValue) |
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) |
Return 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) |
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) |
Convert 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) |
Convert 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 |
||
) |
Convert 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 553 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 516 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 487 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 456 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 385 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 |
||
) |
Definition at line 356 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 366 of file eda_units.cpp.
References MessageTextFromValue().
wxString EDA_UNIT_UTILS::UI::MessageTextFromValue | ( | EDA_ANGLE | aValue, |
bool | aAddUnitLabel = true |
||
) |
Definition at line 375 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 |
||
) |
Return the string from aValue according to aUnits (inch, mm ...) for display.
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. |
Definition at line 290 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 | ||
) |
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 261 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 |
||
) |
Convert 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 648 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 657 of file eda_units.cpp.
References DoubleValueFromString().