LibrePCB Developers Documentation
Loading...
Searching...
No Matches
packageeditorstate_addpads.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_EDITOR_PACKAGEEDITORSTATE_ADDPADS_H
21#define LIBREPCB_EDITOR_PACKAGEEDITORSTATE_ADDPADS_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "packageeditorstate.h"
27
29
30#include <QtCore>
31
32#include <memory>
33
34/*******************************************************************************
35 * Namespace / Forward Declarations
36 ******************************************************************************/
37namespace librepcb {
38namespace editor {
39
40class CmdFootprintPadEdit;
41class FootprintPadGraphicsItem;
42
43/*******************************************************************************
44 * Class PackageEditorState_AddPads
45 ******************************************************************************/
46
51 Q_OBJECT
52
53public:
54 // Types
55 enum class PadType { THT, SMT };
56
57 // Constructors / Destructor
60 explicit PackageEditorState_AddPads(Context& context, PadType type,
61 Pad::Function function) noexcept;
62 virtual ~PackageEditorState_AddPads() noexcept;
63
64 // General Methods
65 virtual bool entry() noexcept override;
66 virtual bool exit() noexcept override;
67
68 // Event Handlers
70 const GraphicsSceneMouseEvent& e) noexcept override;
72 const GraphicsSceneMouseEvent& e) noexcept override;
74 const GraphicsSceneMouseEvent& e) noexcept override;
75 virtual bool processRotate(const Angle& rotation) noexcept override;
76
77 // Connection to UI
78 PadType getType() const noexcept { return mPadType; }
79 const std::optional<Uuid>& getPackagePad() const noexcept {
81 }
82 void setPackagePad(const std::optional<Uuid>& pad) noexcept;
86 void setComponentSide(Pad::ComponentSide side) noexcept;
87 Pad::Shape getShape() const noexcept { return mCurrentProperties.getShape(); }
88 void setShape(Pad::Shape shape) noexcept;
89 const PositiveLength& getWidth() const noexcept {
91 }
92 void setWidth(const PositiveLength& width) noexcept;
93 const PositiveLength& getHeight() const noexcept {
95 }
96 void setHeight(const PositiveLength& height) noexcept;
97 const UnsignedLimitedRatio& getRadius() const noexcept {
99 }
100 void setRadius(const UnsignedLimitedRatio& radius) noexcept;
101 std::optional<PositiveLength> getDrillDiameter() const noexcept {
102 if (std::shared_ptr<const PadHole> hole =
104 return hole->getDiameter();
105 } else {
106 return std::nullopt;
107 }
108 }
109 void setDrillDiameter(const PositiveLength& diameter) noexcept;
110 const UnsignedLength& getCopperClearance() const noexcept {
112 }
113 void setCopperClearance(const UnsignedLength& clearance) noexcept;
114 const MaskConfig& getStopMaskConfig() const noexcept {
116 }
117 void setStopMaskConfig(const MaskConfig& cfg) noexcept;
118 Pad::Function getFunction() const noexcept {
120 }
121 bool getFunctionIsFiducial() const noexcept {
123 }
124 void setFunction(Pad::Function function) noexcept;
125
126 // Operator Overloadings
128 delete;
129
130signals:
131 void packagePadChanged(const std::optional<Uuid>& pad);
134 void widthChanged(const PositiveLength& width);
135 void heightChanged(const PositiveLength& height);
141
142private: // Methods
143 bool startAddPad(const Point& pos) noexcept;
144 bool finishAddPad(const Point& pos) noexcept;
145 bool abortAddPad() noexcept;
146 void selectNextFreePackagePad() noexcept;
147 void applyRecommendedRoundedRectRadius() noexcept;
148
149private: // Types / Data
151
153
157};
158
159/*******************************************************************************
160 * End of File
161 ******************************************************************************/
162
163} // namespace editor
164} // namespace librepcb
165
166#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition angle.h:76
The FootprintPad class represents a pad of a footprint.
Definition footprintpad.h:43
const std::optional< Uuid > & getPackagePadUuid() const noexcept
Definition footprintpad.h:88
PadHoleList & getHoles() noexcept
Definition footprintpad.h:87
The MaskConfig class defines how to add automatic stop mask or solder paste.
Definition maskconfig.h:45
const PositiveLength & getWidth() const noexcept
Definition pad.h:100
bool getFunctionIsFiducial() const noexcept
Definition pad.cpp:220
const MaskConfig & getStopMaskConfig() const noexcept
Definition pad.h:106
ComponentSide
Definition pad.h:64
const UnsignedLength & getCopperClearance() const noexcept
Definition pad.h:112
Function
Definition pad.h:69
Function getFunction() const noexcept
Definition pad.h:116
Shape
Definition pad.h:58
const PositiveLength & getHeight() const noexcept
Definition pad.h:101
ComponentSide getComponentSide() const noexcept
Definition pad.h:115
const UnsignedLimitedRatio & getRadius() const noexcept
Definition pad.h:102
Shape getShape() const noexcept
Definition pad.h:99
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
std::shared_ptr< T > value(int index) noexcept
Definition serializableobjectlist.h:254
The CmdFootprintPadEdit class.
Definition cmdfootprintpadedit.h:48
The FootprintPadGraphicsItem class.
Definition footprintpadgraphicsitem.h:50
The PackageEditorState_AddPads class.
Definition packageeditorstate_addpads.h:50
Pad::Shape getShape() const noexcept
Definition packageeditorstate_addpads.h:87
void setFunction(Pad::Function function) noexcept
Definition packageeditorstate_addpads.cpp:326
void setComponentSide(Pad::ComponentSide side) noexcept
Definition packageeditorstate_addpads.cpp:208
void setRadius(const UnsignedLimitedRatio &radius) noexcept
Definition packageeditorstate_addpads.cpp:269
PackageEditorState_AddPads & operator=(const PackageEditorState_AddPads &rhs)=delete
void setShape(Pad::Shape shape) noexcept
Definition packageeditorstate_addpads.cpp:220
virtual bool processGraphicsSceneMouseMoved(const GraphicsSceneMouseEvent &e) noexcept override
Definition packageeditorstate_addpads.cpp:157
std::shared_ptr< FootprintPad > mCurrentPad
Definition packageeditorstate_addpads.h:154
const PositiveLength & getWidth() const noexcept
Definition packageeditorstate_addpads.h:89
void radiusChanged(const UnsignedLimitedRatio &radius)
bool getFunctionIsFiducial() const noexcept
Definition packageeditorstate_addpads.h:121
const MaskConfig & getStopMaskConfig() const noexcept
Definition packageeditorstate_addpads.h:114
std::optional< PositiveLength > getDrillDiameter() const noexcept
Definition packageeditorstate_addpads.h:101
PadType
Definition packageeditorstate_addpads.h:55
Pad::ComponentSide getComponentSide() const noexcept
Definition packageeditorstate_addpads.h:83
virtual bool processGraphicsSceneRightMouseButtonReleased(const GraphicsSceneMouseEvent &e) noexcept override
Definition packageeditorstate_addpads.cpp:177
bool finishAddPad(const Point &pos) noexcept
Definition packageeditorstate_addpads.cpp:376
const UnsignedLength & getCopperClearance() const noexcept
Definition packageeditorstate_addpads.h:110
void setDrillDiameter(const PositiveLength &diameter) noexcept
Definition packageeditorstate_addpads.cpp:280
FootprintPad mCurrentProperties
Definition packageeditorstate_addpads.h:152
virtual bool processGraphicsSceneLeftMouseButtonPressed(const GraphicsSceneMouseEvent &e) noexcept override
Definition packageeditorstate_addpads.cpp:168
void setWidth(const PositiveLength &width) noexcept
Definition packageeditorstate_addpads.cpp:231
const PositiveLength & getHeight() const noexcept
Definition packageeditorstate_addpads.h:93
std::shared_ptr< FootprintPadGraphicsItem > mCurrentGraphicsItem
Definition packageeditorstate_addpads.h:155
const PadType mPadType
Definition packageeditorstate_addpads.h:150
void componentSideChanged(Pad::ComponentSide side)
PadType getType() const noexcept
Definition packageeditorstate_addpads.h:78
const std::optional< Uuid > & getPackagePad() const noexcept
Definition packageeditorstate_addpads.h:79
bool abortAddPad() noexcept
Definition packageeditorstate_addpads.cpp:393
void heightChanged(const PositiveLength &height)
virtual bool processRotate(const Angle &rotation) noexcept override
Definition packageeditorstate_addpads.cpp:183
Pad::Function getFunction() const noexcept
Definition packageeditorstate_addpads.h:118
void functionChanged(Pad::Function function)
void stopMaskConfigChanged(const MaskConfig &cfg)
void drillDiameterChanged(const PositiveLength &diameter)
bool startAddPad(const Point &pos) noexcept
Definition packageeditorstate_addpads.cpp:340
void setPackagePad(const std::optional< Uuid > &pad) noexcept
Definition packageeditorstate_addpads.cpp:196
virtual bool exit() noexcept override
Definition packageeditorstate_addpads.cpp:142
void packagePadChanged(const std::optional< Uuid > &pad)
PackageEditorState_AddPads(const PackageEditorState_AddPads &other)=delete
void widthChanged(const PositiveLength &width)
void copperClearanceChanged(const UnsignedLength &clearance)
void selectNextFreePackagePad() noexcept
Definition packageeditorstate_addpads.cpp:408
void applyRecommendedRoundedRectRadius() noexcept
Definition packageeditorstate_addpads.cpp:427
void setHeight(const PositiveLength &height) noexcept
Definition packageeditorstate_addpads.cpp:250
virtual ~PackageEditorState_AddPads() noexcept
Definition packageeditorstate_addpads.cpp:117
std::unique_ptr< CmdFootprintPadEdit > mCurrentEditCmd
Definition packageeditorstate_addpads.h:156
void setCopperClearance(const UnsignedLength &clearance) noexcept
Definition packageeditorstate_addpads.cpp:302
const UnsignedLimitedRatio & getRadius() const noexcept
Definition packageeditorstate_addpads.h:97
virtual bool entry() noexcept override
Definition packageeditorstate_addpads.cpp:125
void setStopMaskConfig(const MaskConfig &cfg) noexcept
Definition packageeditorstate_addpads.cpp:314
The PackageEditorState class is the base class of all package editor FSM states.
Definition packageeditorstate.h:52
Definition occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition length.h:810
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition length.h:694
type_safe::constrained_type< Ratio, UnsignedLimitedRatioConstraint, UnsignedLimitedRatioVerifier > UnsignedLimitedRatio
Definition ratio.h:376
Definition uuid.h:186
Definition graphicsscene.h:45
Definition packageeditorfsm.h:89