mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-11 14:20:10 +00:00
Remove some more
This commit is contained in:
parent
33f8161799
commit
ee48c8d232
@ -41,8 +41,8 @@ const int DEFAULT_DIFF_PAIR_WIDTH = pcbIUScale.mmToIU( 0.2 );
|
||||
const int DEFAULT_DIFF_PAIR_GAP = pcbIUScale.mmToIU( 0.25 );
|
||||
const int DEFAULT_DIFF_PAIR_VIAGAP = pcbIUScale.mmToIU( 0.25 );
|
||||
|
||||
const int DEFAULT_WIRE_WIDTH = SchMils2iu( 6 );
|
||||
const int DEFAULT_BUS_WIDTH = SchMils2iu( 12 );
|
||||
const int DEFAULT_WIRE_WIDTH = schIUScale.MilsToIU( 6 );
|
||||
const int DEFAULT_BUS_WIDTH = schIUScale.MilsToIU( 12 );
|
||||
|
||||
const int DEFAULT_LINE_STYLE = 0; // solid
|
||||
|
||||
|
@ -48,7 +48,7 @@ static std::optional<int> getInPcbUnits( const nlohmann::json& aObj, const std::
|
||||
static int getInSchUnits( const nlohmann::json& aObj, const std::string& aKey, int aDefault )
|
||||
{
|
||||
if( aObj.contains( aKey ) && aObj[aKey].is_number() )
|
||||
return SchMils2iu( aObj[aKey].get<double>() );
|
||||
return schIUScale.MilsToIU( aObj[aKey].get<double>() );
|
||||
else
|
||||
return aDefault;
|
||||
};
|
||||
@ -67,8 +67,8 @@ NET_SETTINGS::NET_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
|
||||
// fields are used in which units system.
|
||||
nlohmann::json nc_json = {
|
||||
{ "name", nc->GetName().ToUTF8() },
|
||||
{ "wire_width", SchIu2Mils( nc->GetWireWidth() ) },
|
||||
{ "bus_width", SchIu2Mils( nc->GetBusWidth() ) },
|
||||
{ "wire_width", schIUScale.IUToMils( nc->GetWireWidth() ) },
|
||||
{ "bus_width", schIUScale.IUToMils( nc->GetBusWidth() ) },
|
||||
{ "line_style", nc->GetLineStyle() },
|
||||
{ "schematic_color", nc->GetSchematicColor() },
|
||||
{ "pcb_color", nc->GetPcbColor() }
|
||||
|
@ -92,6 +92,19 @@ struct EDA_IU_SCALE
|
||||
{
|
||||
return (int) ( mm < 0 ? ( mm * IU_PER_MM - 0.5 ) : ( mm * IU_PER_MM + 0.5 ) );
|
||||
}
|
||||
|
||||
constexpr inline int MilsToIU( int mils ) const
|
||||
{
|
||||
double x = mils * IU_PER_MILS;
|
||||
return int( x < 0 ? x - 0.5 : x + 0.5 );
|
||||
}
|
||||
|
||||
constexpr inline double IUToMils( int iu ) const
|
||||
{
|
||||
double mils = iu / IU_PER_MILS;
|
||||
|
||||
return static_cast<int>( mils < 0 ? mils - 0.5 : mils + 0.5 );
|
||||
}
|
||||
};
|
||||
|
||||
constexpr EDA_IU_SCALE gerbIUScale = EDA_IU_SCALE( GERB_IU_PER_MM );
|
||||
@ -157,18 +170,4 @@ constexpr inline int Millimeter2iu( double mm )
|
||||
constexpr int ARC_LOW_DEF = Millimeter2iu( 0.02 );
|
||||
constexpr int ARC_HIGH_DEF = Millimeter2iu( 0.005 );
|
||||
|
||||
#else
|
||||
constexpr double PCB_IU_PER_MILS = (PCB_IU_PER_MM * 0.0254);
|
||||
constexpr double SCH_IU_PER_MILS = (SCH_IU_PER_MM * 0.0254);
|
||||
|
||||
constexpr inline int SchMils2iu( double mils )
|
||||
{
|
||||
double x = mils * SCH_IU_PER_MILS;
|
||||
return int( x < 0 ? x - 0.5 : x + 0.5 );
|
||||
}
|
||||
constexpr inline double SchIu2Mils( int iu )
|
||||
{
|
||||
return iu / SCH_IU_PER_MILS;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user