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

The "draw trace" state/tool of the board editor. More...

#include <boardeditorstate_drawtrace.h>

+ Inheritance diagram for BoardEditorState_DrawTrace:
+ Collaboration diagram for BoardEditorState_DrawTrace:

Public Types

enum class  WireMode
 All available wire modes. More...
 
- Public Types inherited from BoardEditorState
enum class  FindFlag : uint32_t
 
using Context = BoardEditorFsm::Context
 

Signals

void wireModeChanged (WireMode mode)
 
void layerChanged (const Layer &layer)
 
void autoWidthChanged (bool autoWidth)
 
void widthChanged (const PositiveLength &width)
 
void viaSizeChanged (const PositiveLength &size)
 
void viaDrillDiameterChanged (const PositiveLength &diameter)
 
- Signals inherited from BoardEditorState
void requestLeavingState ()
 Signal to indicate that the current tool should be exited.
 

Public Member Functions

 BoardEditorState_DrawTrace ()=delete
 
 BoardEditorState_DrawTrace (const BoardEditorState_DrawTrace &other)=delete
 
 BoardEditorState_DrawTrace (const Context &context) noexcept
 
virtual ~BoardEditorState_DrawTrace () noexcept
 
virtual bool entry () noexcept override
 
virtual bool exit () noexcept override
 
virtual bool processAbortCommand () noexcept override
 
virtual bool processKeyPressed (const GraphicsSceneKeyEvent &e) noexcept override
 
virtual bool processKeyReleased (const GraphicsSceneKeyEvent &e) noexcept override
 
virtual bool processGraphicsSceneMouseMoved (const GraphicsSceneMouseEvent &e) noexcept override
 
virtual bool processGraphicsSceneLeftMouseButtonPressed (const GraphicsSceneMouseEvent &e) noexcept override
 
virtual bool processGraphicsSceneLeftMouseButtonDoubleClicked (const GraphicsSceneMouseEvent &e) noexcept override
 
virtual bool processGraphicsSceneRightMouseButtonReleased (const GraphicsSceneMouseEvent &e) noexcept override
 
WireMode getWireMode () const noexcept
 
void setWireMode (WireMode mode) noexcept
 
QSet< const Layer * > getAvailableLayers () noexcept
 
const LayergetLayer () const noexcept
 
void setLayer (const Layer &layer) noexcept
 
bool getAutoWidth () const noexcept
 
void setAutoWidth (bool autoWidth) noexcept
 
const PositiveLengthgetWidth () const noexcept
 
void setWidth (const PositiveLength &width) noexcept
 
const PositiveLengthgetViaSize () const noexcept
 
void setViaSize (const PositiveLength &size) noexcept
 
const PositiveLengthgetViaDrillDiameter () const noexcept
 
void setViaDrillDiameter (const PositiveLength &diameter) noexcept
 
BoardEditorState_DrawTraceoperator= (const BoardEditorState_DrawTrace &rhs)=delete
 
- Public Member Functions inherited from BoardEditorState
 BoardEditorState ()=delete
 
 BoardEditorState (const BoardEditorState &other)=delete
 
 BoardEditorState (const Context &context, QObject *parent=nullptr) noexcept
 
virtual ~BoardEditorState () noexcept
 
virtual bool processAddDevice (ComponentInstance &component, const Uuid &device, const Uuid &footprint) noexcept
 
virtual bool processImportDxf () noexcept
 
virtual bool processSelectAll () noexcept
 
virtual bool processCut () noexcept
 
virtual bool processCopy () noexcept
 
virtual bool processPaste () noexcept
 
virtual bool processMove (const Point &delta) noexcept
 
virtual bool processRotate (const Angle &rotation) noexcept
 
virtual bool processFlip (Qt::Orientation orientation) noexcept
 
virtual bool processSnapToGrid () noexcept
 
virtual bool processSetLocked (bool locked) noexcept
 
virtual bool processChangeLineWidth (int step) noexcept
 
virtual bool processResetAllTexts () noexcept
 
virtual bool processRemove () noexcept
 
virtual bool processEditProperties () noexcept
 
virtual bool processGraphicsSceneLeftMouseButtonReleased (const GraphicsSceneMouseEvent &e) noexcept
 
BoardEditorStateoperator= (const BoardEditorState &rhs)=delete
 

Private Types

enum  SubState
 Internal FSM States (substates) More...
 

