LibrePCB Developers Documentation
cmdremoveselectedschematicitems.h
Go to the documentation of this file.
1 /*
2  * LibrePCB - Professional EDA for everyone!
3  * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4  * https://librepcb.org/
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (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 <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef LIBREPCB_PROJECT_CMDREMOVESELECTEDSCHEMATICITEMS_H
21 #define LIBREPCB_PROJECT_CMDREMOVESELECTEDSCHEMATICITEMS_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
28 
29 #include <QtCore>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 namespace project {
36 
37 class Schematic;
38 class SI_NetSegment;
39 class SI_NetPoint;
40 class SI_NetLine;
41 class SI_NetLabel;
42 class SI_Symbol;
43 class SI_SymbolPin;
44 class BI_Device;
45 class SI_NetLineAnchor;
46 class ComponentSignalInstance;
47 
48 namespace editor {
49 
50 /*******************************************************************************
51  * Class CmdRemoveSelectedSchematicItems
52  ******************************************************************************/
53 
58 private:
59  // Private Types
60  struct NetSegmentItems {
61  QSet<SI_NetPoint*> netpoints;
62  QSet<SI_NetLine*> netlines;
63  QSet<SI_NetLabel*> netlabels;
64  };
65  typedef QHash<SI_NetSegment*, NetSegmentItems> NetSegmentItemList;
66 
67 public:
68  // Constructors / Destructor
69  explicit CmdRemoveSelectedSchematicItems(Schematic& schematic) noexcept;
71 
72 private:
73  // Private Methods
74 
76  bool performExecute() override;
77 
78  void removeNetSegment(SI_NetSegment& netsegment);
79  void splitUpNetSegment(SI_NetSegment& netsegment,
80  const NetSegmentItems& selectedItems);
82  const NetSegmentItems& items);
83  void removeNetLabel(SI_NetLabel& netlabel);
84  void removeSymbol(SI_Symbol& symbol);
87  SI_NetSegment& segment, const NetSegmentItems& removedItems) noexcept;
89  SI_NetLineAnchor& anchor, QSet<SI_NetLineAnchor*>& processedAnchors,
90  QSet<SI_NetPoint*>& netpoints, QSet<SI_NetLine*>& netlines,
91  QSet<SI_NetLine*>& availableNetLines) const noexcept;
93  const SI_NetLabel& netlabel, const QList<NetSegmentItems>& segments) const
94  noexcept;
96  const SI_NetLabel& netlabel, const NetSegmentItems& netsegment) const
97  noexcept;
98 
99  // Attributes from the constructor
101 };
102 
103 /*******************************************************************************
104  * End of File
105  ******************************************************************************/
106 
107 } // namespace editor
108 } // namespace project
109 } // namespace librepcb
110 
111 #endif // LIBREPCB_PROJECT_CMDREMOVESELECTEDSCHEMATICITEMS_H
void findAllConnectedNetPointsAndNetLines(SI_NetLineAnchor &anchor, QSet< SI_NetLineAnchor *> &processedAnchors, QSet< SI_NetPoint *> &netpoints, QSet< SI_NetLine *> &netlines, QSet< SI_NetLine *> &availableNetLines) const noexcept
Definition: cmdremoveselectedschematicitems.cpp:414
The SI_Symbol class.
Definition: si_symbol.h:57
QSet< SI_NetLine * > netlines
Definition: cmdremoveselectedschematicitems.h:62
The SI_NetPoint class.
Definition: si_netpoint.h:48
void disconnectComponentSignalInstance(ComponentSignalInstance &signal)
Definition: cmdremoveselectedschematicitems.cpp:363
int getNearestNetSegmentOfNetLabel(const SI_NetLabel &netlabel, const QList< NetSegmentItems > &segments) const noexcept
Definition: cmdremoveselectedschematicitems.cpp:440
Definition: airwiresbuilder.cpp:32
QHash< SI_NetSegment *, NetSegmentItems > NetSegmentItemList
Definition: cmdremoveselectedschematicitems.h:65
The Schematic class represents one schematic page of a project and is always part of a circuit...
Definition: schematic.h:83
void splitUpNetSegment(SI_NetSegment &netsegment, const NetSegmentItems &selectedItems)
Definition: cmdremoveselectedschematicitems.cpp:192
The UndoCommandGroup class makes it possible to pack multiple undo commands together (it acts as a pa...
Definition: undocommandgroup.h:43
QSet< SI_NetPoint * > netpoints
Definition: cmdremoveselectedschematicitems.h:61
The CmdRemoveSelectedSchematicItems class.
Definition: cmdremoveselectedschematicitems.h:57
void removeNetLabel(SI_NetLabel &netlabel)
Definition: cmdremoveselectedschematicitems.cpp:307
QList< NetSegmentItems > getNonCohesiveNetSegmentSubSegments(SI_NetSegment &segment, const NetSegmentItems &removedItems) noexcept
Definition: cmdremoveselectedschematicitems.cpp:384
CmdRemoveSelectedSchematicItems(Schematic &schematic) noexcept
Definition: cmdremoveselectedschematicitems.cpp:80
void removeNetSegment(SI_NetSegment &netsegment)
Definition: cmdremoveselectedschematicitems.cpp:169
The SI_NetSegment class.
Definition: si_netsegment.h:55
Definition: si_netline.h:46
QSet< SI_NetLabel * > netlabels
Definition: cmdremoveselectedschematicitems.h:63
SI_NetSegment * createNewSubNetSegment(SI_NetSegment &netsegment, const NetSegmentItems &items)
Definition: cmdremoveselectedschematicitems.cpp:265
void removeSymbol(SI_Symbol &symbol)
Definition: cmdremoveselectedschematicitems.cpp:339
The SI_NetLabel class.
Definition: si_netlabel.h:51
The ComponentSignalInstance class.
Definition: componentsignalinstance.h:61
Length getDistanceBetweenNetLabelAndNetSegment(const SI_NetLabel &netlabel, const NetSegmentItems &netsegment) const noexcept
Definition: cmdremoveselectedschematicitems.cpp:456
The Length class is used to represent a length (for example 12.75 millimeters)
Definition: length.h:82
The SI_NetLine class.
Definition: si_netline.h:64
~CmdRemoveSelectedSchematicItems() noexcept
Definition: cmdremoveselectedschematicitems.cpp:85
Schematic & mSchematic
Definition: cmdremoveselectedschematicitems.h:100
bool performExecute() override
Execute the command the first time.
Definition: cmdremoveselectedschematicitems.cpp:92