LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Board Class Referencefinal

The Board class represents a PCB of a project and is always part of a circuit. More...

#include <board.h>

+ Inheritance diagram for Board:
+ Collaboration diagram for Board:

Public Types

enum  ItemZValue
 Z Values of all items in a board scene (to define the stacking order) More...
 

Signals

void attributesChanged () override
 This signal is emited when the value of attributes has changed. More...
 
void deviceAdded (BI_Device &comp)
 
void deviceRemoved (BI_Device &comp)
 
- Signals inherited from AttributeProvider
virtual void attributesChanged ()=0
 This signal is emited when the value of attributes has changed. More...
 

Public Member Functions

 Board ()=delete
 
 Board (const Board &other)=delete
 
 Board (const Board &other, const FilePath &filepath, const ElementName &name)
 
 Board (Project &project, const FilePath &filepath, bool restore, bool readOnly)
 
 ~Board () noexcept
 
ProjectgetProject () const noexcept
 
const FilePathgetFilePath () const noexcept
 
const GridPropertiesgetGridProperties () const noexcept
 
GraphicsScenegetGraphicsScene () const noexcept
 
BoardLayerStackgetLayerStack () noexcept
 
const BoardLayerStackgetLayerStack () const noexcept
 
BoardDesignRulesgetDesignRules () noexcept
 
const BoardDesignRulesgetDesignRules () const noexcept
 
BoardFabricationOutputSettingsgetFabricationOutputSettings () noexcept
 
const
BoardFabricationOutputSettings
getFabricationOutputSettings () const noexcept
 
bool isEmpty () const noexcept
 
QList< BI_Base * > getItemsAtScenePos (const Point &pos) const noexcept
 
QList< BI_Via * > getViasAtScenePos (const Point &pos, const NetSignal *netsignal) const noexcept
 
QList< BI_NetPoint * > getNetPointsAtScenePos (const Point &pos, const GraphicsLayer *layer, const NetSignal *netsignal) const noexcept
 
QList< BI_NetLine * > getNetLinesAtScenePos (const Point &pos, const GraphicsLayer *layer, const NetSignal *netsignal) const noexcept
 
QList< BI_FootprintPad * > getPadsAtScenePos (const Point &pos, const GraphicsLayer *layer, const NetSignal *netsignal) const noexcept
 
QList< BI_Base * > getAllItems () const noexcept
 
void setGridProperties (const GridProperties &grid) noexcept
 
const UuidgetUuid () const noexcept
 
const ElementNamegetName () const noexcept
 
const QIcon & getIcon () const noexcept
 
const QString & getDefaultFontName () const noexcept
 
const QMap< Uuid, BI_Device * > & getDeviceInstances () const noexcept
 
BI_DevicegetDeviceInstanceByComponentUuid (const Uuid &uuid) const noexcept
 
void addDeviceInstance (BI_Device &instance)
 
void removeDeviceInstance (BI_Device &instance)
 
const QList< BI_NetSegment * > & getNetSegments () const noexcept
 
BI_NetSegmentgetNetSegmentByUuid (const Uuid &uuid) const noexcept
 
void addNetSegment (BI_NetSegment &netsegment)
 
void removeNetSegment (BI_NetSegment &netsegment)
 
const QList< BI_Plane * > & getPlanes () const noexcept
 
void addPlane (BI_Plane &plane)
 
void removePlane (BI_Plane &plane)
 
void rebuildAllPlanes () noexcept
 
const QList< BI_Polygon * > & getPolygons () const noexcept
 
void addPolygon (BI_Polygon &polygon)
 
void removePolygon (BI_Polygon &polygon)
 
const QList< BI_StrokeText * > & getStrokeTexts () const noexcept
 
void addStrokeText (BI_StrokeText &text)
 
void removeStrokeText (BI_StrokeText &text)
 
const QList< BI_Hole * > & getHoles () const noexcept
 
void addHole (BI_Hole &hole)
 
void removeHole (BI_Hole &hole)
 
void scheduleAirWiresRebuild (NetSignal *netsignal) noexcept
 
void triggerAirWiresRebuild () noexcept
 
void forceAirWiresRebuild () noexcept
 
void addToProject ()
 
void removeFromProject ()
 
bool save (bool toOriginal, QStringList &errors) noexcept
 
void showInView (GraphicsView &view) noexcept
 
void saveViewSceneRect (const QRectF &rect) noexcept
 
const QRectF & restoreViewSceneRect () const noexcept
 