Private Member Functions

bool startPositioning (Board &board, const Point &pos, BI_NetPoint *fixedPoint=nullptr, BI_Via *fixedVia=nullptr, BI_FootprintPad *fixedPad=nullptr) noexcept
 Begin drawing the next BI_NetLine.
 
bool addNextNetPoint (BoardGraphicsScene &scene) noexcept
 Finalize the BI_NetLines and connect them to other existing traces if necessary.
 
bool abortPositioning (bool showErrMsgBox) noexcept
 Abort or cancel the current drawing of the trace.
 
void updateNetpointPositions () noexcept
 Update the currently active traces according to the set parameters.
 
void showVia (bool isVisible) noexcept
 Sets the BI_Via of the currently active trace.
 
BI_NetLineAnchorcombineAnchors (BI_NetLineAnchor &a, BI_NetLineAnchor &b)
 
Point calcMiddlePointPos (const Point &p1, const Point p2, WireMode mode) const noexcept
 Calculate the 'middle point' of two point, according to the chosen WireMode.
 

Private Attributes

SubState mSubState
 the current substate
 
WireMode mCurrentWireMode
 the current wire mode
 
const LayermCurrentLayer
 the current board layer name
 
bool mAddVia
 whether a via add is requested
 
BI_ViamTempVia
 
Via mCurrentViaProperties
 
const LayermViaLayer
 Layer where the via was started.
 
Point mTargetPos
 
Point mCursorPos
 the current cursor position
 
PositiveLength mCurrentWidth
 the current wire width
 
bool mCurrentAutoWidth
 automatically adjust wire width
 
bool mCurrentSnapActive
 the current active snap to target
 
BI_NetLineAnchormFixedStartAnchor
 
BI_NetSegmentmCurrentNetSegment
 
BI_NetLinemPositioningNetLine1
 line between fixed point and p1
 
BI_NetPointmPositioningNetPoint1
 the first netpoint to place
 
BI_NetLinemPositioningNetLine2
 line between p1 and p2
 
BI_NetPointmPositioningNetPoint2
 the second netpoint to place
 

Additional Inherited Members

- Protected Member Functions inherited from BoardEditorState
BoardGraphicsScenegetActiveBoardScene () noexcept
 
bool getIgnoreLocks () const noexcept
 
PositiveLength getGridInterval () const noexcept
 
const LengthUnitgetLengthUnit () const noexcept
 
QSet< const Layer * > getAllowedGeometryLayers () noexcept
 
void makeLayerVisible (const QString &layer) noexcept
 
void abortBlockingToolsInOtherEditors () noexcept
 
bool execCmd (UndoCommand *cmd)
 
QWidget * parentWidget () noexcept
 
QList< std::shared_ptr< QGraphicsItem > > findItemsAtPos (const Point &pos, FindFlags flags, const Layer *cuLayer=nullptr, const QSet< const NetSignal * > &netsignals={}, const QVector< std::shared_ptr< QGraphicsItem > > &except={}) noexcept
 
template<typename T = QGraphicsItem>
std::shared_ptr< T > findItemAtPos (const Point &pos, FindFlags flags, const Layer *cuLayer=nullptr, const QSet< const NetSignal * > &netsignals={}, const QVector< std::shared_ptr< QGraphicsItem > > &except={}) noexcept
 
- Protected Attributes inherited from BoardEditorState
Context mContext
 
BoardEditorFsmAdaptermAdapter
 

Detailed Description

The "draw trace" state/tool of the board editor.

Member Enumeration Documentation

◆ WireMode

enum class WireMode
strong

All available wire modes.

Enumerator
HV 

horizontal - vertical [default]

VH 

vertical - horizontal

Deg9045 

90° - 45°

Deg4590 

45° - 90°

Straight 

straight

_COUNT 

◆ SubState

enum SubState
private

Internal FSM States (substates)

Enumerator
SubState_Idle 

idle state [initial state]

SubState_Initializing 

beginning to start

SubState_PositioningNetPoint 

in this state, an undo command is active!

Constructor & Destructor Documentation

◆ BoardEditorState_DrawTrace() [1/3]

◆ BoardEditorState_DrawTrace() [2/3]

◆ BoardEditorState_DrawTrace() [3/3]

BoardEditorState_DrawTrace ( const Context context)
explicitnoexcept

◆ ~BoardEditorState_DrawTrace()

