LibrePCB Developers Documentation
schematicnetsegmentsplitter.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_CORE_SCHEMATICNETSEGMENTSPLITTER_H
21 #define LIBREPCB_CORE_SCHEMATICNETSEGMENTSPLITTER_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../../geometry/junction.h"
27 #include "../../geometry/netlabel.h"
28 #include "../../geometry/netline.h"
29 
30 #include <QtCore>
31 #include <QtWidgets>
32 
33 /*******************************************************************************
34  * Namespace / Forward Declarations
35  ******************************************************************************/
36 namespace librepcb {
37 
38 /*******************************************************************************
39  * Class SchematicNetSegmentSplitter
40  ******************************************************************************/
41 
46 public:
47  // Types
48  struct Segment {
52  };
53 
54  // Constructors / Destructor
55  SchematicNetSegmentSplitter() noexcept;
57  delete;
58  ~SchematicNetSegmentSplitter() noexcept;
59 
60  // General Methods
61  void addSymbolPin(const NetLineAnchor& anchor, const Point& pos,
62  bool replaceByJunction = false) noexcept;
63  void addJunction(const Junction& junction) noexcept;
64  void addNetLine(const NetLine& netline) noexcept;
65  void addNetLabel(const NetLabel& netlabel) noexcept;
66  QList<Segment> split() noexcept;
67 
68  // Operator Overloadings
69  SchematicNetSegmentSplitter& operator=(
70  const SchematicNetSegmentSplitter& rhs) = delete;
71 
72 private: // Methods
73  NetLineAnchor replacePinAnchor(const NetLineAnchor& anchor) noexcept;
74  void findConnectedLinesAndPoints(const NetLineAnchor& anchor,
75  NetLineList& availableNetLines,
76  Segment& segment)
77 
78  noexcept;
79  void addNetLabelToNearestNetSegment(const NetLabel& netlabel,
80  QList<Segment>& segments) const noexcept;
82  const NetLabel& netlabel, const Segment& netsegment) const noexcept;
83  Point getAnchorPosition(const NetLineAnchor& anchor) const noexcept;
84 
85 private: // Data
89 
90  QHash<NetLineAnchor, NetLineAnchor> mPinAnchorsToReplace;
91  QHash<NetLineAnchor, Point> mPinPositions;
92 };
93 
94 /*******************************************************************************
95  * End of File
96  ******************************************************************************/
97 
98 } // namespace librepcb
99 
100 #endif
void addNetLabel(const NetLabel &netlabel) noexcept
Definition: schematicnetsegmentsplitter.cpp:76
Length getDistanceBetweenNetLabelAndNetSegment(const NetLabel &netlabel, const Segment &netsegment) const noexcept
Definition: schematicnetsegmentsplitter.cpp:156
QList< Segment > split() noexcept
Definition: schematicnetsegmentsplitter.cpp:82
NetLineAnchor replacePinAnchor(const NetLineAnchor &anchor) noexcept
Definition: schematicnetsegmentsplitter.cpp:107
void addNetLine(const NetLine &netline) noexcept
Definition: schematicnetsegmentsplitter.cpp:69
The NetLine class represents a net line within a schematic.
Definition: netline.h:109
NetLabelList netlabels
Definition: schematicnetsegmentsplitter.h:51
Point getAnchorPosition(const NetLineAnchor &anchor) const noexcept
Definition: schematicnetsegmentsplitter.cpp:172
The Junction class represents the connection point between netlines or traces.
Definition: junction.h:47
Definition: occmodel.cpp:77
void addJunction(const Junction &junction) noexcept
Definition: schematicnetsegmentsplitter.cpp:64
Definition: schematicnetsegmentsplitter.h:48
The NetLabel class represents a net text label of a schematic.
Definition: netlabel.h:47
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:79
void findConnectedLinesAndPoints(const NetLineAnchor &anchor, NetLineList &availableNetLines, Segment &segment) noexcept
Definition: schematicnetsegmentsplitter.cpp:112
JunctionList mJunctions
Definition: schematicnetsegmentsplitter.h:86
NetLineList mNetLines
Definition: schematicnetsegmentsplitter.h:87
QHash< NetLineAnchor, Point > mPinPositions
Definition: schematicnetsegmentsplitter.h:91
NetLabelList mNetLabels
Definition: schematicnetsegmentsplitter.h:88
QHash< NetLineAnchor, NetLineAnchor > mPinAnchorsToReplace
Definition: schematicnetsegmentsplitter.h:90
NetLineList netlines
Definition: schematicnetsegmentsplitter.h:50
The Length class is used to represent a length (for example 12.75 millimeters)
Definition: length.h:83
void addSymbolPin(const NetLineAnchor &anchor, const Point &pos, bool replaceByJunction=false) noexcept
Definition: schematicnetsegmentsplitter.cpp:50
JunctionList junctions
Definition: schematicnetsegmentsplitter.h:49
The NetLineAnchor class.
Definition: netline.h:44
void addNetLabelToNearestNetSegment(const NetLabel &netlabel, QList< Segment > &segments) const noexcept
Definition: schematicnetsegmentsplitter.cpp:138
SchematicNetSegmentSplitter() noexcept
Definition: schematicnetsegmentsplitter.cpp:39
The SchematicNetSegmentSplitter class.
Definition: schematicnetsegmentsplitter.h:45