KiCad PCB EDA Suite
Loading...
Searching...
No Matches
SCH_DRAG_NET_COLLISION_MONITOR Class Reference

Helper responsible for tracking the original net assignments of items involved in a drag operation and providing visual feedback when the drag would create an unintended net merge. More...

#include <sch_drag_net_collision.h>

Classes

struct  COLLISION_MARKER
 
struct  DISCONNECTION_MARKER
 
struct  ORIGINAL_CONNECTION
 
struct  PREVIEW_NET_ASSIGNMENT
 

Public Member Functions

 SCH_DRAG_NET_COLLISION_MONITOR (SCH_EDIT_FRAME *aFrame, KIGFX::VIEW *aView)
 
 ~SCH_DRAG_NET_COLLISION_MONITOR ()
 
void Initialize (const SCH_SELECTION &aSelection)
 
bool Update (const std::vector< SCH_JUNCTION * > &aJunctions, const SCH_SELECTION &aSelection, std::span< const PREVIEW_NET_ASSIGNMENT > aPreviewAssignments={})
 
void Reset ()
 
KICURSOR AdjustCursor (KICURSOR aBaseCursor) const
 
std::optional< int > GetNetCode (const SCH_ITEM *aItem) const
 

Private Member Functions

std::optional< COLLISION_MARKERanalyzeJunction (SCH_JUNCTION *aJunction, const SCH_SELECTION &aSelection, const std::unordered_map< const SCH_ITEM *, std::optional< int > > &aPreviewNetCodes) const
 
void recordItemNet (SCH_ITEM *aItem)
 
void recordOriginalConnections (const SCH_SELECTION &aSelection)
 
std::vector< DISCONNECTION_MARKERcollectDisconnectedMarkers (const SCH_SELECTION &aSelection) const
 
void ensureOverlay ()
 
void clearOverlay () const
 

Private Attributes

SCH_EDIT_FRAMEm_frame
 
KIGFX::VIEWm_view
 
std::shared_ptr< KIGFX::VIEW_OVERLAYm_overlay
 
std::unordered_map< const SCH_ITEM *, std::optional< int > > m_itemNetCodes
 
SCH_SHEET_PATH m_sheetPath
 
std::vector< ORIGINAL_CONNECTIONm_originalConnections
 
bool m_hasCollision
 

Detailed Description

Helper responsible for tracking the original net assignments of items involved in a drag operation and providing visual feedback when the drag would create an unintended net merge.

Definition at line 55 of file sch_drag_net_collision.h.

Constructor & Destructor Documentation

◆ SCH_DRAG_NET_COLLISION_MONITOR()

SCH_DRAG_NET_COLLISION_MONITOR::SCH_DRAG_NET_COLLISION_MONITOR ( SCH_EDIT_FRAME * aFrame,
KIGFX::VIEW * aView )

◆ ~SCH_DRAG_NET_COLLISION_MONITOR()

SCH_DRAG_NET_COLLISION_MONITOR::~SCH_DRAG_NET_COLLISION_MONITOR ( )

Definition at line 59 of file sch_drag_net_collision.cpp.

References Reset().

Member Function Documentation

◆ AdjustCursor()

KICURSOR SCH_DRAG_NET_COLLISION_MONITOR::AdjustCursor ( KICURSOR aBaseCursor) const

Definition at line 215 of file sch_drag_net_collision.cpp.

References m_hasCollision, and WARNING.

◆ analyzeJunction()

std::optional< SCH_DRAG_NET_COLLISION_MONITOR::COLLISION_MARKER > SCH_DRAG_NET_COLLISION_MONITOR::analyzeJunction ( SCH_JUNCTION * aJunction,
const SCH_SELECTION & aSelection,
const std::unordered_map< const SCH_ITEM *, std::optional< int > > & aPreviewNetCodes ) const
private

◆ clearOverlay()

void SCH_DRAG_NET_COLLISION_MONITOR::clearOverlay ( ) const
private

Definition at line 659 of file sch_drag_net_collision.cpp.

References m_overlay, and m_view.

Referenced by Reset(), and Update().

◆ collectDisconnectedMarkers()

◆ ensureOverlay()

void SCH_DRAG_NET_COLLISION_MONITOR::ensureOverlay ( )
private

Definition at line 652 of file sch_drag_net_collision.cpp.

References m_overlay, and m_view.

Referenced by Update().

◆ GetNetCode()

std::optional< int > SCH_DRAG_NET_COLLISION_MONITOR::GetNetCode ( const SCH_ITEM * aItem) const

Definition at line 224 of file sch_drag_net_collision.cpp.

References SCH_ITEM::Connection(), m_itemNetCodes, and m_sheetPath.

◆ Initialize()

void SCH_DRAG_NET_COLLISION_MONITOR::Initialize ( const SCH_SELECTION & aSelection)

◆ recordItemNet()

void SCH_DRAG_NET_COLLISION_MONITOR::recordItemNet ( SCH_ITEM * aItem)
private

◆ recordOriginalConnections()

void SCH_DRAG_NET_COLLISION_MONITOR::recordOriginalConnections ( const SCH_SELECTION & aSelection)
private

◆ Reset()

void SCH_DRAG_NET_COLLISION_MONITOR::Reset ( )

◆ Update()

bool SCH_DRAG_NET_COLLISION_MONITOR::Update ( const std::vector< SCH_JUNCTION * > & aJunctions,
const SCH_SELECTION & aSelection,
std::span< const PREVIEW_NET_ASSIGNMENT > aPreviewAssignments = {} )

Member Data Documentation

◆ m_frame

SCH_EDIT_FRAME* SCH_DRAG_NET_COLLISION_MONITOR::m_frame
private

◆ m_hasCollision

bool SCH_DRAG_NET_COLLISION_MONITOR::m_hasCollision
private

◆ m_itemNetCodes

std::unordered_map<const SCH_ITEM*, std::optional<int> > SCH_DRAG_NET_COLLISION_MONITOR::m_itemNetCodes
private

◆ m_originalConnections

std::vector<ORIGINAL_CONNECTION> SCH_DRAG_NET_COLLISION_MONITOR::m_originalConnections
private

◆ m_overlay

std::shared_ptr<KIGFX::VIEW_OVERLAY> SCH_DRAG_NET_COLLISION_MONITOR::m_overlay
private

◆ m_sheetPath

SCH_SHEET_PATH SCH_DRAG_NET_COLLISION_MONITOR::m_sheetPath
private

◆ m_view

KIGFX::VIEW* SCH_DRAG_NET_COLLISION_MONITOR::m_view
private

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