~BoardEditorState_DrawTrace ( )
virtualnoexcept

Member Function Documentation

◆ entry()

bool entry ( )
overridevirtualnoexcept

Reimplemented from BoardEditorState.

+ Here is the call graph for this function:

◆ exit()

bool exit ( )
overridevirtualnoexcept

Reimplemented from BoardEditorState.

+ Here is the call graph for this function:

◆ processAbortCommand()

bool processAbortCommand ( )
overridevirtualnoexcept

Reimplemented from BoardEditorState.

+ Here is the call graph for this function:

◆ processKeyPressed()

bool processKeyPressed ( const GraphicsSceneKeyEvent e)
overridevirtualnoexcept

Reimplemented from BoardEditorState.

◆ processKeyReleased()

bool processKeyReleased ( const GraphicsSceneKeyEvent e)
overridevirtualnoexcept

Reimplemented from BoardEditorState.

◆ processGraphicsSceneMouseMoved()

bool processGraphicsSceneMouseMoved ( const GraphicsSceneMouseEvent e)
overridevirtualnoexcept

Reimplemented from BoardEditorState.

◆ processGraphicsSceneLeftMouseButtonPressed()

bool processGraphicsSceneLeftMouseButtonPressed ( const GraphicsSceneMouseEvent e)
overridevirtualnoexcept

Reimplemented from BoardEditorState.

+ Here is the call graph for this function:

◆ processGraphicsSceneLeftMouseButtonDoubleClicked()

bool processGraphicsSceneLeftMouseButtonDoubleClicked ( const GraphicsSceneMouseEvent e)
overridevirtualnoexcept

Reimplemented from BoardEditorState.

◆ processGraphicsSceneRightMouseButtonReleased()

bool processGraphicsSceneRightMouseButtonReleased ( const GraphicsSceneMouseEvent e)
overridevirtualnoexcept

Reimplemented from BoardEditorState.

◆ getWireMode()

WireMode getWireMode ( ) const
inlinenoexcept

◆ setWireMode()

void setWireMode ( WireMode  mode)
noexcept
+ Here is the caller graph for this function:

◆ getAvailableLayers()

QSet< const Layer * > getAvailableLayers ( )
noexcept
+ Here is the call graph for this function:

◆ getLayer()

const Layer & getLayer ( ) const
inlinenoexcept

◆ setLayer()

void setLayer ( const Layer layer)
noexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAutoWidth()

bool getAutoWidth ( ) const
inlinenoexcept

◆ setAutoWidth()

void setAutoWidth ( bool  autoWidth)
noexcept
+ Here is the caller graph for this function:

◆ getWidth()

const PositiveLength & getWidth ( ) const
inlinenoexcept

◆ setWidth()

void setWidth ( const PositiveLength width)
noexcept
+ Here is the caller graph for this function:

◆ getViaSize()

const PositiveLength & getViaSize ( ) const
inlinenoexcept
+ Here is the call graph for this function:

◆ setViaSize()

void setViaSize ( const PositiveLength size)
noexcept
+ Here is the caller graph for this function:

◆ getViaDrillDiameter()

const PositiveLength & getViaDrillDiameter ( ) const
inlinenoexcept
+ Here is the call graph for this function:

◆ setViaDrillDiameter()

void setViaDrillDiameter ( const PositiveLength diameter)
noexcept
+ Here is the caller graph for this function:

◆ operator=()

BoardEditorState_DrawTrace & operator= ( const BoardEditorState_DrawTrace rhs)
delete

◆ wireModeChanged

void wireModeChanged ( WireMode  mode)
signal
+ Here is the caller graph for this function:

◆ layerChanged

void layerChanged ( const Layer layer)
signal
+ Here is the caller graph for this function:

◆ autoWidthChanged

void autoWidthChanged ( bool  autoWidth)
signal
+ Here is the caller graph for this function:

◆ widthChanged

void widthChanged ( const PositiveLength width)
signal
+ Here is the caller graph for this function:

◆ viaSizeChanged

void viaSizeChanged ( const PositiveLength size)
signal
+ Here is the caller graph for this function:

◆ viaDrillDiameterChanged

void viaDrillDiameterChanged ( const PositiveLength diameter)
signal
+ Here is the caller graph for this function:

◆ startPositioning()

