KiCad PCB EDA Suite
Loading...
Searching...
No Matches
drill_symbol_profile.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef DRILL_SYMBOL_PROFILE_H
21#define DRILL_SYMBOL_PROFILE_H
22
23#include <map>
24#include <optional>
25#include <set>
26#include <string>
27#include <vector>
28
29#include <kiid.h>
30#include <math/vector2d.h>
31#include <wx/string.h>
32
33struct DRILL_OPERATION;
34
35
53
54
61
62
70
71
79
80
86{
87public:
89
90 const KIID& Uuid() const { return m_uuid; }
91 void SetUuid( const KIID& aUuid ) { m_uuid = aUuid; }
92
93 const wxString& GetName() const { return m_name; }
94 void SetName( const wxString& aName ) { m_name = aName; }
95
96 bool IsGroupedBy( DRILL_GROUP_KEY aKey ) const { return m_groupBy.count( aKey ) > 0; }
97 void SetGroupedBy( DRILL_GROUP_KEY aKey, bool aOn );
98 const std::set<DRILL_GROUP_KEY>& GroupKeys() const { return m_groupBy; }
99
101 void SetMarkPolicy( DRILL_MARK_POLICY aPolicy ) { m_markPolicy = aPolicy; }
102
103 int GetSymbolSize() const { return m_symbolSize; }
104 void SetSymbolSize( int aSize ) { m_symbolSize = aSize; }
105
106 int GetSymbolWidth() const { return m_symbolWidth; }
107 void SetSymbolWidth( int aWidth ) { m_symbolWidth = aWidth; }
108
110 void SetFreezeAssignments( bool aFreeze ) { m_freezeAssignments = aFreeze; }
111
119 std::string GroupKeyString( const DRILL_OPERATION& aOperation ) const;
120
121 const std::map<std::string, DRILL_SYMBOL_ASSIGNMENT>& Assignments() const { return m_assignments; }
122
123 const DRILL_SYMBOL_ASSIGNMENT* GetAssignment( const std::string& aKey ) const;
124 void SetAssignment( const std::string& aKey, const DRILL_SYMBOL_ASSIGNMENT& aAssignment );
125
130 void ClearAssignments() { m_assignments.clear(); }
131
132 bool operator==( const DRILL_SYMBOL_PROFILE& aOther ) const;
133
137 uint64_t Fingerprint() const;
138
139private:
141 wxString m_name;
142 std::set<DRILL_GROUP_KEY> m_groupBy;
147
148 std::map<std::string, DRILL_SYMBOL_ASSIGNMENT> m_assignments;
149};
150
155const char* DrillGroupKeyToken( DRILL_GROUP_KEY aKey );
156const char* DrillMarkPolicyToken( DRILL_MARK_POLICY aPolicy );
157const char* DrillMarkModeToken( DRILL_MARK_MODE aMode );
158
159bool DrillGroupKeyFromToken( const wxString& aToken, DRILL_GROUP_KEY& aKey );
160bool DrillMarkPolicyFromToken( const wxString& aToken, DRILL_MARK_POLICY& aPolicy );
161bool DrillMarkModeFromToken( const wxString& aToken, DRILL_MARK_MODE& aMode );
162
163#endif // DRILL_SYMBOL_PROFILE_H
Grouping rules and symbol assignments, shared by reference so a chart and its map can never disagree ...
DRILL_MARK_POLICY m_markPolicy
void SetUuid(const KIID &aUuid)
std::string GroupKeyString(const DRILL_OPERATION &aOperation) const
Stable identity for a group under the currently enabled keys.
const wxString & GetName() const
const std::map< std::string, DRILL_SYMBOL_ASSIGNMENT > & Assignments() const
void SetSymbolWidth(int aWidth)
bool operator==(const DRILL_SYMBOL_PROFILE &aOther) const
std::set< DRILL_GROUP_KEY > m_groupBy
void SetName(const wxString &aName)
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 SetFreezeAssignments(bool aFreeze)
void SetGroupedBy(DRILL_GROUP_KEY aKey, bool aOn)
void SetMarkPolicy(DRILL_MARK_POLICY aPolicy)
void ClearAssignments()
Assignments whose key no longer matches any hole are kept, so deleting and restoring a hole size does...
const std::set< DRILL_GROUP_KEY > & GroupKeys() const
const KIID & Uuid() const
void SetAssignment(const std::string &aKey, const DRILL_SYMBOL_ASSIGNMENT &aAssignment)
DRILL_MARK_POLICY GetMarkPolicy() const
std::map< std::string, DRILL_SYMBOL_ASSIGNMENT > m_assignments
Definition kiid.h:46
An abstract shape on 2D plane.
Definition shape.h:124
DRILL_MARK_POLICY
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)
DRILL_GROUP_KEY
Which properties split holes into separate chart rows and symbols.
const char * DrillMarkPolicyToken(DRILL_MARK_POLICY aPolicy)
One machining action, which is also one NC hit and one tool assignment.