diff --git a/3d-viewer/3d_canvas/board_adapter.cpp b/3d-viewer/3d_canvas/board_adapter.cpp index 19a4134e36..0ac4aa30ed 100644 --- a/3d-viewer/3d_canvas/board_adapter.cpp +++ b/3d-viewer/3d_canvas/board_adapter.cpp @@ -33,7 +33,6 @@ #include <3d_math.h> #include "3d_fastmath.h" #include <geometry/geometry_utils.h> -#include <convert_to_biu.h> #include <pgm_base.h> #include <settings/settings_manager.h> #include <wx/log.h> diff --git a/bitmap2component/bitmap2component.cpp b/bitmap2component/bitmap2component.cpp index de6ff48e42..f9b585ef85 100644 --- a/bitmap2component/bitmap2component.cpp +++ b/bitmap2component/bitmap2component.cpp @@ -31,7 +31,6 @@ #include <string> #include <vector> -#include <convert_to_biu.h> #include <layer_ids.h> #include <locale_io.h> diff --git a/common/callback_gal.cpp b/common/callback_gal.cpp index fcbd2434f1..c33f7e9369 100644 --- a/common/callback_gal.cpp +++ b/common/callback_gal.cpp @@ -22,7 +22,6 @@ */ #include <trigo.h> -#include <convert_to_biu.h> #include <convert_basic_shapes_to_polygon.h> #include <geometry/geometry_utils.h> diff --git a/common/eda_units.cpp b/common/eda_units.cpp index 1ebcf0578b..e3eb92965a 100644 --- a/common/eda_units.cpp +++ b/common/eda_units.cpp @@ -23,7 +23,6 @@ #include <eda_units.h> #include <math/util.h> // for KiROUND -#include <convert_to_biu.h> #include <macros.h> bool EDA_UNIT_UTILS::IsImperialUnit( EDA_UNITS aUnit ) diff --git a/common/libeval_compiler/libeval_compiler.cpp b/common/libeval_compiler/libeval_compiler.cpp index 8cb2060295..86cc4480f5 100644 --- a/common/libeval_compiler/libeval_compiler.cpp +++ b/common/libeval_compiler/libeval_compiler.cpp @@ -23,6 +23,7 @@ #include <vector> #include <algorithm> +#include <eda_units.h> #include <string_utils.h> #include <wx/log.h> diff --git a/common/pg_properties.cpp b/common/pg_properties.cpp index 407767048e..966b2feb23 100644 --- a/common/pg_properties.cpp +++ b/common/pg_properties.cpp @@ -27,7 +27,7 @@ #include <common.h> #include <macros.h> #include <validators.h> -#include <convert_to_biu.h> +#include <eda_units.h> #include <property.h> #include <widgets/color_swatch.h> diff --git a/common/project/net_settings.cpp b/common/project/net_settings.cpp index 6e4a28fb2a..bfae94ffab 100644 --- a/common/project/net_settings.cpp +++ b/common/project/net_settings.cpp @@ -26,7 +26,7 @@ #include <settings/json_settings_internals.h> #include <settings/settings_manager.h> #include <string_utils.h> -#include <convert_to_biu.h> +#include <base_units.h> // const int netSettingsSchemaVersion = 0; diff --git a/common/settings/app_settings.cpp b/common/settings/app_settings.cpp index 914564eb32..6c0b8d9d88 100644 --- a/common/settings/app_settings.cpp +++ b/common/settings/app_settings.cpp @@ -20,6 +20,7 @@ #include <class_draw_panel_gal.h> #include <common.h> +#include <eda_units.h> #include <layer_ids.h> #include <pgm_base.h> #include <settings/app_settings.h> diff --git a/common/swig/kicad.i b/common/swig/kicad.i index fba9d0f334..1753e27803 100644 --- a/common/swig/kicad.i +++ b/common/swig/kicad.i @@ -96,7 +96,6 @@ principle should be easily implemented by adapting the current STL containers. #include <title_block.h> #include <marker_base.h> #include <eda_text.h> - #include <convert_to_biu.h> #include <id.h> #include <build_version.h> #include <layer_ids.h> diff --git a/eeschema/sch_plugins/altium/altium_parser_sch.cpp b/eeschema/sch_plugins/altium/altium_parser_sch.cpp index c5fade44f7..cd08ef7054 100644 --- a/eeschema/sch_plugins/altium/altium_parser_sch.cpp +++ b/eeschema/sch_plugins/altium/altium_parser_sch.cpp @@ -25,7 +25,7 @@ #include <iostream> #include <unordered_map> -#include <convert_to_biu.h> +#include <base_units.h> #include <ki_exception.h> #include <wx/log.h> diff --git a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_parser.cpp b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_parser.cpp index ee842a82b5..ff22e1e526 100644 --- a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_parser.cpp +++ b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_parser.cpp @@ -23,7 +23,7 @@ * @brief Reads in a CADSTAR Schematic Archive (*.csa) file */ -#include <convert_to_biu.h> // SCH_IU_PER_MM +#include <base_units.h> #include <macros.h> #include <sch_plugins/cadstar/cadstar_sch_archive_parser.h> #include <progress_reporter.h> diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_parser.h b/eeschema/sch_plugins/kicad/sch_sexpr_parser.h index f6de89dfbe..d276393071 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_parser.h +++ b/eeschema/sch_plugins/kicad/sch_sexpr_parser.h @@ -32,8 +32,6 @@ #ifndef __SCH_SEXPR_PARSER_H__ #define __SCH_SEXPR_PARSER_H__ -#include <convert_to_biu.h> // IU_PER_MM - #include <symbol_library.h> #include <schematic_lexer.h> #include <sch_file_versions.h> diff --git a/eeschema/schematic_settings.cpp b/eeschema/schematic_settings.cpp index 4a594f5bc0..2176d7012a 100644 --- a/eeschema/schematic_settings.cpp +++ b/eeschema/schematic_settings.cpp @@ -21,7 +21,6 @@ #include <base_screen.h> #include <lib_symbol.h> -#include <convert_to_biu.h> #include <default_values.h> #include <eeschema_settings.h> #include <kiface_base.h> diff --git a/eeschema/schematic_settings.h b/eeschema/schematic_settings.h index c9650e4d27..93f49cd416 100644 --- a/eeschema/schematic_settings.h +++ b/eeschema/schematic_settings.h @@ -20,7 +20,6 @@ #ifndef KICAD_SCHEMATIC_SETTINGS_H #define KICAD_SCHEMATIC_SETTINGS_H -#include <convert_to_biu.h> #include <default_values.h> #include <settings/nested_settings.h> #include <template_fieldnames.h> diff --git a/gerbview/am_primitive.cpp b/gerbview/am_primitive.cpp index 76a95ca970..1473f60199 100644 --- a/gerbview/am_primitive.cpp +++ b/gerbview/am_primitive.cpp @@ -28,7 +28,6 @@ */ #include <trigo.h> -#include <convert_to_biu.h> #include <convert_basic_shapes_to_polygon.h> #include <math/util.h> // for KiROUND diff --git a/gerbview/dcode.cpp b/gerbview/dcode.cpp index ceca42daae..bd2a3e9182 100644 --- a/gerbview/dcode.cpp +++ b/gerbview/dcode.cpp @@ -31,7 +31,7 @@ #include <trigo.h> #include <gerbview_frame.h> #include <gerber_file_image.h> -#include <convert_to_biu.h> +#include <eda_units.h> #include <convert_basic_shapes_to_polygon.h> #define DCODE_DEFAULT_SIZE gerbIUScale.mmToIU( 0.1 ) diff --git a/gerbview/export_to_pcbnew.h b/gerbview/export_to_pcbnew.h index a8ec8ea47c..fdb9f3d1cc 100644 --- a/gerbview/export_to_pcbnew.h +++ b/gerbview/export_to_pcbnew.h @@ -22,7 +22,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include <convert_to_biu.h> #include <geometry/shape_poly_set.h> #include <layer_ids.h> diff --git a/gerbview/gerber_file_image.cpp b/gerbview/gerber_file_image.cpp index 202bb5a90f..2052d3fa80 100644 --- a/gerbview/gerber_file_image.cpp +++ b/gerbview/gerber_file_image.cpp @@ -22,7 +22,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include <convert_to_biu.h> #include <gerbview.h> #include <gerbview_frame.h> #include <gerber_file_image.h> diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index 9c6fc5fcc2..63683adb1a 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -27,7 +27,6 @@ #include <eda_draw_frame.h> #include <layer_ids.h> #include <gerbview.h> -#include <convert_to_biu.h> #include <gbr_layout.h> #include <page_info.h> #include <gbr_display_options.h> diff --git a/gerbview/gerbview_painter.cpp b/gerbview/gerbview_painter.cpp index c82e1c9492..56f3f90d0b 100644 --- a/gerbview/gerbview_painter.cpp +++ b/gerbview/gerbview_painter.cpp @@ -25,7 +25,6 @@ #include <settings/color_settings.h> #include <gerbview_settings.h> #include <convert_basic_shapes_to_polygon.h> -#include <convert_to_biu.h> #include <gerbview.h> #include <trigo.h> diff --git a/include/base_units.h b/include/base_units.h index 0fdaa37a32..13e56051de 100644 --- a/include/base_units.h +++ b/include/base_units.h @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012 CERN - * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2012-2016 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -22,16 +22,102 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/** - * @author Wayne Stambaugh <stambaughw@verizon.net> - * @file base_units.h - * @brief Implementation of conversion functions that require both schematic and board - * internal units. - */ #ifndef _BASE_UNITS_H_ #define _BASE_UNITS_H_ -#include <eda_units.h> +/* Note about internal units and max size for boards and items + + The largest distance that we (and Kicad) can support is INT_MAX, since it represents + distance often in a wxCoord or wxSize. As a scalar, a distance is always + positive. Because int is 32 bits and INT_MAX is + 2147483647. The most difficult distance for a virtual (world) cartesian + space is the hypotenuse, or diagonal measurement at a 45 degree angle. This + puts the most stress on the distance magnitude within the bounded virtual + space. So if we allow this distance to be our constraint of <= INT_MAX, this + constraint then propagates to the maximum distance in X and in Y that can be + supported on each axis. Remember that the hypotenuse of a 1x1 square is + sqrt( 1x1 + 1x1 ) = sqrt(2) = 1.41421356. + + hypotenuse of any square = sqrt(2) * deltaX; + + Let maximum supported hypotenuse be INT_MAX, then: + + MAX_AXIS = INT_MAX / sqrt(2) = 2147483647 / 1.41421356 = 1518500251 + + The next choice is what to use for internal units (IU), sometimes called + world units. If nanometers, then the virtual space must be limited to + about 1.5 x 1.5 meters square. This is 1518500251 divided by 1e9 nm/meter. + + The maximum zoom factor then depends on the client window size. If we ask + wx to handle something outside INT_MIN to INT_MAX, there are unreported + problems in the non-Debug build because wxRound() goes silent. + + Pcbnew uses nanometers because we need to convert coordinates and size between + millimeters and inches. using a iu = 1 nm avoid rounding issues + + Gerbview uses iu = 10 nm because we can have coordinates far from origin, and + 1 nm is too small to avoid int overflow. + (Conversions between millimeters and inches are not critical) +*/ + +/** + * @brief some define and functions to convert a value in mils, decimils or mm + * to the internal unit used in pcbnew, cvpcb or gerbview (nanometer or deci-mil) + * depending on compile time option + */ + +constexpr double GERB_IU_PER_MM = 1e5; // Gerbview IU is 10 nanometers. +constexpr double PCB_IU_PER_MM = 1e6; // Pcbnew IU is 1 nanometer. +constexpr double PL_IU_PER_MM = 1e3; // internal units in micron (should be enough) +constexpr double SCH_IU_PER_MM = 1e4; // Schematic internal units 1=100nm + +struct EDA_IU_SCALE +{ + const double IU_PER_MM; + const double IU_PER_MILS; + const double MM_PER_IU; + + + constexpr EDA_IU_SCALE( double aIUPerMM ) : + IU_PER_MM( aIUPerMM ), IU_PER_MILS( aIUPerMM * 0.0254 ), MM_PER_IU( 1 / IU_PER_MM ) + { + } + + constexpr inline double IUTomm( int iu ) const { return iu / IU_PER_MM; } + + constexpr inline int mmToIU( double mm ) const + { + 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 ); +constexpr EDA_IU_SCALE pcbIUScale = EDA_IU_SCALE( PCB_IU_PER_MM ); +constexpr EDA_IU_SCALE drawSheetIUScale = EDA_IU_SCALE( PL_IU_PER_MM ); +constexpr EDA_IU_SCALE schIUScale = EDA_IU_SCALE( SCH_IU_PER_MM ); + +#ifndef SWIG +// The max error is the distance between the middle of a segment, and the circle +// for circle/arc to segment approximation. +// Warning: too small values can create very long calculation time in zone filling +// 0.05 to 0.005 mm are reasonable values + +constexpr int ARC_LOW_DEF = pcbIUScale.mmToIU( 0.02 ); +constexpr int ARC_HIGH_DEF = pcbIUScale.mmToIU( 0.005 ); +#endif #endif // _BASE_UNITS_H_ diff --git a/include/board_item.h b/include/board_item.h index 849574bb73..b34b410578 100644 --- a/include/board_item.h +++ b/include/board_item.h @@ -28,7 +28,6 @@ #include <eda_item.h> #include <eda_units.h> -#include <convert_to_biu.h> #include <gr_basic.h> #include <layer_ids.h> #include <geometry/geometry_utils.h> diff --git a/include/convert_to_biu.h b/include/convert_to_biu.h deleted file mode 100644 index af0f95b4ad..0000000000 --- a/include/convert_to_biu.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2012-2016 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#pragma once - - -/* Note about internal units and max size for boards and items - - The largest distance that we (and Kicad) can support is INT_MAX, since it represents - distance often in a wxCoord or wxSize. As a scalar, a distance is always - positive. Because int is 32 bits and INT_MAX is - 2147483647. The most difficult distance for a virtual (world) cartesian - space is the hypotenuse, or diagonal measurement at a 45 degree angle. This - puts the most stress on the distance magnitude within the bounded virtual - space. So if we allow this distance to be our constraint of <= INT_MAX, this - constraint then propagates to the maximum distance in X and in Y that can be - supported on each axis. Remember that the hypotenuse of a 1x1 square is - sqrt( 1x1 + 1x1 ) = sqrt(2) = 1.41421356. - - hypotenuse of any square = sqrt(2) * deltaX; - - Let maximum supported hypotenuse be INT_MAX, then: - - MAX_AXIS = INT_MAX / sqrt(2) = 2147483647 / 1.41421356 = 1518500251 - - The next choice is what to use for internal units (IU), sometimes called - world units. If nanometers, then the virtual space must be limited to - about 1.5 x 1.5 meters square. This is 1518500251 divided by 1e9 nm/meter. - - The maximum zoom factor then depends on the client window size. If we ask - wx to handle something outside INT_MIN to INT_MAX, there are unreported - problems in the non-Debug build because wxRound() goes silent. - - Pcbnew uses nanometers because we need to convert coordinates and size between - millimeters and inches. using a iu = 1 nm avoid rounding issues - - Gerbview uses iu = 10 nm because we can have coordinates far from origin, and - 1 nm is too small to avoid int overflow. - (Conversions between millimeters and inches are not critical) -*/ - -/** - * @brief some define and functions to convert a value in mils, decimils or mm - * to the internal unit used in pcbnew, cvpcb or gerbview (nanometer or deci-mil) - * depending on compile time option - */ - -constexpr double GERB_IU_PER_MM = 1e5; // Gerbview IU is 10 nanometers. -constexpr double PCB_IU_PER_MM = 1e6; // Pcbnew IU is 1 nanometer. -constexpr double PL_IU_PER_MM = 1e3; // internal units in micron (should be enough) -constexpr double SCH_IU_PER_MM = 1e4; // Schematic internal units 1=100nm - - -struct EDA_IU_SCALE -{ - const double IU_PER_MM; - const double IU_PER_MILS; - const double MM_PER_IU; - - - constexpr EDA_IU_SCALE( double aIUPerMM ) : - IU_PER_MM( aIUPerMM ), - IU_PER_MILS( aIUPerMM * 0.0254 ), - MM_PER_IU( 1 / IU_PER_MM ) - { - } - - constexpr inline double IUTomm( int iu ) const { return iu / IU_PER_MM; } - - constexpr inline int mmToIU( double mm ) const - { - 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 ); -constexpr EDA_IU_SCALE pcbIUScale = EDA_IU_SCALE( PCB_IU_PER_MM ); -constexpr EDA_IU_SCALE drawSheetIUScale = EDA_IU_SCALE( PL_IU_PER_MM ); -constexpr EDA_IU_SCALE schIUScale = EDA_IU_SCALE( SCH_IU_PER_MM ); - -#ifndef SWIG -// The max error is the distance between the middle of a segment, and the circle -// for circle/arc to segment approximation. -// Warning: too small values can create very long calculation time in zone filling -// 0.05 to 0.005 mm are reasonable values - -constexpr int ARC_LOW_DEF = pcbIUScale.mmToIU( 0.02 ); -constexpr int ARC_HIGH_DEF = pcbIUScale.mmToIU( 0.005 ); -#endif \ No newline at end of file diff --git a/include/eda_units.h b/include/eda_units.h index afc75f7485..5e66c4447f 100644 --- a/include/eda_units.h +++ b/include/eda_units.h @@ -27,7 +27,7 @@ #include <wx/string.h> #include <geometry/eda_angle.h> -#include <convert_to_biu.h> +#include <base_units.h> /** * The type of unit. diff --git a/include/libeval/numeric_evaluator.h b/include/libeval/numeric_evaluator.h index bf2a044f9d..355f399619 100644 --- a/include/libeval/numeric_evaluator.h +++ b/include/libeval/numeric_evaluator.h @@ -71,7 +71,7 @@ Supported units are millimeters (mm), Mil (mil) and inch (") #include <map> #include <string> -#include <base_units.h> +#include <eda_units.h> // This namespace is used for the lemon parser namespace numEval diff --git a/include/stroke_params.h b/include/stroke_params.h index ce274283fb..76d9219cf9 100644 --- a/include/stroke_params.h +++ b/include/stroke_params.h @@ -26,6 +26,7 @@ #include <map> #include <bitmaps.h> +#include <eda_units.h> #include <gal/color4d.h> #include <wx/translation.h> #include <geometry/shape.h> diff --git a/libs/kimath/include/geometry/shape_arc.h b/libs/kimath/include/geometry/shape_arc.h index 0d70fa22c3..3c8b503e21 100644 --- a/libs/kimath/include/geometry/shape_arc.h +++ b/libs/kimath/include/geometry/shape_arc.h @@ -27,7 +27,7 @@ #define __SHAPE_ARC_H #include <geometry/shape.h> -#include <convert_to_biu.h> +#include <base_units.h> #include <math/vector2d.h> // for VECTOR2I #include <geometry/eda_angle.h> diff --git a/pcbnew/autorouter/spread_footprints.cpp b/pcbnew/autorouter/spread_footprints.cpp index 73b3b1178b..b3c39c8481 100644 --- a/pcbnew/autorouter/spread_footprints.cpp +++ b/pcbnew/autorouter/spread_footprints.cpp @@ -35,7 +35,6 @@ */ #include <algorithm> -#include <convert_to_biu.h> #include <confirm.h> #include <pcb_edit_frame.h> #include <board.h> diff --git a/pcbnew/board_stackup_manager/board_stackup.cpp b/pcbnew/board_stackup_manager/board_stackup.cpp index 8fcc1611a5..fcdf499891 100644 --- a/pcbnew/board_stackup_manager/board_stackup.cpp +++ b/pcbnew/board_stackup_manager/board_stackup.cpp @@ -20,7 +20,6 @@ #include "board_stackup.h" -#include <convert_to_biu.h> #include <base_units.h> #include <string_utils.h> #include <layer_ids.h> diff --git a/pcbnew/dialogs/panel_setup_constraints.cpp b/pcbnew/dialogs/panel_setup_constraints.cpp index 70944a55b7..74d2dcb863 100644 --- a/pcbnew/dialogs/panel_setup_constraints.cpp +++ b/pcbnew/dialogs/panel_setup_constraints.cpp @@ -23,7 +23,6 @@ #include <board_design_settings.h> #include <board.h> -#include <convert_to_biu.h> #include <math/util.h> #include <panel_setup_constraints.h> #include <panel_setup_constraints_base.h> diff --git a/pcbnew/drc/drc_engine.h b/pcbnew/drc/drc_engine.h index 33ba092e6e..e595e00ea1 100644 --- a/pcbnew/drc/drc_engine.h +++ b/pcbnew/drc/drc_engine.h @@ -28,6 +28,7 @@ #include <vector> #include <unordered_map> +#include <eda_units.h> #include <geometry/shape.h> #include <drc/drc_rule.h> diff --git a/pcbnew/exporters/export_idf.cpp b/pcbnew/exporters/export_idf.cpp index 11e5545c67..c8f4282d5a 100644 --- a/pcbnew/exporters/export_idf.cpp +++ b/pcbnew/exporters/export_idf.cpp @@ -41,7 +41,7 @@ #include "filename_resolver.h" -#include <convert_to_biu.h> // to define pcbIUScale.FromMillimeter(x) +#include <base_units.h> // to define pcbIUScale.FromMillimeter(x) // assumed default graphical line thickness: == 0.1mm diff --git a/pcbnew/exporters/exporter_vrml.cpp b/pcbnew/exporters/exporter_vrml.cpp index 892d69866e..0c9a2131b2 100644 --- a/pcbnew/exporters/exporter_vrml.cpp +++ b/pcbnew/exporters/exporter_vrml.cpp @@ -38,7 +38,6 @@ #include "pad.h" #include "pcb_text.h" #include "pcb_track.h" -#include "convert_to_biu.h" #include <core/arraydim.h> #include <filename_resolver.h> #include "plugins/3dapi/ifsg_all.h" diff --git a/pcbnew/footprint.h b/pcbnew/footprint.h index daeec91130..66b0364de9 100644 --- a/pcbnew/footprint.h +++ b/pcbnew/footprint.h @@ -30,7 +30,6 @@ #include <board_item_container.h> #include <board_item.h> #include <collectors.h> -#include <convert_to_biu.h> #include <layer_ids.h> // ALL_LAYERS definition. #include <lib_id.h> #include <list> diff --git a/pcbnew/import_gfx/graphics_importer_pcbnew.cpp b/pcbnew/import_gfx/graphics_importer_pcbnew.cpp index e045006880..8e151a3563 100644 --- a/pcbnew/import_gfx/graphics_importer_pcbnew.cpp +++ b/pcbnew/import_gfx/graphics_importer_pcbnew.cpp @@ -32,8 +32,6 @@ #include <memory> #include <tuple> -#include "convert_to_biu.h" - GRAPHICS_IMPORTER_PCBNEW::GRAPHICS_IMPORTER_PCBNEW() { diff --git a/pcbnew/import_gfx/svg_import_plugin.cpp b/pcbnew/import_gfx/svg_import_plugin.cpp index 38238f7478..4a3ba6a044 100644 --- a/pcbnew/import_gfx/svg_import_plugin.cpp +++ b/pcbnew/import_gfx/svg_import_plugin.cpp @@ -30,7 +30,6 @@ #include <math/vector2d.h> -#include "convert_to_biu.h" #include <eda_item.h> #include "graphics_importer.h" diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp index 4b14314a63..5ff7b49f1e 100644 --- a/pcbnew/pad.cpp +++ b/pcbnew/pad.cpp @@ -44,7 +44,7 @@ #include <pad.h> #include <pcb_shape.h> #include <connectivity/connectivity_data.h> -#include <convert_to_biu.h> +#include <eda_units.h> #include <convert_basic_shapes_to_polygon.h> #include <widgets/msgpanel.h> #include <pcb_painter.h> diff --git a/pcbnew/pad.h b/pcbnew/pad.h index 013da8e593..55963a3ec3 100644 --- a/pcbnew/pad.h +++ b/pcbnew/pad.h @@ -28,7 +28,6 @@ #include <mutex> #include <zones.h> #include <board_connected_item.h> -#include <convert_to_biu.h> #include <geometry/shape_poly_set.h> #include <geometry/shape_compound.h> #include <pad_shapes.h> diff --git a/pcbnew/pcb_bitmap.cpp b/pcbnew/pcb_bitmap.cpp index 80f612753b..7ef9053bad 100644 --- a/pcbnew/pcb_bitmap.cpp +++ b/pcbnew/pcb_bitmap.cpp @@ -39,7 +39,6 @@ #include <pcb_bitmap.h> #include <trigo.h> #include <geometry/shape_rect.h> -#include <convert_to_biu.h> #include <wx/mstream.h> diff --git a/pcbnew/pcb_plot_params.cpp b/pcbnew/pcb_plot_params.cpp index 21cd083c56..a1abe2c949 100644 --- a/pcbnew/pcb_plot_params.cpp +++ b/pcbnew/pcb_plot_params.cpp @@ -23,7 +23,6 @@ #include <board_design_settings.h> #include <charconv> -#include <convert_to_biu.h> #include <layer_ids.h> #include <macros.h> #include <math/util.h> // for KiROUND diff --git a/pcbnew/pcb_track.h b/pcbnew/pcb_track.h index 361397a985..3185c00f5a 100644 --- a/pcbnew/pcb_track.h +++ b/pcbnew/pcb_track.h @@ -37,7 +37,7 @@ #include <board_connected_item.h> -#include <convert_to_biu.h> +#include <base_units.h> #include <geometry/shape_segment.h> #include "core/minoptmax.h" diff --git a/pcbnew/pcbnew.h b/pcbnew/pcbnew.h index 9605751fc9..c2049c1c7b 100644 --- a/pcbnew/pcbnew.h +++ b/pcbnew/pcbnew.h @@ -25,7 +25,7 @@ #ifndef PCBNEW_H #define PCBNEW_H -#include <convert_to_biu.h> // to define pcbIUScale.MilsToIU() conversion function +#include <eda_units.h> // to define pcbIUScale.MilsToIU() conversion function // These are only here for algorithmic safety, not to tell the user what to do #define TEXTS_MIN_SIZE pcbIUScale.MilsToIU( 1 ) ///< Minimum text size in internal units (1 mil) diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_parser.cpp b/pcbnew/plugins/cadstar/cadstar_pcb_archive_parser.cpp index 3cd84771d5..872f27600f 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_parser.cpp +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_parser.cpp @@ -23,8 +23,8 @@ * @brief Parses a CADSTAR PCB Archive file */ +#include <base_units.h> #include <cadstar_pcb_archive_parser.h> -#include <convert_to_biu.h> // PCB_IU_PER_MM #include <macros.h> #include <progress_reporter.h> #include <wx/translation.h> diff --git a/pcbnew/plugins/fabmaster/import_fabmaster.cpp b/pcbnew/plugins/fabmaster/import_fabmaster.cpp index 8fd507de99..ae508715ab 100644 --- a/pcbnew/plugins/fabmaster/import_fabmaster.cpp +++ b/pcbnew/plugins/fabmaster/import_fabmaster.cpp @@ -41,7 +41,6 @@ #include <board.h> #include <board_design_settings.h> #include <board_item.h> -#include <convert_to_biu.h> #include <footprint.h> #include <fp_shape.h> #include <pad.h> diff --git a/pcbnew/plugins/kicad/pcb_parser.h b/pcbnew/plugins/kicad/pcb_parser.h index e933da4e25..07630cd77e 100644 --- a/pcbnew/plugins/kicad/pcb_parser.h +++ b/pcbnew/plugins/kicad/pcb_parser.h @@ -30,7 +30,6 @@ #ifndef _PCBNEW_PARSER_H_ #define _PCBNEW_PARSER_H_ -#include <convert_to_biu.h> // IU_PER_MM #include <core/wx_stl_compat.h> #include <hashtables.h> #include <layer_ids.h> // PCB_LAYER_ID diff --git a/pcbnew/plugins/legacy/legacy_plugin.cpp b/pcbnew/plugins/legacy/legacy_plugin.cpp index 9edc5b78c2..d6f1e5ac75 100644 --- a/pcbnew/plugins/legacy/legacy_plugin.cpp +++ b/pcbnew/plugins/legacy/legacy_plugin.cpp @@ -85,7 +85,6 @@ #include <fp_shape.h> #include <pcb_plot_params.h> #include <pcb_plot_params_parser.h> -#include <convert_to_biu.h> #include <trigo.h> #include <confirm.h> #include <math/util.h> // for KiROUND diff --git a/pcbnew/plugins/pcad/pcad2kicad_common.cpp b/pcbnew/plugins/pcad/pcad2kicad_common.cpp index a9059f61a8..49199fc8e2 100644 --- a/pcbnew/plugins/pcad/pcad2kicad_common.cpp +++ b/pcbnew/plugins/pcad/pcad2kicad_common.cpp @@ -30,7 +30,6 @@ #include <pcad/pcad2kicad_common.h> #include <common.h> -#include <convert_to_biu.h> #include <math/util.h> // for KiROUND #include <trigo.h> #include <xnode.h> diff --git a/pcbnew/python/swig/pcbnew.i b/pcbnew/python/swig/pcbnew.i index 8610acf385..550aaa3854 100644 --- a/pcbnew/python/swig/pcbnew.i +++ b/pcbnew/python/swig/pcbnew.i @@ -43,8 +43,6 @@ // mostly for KICAD_T %include typeinfo.i -%include <convert_to_biu.h> - %{ #include <lib_id.h> %} diff --git a/pcbnew/teardrop/teardrop_parameters.h b/pcbnew/teardrop/teardrop_parameters.h index b8d53f76c1..6cfbc97f48 100644 --- a/pcbnew/teardrop/teardrop_parameters.h +++ b/pcbnew/teardrop/teardrop_parameters.h @@ -27,7 +27,7 @@ #include <string> #include <vector> -#include <convert_to_biu.h> +#include <base_units.h> // IDs for targets when creating teardrops enum TARGET_TD diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 0f84b2a6d3..87cefbe171 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -32,7 +32,6 @@ #include <fp_shape.h> #include <fp_textbox.h> #include <collectors.h> -#include <convert_to_biu.h> #include <pcb_edit_frame.h> #include <drawing_sheet/ds_proxy_view_item.h> #include <kiway.h> diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index 7089107b59..373fe390d2 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -46,7 +46,6 @@ #include <geometry/convex_hull.h> #include <geometry/geometry_utils.h> #include <confirm.h> -#include <convert_to_biu.h> #include <thread_pool.h> #include <math/util.h> // for KiROUND #include "zone_filler.h" diff --git a/pcbnew/zone_settings.cpp b/pcbnew/zone_settings.cpp index 904f04c4ba..3e8382a064 100644 --- a/pcbnew/zone_settings.cpp +++ b/pcbnew/zone_settings.cpp @@ -25,7 +25,6 @@ #include <zone_settings.h> -#include <convert_to_biu.h> #include <pcbnew.h> #include <pcb_base_frame.h> #include <board.h> diff --git a/qa/qa_utils/eda_item_test_utils.h b/qa/qa_utils/eda_item_test_utils.h index ac8c9030e9..66272c38f7 100644 --- a/qa/qa_utils/eda_item_test_utils.h +++ b/qa/qa_utils/eda_item_test_utils.h @@ -25,7 +25,7 @@ #define EDA_ITEM_TEST_UTILS_H #include <qa_utils/wx_utils/unit_test_utils.h> -#include <convert_to_biu.h> +#include <base_units.h> #include <eda_item.h> diff --git a/qa/unittests/eeschema/test_sch_biu.cpp b/qa/unittests/eeschema/test_sch_biu.cpp index 6558a8e930..4a9ebf5063 100644 --- a/qa/unittests/eeschema/test_sch_biu.cpp +++ b/qa/unittests/eeschema/test_sch_biu.cpp @@ -29,7 +29,7 @@ #include <qa_utils/wx_utils/unit_test_utils.h> -#include <convert_to_biu.h> +#include <base_units.h> class TEST_SCH_INTERNAL_UNITS diff --git a/qa/unittests/eeschema/test_sch_rtree.cpp b/qa/unittests/eeschema/test_sch_rtree.cpp index 1b88cd683a..8204113954 100644 --- a/qa/unittests/eeschema/test_sch_rtree.cpp +++ b/qa/unittests/eeschema/test_sch_rtree.cpp @@ -26,7 +26,7 @@ * Test suite for SCH_SHEET */ -#include <convert_to_biu.h> +#include <base_units.h> #include <ignore.h> #include <sch_junction.h> #include <sch_no_connect.h> diff --git a/qa/unittests/libs/kimath/geometry/test_shape_poly_set_distance.cpp b/qa/unittests/libs/kimath/geometry/test_shape_poly_set_distance.cpp index 34c123c847..9816605239 100644 --- a/qa/unittests/libs/kimath/geometry/test_shape_poly_set_distance.cpp +++ b/qa/unittests/libs/kimath/geometry/test_shape_poly_set_distance.cpp @@ -24,8 +24,6 @@ #include <qa_utils/wx_utils/unit_test_utils.h> -#include <convert_to_biu.h> - #include <geometry/shape_poly_set.h> #include <qa_utils/geometry/poly_set_construction.h>