KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eda_units.h File Reference
#include <wx/string.h>
#include <geometry/eda_angle.h>
#include <base_units.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 }
 The type of unit. More...
 
enum class  EDA_UNITS {
  INCHES = 0 , MILLIMETRES = 1 , UNSCALED = 2 , DEGREES = 3 ,
  PERCENT = 4 , MILS = 5
}
 

Functions

bool EDA_UNIT_UTILS::IsImperialUnit (EDA_UNITS aUnit)
 
bool EDA_UNIT_UTILS::IsMetricUnit (EDA_UNITS aUnit)
 
int EDA_UNIT_UTILS::Mm2mils (double aVal)
 Convert mm to mils. More...
 
int EDA_UNIT_UTILS::Mils2mm (double aVal)
 Convert mils to mm. More...
 
bool EDA_UNIT_UTILS::FetchUnitsFromString (const wxString &aTextValue, EDA_UNITS &aUnits)
 Writes any unit info found in the string to aUnits. More...
 
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. More...
 
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. More...
 
std::string EDA_UNIT_UTILS::FormatAngle (const EDA_ANGLE &aAngle)
 Converts aAngle from board units to a string appropriate for writing to file. More...
 
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. More...
 
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)
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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)
 
wxString EDA_UNIT_UTILS::UI::MessageTextFromValue (EDA_ANGLE aValue, bool aAddUnitLabel=true)
 
double EDA_UNIT_UTILS::UI::FromUserUnit (const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnit, double aValue)
 Return in internal units the value "val" given in a real unit such as "in", "mm" or "deg". More...
 
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. More...
 
double EDA_UNIT_UTILS::UI::DoubleValueFromString (const wxString &aTextValue)
 
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. More...
 
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 

Definition at line 35 of file eda_units.h.

◆ EDA_UNITS

enum class EDA_UNITS
strong
Enumerator
INCHES 
MILLIMETRES 
UNSCALED 
DEGREES 
PERCENT 
MILS 

Definition at line 42 of file eda_units.h.