LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
symbolpingraphicsitem.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_LIBRARY_SYMBOLPINGRAPHICSITEM_H
21 #define LIBREPCB_LIBRARY_SYMBOLPINGRAPHICSITEM_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
28 
29 #include <QtCore>
30 #include <QtWidgets>
31 
32 /*******************************************************************************
33  * Namespace / Forward Declarations
34  ******************************************************************************/
35 namespace librepcb {
36 
37 class IF_GraphicsLayerProvider;
38 class PrimitiveCircleGraphicsItem;
39 class LineGraphicsItem;
40 class PrimitiveTextGraphicsItem;
41 
42 namespace library {
43 
44 class SymbolPin;
45 
46 /*******************************************************************************
47  * Class SymbolPinGraphicsItem
48  ******************************************************************************/
49 
53 class SymbolPinGraphicsItem final : public QGraphicsItem {
54 public:
55  // Constructors / Destructor
56  SymbolPinGraphicsItem() = delete;
57  SymbolPinGraphicsItem(const SymbolPinGraphicsItem& other) = delete;
59  QGraphicsItem* parent = nullptr) noexcept;
60  ~SymbolPinGraphicsItem() noexcept;
61 
62  // Getters
63  SymbolPin& getPin() noexcept { return mPin; }
64 
65  // Setters
66  void setPosition(const Point& pos) noexcept;
67  void setRotation(const Angle& rot) noexcept;
68  void setLength(const UnsignedLength& length) noexcept;
69  void setName(const CircuitIdentifier& name) noexcept;
70  void setSelected(bool selected) noexcept;
71 
72  // Inherited from QGraphicsItem
73  QRectF boundingRect() const noexcept override { return QRectF(); }
74  QPainterPath shape() const noexcept override;
75  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
76  QWidget* widget = 0) noexcept override;
77 
78  // Operator Overloadings
79  SymbolPinGraphicsItem& operator=(const SymbolPinGraphicsItem& rhs) = delete;
80 
81 private: // Methods
82  void updateShape() noexcept;
83 
84 private: // Data
89 };
90 
91 /*******************************************************************************
92  * End of File
93  ******************************************************************************/
94 
95 } // namespace library
96 } // namespace librepcb
97 
98 #endif // LIBREPCB_LIBRARY_SYMBOLPINGRAPHICSITEM_H
QScopedPointer< LineGraphicsItem > mLineGraphicsItem
Definition: symbolpingraphicsitem.h:87
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers...
Definition: graphicslayer.h:227
QRectF boundingRect() const noexceptoverride
Definition: symbolpingraphicsitem.h:73
QScopedPointer< PrimitiveCircleGraphicsItem > mCircleGraphicsItem
Definition: symbolpingraphicsitem.h:86
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0) noexceptoverride
Definition: symbolpingraphicsitem.cpp:127
~SymbolPinGraphicsItem() noexcept
Definition: symbolpingraphicsitem.cpp:84
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
void setSelected(bool selected) noexcept
Definition: symbolpingraphicsitem.cpp:110
The LineGraphicsItem class.
Definition: linegraphicsitem.h:44
SymbolPin & mPin
Definition: symbolpingraphicsitem.h:85
The SymbolPinGraphicsItem class.
Definition: symbolpingraphicsitem.h:53
void setName(const CircuitIdentifier &name) noexcept
Definition: symbolpingraphicsitem.cpp:105
void setRotation(const Angle &rot) noexcept
Definition: symbolpingraphicsitem.cpp:96
void setPosition(const Point &pos) noexcept
Definition: symbolpingraphicsitem.cpp:92
type_safe::constrained_type< QString, CircuitIdentifierConstraint, CircuitIdentifierVerifier > CircuitIdentifier
Definition: circuitidentifier.h:89
The PrimitiveCircleGraphicsItem class.
Definition: primitivecirclegraphicsitem.h:44
SymbolPin & getPin() noexcept
Definition: symbolpingraphicsitem.h:63
QPainterPath shape() const noexceptoverride
Definition: symbolpingraphicsitem.cpp:121
The SymbolPin class represents one pin of a symbol.
Definition: symbolpin.h:54
void setLength(const UnsignedLength &length) noexcept
Definition: symbolpingraphicsitem.cpp:100
QScopedPointer< PrimitiveTextGraphicsItem > mTextGraphicsItem
Definition: symbolpingraphicsitem.h:88
The PrimitiveTextGraphicsItem class is the graphical representation of a text.
Definition: primitivetextgraphicsitem.h:46
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:659