20#ifndef LIBREPCB_CORE_BOARD_H
21#define LIBREPCB_CORE_BOARD_H
26#include "../../fileio/filepath.h"
27#include "../../fileio/transactionaldirectory.h"
28#include "../../types/elementname.h"
29#include "../../types/length.h"
30#include "../../types/lengthunit.h"
31#include "../../types/uuid.h"
32#include "../../types/version.h"
56class BoardDesignRuleCheckSettings;
57class BoardDesignRules;
58class BoardFabricationOutputSettings;
73class Board final :
public QObject {
80 Board(
Project& project, std::unique_ptr<TransactionalDirectory> directory,
81 const QString& directoryName,
const Uuid& uuid,
105 const
tl::optional<
Uuid>& assemblyVariant) const noexcept;
174 const QSet<SExpression>& approvals)
noexcept;
176 bool partialRun)
noexcept;
178 bool approved)
noexcept;
202 const QSet<const
Layer*>& layers) noexcept;
246 bool operator==(const
Board& rhs) noexcept {
return (
this == &rhs); }
The BI_AirWire class.
Definition: bi_airwire.h:45
The Board Item Base (BI_Base) class.
Definition: bi_base.h:45
The BI_Device class.
Definition: bi_device.h:57
The BI_Hole class.
Definition: bi_hole.h:46
The BI_NetSegment class.
Definition: bi_netsegment.h:52
The BI_Plane class.
Definition: bi_plane.h:52
The BI_Polygon class.
Definition: bi_polygon.h:46
The BI_StrokeText class.
Definition: bi_stroketext.h:49
The BI_Zone class.
Definition: bi_zone.h:46
The BoardDesignRuleCheckSettings class.
Definition: boarddesignrulechecksettings.h:44
The BoardDesignRules class.
Definition: boarddesignrules.h:45
The BoardFabricationOutputSettings class.
Definition: boardfabricationoutputsettings.h:43
The Board class represents a PCB of a project and is always part of a circuit.
Definition: board.h:73
std::shared_ptr< SceneData3D > buildScene3D(const tl::optional< Uuid > &assemblyVariant) const noexcept
Definition: board.cpp:160
void setLayersVisibility(const QMap< QString, bool > &visibility) noexcept
Definition: board.h:163
TransactionalDirectory & getDirectory() noexcept
Definition: board.h:88
void setSilkscreenColor(const PcbColor &c) noexcept
Definition: board.h:156
void removeStrokeText(BI_StrokeText &text)
Definition: board.cpp:565
QMap< Uuid, BI_Polygon * > mPolygons
Definition: board.h:313
void setName(const ElementName &name) noexcept
Definition: board.h:145
void removeHole(BI_Hole &hole)
Definition: board.cpp:596
const BoardDesignRules & getDesignRules() const noexcept
Definition: board.h:89
void invalidatePlanes(const Layer *layer=nullptr) noexcept
Definition: board.cpp:455
QScopedPointer< BoardFabricationOutputSettings > mFabricationOutputSettings
Definition: board.h:280
void addNetSegment(BI_NetSegment &netsegment)
Definition: board.cpp:395
void addHole(BI_Hole &hole)
Definition: board.cpp:580
const LengthUnit & getGridUnit() const noexcept
Definition: board.h:116
void removeZone(BI_Zone &zone)
Definition: board.cpp:500
const BoardDesignRuleCheckSettings & getDrcSettings() const noexcept
Definition: board.h:92
PositiveLength mGridInterval
Definition: board.h:288
void removePolygon(BI_Polygon &polygon)
Definition: board.cpp:533
BoardFabricationOutputSettings & getFabricationOutputSettings() noexcept
Definition: board.h:95
void removeDeviceInstance(BI_Device &instance)
Definition: board.cpp:379
const PositiveLength & getGridInterval() const noexcept
Definition: board.h:113
void removeNetSegment(BI_NetSegment &netsegment)
Definition: board.cpp:413
void forceAirWiresRebuild() noexcept
Definition: board.cpp:648
QSet< const Layer * > mScheduledLayersForPlanesRebuild
Definition: board.h:282
QSet< SExpression > mSupportedDrcMessageApprovals
Definition: board.h:306
tl::optional< std::pair< Point, Point > > calculateBoundingRect() const noexcept
Definition: board.cpp:659
const QMap< Uuid, BI_StrokeText * > & getStrokeTexts() const noexcept
Definition: board.h:217
const QMap< Uuid, BI_Hole * > & getHoles() const noexcept
Definition: board.h:224
void copyFrom(const Board &other)
Definition: board.cpp:706
const PcbColor * getSilkscreenColorBot() const noexcept
Definition: board.h:131
QMap< Uuid, BI_Device * > mDeviceInstances
Definition: board.h:309
void netSegmentAdded(BI_NetSegment &netSegment)
void airWireRemoved(BI_AirWire &airWire)
const QString mDirectoryName
Definition: board.h:274
void setInnerLayerCount(int count) noexcept
Definition: board.cpp:272
QVector< const Layer * > mSilkscreenLayersTop
Definition: board.h:297
LengthUnit mGridUnit
Definition: board.h:289
const QSet< const Layer * > getCopperLayers() const noexcept
Definition: board.h:118
const PcbColor & getSilkscreenColor() const noexcept
Definition: board.h:125
const QMap< Uuid, BI_Plane * > & getPlanes() const noexcept
Definition: board.h:196
void addStrokeText(BI_StrokeText &text)
Definition: board.cpp:548
void strokeTextAdded(BI_StrokeText &strokeText)
const PcbColor * mSilkscreenColor
Must never be nullptr!
Definition: board.h:296
void polygonRemoved(BI_Polygon &polygon)
void strokeTextRemoved(BI_StrokeText &strokeText)
const PositiveLength & getPcbThickness() const noexcept
Definition: board.h:121
QSet< SExpression > mDrcMessageApprovals
Definition: board.h:305
void loadDrcMessageApprovals(const Version &version, const QSet< SExpression > &approvals) noexcept
Definition: board.cpp:306
const PcbColor * getSilkscreenColorTop() const noexcept
Definition: board.h:128
const ElementName & getName() const noexcept
Definition: board.h:109
Uuid mUuid
Definition: board.h:285
QMap< Uuid, BI_Hole * > mHoles
Definition: board.h:315
const QVector< const Layer * > & getSilkscreenLayersBot() const noexcept
Definition: board.h:137
void setDrcSettings(const BoardDesignRuleCheckSettings &settings) noexcept
Definition: board.cpp:297
QScopedPointer< BoardDesignRules > mDesignRules
Definition: board.h:278
~Board() noexcept
Definition: board.cpp:111
const QVector< const Layer * > & getSilkscreenLayersTop() const noexcept
Definition: board.h:134
void setDesignRules(const BoardDesignRules &rules) noexcept
Definition: board.cpp:288
void addPlane(BI_Plane &plane)
Definition: board.cpp:428
ElementName mName
Definition: board.h:286
void setDefaultFontName(const QString &name) noexcept
Definition: board.h:146
void addDeviceInstance(BI_Device &instance)
Definition: board.cpp:361
Version mDrcMessageApprovalsVersion
Definition: board.h:304
bool mIsAddedToProject
Definition: board.h:276
QMap< Uuid, BI_Plane * > mPlanes
Definition: board.h:311
QMap< Uuid, BI_Zone * > mZones
Definition: board.h:312
void polygonAdded(BI_Polygon &polygon)
BI_Device * getDeviceInstanceByComponentUuid(const Uuid &uuid) const noexcept
Definition: board.cpp:356
const BoardFabricationOutputSettings & getFabricationOutputSettings() const noexcept
Definition: board.h:98
void addPolygon(BI_Polygon &polygon)
Definition: board.cpp:515
void airWireAdded(BI_AirWire &airWire)
const QMap< Uuid, BI_Device * > & getDeviceInstances() const noexcept
Definition: board.h:181
void netSegmentRemoved(BI_NetSegment &netSegment)
Board(const Board &other)=delete
bool updateDrcMessageApprovals(QSet< SExpression > approvals, bool partialRun) noexcept
Definition: board.cpp:312
void setGridUnit(const LengthUnit &unit) noexcept
Definition: board.h:152
void scheduleAirWiresRebuild(NetSignal *netsignal) noexcept
Definition: board.h:230
const QSet< SExpression > & getDrcMessageApprovals() const noexcept
Definition: board.h:170
Project & getProject() const noexcept
Definition: board.h:86
PositiveLength mPcbThickness
Total PCB thickness (all layers)
Definition: board.h:294
QSet< const Layer * > mCopperLayers
Derived from mInnerLayerCount.
Definition: board.h:293
const QString & getDefaultFontName() const noexcept
Definition: board.h:110
QList< BI_Base * > getAllItems() const noexcept
Definition: board.cpp:147
void addToProject()
Definition: board.cpp:839
Project & mProject
A reference to the Project object (from the ctor)
Definition: board.h:273
int getInnerLayerCount() const noexcept
Definition: board.h:117
int mInnerLayerCount
Definition: board.h:292
void zoneRemoved(BI_Zone &zone)
void addDefaultContent()
Definition: board.cpp:696
void triggerAirWiresRebuild() noexcept
Definition: board.cpp:611
QScopedPointer< BoardDesignRuleCheckSettings > mDrcSettings
Definition: board.h:279
const QMap< Uuid, BI_NetSegment * > & getNetSegments() const noexcept
Definition: board.h:189
void deviceRemoved(BI_Device &device)
QString mDefaultFontFileName
Definition: board.h:287
QMap< QString, bool > mLayersVisibility
Definition: board.h:301
void planeAdded(BI_Plane &plane)
void designRulesModified()
QMap< Uuid, BI_NetSegment * > mNetSegments
Definition: board.h:310
void save()
Definition: board.cpp:885
const Uuid & getUuid() const noexcept
Definition: board.h:108
void removePlane(BI_Plane &plane)
Definition: board.cpp:444
std::unique_ptr< TransactionalDirectory > mDirectory
Definition: board.h:275
void addZone(BI_Zone &zone)
Definition: board.cpp:484
QSet< const Layer * > takeScheduledLayersForPlanesRebuild(const QSet< const Layer * > &layers) noexcept
Definition: board.cpp:473
bool isEmpty() const noexcept
Definition: board.cpp:141
void setSilkscreenLayersTop(const QVector< const Layer * > &l) noexcept
Definition: board.h:157
void setPcbThickness(const PositiveLength &t) noexcept
Definition: board.h:154
void setSilkscreenLayersBot(const QVector< const Layer * > &l) noexcept
Definition: board.h:160
void planeRemoved(BI_Plane &plane)
const QMap< QString, bool > & getLayersVisibility() const noexcept
Definition: board.h:140
bool operator!=(const Board &rhs) noexcept
Definition: board.h:247
const PcbColor * mSolderResist
nullptr means no solder resist!
Definition: board.h:295
QSet< NetSignal * > mScheduledNetSignalsForAirWireRebuild
Definition: board.h:281
void removeFromProject()
Definition: board.cpp:864
void innerLayerCountChanged()
const QMap< Uuid, BI_Zone * > & getZones() const noexcept
Definition: board.h:205
void holeAdded(BI_Hole &hole)
QMap< Uuid, BI_StrokeText * > mStrokeTexts
Definition: board.h:314
void zoneAdded(BI_Zone &zone)
QMultiHash< NetSignal *, BI_AirWire * > mAirWires
Definition: board.h:316
void deviceAdded(BI_Device &device)
const PcbColor * getSolderResist() const noexcept
Definition: board.h:124
const QMap< Uuid, BI_Polygon * > & getPolygons() const noexcept
Definition: board.h:210
QVector< const Layer * > mSilkscreenLayersBot
Definition: board.h:298
void holeRemoved(BI_Hole &hole)
void setGridInterval(const PositiveLength &interval) noexcept
Definition: board.h:149
void setSolderResist(const PcbColor *c) noexcept
Definition: board.h:155
QList< BI_AirWire * > getAirWires() const noexcept
Definition: board.h:229
void setDrcMessageApproved(const SExpression &approval, bool approved) noexcept
Definition: board.cpp:343
const QString & getDirectoryName() const noexcept
Definition: board.h:87
The Layer class provides all supported geometry layers.
Definition: layer.h:42
The LengthUnit class represents a length unit (millimeters, inches,...) and provides some useful meth...
Definition: lengthunit.h:60
The NetSignal class.
Definition: netsignal.h:50
Predefined colors relevant for PCB fabrication.
Definition: pcbcolor.h:41
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition: point.h:79
The Project class represents a whole (opened) project with all its content.
Definition: project.h:71
The SExpression class.
Definition: sexpression.h:69
3D scene data representing a board with package models
Definition: scenedata3d.h:53
Helper class to access a subdirectory of TransactionalFileSystem.
Definition: transactionaldirectory.h:51
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The Version class represents a version number in the format "1.42.7".
Definition: version.h:58
Definition: occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
type_safe::constrained_type< QString, ElementNameConstraint, ElementNameVerifier > ElementName
Definition: elementname.h:84