void setSelectionRect (const Point &p1, const Point &p2, bool updateItems) noexcept
 
void clearSelection () const noexcept
 
std::unique_ptr
< BoardSelectionQuery
createSelectionQuery () const noexcept
 
QString getBuiltInAttributeValue (const QString &key) const noexceptoverride
 Get the value of a built-in attribute (if available) More...
 
QVector< const
AttributeProvider * > 
getAttributeProviderParents () const noexceptoverride
 Get all parent attribute providers (fallback if attribute not found) More...
 
Boardoperator= (const Board &rhs)=delete
 
bool operator== (const Board &rhs) noexcept
 
bool operator!= (const Board &rhs) noexcept
 
- Public Member Functions inherited from AttributeProvider
 AttributeProvider () noexcept
 
 AttributeProvider (const AttributeProvider &other)=delete
 
AttributeProvideroperator= (const AttributeProvider &rhs)=delete
 
virtual ~AttributeProvider () noexcept
 
QString getAttributeValue (const QString &key) const noexcept
 Get the value of an attribute which can be used in texts (like "{{NAME}}") More...
 
virtual QString getUserDefinedAttributeValue (const QString &key) const noexcept
 Get the value of a user defined attribute (if available) More...
 
- Public Member Functions inherited from IF_ErcMsgProvider
 IF_ErcMsgProvider ()
 
virtual ~IF_ErcMsgProvider ()
 
virtual const char * getErcMsgOwnerClassName () const noexcept=0
 
- Public Member Functions inherited from SerializableObject
 SerializableObject () noexcept
 
virtual ~SerializableObject () noexcept
 
SExpression serializeToDomElement (const QString &name) const
 Serialize the object to a new S-Expression node. More...
 

Static Public Member Functions

static Boardcreate (Project &project, const FilePath &filepath, const ElementName &name)
 
- Static Public Member Functions inherited from SerializableObject
template<typename T >
static void serializeObjectContainer (SExpression &root, const T &container, const QString &itemName)
 
template<typename T >
static void serializePointerContainer (SExpression &root, const T &container, const QString &itemName)
 
template<typename T >
static void serializePointerContainerUuidSorted (SExpression &root, const T &container, const QString &itemName)
 

Private Member Functions

 Board (Project &project, const FilePath &filepath, bool restore, bool readOnly, bool create, const QString &newName)
 
void updateIcon () noexcept
 
void updateErcMessages () noexcept
 
void serialize (SExpression &root) const override
 Serialize the object into an existing S-Expression node. More...
 

Private Attributes

ProjectmProject
 A reference to the Project object (from the ctor) More...
 
FilePath mFilePath
 the filepath of the board.lp file (from the ctor) More...
 
QScopedPointer< SmartSExprFilemFile
 
bool mIsAddedToProject
 
QScopedPointer< GraphicsScenemGraphicsScene
 
QScopedPointer< BoardLayerStackmLayerStack
 
QScopedPointer< GridPropertiesmGridProperties
 
QScopedPointer< BoardDesignRulesmDesignRules
 
QScopedPointer
< BoardFabricationOutputSettings
mFabricationOutputSettings
 
QScopedPointer< BoardUserSettingsmUserSettings
 
QRectF mViewRect
 
QSet< NetSignal * > mScheduledNetSignalsForAirWireRebuild
 
Uuid mUuid
 
ElementName mName
 
QIcon mIcon
 
QString mDefaultFontFileName
 
QMap< Uuid, BI_Device * > mDeviceInstances
 
QList< BI_NetSegment * > mNetSegments
 
QList< BI_Plane * > mPlanes
 
QList< BI_Polygon * > mPolygons
 
QList< BI_StrokeText * > mStrokeTexts
 
QList< BI_Hole * > mHoles
 
QMultiHash< NetSignal
*, BI_AirWire * > 
mAirWires
 
QHash< Uuid, ErcMsg * > mErcMsgListUnplacedComponentInstances
 

Detailed Description

The Board class represents a PCB of a project and is always part of a circuit.

Member Enumeration Documentation

enum ItemZValue

Z Values of all items in a board scene (to define the stacking order)

These values are used for QGraphicsItem::setZValue() to define the stacking order of all items in a board QGraphicsScene. We use integer values, even if the z-value of QGraphicsItem is a qreal attribute...

Low number = background, high number = foreground

Enumerator
ZValue_Default 

this is the default value (behind all other items)

ZValue_TextsBottom 

Z value for librepcb::project::BI_StrokeText items.

ZValue_FootprintsBottom 

Z value for librepcb::project::BI_Footprint items

ZValue_FootprintPadsBottom 

Z value for librepcb::project::BI_FootprintPad items

ZValue_CopperBottom 
ZValue_CopperTop 
ZValue_FootprintPadsTop 

Z value for librepcb::project::BI_FootprintPad items

ZValue_FootprintsTop 

Z value for librepcb::project::BI_Footprint items

ZValue_TextsTop 

Z value for librepcb::project::BI_StrokeText items.

ZValue_Vias 

Z value for librepcb::project::BI_Via items.

ZValue_Texts 

Z value for librepcb::project::BI_StrokeText items.

ZValue_AirWires 

Z value for librepcb::project::BI_AirWire items.

Constructor & Destructor Documentation

Board ( )
delete

+ Here is the caller graph for this function:

Board ( const Board other)
delete
Board ( const Board other,
const FilePath filepath,
const ElementName name 
)

+ Here is the call graph for this function:

Board ( Project project,
const FilePath filepath,
bool  restore,
bool  readOnly 
)
inline
~Board ( )
noexcept
Board ( Project project,
const FilePath filepath,
bool  restore,
bool  readOnly,
bool  create,
const QString &  newName 
)
private

+ Here is the call graph for this function:

Member Function Documentation

Project& getProject ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

const FilePath& getFilePath ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

const GridProperties& getGridProperties ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

GraphicsScene& getGraphicsScene ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

BoardLayerStack& getLayerStack ( )
inlinenoexcept

+ Here is the caller graph for this function:

const BoardLayerStack& getLayerStack ( ) const
inlinenoexcept
BoardDesignRules& getDesignRules ( )
inlinenoexcept

+ Here is the caller graph for this function:

const BoardDesignRules& getDesignRules ( ) const
inlinenoexcept
BoardFabricationOutputSettings& getFabricationOutputSettings ( )
inlinenoexcept

+ Here is the caller graph for this function:

const BoardFabricationOutputSettings& getFabricationOutputSettings ( ) const
inlinenoexcept
bool isEmpty ( ) const
noexcept
QList< BI_Base * > getItemsAtScenePos ( const Point pos) const
noexcept

+ Here is the call graph for this function:

QList< BI_Via * > getViasAtScenePos ( const Point pos,
const NetSignal netsignal 
) const
noexcept

+ Here is the call graph for this function:

QList< BI_NetPoint * > getNetPointsAtScenePos ( const Point pos,
const GraphicsLayer layer,
const NetSignal netsignal 
) const
noexcept

+ Here is the call graph for this function:

QList< BI_NetLine * > getNetLinesAtScenePos ( const Point pos,
const GraphicsLayer layer,
const NetSignal netsignal 
) const
noexcept

+ Here is the call graph for this function:

QList< BI_FootprintPad * > getPadsAtScenePos ( const Point pos,
const GraphicsLayer layer,
const NetSignal netsignal 
) const
noexcept

+ Here is the call graph for this function:

QList< BI_Base * > getAllItems ( ) const
noexcept

+ Here is the caller graph for this function:

void setGridProperties ( const GridProperties grid)
noexcept

+ Here is the caller graph for this function:

const Uuid& getUuid ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

const ElementName& getName ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

const QIcon& getIcon ( ) const
inlinenoexcept
const QString& getDefaultFontName ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

const QMap<Uuid, BI_Device*>& getDeviceInstances ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

BI_Device * getDeviceInstanceByComponentUuid ( const Uuid uuid) const
noexcept

+ Here is the caller graph for this function:

void addDeviceInstance ( BI_Device instance)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void removeDeviceInstance ( BI_Device instance)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const QList<BI_NetSegment*>& getNetSegments ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

BI_NetSegment * getNetSegmentByUuid ( const Uuid uuid) const
noexcept

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void addNetSegment ( BI_NetSegment netsegment)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void removeNetSegment ( BI_NetSegment netsegment)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const QList<BI_Plane*>& getPlanes ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

void addPlane ( BI_Plane plane)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void removePlane ( BI_Plane plane)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void rebuildAllPlanes ( )
noexcept

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const QList<BI_Polygon*>& getPolygons ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

void addPolygon ( BI_Polygon polygon)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void removePolygon ( BI_Polygon polygon)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const QList<BI_StrokeText*>& getStrokeTexts ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

