KiCad PCB EDA Suite
Loading...
Searching...
No Matches
drill_symbol_assigner.h File Reference
#include <map>
#include <string>
#include <vector>
#include <drill/drill_chart_model.h>
#include <drill/drill_symbol_profile.h>

Go to the source code of this file.

Classes

struct  DRILL_SYMBOL_ENTRY
 One drawable mark, with the geometry the renderer needs to place it. More...
 

Functions

void AssignDrillSymbols (std::vector< DRILL_CHART_GROUP > &aGroups, DRILL_SYMBOL_PROFILE &aProfile)
 Give every group a mark, keeping the ones the profile already records.
 
std::map< std::string, DRILL_SYMBOL_ASSIGNMENTResolveDrillSymbols (const BOARD &aBoard)
 The symbol every hole should carry, without touching the board.
 
std::map< KIID, std::vector< DRILL_SYMBOL_ENTRY > > ResolveDrillSymbolsByItem (const BOARD &aBoard, const std::map< std::string, DRILL_SYMBOL_ASSIGNMENT > &aResolved)
 The same answer keyed by the item that owns the holes.
 

Function Documentation

◆ AssignDrillSymbols()

void AssignDrillSymbols ( std::vector< DRILL_CHART_GROUP > & aGroups,
DRILL_SYMBOL_PROFILE & aProfile )

Give every group a mark, keeping the ones the profile already records.

With freeze on, an existing group never changes symbol because a new hole size appeared; new groups take the lowest mark nobody is using. Fabrication drawings get re-approved when symbols move, so churn here is expensive for the user.

Parameters
aGroupsis updated in place with the resolved marks.
aProfilegains assignments for any group that did not have one.

Definition at line 30 of file drill_symbol_assigner.cpp.

References DRILL_MARKERS::CuratedShapeCount(), DRILL_SYMBOL_PROFILE::GetAssignment(), DRILL_SYMBOL_PROFILE::GetFreezeAssignments(), DRILL_SYMBOL_PROFILE::GetMarkPolicy(), group, LETTER, LETTERS, DRILL_SYMBOL_ASSIGNMENT::m_Letter, DRILL_SYMBOL_ASSIGNMENT::m_MarkMode, DRILL_SYMBOL_ASSIGNMENT::m_ShapeIndex, DRILL_SYMBOL_PROFILE::SetAssignment(), SHAPE, SHAPES, SHAPES_THEN_LETTERS, and SIZE_TEXT.

Referenced by PCB_DRILL_CHART::RebuildCells(), and ResolveDrillSymbols().

◆ ResolveDrillSymbols()

std::map< std::string, DRILL_SYMBOL_ASSIGNMENT > ResolveDrillSymbols ( const BOARD & aBoard)

The symbol every hole should carry, without touching the board.

A drill map has to draw the same marks whether or not a chart has ever been placed, so consumers resolve through here rather than relying on the profile already holding assignments. Assignment happens on a copy. Only a chart rebuild commits new ones.

Definition at line 135 of file drill_symbol_assigner.cpp.

References AssignDrillSymbols(), EnumerateDrillSpans(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetDrillSymbolProfile(), group, and model.

Referenced by BOOST_AUTO_TEST_CASE(), BOARD::DrillSymbolCache(), and PCB_DRILL_CHART::RebuildCells().

◆ ResolveDrillSymbolsByItem()

std::map< KIID, std::vector< DRILL_SYMBOL_ENTRY > > ResolveDrillSymbolsByItem ( const BOARD & aBoard,
const std::map< std::string, DRILL_SYMBOL_ASSIGNMENT > & aResolved )

The same answer keyed by the item that owns the holes.

Built once alongside ResolveDrillSymbols so the painter can look a hole up rather than rescanning every operation, which would make a repaint quadratic in the hole count.

One item maps to several entries. A backdrilled via owns its primary drill and both backdrills, and they carry different symbols. Keeping only the primary would silently drop the marks a backdrill map exists to show.

Definition at line 154 of file drill_symbol_assigner.cpp.

References EnumerateDrillOperations(), EnumerateDrillSpans(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetDrillSymbolProfile(), DRILL_SYMBOL_PROFILE::GroupKeyString(), DRILL_SYMBOL_ENTRY::m_Diameter, DRILL_SYMBOL_ENTRY::m_IsSlot, DRILL_SYMBOL_ENTRY::m_Kind, DRILL_QUERY::m_MergePTHNPTH, DRILL_SYMBOL_ENTRY::m_Orientation, DRILL_SYMBOL_ENTRY::m_Position, DRILL_SYMBOL_ENTRY::m_SizeXY, DRILL_QUERY::m_Span, DRILL_SYMBOL_ENTRY::m_Span, and DRILL_SYMBOL_ENTRY::m_Symbol.

Referenced by BOARD::DrillSymbolCache().