KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eda_group.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, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#ifndef EDA_GROUP_H
25#define EDA_GROUP_H
26
27#include <eda_item.h>
28#include <lib_id.h>
29#include <lset.h>
30#include <unordered_set>
31
32namespace KIGFX
33{
34class VIEW;
35}
36
46{
47public:
48 virtual EDA_ITEM* AsEdaItem() = 0;
49 virtual ~EDA_GROUP();
50
51 wxString GetName() const { return m_name; }
52 void SetName( const wxString& aName ) { m_name = aName; }
53
54 std::unordered_set<EDA_ITEM*>& GetItems() { return m_items; }
55
56 const std::unordered_set<EDA_ITEM*>& GetItems() const { return m_items; }
57
63 virtual bool AddItem( EDA_ITEM* aItem ) = 0;
64
70 virtual bool RemoveItem( EDA_ITEM* aItem ) = 0;
71
72 virtual void RemoveAll() = 0;
73
74 /*
75 * Clone() this and all descendants
76 */
77 virtual EDA_GROUP* DeepClone() const = 0;
78
79 /*
80 * Duplicate() this and all descendants
81 */
82 virtual EDA_GROUP* DeepDuplicate() const = 0;
83
85
86 void SetDesignBlockLibId( const LIB_ID& aLibId ) { m_designBlockLibId = aLibId; }
87
89
90protected:
91 std::unordered_set<EDA_ITEM*> m_items; // Members of the group
92 wxString m_name; // Optional group name
93
94 // Optional link to a design block
96};
97
98#endif // CLASS_PCB_GROUP_H_
A set of EDA_ITEMs (i.e., without duplicates).
Definition: eda_group.h:46
const LIB_ID & GetDesignBlockLibId() const
Definition: eda_group.h:88
const std::unordered_set< EDA_ITEM * > & GetItems() const
Definition: eda_group.h:56
wxString m_name
Definition: eda_group.h:92
std::unordered_set< EDA_ITEM * > m_items
Definition: eda_group.h:91
std::unordered_set< EDA_ITEM * > & GetItems()
Definition: eda_group.h:54
virtual void RemoveAll()=0
wxString GetName() const
Definition: eda_group.h:51
bool HasDesignBlockLink() const
Definition: eda_group.h:84
virtual bool RemoveItem(EDA_ITEM *aItem)=0
Remove item from group.
virtual bool AddItem(EDA_ITEM *aItem)=0
Add item to group.
virtual ~EDA_GROUP()
Definition: eda_group.cpp:4
LIB_ID m_designBlockLibId
Definition: eda_group.h:95
void SetDesignBlockLibId(const LIB_ID &aLibId)
Definition: eda_group.h:86
virtual EDA_GROUP * DeepClone() const =0
virtual EDA_GROUP * DeepDuplicate() const =0
virtual EDA_ITEM * AsEdaItem()=0
void SetName(const wxString &aName)
Definition: eda_group.h:52
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:96
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:67
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:172
The Cairo implementation of the graphics abstraction layer.
Definition: eda_group.h:33