KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eda_units.h File Reference
#include <kicommon.h>
#include <wx/string.h>
#include <geometry/eda_angle.h>
#include <base_units.h>
#include <core/minoptmax.h>

Go to the source code of this file.

Namespaces

namespace  EDA_UNIT_UTILS
 
namespace  EDA_UNIT_UTILS::UI
 

Enumerations

enum class  EDA_DATA_TYPE { DISTANCE = 0 , AREA = 1 , VOLUME = 2 , UNITLESS = 3 }
 The type of unit. More...
 
enum class  EDA_UNITS {
  INCHES = 0 , MILLIMETRES = 1 , UNSCALED = 2 , DEGREES = 3 ,
  PERCENT = 4 , MILS = 5 , MICROMETRES = 6 , CENTIMETRES = 7
}
 

Functions

KICOMMON_API bool EDA_UNIT_UTILS::IsImperialUnit (EDA_UNITS aUnit)
 
KICOMMON_API bool EDA_UNIT_UTILS::IsMetricUnit (EDA_UNITS aUnit)
 
KICOMMON_API int EDA_UNIT_UTILS::Mm2mils (double aVal)
 Convert mm to mils.
 
KICOMMON_API int EDA_UNIT_UTILS::Mils2mm (double aVal)
 Convert mils to mm.
 
KICOMMON_API bool EDA_UNIT_UTILS::FetchUnitsFromString (const wxString &aTextValue, EDA_UNITS &aUnits)
 Writes any unit info found in the string to aUnits.
 
KICOMMON_API wxString EDA_UNIT_UTILS::GetText (EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
 Get the units string for a given units type.
 
KICOMMON_API wxString EDA_UNIT_UTILS::GetLabel (EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
 Get the units string for a given units type.
 
KICOMMON_API std::string EDA_UNIT_UTILS::FormatAngle (const EDA_ANGLE &aAngle)
 Converts aAngle from board units to a string appropriate for writing to file.
 
KICOMMON_API std::string EDA_UNIT_UTILS::FormatInternalUnits (const EDA_IU_SCALE &aIuScale, int aValue)
 Converts aValue from internal units to a string appropriate for writing to file.
 
KICOMMON_API std::string EDA_UNIT_UTILS::FormatInternalUnits (const EDA_IU_SCALE &aIuScale, const VECTOR2I &aPoint)
 
constexpr int EDA_UNIT_UTILS::Mils2IU (const EDA_IU_SCALE &aIuScale, int mils)
 
KICOMMON_API 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.
 
KICOMMON_API 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.
 
KICOMMON_API 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.
 
KICOMMON_API 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.
 
KICOMMON_API 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)
 
KICOMMON_API wxString EDA_UNIT_UTILS::UI::MessageTextFromValue (EDA_ANGLE aValue, bool aAddUnitLabel=true)
 
KICOMMON_API wxString EDA_UNIT_UTILS::UI::MessageTextFromMinOptMax (const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const MINOPTMAX< int > &aValue)
 
KICOMMON_API 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".
 
KICOMMON_API 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.
 
KICOMMON_API double EDA_UNIT_UTILS::UI::DoubleValueFromString (const wxString &aTextValue)
 
KICOMMON_API 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.
 
KICOMMON_API long long int EDA_UNIT_UTILS::UI::ValueFromString (const wxString &aTextValue)
 

Enumeration Type Documentation

◆ EDA_DATA_TYPE

enum class EDA_DATA_TYPE
strong

The type of unit.

Enumerator
DISTANCE 
AREA 
VOLUME 
UNITLESS 

Definition at line 37 of file eda_units.h.

◆ EDA_UNITS

enum class EDA_UNITS
strong
Enumerator
INCHES 
MILLIMETRES 
UNSCALED 
DEGREES 
PERCENT 
MILS 
MICROMETRES 
CENTIMETRES 

Definition at line 45 of file eda_units.h.