KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pth_hole_size.cpp File Reference
#include <pth_hole_size.h>
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <utility>
#include <base_units.h>
#include <math/util.h>
#include <wx/intl.h>

Go to the source code of this file.

Functions

int ComputeRecommendedPthHoleSize (const PTH_HOLE_SIZE_RESULT &aRange, int aRoundingStep, PTH_HOLE_ROUNDING aRounding)
 Choose a recommended hole within an allowable range.
 
const PTH_HOLE_SIZE_STANDARDFindPthHoleSizeStandard (const wxString &aId)
 Find a hole size standard in the registry by its ID (e.g.
 
const std::vector< const PTH_HOLE_SIZE_STANDARD * > & GetPthHoleSizeStandards ()
 

Function Documentation

◆ ComputeRecommendedPthHoleSize()

int ComputeRecommendedPthHoleSize ( const PTH_HOLE_SIZE_RESULT & aRange,
int aRoundingStep,
PTH_HOLE_ROUNDING aRounding )

Choose a recommended hole within an allowable range.

The midpoint of the range is rounded onto the rounding grid: to the nearest multiple of the step, or always up to the next multiple. The result is never below the range minimum.

Parameters
aRangeis the allowable hole size range (m_holeMin and m_holeMax).
aRoundingStepis the rounding grid. A value of 0 or less returns the exact midpoint of the range.
aRoundingselects how the midpoint is rounded onto the grid.
Returns
the recommended hole size.

Definition at line 129 of file pth_hole_size.cpp.

References PTH_HOLE_SIZE_RESULT::m_holeMax, PTH_HOLE_SIZE_RESULT::m_holeMin, and UP.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PANEL_PTH_SIZE::recalculate().

◆ FindPthHoleSizeStandard()

const PTH_HOLE_SIZE_STANDARD * FindPthHoleSizeStandard ( const wxString & aId)

Find a hole size standard in the registry by its ID (e.g.

"IPC-2222B").

The caller does not own the returned pointer.

Parameters
aIdis the standard ID.
Returns
the standard, or nullptr if the ID is not known.

Definition at line 152 of file pth_hole_size.cpp.

References GetPthHoleSizeStandards().

Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ GetPthHoleSizeStandards()

const std::vector< const PTH_HOLE_SIZE_STANDARD * > & GetPthHoleSizeStandards ( )
Returns
the available hole size standards, in the order they should be offered in the UI. The pointers are non-owning and remain valid for the program lifetime.

Definition at line 164 of file pth_hole_size.cpp.

Referenced by FindPthHoleSizeStandard(), PANEL_PTH_SIZE::populateStandardChoice(), and PANEL_PTH_SIZE::updateStandard().