45 changed files with 409 additions and 293 deletions
-
3common/CMakeLists.txt
-
67common/dialogs/dialog_group_properties.cpp
-
15common/dialogs/dialog_group_properties.h
-
6common/eda_group.cpp
-
95common/eda_group.h
-
3common/eda_item.cpp
-
89eeschema/sch_group.cpp
-
30eeschema/sch_group.h
-
9eeschema/sch_item.cpp
-
5eeschema/sch_item.h
-
10include/board_item.h
-
7include/eda_item.h
-
2pcbnew/CMakeLists.txt
-
20pcbnew/board.cpp
-
12pcbnew/board_commit.cpp
-
10pcbnew/board_item.cpp
-
6pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp
-
6pcbnew/dialogs/dialog_global_edit_teardrops.cpp
-
6pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp
-
6pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp
-
16pcbnew/footprint.cpp
-
2pcbnew/footprint_libraries_utils.cpp
-
8pcbnew/generators/pcb_tuning_pattern.cpp
-
2pcbnew/pad.cpp
-
2pcbnew/pcb_edit_frame.cpp
-
14pcbnew/pcb_generator.cpp
-
4pcbnew/pcb_generator.h
-
100pcbnew/pcb_group.cpp
-
35pcbnew/pcb_group.h
-
4pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp
-
4pcbnew/pcbexpr_functions.cpp
-
2pcbnew/python/swig/pcb_group.i
-
2pcbnew/specctra_import_export/specctra_import.cpp
-
4pcbnew/tools/board_editor_control.cpp
-
4pcbnew/tools/board_inspection_tool.cpp
-
12pcbnew/tools/edit_tool.cpp
-
2pcbnew/tools/edit_tool.h
-
4pcbnew/tools/group_tool.cpp
-
7pcbnew/tools/multichannel_tool.cpp
-
10pcbnew/tools/pcb_control.cpp
-
2pcbnew/tools/pcb_grid_helper.cpp
-
39pcbnew/tools/pcb_selection_tool.cpp
-
2pcbnew/tracks_cleaner.cpp
-
6pcbnew/undo_redo.cpp
-
8qa/tests/pcbnew/group_saveload.cpp
@ -0,0 +1,6 @@ |
|||
|
|||
#include <eda_group.h>
|
|||
|
|||
EDA_GROUP::~EDA_GROUP() |
|||
{ |
|||
} |
|||
@ -0,0 +1,95 @@ |
|||
/* |
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright The KiCad Developers, see AUTHORS.txt for contributors. |
|||
* |
|||
* This program is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU General Public License |
|||
* as published by the Free Software Foundation; either version 2 |
|||
* of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, you may find one here: |
|||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
|||
* or you may search the http://www.gnu.org website for the version 2 license, |
|||
* or you may write to the Free Software Foundation, Inc., |
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|||
*/ |
|||
|
|||
#ifndef EDA_GROUP_H |
|||
#define EDA_GROUP_H |
|||
|
|||
#include <eda_item.h> |
|||
#include <lset.h> |
|||
#include <unordered_set> |
|||
|
|||
namespace KIGFX |
|||
{ |
|||
class VIEW; |
|||
} |
|||
|
|||
/** |
|||
* A set of EDA_ITEMs (i.e., without duplicates). |
|||
* |
|||
* The group parent is always board/sheet, not logical parent group. The group is transparent |
|||
* container - e.g., its position is derived from the position of its members. A selection |
|||
* containing a group implicitly contains its members. However other operations on sets of |
|||
* items, like committing, updating the view, etc the set is explicit. |
|||
*/ |
|||
class EDA_GROUP |
|||
{ |
|||
public: |
|||
virtual EDA_ITEM* AsEdaItem() = 0; |
|||
virtual ~EDA_GROUP(); |
|||
|
|||
wxString GetName() const { return m_name; } |
|||
void SetName( const wxString& aName ) { m_name = aName; } |
|||
|
|||
std::unordered_set<EDA_ITEM*>& GetItems() { return m_items; } |
|||
|
|||
const std::unordered_set<EDA_ITEM*>& GetItems() const { return m_items; } |
|||
|
|||
/** |
|||
* Add item to group. Does not take ownership of item. |
|||
* |
|||
* @return true if item was added (false if item belongs to a different group). |
|||
*/ |
|||
virtual bool AddItem( EDA_ITEM* aItem ) = 0; |
|||
|
|||
/** |
|||
* Remove item from group. |
|||
* |
|||
* @return true if item was removed (false if item was not in the group). |
|||
*/ |
|||
virtual bool RemoveItem( EDA_ITEM* aItem ) = 0; |
|||
|
|||
virtual void RemoveAll() = 0; |
|||
|
|||
/* |
|||
* Clone() this and all descendants |
|||
*/ |
|||
virtual EDA_GROUP* DeepClone() const = 0; |
|||
|
|||
/* |
|||
* Duplicate() this and all descendants |
|||
*/ |
|||
virtual EDA_GROUP* DeepDuplicate() const = 0; |
|||
|
|||
/** |
|||
* Check if the proposed type can be added to a group |
|||
* @param aType KICAD_T type to check |
|||
* @return true if the type can belong to a group, false otherwise |
|||
*/ |
|||
//virtual static bool IsGroupableType( KICAD_T aType ); |
|||
|
|||
protected: |
|||
std::unordered_set<EDA_ITEM*> m_items; // Members of the group |
|||
wxString m_name; // Optional group name |
|||
}; |
|||
|
|||
#endif // CLASS_PCB_GROUP_H_ |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue