LibrePCB Developers Documentation
Loading...
Searching...
No Matches
BoardDesignRuleCheck Class Referencefinal

The BoardDesignRuleCheck class checks a librepcb::Board for design rule violations. More...

#include <boarddesignrulecheck.h>

Inherits QObject.

+ Collaboration diagram for BoardDesignRuleCheck:

Classes

struct  CalculatedJobData
 
struct  Result
 

Public Types

using Data = BoardDesignRuleCheckData
 

Signals

void started ()
 
void progressPercent (int percent)
 
void progressStatus (const QString &msg)
 
void finished (Result result)
 

Public Member Functions

 BoardDesignRuleCheck (QObject *parent=nullptr) noexcept
 
 ~BoardDesignRuleCheck () noexcept
 
void start (Board &board, const BoardDesignRuleCheckSettings &settings, bool quick) noexcept
 
bool isRunning () const noexcept
 
Result waitForFinished () const noexcept
 Wait until the asynchronous operation is finished.
 
void cancel () noexcept
 Cancel the current asynchronous job.
 

Private Types

typedef std::function< RuleCheckMessageList()> JobFunc
 
typedef std::function< void(const Data &, CalculatedJobData &)> Stage1Func
 
typedef RuleCheckMessageList(BoardDesignRuleCheck::* Stage2Func) (const Data &, const CalculatedJobData &)
 
typedef RuleCheckMessageList(BoardDesignRuleCheck::* IndependentStageFunc) (const Data &)
 

Private Member Functions

Result tryRunJob (JobFunc function, int weight) noexcept
 
Result run (std::shared_ptr< const Data > data, std::shared_ptr< QElapsedTimer > timer) noexcept
 
void prepareCopperPaths (const Data &data, CalculatedJobData &calcData, const Layer &layer)
 
RuleCheckMessageList checkCopperCopperClearances (const Data &data)
 
RuleCheckMessageList checkCopperBoardClearances (const Data &data)
 
RuleCheckMessageList checkCopperHoleClearances (const Data &data, const CalculatedJobData &calcData)
 
RuleCheckMessageList checkDrillDrillClearances (const Data &data)
 
RuleCheckMessageList checkDrillBoardClearances (const Data &data)
 
RuleCheckMessageList checkSilkscreenStopmaskClearances (const Data &data)
 
RuleCheckMessageList checkMinimumCopperWidth (const Data &data)
 
RuleCheckMessageList checkMinimumPthAnnularRing (const Data &data, const CalculatedJobData &calcData)
 
RuleCheckMessageList checkMinimumNpthDrillDiameter (const Data &data)
 
RuleCheckMessageList checkMinimumNpthSlotWidth (const Data &data)
 
RuleCheckMessageList checkMinimumPthDrillDiameter (const Data &data)
 
RuleCheckMessageList checkMinimumPthSlotWidth (const Data &data)
 
RuleCheckMessageList checkMinimumSilkscreenWidth (const Data &data)
 
RuleCheckMessageList checkMinimumSilkscreenTextHeight (const Data &data)
 
RuleCheckMessageList checkZones (const Data &data)
 
RuleCheckMessageList checkVias (const Data &data)
 
RuleCheckMessageList checkAllowedNpthSlots (const Data &data)
 
RuleCheckMessageList checkAllowedPthSlots (const Data &data)
 
RuleCheckMessageList checkInvalidPadConnections (const Data &data)
 
RuleCheckMessageList checkDeviceClearances (const Data &data)
 
RuleCheckMessageList checkBoardOutline (const Data &data)
 
RuleCheckMessageList checkUsedLayers (const Data &data)
 
RuleCheckMessageList checkForUnplacedComponents (const Data &data)
 
RuleCheckMessageList checkForMissingConnections (const Data &data)
 
RuleCheckMessageList checkForStaleObjects (const Data &data)
 
void emitProgress (int percent) noexcept
 
void emitStatus (const QString &status) noexcept
 

Static Private Member Functions

static void checkMinimumWidth (RuleCheckMessageList &messages, const Data &data, const UnsignedLength &minWidth, std::function< bool(const Layer &)> layerFilter)
 
static bool requiresHoleSlotWarning (const Data::Hole &hole, BoardDesignRuleCheckSettings::AllowedSlots allowed)
 
static ClipperLib::Paths getBoardClearanceArea (const Data &data, const UnsignedLength &clearance)
 
static QVector< PathgetBoardOutlines (const Data &data, const QSet< const Layer * > &layers) noexcept
 
static ClipperLib::Paths getDeviceOutlinePaths (const Data::Device &device, const Layer &layer)
 
static QVector< PathgetDeviceLocation (const Data::Device &device)
 
static QVector< PathgetViaLocation (const Data::Via &via) noexcept
 
static bool isViaUseless (const Data &data, const Data::Segment &ns, const Data::Via &via) noexcept
 
static QVector< PathgetTraceLocation (const Data::Trace &trace) noexcept
 
static QVector< PathgetHoleLocation (const Data::Hole &hole, const Transform &transform=Transform()) noexcept
 
static PositiveLength maxArcTolerance () noexcept
 

Private Attributes

QMutex mMutex
 
int mProgressTotal = 0
 
int mProgressCounter = 0
 
QFuture< ResultmFuture
 
bool mAbort = false
 

Detailed Description

The BoardDesignRuleCheck class checks a librepcb::Board for design rule violations.

Member Typedef Documentation

◆ Data

◆ JobFunc

typedef std::function<RuleCheckMessageList()> JobFunc
private

◆ Stage1Func

typedef std::function<void(const Data&, CalculatedJobData&)> Stage1Func
private

◆ Stage2Func

typedef RuleCheckMessageList(BoardDesignRuleCheck::* Stage2Func) (const Data &, const CalculatedJobData &)
private

◆ IndependentStageFunc

typedef RuleCheckMessageList(BoardDesignRuleCheck::* IndependentStageFunc) (const Data &)
private

Constructor & Destructor Documentation

◆ BoardDesignRuleCheck()

BoardDesignRuleCheck ( QObject *  parent = nullptr)
explicitnoexcept

◆ ~BoardDesignRuleCheck()

~BoardDesignRuleCheck ( )
noexcept
+ Here is the call graph for this function:

Member Function Documentation

◆ start()

void start ( Board board,
const BoardDesignRuleCheckSettings settings,
bool  quick 
)
noexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isRunning()

bool isRunning ( ) const
noexcept

◆ waitForFinished()

BoardDesignRuleCheck::Result waitForFinished ( ) const
noexcept

Wait until the asynchronous operation is finished.

Returns
All emitted messages and occurred errors
+ Here is the caller graph for this function:

◆ cancel()

void cancel ( )
noexcept

Cancel the current asynchronous job.

+ Here is the caller graph for this function:

◆ started

void started ( )
signal

◆ progressPercent

void progressPercent ( int  percent)
signal

◆ progressStatus

void progressStatus ( const QString &  msg)
signal

◆ finished

void finished ( Result  result)
signal

◆ tryRunJob()

BoardDesignRuleCheck::Result tryRunJob ( JobFunc  function,
int  weight 
)
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ run()

BoardDesignRuleCheck::Result run ( std::shared_ptr< const Data data,
std::shared_ptr< QElapsedTimer >  timer 
)
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareCopperPaths()

void prepareCopperPaths ( const Data data,
CalculatedJobData calcData,
const Layer layer 
)
private
+ Here is the call graph for this function:

◆ checkCopperCopperClearances()

RuleCheckMessageList checkCopperCopperClearances ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkCopperBoardClearances()

RuleCheckMessageList checkCopperBoardClearances ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkCopperHoleClearances()

RuleCheckMessageList checkCopperHoleClearances ( const Data data,
const CalculatedJobData calcData 
)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkDrillDrillClearances()

RuleCheckMessageList checkDrillDrillClearances ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkDrillBoardClearances()

RuleCheckMessageList checkDrillBoardClearances ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkSilkscreenStopmaskClearances()

RuleCheckMessageList checkSilkscreenStopmaskClearances ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkMinimumCopperWidth()

RuleCheckMessageList checkMinimumCopperWidth ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkMinimumPthAnnularRing()

RuleCheckMessageList checkMinimumPthAnnularRing ( const Data data,
const CalculatedJobData calcData 
)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkMinimumNpthDrillDiameter()

RuleCheckMessageList checkMinimumNpthDrillDiameter ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkMinimumNpthSlotWidth()

RuleCheckMessageList checkMinimumNpthSlotWidth ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkMinimumPthDrillDiameter()

RuleCheckMessageList checkMinimumPthDrillDiameter ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkMinimumPthSlotWidth()

RuleCheckMessageList checkMinimumPthSlotWidth ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkMinimumSilkscreenWidth()

RuleCheckMessageList checkMinimumSilkscreenWidth ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkMinimumSilkscreenTextHeight()

RuleCheckMessageList checkMinimumSilkscreenTextHeight ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkZones()

RuleCheckMessageList checkZones ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkVias()

RuleCheckMessageList checkVias ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkAllowedNpthSlots()

RuleCheckMessageList checkAllowedNpthSlots ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkAllowedPthSlots()

RuleCheckMessageList checkAllowedPthSlots ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkInvalidPadConnections()

RuleCheckMessageList checkInvalidPadConnections ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkDeviceClearances()

RuleCheckMessageList checkDeviceClearances ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkBoardOutline()

RuleCheckMessageList checkBoardOutline ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkUsedLayers()

RuleCheckMessageList checkUsedLayers ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkForUnplacedComponents()

RuleCheckMessageList checkForUnplacedComponents ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkForMissingConnections()

RuleCheckMessageList checkForMissingConnections ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkForStaleObjects()

RuleCheckMessageList checkForStaleObjects ( const Data data)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkMinimumWidth()

void checkMinimumWidth ( RuleCheckMessageList messages,
const Data data,
const UnsignedLength minWidth,
std::function< bool(const Layer &)>  layerFilter 
)
staticprivate
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ requiresHoleSlotWarning()

bool requiresHoleSlotWarning ( const Data::Hole hole,
BoardDesignRuleCheckSettings::AllowedSlots  allowed 
)
staticprivate
+ Here is the caller graph for this function:

◆ getBoardClearanceArea()

ClipperLib::Paths getBoardClearanceArea ( const Data data,
const UnsignedLength clearance 
)
staticprivate
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBoardOutlines()

QVector< Path > getBoardOutlines ( const Data data,
const QSet< const Layer * > &  layers 
)
staticprivatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDeviceOutlinePaths()

ClipperLib::Paths getDeviceOutlinePaths ( const Data::Device device,
const Layer layer 
)
staticprivate
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDeviceLocation()

QVector< Path > getDeviceLocation ( const Data::Device device)
staticprivate
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getViaLocation()

QVector< Path > getViaLocation ( const Data::Via via)
staticprivatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isViaUseless()

bool isViaUseless ( const Data data,
const Data::Segment ns,
const Data::Via via 
)
staticprivatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTraceLocation()

QVector< Path > getTraceLocation ( const Data::Trace trace)
staticprivatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHoleLocation()

QVector< Path > getHoleLocation ( const Data::Hole hole,
const Transform transform = Transform() 
)
staticprivatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ emitProgress()

void emitProgress ( int  percent)
privatenoexcept

◆ emitStatus()

void emitStatus ( const QString &  status)
privatenoexcept
+ Here is the caller graph for this function:

◆ maxArcTolerance()

static PositiveLength maxArcTolerance ( )
inlinestaticprivatenoexcept

Returns the maximum allowed arc tolerance when flattening arcs.

+ Here is the caller graph for this function:

Member Data Documentation

◆ mMutex

QMutex mMutex
private

◆ mProgressTotal

int mProgressTotal = 0
private

◆ mProgressCounter

int mProgressCounter = 0
private

◆ mFuture

QFuture<Result> mFuture
private

◆ mAbort

bool mAbort = false
private

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