bool startPositioning ( Board board,
const Point pos,
BI_NetPoint fixedPoint = nullptr,
BI_Via fixedVia = nullptr,
BI_FootprintPad fixedPad = nullptr 
)
privatenoexcept

Begin drawing the next BI_NetLine.

Parameters
boardOn which board the new traces are drawn.
posThe position, where the tracing should begin. If necessary, a new BI_NetPoint is created.
fixedPointThe BI_NetPoint used as the start anchor, when beginning a new trace.
fixedViaThe BI_Via used as the start anchor, when beginning a new trace.
fixedPadThe BI_FootprintPad used as the start anchor, when beginning a new trace.
Returns
True, when the tracing is successfully started.
+ Here is the call graph for this function:

◆ addNextNetPoint()

bool addNextNetPoint ( BoardGraphicsScene scene)
privatenoexcept

Finalize the BI_NetLines and connect them to other existing traces if necessary.

Parameters
sceneOn which board scene the drawing is finalized.
Returns
True, when the trace is successfully drawn. When the trace is continued, return the result of startPositioning(). False when canceled or an error occurred
+ Here is the call graph for this function:

◆ abortPositioning()

bool abortPositioning ( bool  showErrMsgBox)
privatenoexcept

Abort or cancel the current drawing of the trace.

Parameters
showErrMsgBoxWhen true, show an error message in a pop-up box.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateNetpointPositions()

void updateNetpointPositions ( )
privatenoexcept

Update the currently active traces according to the set parameters.

Uses the current mCursorPos to where the currently active trace is snapped to and how its BI_NetLine are palced. Also determines whether a BI_Via should be added or if the target anchor can provide the desired layer change.

+ Here is the call graph for this function:

◆ showVia()

void showVia ( bool  isVisible)
privatenoexcept

Sets the BI_Via of the currently active trace.

When true, adds a BI_Via instead of the current last BI_NetPoint to the currently active trace. Otherwise removes it if necessary and replaces it again with a BI_NetPoint. It also updates the BI_Via according to the currently selected parameters.

Warning
mPositioningNetPoint2 and mTempVia are exclusive. If one is set, the other is nullptr and vice versa.
Parameters
isVisibleWhether the BI_Via is shown or not
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ combineAnchors()

BI_NetLineAnchor * combineAnchors ( BI_NetLineAnchor a,
BI_NetLineAnchor b 
)
private
+ Here is the call graph for this function:

◆ calcMiddlePointPos()

Point calcMiddlePointPos ( const Point p1,
const Point  p2,
WireMode  mode 
) const
privatenoexcept

Calculate the 'middle point' of two point, according to the chosen WireMode.

Parameters
p1Start point.
p2End point.
modeThe selected WireMode.
Returns
Middle Point.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ mSubState

SubState mSubState
private

the current substate

◆ mCurrentWireMode

WireMode mCurrentWireMode
private

the current wire mode

◆ mCurrentLayer

const Layer* mCurrentLayer
private

the current board layer name

◆ mAddVia

bool mAddVia
private

whether a via add is requested

◆ mTempVia

BI_Via* mTempVia
private

◆ mCurrentViaProperties

Via mCurrentViaProperties
private

The current Via properties diameter

◆ mViaLayer

const Layer* mViaLayer
private

Layer where the via was started.

◆ mTargetPos

Point mTargetPos
private

the current target position of the active trace

◆ mCursorPos

Point mCursorPos
private

the current cursor position

◆ mCurrentWidth

PositiveLength mCurrentWidth
private

the current wire width

◆ mCurrentAutoWidth

bool mCurrentAutoWidth
private

automatically adjust wire width

◆ mCurrentSnapActive

bool mCurrentSnapActive
private

the current active snap to target

◆ mFixedStartAnchor

BI_NetLineAnchor* mFixedStartAnchor
private

the fixed netline anchor (start point of the line)

◆ mCurrentNetSegment

BI_NetSegment* mCurrentNetSegment
private

the net segment that is currently edited

◆ mPositioningNetLine1

BI_NetLine* mPositioningNetLine1
private

line between fixed point and p1

◆ mPositioningNetPoint1

BI_NetPoint* mPositioningNetPoint1
private

the first netpoint to place

◆ mPositioningNetLine2

BI_NetLine* mPositioningNetLine2
private

line between p1 and p2

◆ mPositioningNetPoint2

BI_NetPoint* mPositioningNetPoint2
private

the second netpoint to place


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