void addStrokeText ( BI_StrokeText text)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void removeStrokeText ( BI_StrokeText text)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const QList<BI_Hole*>& getHoles ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

void addHole ( BI_Hole hole)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void removeHole ( BI_Hole hole)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void scheduleAirWiresRebuild ( NetSignal netsignal)
inlinenoexcept

+ Here is the caller graph for this function:

void triggerAirWiresRebuild ( )
noexcept

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void forceAirWiresRebuild ( )
noexcept

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void addToProject ( )

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void removeFromProject ( )

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool save ( bool  toOriginal,
QStringList &  errors 
)
noexcept

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void showInView ( GraphicsView view)
noexcept

+ Here is the caller graph for this function:

void saveViewSceneRect ( const QRectF &  rect)
inlinenoexcept
const QRectF& restoreViewSceneRect ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

void setSelectionRect ( const Point p1,
const Point p2,
bool  updateItems 
)
noexcept

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void clearSelection ( ) const
noexcept

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::unique_ptr< BoardSelectionQuery > createSelectionQuery ( ) const
noexcept

+ Here is the caller graph for this function:

QString getBuiltInAttributeValue ( const QString &  key) const
overridevirtualnoexcept

Get the value of a built-in attribute (if available)

Parameters
keyThe attribute name (e.g. "NAME" for "{{NAME}}")
Returns
The value of the attribute (empty string if not found)

Reimplemented from AttributeProvider.

QVector< const AttributeProvider * > getAttributeProviderParents ( ) const
overridevirtualnoexcept

Get all parent attribute providers (fallback if attribute not found)

Returns
All parent attribute provider objects (empty and nullptr are allowed)

Reimplemented from AttributeProvider.

Board& operator= ( const Board rhs)
delete
bool operator== ( const Board rhs)
inlinenoexcept
bool operator!= ( const Board rhs)
inlinenoexcept
Board * create ( Project project,
const FilePath filepath,
const ElementName name 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void attributesChanged ( )
overridesignal

This signal is emited when the value of attributes has changed.

All derived classes must emit this signal when some attributes have changed their values (only attributes which can be fetched with getAttributeValue(), inclusive all attributes from all "parent" classes).

+ Here is the caller graph for this function:

void deviceAdded ( BI_Device comp)
signal

+ Here is the caller graph for this function:

void deviceRemoved ( BI_Device comp)
signal

+ Here is the caller graph for this function:

void updateIcon ( )
privatenoexcept

+ Here is the caller graph for this function:

void updateErcMessages ( )
privatenoexcept

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void serialize ( SExpression root) const
overrideprivatevirtual

Serialize the object into an existing S-Expression node.

This method inserts/appends all attributes and childs of the object to an existing S-Expression node. The content which already exists in the given S-Expression node will not be removed.

Note
The generated S-Expression node has always the format of the application's major version (it's not possible to generate DOMs of older versions).
Parameters
rootThe target DOM root node
Exceptions
ExceptionThis method throws an exception if an error occurs.

Implements SerializableObject.

+ Here is the call graph for this function:

Member Data Documentation

Project& mProject
private

A reference to the Project object (from the ctor)

FilePath mFilePath
private

the filepath of the board.lp file (from the ctor)

QScopedPointer<SmartSExprFile> mFile
private
bool mIsAddedToProject
private
QScopedPointer<GraphicsScene> mGraphicsScene
private
QScopedPointer<BoardLayerStack> mLayerStack
private
QScopedPointer<GridProperties> mGridProperties
private
QScopedPointer<BoardDesignRules> mDesignRules
private
QScopedPointer<BoardFabricationOutputSettings> mFabricationOutputSettings
private
QScopedPointer<BoardUserSettings> mUserSettings
private
QRectF mViewRect
private
QSet<NetSignal*> mScheduledNetSignalsForAirWireRebuild
private
Uuid mUuid
private
ElementName mName
private
QIcon mIcon
private
QString mDefaultFontFileName
private
QMap<Uuid, BI_Device*> mDeviceInstances
private
QList<BI_NetSegment*> mNetSegments
private
QList<BI_Plane*> mPlanes
private
QList<BI_Polygon*> mPolygons
private
QList<BI_StrokeText*> mStrokeTexts
private
QList<BI_Hole*> mHoles
private
QMultiHash<NetSignal*, BI_AirWire*> mAirWires
private
QHash<Uuid, ErcMsg*> mErcMsgListUnplacedComponentInstances
private

The documentation for this class was generated from the following files: