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

Paints a librepcb::Board in realistic mode to a QPainter. More...

#include <realisticboardpainter.h>

+ Inheritance diagram for RealisticBoardPainter:
+ Collaboration diagram for RealisticBoardPainter:

Public Member Functions

 RealisticBoardPainter ()=delete
 
 RealisticBoardPainter (std::shared_ptr< SceneData3D > data)
 
 RealisticBoardPainter (const RealisticBoardPainter &other)=delete
 
 ~RealisticBoardPainter () noexcept
 
void paint (QPainter &painter, const GraphicsExportSettings &settings) const noexcept override
 Draw page content on a QPainter.
 
RealisticBoardPainteroperator= (const RealisticBoardPainter &rhs)=delete
 

Private Member Functions

QVector< std::pair< QColor, QPainterPath > > getContent (const GraphicsExportSettings &settings) const noexcept
 

Private Attributes

const PositiveLength mMaxArcTolerance
 
std::shared_ptr< SceneData3DmData
 
QMutex mMutex
 
bool mDataPreprocessed
 
std::optional< ClipperLib::Paths > mCachedHoles
 
std::optional< ClipperLib::Paths > mCachedCopperHoles
 
std::optional< ClipperLib::Paths > mCachedBoardOutlines
 
std::optional< ClipperLib::Paths > mCachedBoardArea
 
std::optional< ClipperLib::Paths > mCachedSolderResistTop
 
std::optional< ClipperLib::Paths > mCachedSolderResistBot
 
QHash< QString, QPainterPath > mCachedContentPerLayer
 

Detailed Description

Paints a librepcb::Board in realistic mode to a QPainter.

Similar to librepcb::BoardPainter, but rendering physical layers instead of logical layers, i.e. the output will be a realistic PCB with gray body, golden copper, (typically) green solder resist and (typically) white silkscreen instead of just rendering all objects the same way as on screen.

Used in conjuction with librepcb::GraphicsExport. Colors are obtained from librepcb::SceneData3D and whether the top or the bottom side is rendered is controlled by librepcb::GraphicsExportSettings::getMirror().

See also
librepcb::GraphicsPagePainter
librepcb::GraphicsExport
librepcb::SceneData3D

Constructor & Destructor Documentation

◆ RealisticBoardPainter() [1/3]

◆ RealisticBoardPainter() [2/3]

RealisticBoardPainter ( std::shared_ptr< SceneData3D data)
explicit

◆ RealisticBoardPainter() [3/3]

RealisticBoardPainter ( const RealisticBoardPainter other)
delete

◆ ~RealisticBoardPainter()

~RealisticBoardPainter ( )
noexcept

Member Function Documentation

◆ paint()

void paint ( QPainter &  painter,
const GraphicsExportSettings settings 
) const
overridevirtualnoexcept

Draw page content on a QPainter.

Attention
This method must be thread-safe as it might be called from multiple threads at the same time!
Note
Most settings are already handled by librepcb::GraphicsExport and should not be taken into account when implementing this method. In particular, any page layout or coordinate transformations do not need to be respected by this implementation. And for layer colors, just use librepcb::GraphicsExportSettings::getColor() and librepcb::GraphicsExportSettings::getFillColor().
Parameters
painterWhere to paint the content to.
settingsHelper class to fetch layer colors depending on the current export settings.

Implements GraphicsPagePainter.

◆ operator=()

RealisticBoardPainter & operator= ( const RealisticBoardPainter rhs)
delete

◆ getContent()

QVector< std::pair< QColor, QPainterPath > > getContent ( const GraphicsExportSettings settings) const
privatenoexcept
+ Here is the call graph for this function:

Member Data Documentation

◆ mMaxArcTolerance

const PositiveLength mMaxArcTolerance
private

◆ mData

std::shared_ptr<SceneData3D> mData
private

◆ mMutex

QMutex mMutex
mutableprivate

◆ mDataPreprocessed

bool mDataPreprocessed
mutableprivate

◆ mCachedHoles

std::optional<ClipperLib::Paths> mCachedHoles
mutableprivate

◆ mCachedCopperHoles

std::optional<ClipperLib::Paths> mCachedCopperHoles
mutableprivate

◆ mCachedBoardOutlines

std::optional<ClipperLib::Paths> mCachedBoardOutlines
mutableprivate

◆ mCachedBoardArea

std::optional<ClipperLib::Paths> mCachedBoardArea
mutableprivate

◆ mCachedSolderResistTop

std::optional<ClipperLib::Paths> mCachedSolderResistTop
mutableprivate

◆ mCachedSolderResistBot

std::optional<ClipperLib::Paths> mCachedSolderResistBot
mutableprivate

◆ mCachedContentPerLayer

QHash<QString, QPainterPath> mCachedContentPerLayer
mutableprivate

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