LibrePCB Developers Documentation
PrimitiveZoneGraphicsItem Class Reference

The PrimitiveZoneGraphicsItem class. More...

#include <primitivezonegraphicsitem.h>

+ Inheritance diagram for PrimitiveZoneGraphicsItem:
+ Collaboration diagram for PrimitiveZoneGraphicsItem:

Classes

struct  VertexHandle
 

Public Member Functions

 PrimitiveZoneGraphicsItem ()=delete
 
 PrimitiveZoneGraphicsItem (const PrimitiveZoneGraphicsItem &other)=delete
 
 PrimitiveZoneGraphicsItem (const IF_GraphicsLayerProvider &lp, QGraphicsItem *parent=nullptr) noexcept
 
virtual ~PrimitiveZoneGraphicsItem () noexcept
 
int getLineIndexAtPosition (const Point &pos) const noexcept
 
QVector< int > getVertexIndicesAtPosition (const Point &pos) const noexcept
 
void setPosition (const Point &pos) noexcept
 
void setRotation (const Angle &rot) noexcept
 
void setAllLayers (const QSet< const Layer * > &layers) noexcept
 
void setEnabledLayers (const QSet< const Layer * > &layers) noexcept
 
void setOutline (const Path &path) noexcept
 
void setEditable (bool editable) noexcept
 
QVariant itemChange (GraphicsItemChange change, const QVariant &value) noexcept override
 
QRectF boundingRect () const noexcept override
 
QPainterPath shape () const noexcept override
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0) noexcept override
 
PrimitiveZoneGraphicsItemoperator= (const PrimitiveZoneGraphicsItem &rhs)=delete
 

Private Member Functions

void layerEdited (const GraphicsLayer &layer, GraphicsLayer::Event event) noexcept
 
void updateColors () noexcept
 
void updateBoundingRectAndShape () noexcept
 
void updateBoundingRectMargin () noexcept
 
void updateVisibility () noexcept
 

Private Attributes

const IF_GraphicsLayerProvidermLayerProvider
 
QVector< std::shared_ptr< GraphicsLayer > > mAllGraphicsLayers
 
QVector< std::shared_ptr< GraphicsLayer > > mEnabledGraphicsLayers
 
Path mOutline
 
bool mEditable
 
std::shared_ptr< GraphicsLayermLayer
 
QPen mPen
 
QPen mPenHighlighted
 
QBrush mBrush
 
QBrush mBrushHighlighted
 
QPainterPath mPainterPath
 
QRectF mBoundingRect
 
qreal mBoundingRectMarginPx
 
QPainterPath mShape
 
qreal mVertexHandleRadiusPx
 
QVector< VertexHandlemVertexHandles
 
GraphicsLayer::OnEditedSlot mOnLayerEditedSlot
 

Detailed Description

Constructor & Destructor Documentation

◆ PrimitiveZoneGraphicsItem() [1/3]

◆ PrimitiveZoneGraphicsItem() [2/3]

◆ PrimitiveZoneGraphicsItem() [3/3]

PrimitiveZoneGraphicsItem ( const IF_GraphicsLayerProvider lp,
QGraphicsItem *  parent = nullptr 
)
noexcept

◆ ~PrimitiveZoneGraphicsItem()

~PrimitiveZoneGraphicsItem ( )
virtualnoexcept

Member Function Documentation

◆ getLineIndexAtPosition()

int getLineIndexAtPosition ( const Point pos) const
noexcept

Get the line segment at a specific position

Parameters
posThe position to check for lines.
Returns
The index of the vertex after the line under the cursor. So for the first line segment, index 1 is returned. If no line is located under the specified position, -1 is returned.
+ Here is the call graph for this function:

◆ getVertexIndicesAtPosition()

QVector< int > getVertexIndicesAtPosition ( const Point pos) const
noexcept

Get the vertices at a specific position

Parameters
posThe position to check for vertices.
Returns
All indices of the vertices at the specified position.
+ Here is the call graph for this function:

◆ setPosition()

void setPosition ( const Point pos)
noexcept

◆ setRotation()

void setRotation ( const Angle rot)
noexcept

◆ setAllLayers()

void setAllLayers ( const QSet< const Layer * > &  layers)
noexcept

◆ setEnabledLayers()

void setEnabledLayers ( const QSet< const Layer * > &  layers)
noexcept

◆ setOutline()

void setOutline ( const Path path)
noexcept
+ Here is the call graph for this function:

◆ setEditable()

void setEditable ( bool  editable)
noexcept

Enable/disable editing mode when selected

If the item is editable and selected, vertex handles will be shown to indicate that they can be moved. If not editable, handles will not be shown.

Parameters
editableWhether the polygon is (visually) editable or not.

◆ itemChange()

QVariant itemChange ( GraphicsItemChange  change,
const QVariant &  value 
)
overridenoexcept

◆ boundingRect()

QRectF boundingRect ( ) const
inlineoverridenoexcept

◆ shape()

QPainterPath shape ( ) const
overridenoexcept

◆ paint()

void paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget = 0 
)
overridenoexcept

◆ operator=()

PrimitiveZoneGraphicsItem & operator= ( const PrimitiveZoneGraphicsItem rhs)
delete

◆ layerEdited()

void layerEdited ( const GraphicsLayer layer,
GraphicsLayer::Event  event 
)
privatenoexcept

◆ updateColors()

void updateColors ( )
privatenoexcept

◆ updateBoundingRectAndShape()

void updateBoundingRectAndShape ( )
privatenoexcept
+ Here is the call graph for this function:

◆ updateBoundingRectMargin()

void updateBoundingRectMargin ( )
privatenoexcept

◆ updateVisibility()

void updateVisibility ( )
privatenoexcept

Member Data Documentation

◆ mLayerProvider

const IF_GraphicsLayerProvider& mLayerProvider
private

◆ mAllGraphicsLayers

QVector<std::shared_ptr<GraphicsLayer> > mAllGraphicsLayers
private

◆ mEnabledGraphicsLayers

QVector<std::shared_ptr<GraphicsLayer> > mEnabledGraphicsLayers
private

◆ mOutline

Path mOutline
private

◆ mEditable

bool mEditable
private

◆ mLayer

std::shared_ptr<GraphicsLayer> mLayer
private

◆ mPen

QPen mPen
private

◆ mPenHighlighted

QPen mPenHighlighted
private

◆ mBrush

QBrush mBrush
private

◆ mBrushHighlighted

QBrush mBrushHighlighted
private

◆ mPainterPath

QPainterPath mPainterPath
private

◆ mBoundingRect

QRectF mBoundingRect
private

◆ mBoundingRectMarginPx

qreal mBoundingRectMarginPx
private

◆ mShape

QPainterPath mShape
private

◆ mVertexHandleRadiusPx

qreal mVertexHandleRadiusPx
private

◆ mVertexHandles

QVector<VertexHandle> mVertexHandles
private

◆ mOnLayerEditedSlot

GraphicsLayer::OnEditedSlot mOnLayerEditedSlot
private

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