24#include <fmt/format.h>
65 std::string key =
"v1";
68 key += fmt::format(
"|d{}", aOperation.
m_Diameter );
87 key += fmt::format(
"|k{}",
static_cast<int>( aOperation.
m_Kind ) );
90 key += fmt::format(
"|a{}",
static_cast<int>( aOperation.
m_Attribute ) );
94 key += fmt::format(
"|r{}{}{}{}{}{}{}{}", aOperation.
m_Filled ? 1 : 0,
106 key += fmt::format(
"|m{}:{}:{}:{}/{}:{}:{}:{}",
static_cast<int>( front.
m_Mode ),
118 uint64_t hash = 1469598103934665603ULL;
121 [&]( uint64_t aValue )
124 hash *= 1099511628211ULL;
128 mix(
static_cast<uint64_t
>( key ) );
137 for(
const char ch : key )
138 mix(
static_cast<unsigned char>( ch ) );
140 mix(
static_cast<uint64_t
>( assignment.m_MarkMode ) );
141 mix(
static_cast<uint64_t
>( assignment.m_ShapeIndex ) );
145 for(
const wxUniChar ch : assignment.m_Letter )
146 mix(
static_cast<uint64_t
>( ch.GetValue() ) );
148 mix( assignment.m_Letter.length() );
150 for(
const wxUniChar ch : assignment.m_Description )
151 mix(
static_cast<uint64_t
>( ch.GetValue() ) );
153 mix( assignment.m_Description.length() );
177 if( !other || other->
m_MarkMode != assignment.m_MarkMode
179 || other->
m_Letter != assignment.m_Letter
198const TOKEN_MAP groupKeyTokens[] = {
209const TOKEN_MAP markPolicyTokens[] = {
216const TOKEN_MAP markModeTokens[] = {
223const char* tokenFor(
const TOKEN_MAP ( &aMap )[
N],
int aValue )
225 for(
const TOKEN_MAP& entry : aMap )
227 if( entry.value == aValue )
231 return aMap[0].token;
235bool valueFor(
const TOKEN_MAP ( &aMap )[
N],
const wxString& aToken,
int& aValue )
237 for(
const TOKEN_MAP& entry : aMap )
239 if( aToken.IsSameAs( wxString::FromUTF8( entry.token ) ) )
241 aValue = entry.value;
253 return tokenFor( groupKeyTokens, (
int) aKey );
259 return tokenFor( markPolicyTokens, (
int) aPolicy );
265 return tokenFor( markModeTokens, (
int) aMode );
273 if( !valueFor( groupKeyTokens, aToken, value ) )
285 if( !valueFor( markPolicyTokens, aToken, value ) )
297 if( !valueFor( markModeTokens, aToken, value ) )
constexpr EDA_IU_SCALE pcbIUScale
DRILL_MARK_POLICY m_markPolicy
std::string GroupKeyString(const DRILL_OPERATION &aOperation) const
Stable identity for a group under the currently enabled keys.
bool operator==(const DRILL_SYMBOL_PROFILE &aOther) const
std::set< DRILL_GROUP_KEY > m_groupBy
const DRILL_SYMBOL_ASSIGNMENT * GetAssignment(const std::string &aKey) const
bool IsGroupedBy(DRILL_GROUP_KEY aKey) const
uint64_t Fingerprint() const
Cheap value used to notice an edit.
void SetGroupedBy(DRILL_GROUP_KEY aKey, bool aOn)
void SetAssignment(const std::string &aKey, const DRILL_SYMBOL_ASSIGNMENT &aAssignment)
std::map< std::string, DRILL_SYMBOL_ASSIGNMENT > m_assignments
const char * DrillGroupKeyToken(DRILL_GROUP_KEY aKey)
Stable file tokens, deliberately independent of enum ordering so a later insertion into the enum cann...
bool DrillMarkModeFromToken(const wxString &aToken, DRILL_MARK_MODE &aMode)
const char * DrillMarkModeToken(DRILL_MARK_MODE aMode)
bool DrillMarkPolicyFromToken(const wxString &aToken, DRILL_MARK_POLICY &aPolicy)
bool DrillGroupKeyFromToken(const wxString &aToken, DRILL_GROUP_KEY &aKey)
const char * DrillMarkPolicyToken(DRILL_MARK_POLICY aPolicy)
DRILL_GROUP_KEY
Which properties split holes into separate chart rows and symbols.
size_t CopperLayerToOrdinal(PCB_LAYER_ID aLayer)
Converts KiCad copper layer enum to an ordinal between the front and back layers.
One machining action, which is also one NC hit and one tool assignment.
DRILL_POST_MACHINING m_BackPostMachining
PCB_LAYER_ID m_BottomLayer
VECTOR2I m_SizeXY
Source axes, never normalized to (width, length).
DRILL_POST_MACHINING m_FrontPostMachining
HOLE_ATTRIBUTE m_Attribute
PAD_DRILL_POST_MACHINING_MODE m_Mode
DRILL_MARK_MODE m_MarkMode