KiCad PCB EDA Suite
|
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_MARKER > | analyzeJunction (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_MARKER > | collectDisconnectedMarkers (const SCH_SELECTION &aSelection) const |
void | ensureOverlay () |
void | clearOverlay () const |
Private Attributes | |
SCH_EDIT_FRAME * | m_frame |
KIGFX::VIEW * | m_view |
std::shared_ptr< KIGFX::VIEW_OVERLAY > | m_overlay |
std::unordered_map< const SCH_ITEM *, std::optional< int > > | m_itemNetCodes |
SCH_SHEET_PATH | m_sheetPath |
std::vector< ORIGINAL_CONNECTION > | m_originalConnections |
bool | m_hasCollision |
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.
SCH_DRAG_NET_COLLISION_MONITOR::SCH_DRAG_NET_COLLISION_MONITOR | ( | SCH_EDIT_FRAME * | aFrame, |
KIGFX::VIEW * | aView ) |
Definition at line 46 of file sch_drag_net_collision.cpp.
References m_frame, m_hasCollision, m_itemNetCodes, m_originalConnections, m_overlay, m_sheetPath, and m_view.
SCH_DRAG_NET_COLLISION_MONITOR::~SCH_DRAG_NET_COLLISION_MONITOR | ( | ) |
Definition at line 59 of file sch_drag_net_collision.cpp.
References Reset().
Definition at line 215 of file sch_drag_net_collision.cpp.
References m_hasCollision, and WARNING.
|
private |
Definition at line 249 of file sch_drag_net_collision.cpp.
References SELECTION::Contains(), SCH_JUNCTION::GetEffectiveDiameter(), SCH_JUNCTION::GetPosition(), SELECTION::GetSize(), m_frame, m_itemNetCodes, EE_RTREE::Overlapping(), SCH_DRAG_NET_COLLISION_MONITOR::COLLISION_MARKER::position, SCH_DRAG_NET_COLLISION_MONITOR::COLLISION_MARKER::radius, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by Update().
|
private |
|
private |
Definition at line 598 of file sch_drag_net_collision.cpp.
References SELECTION::Contains(), SCH_ITEM::GetConnectionPoints(), SCH_ITEM::GetPenWidth(), SCH_ITEM::IsConnectable(), EDA_ITEM::IsSelected(), m_originalConnections, SCH_DRAG_NET_COLLISION_MONITOR::DISCONNECTION_MARKER::pointA, and radius.
Referenced by Update().
|
private |
Definition at line 652 of file sch_drag_net_collision.cpp.
References m_overlay, and m_view.
Referenced by Update().
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.
void SCH_DRAG_NET_COLLISION_MONITOR::Initialize | ( | const SCH_SELECTION & | aSelection | ) |
Definition at line 65 of file sch_drag_net_collision.cpp.
References SELECTION::GetSize(), m_frame, m_hasCollision, m_itemNetCodes, m_originalConnections, m_sheetPath, recordItemNet(), recordOriginalConnections(), and EE_RTREE::size().
|
private |
Definition at line 460 of file sch_drag_net_collision.cpp.
References SCH_ITEM::Connection(), SCH_ITEM::GetClass(), EDA_ITEM::GetPosition(), SCH_ITEM::IsConnectable(), m_itemNetCodes, m_sheetPath, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by Initialize().
|
private |
Definition at line 508 of file sch_drag_net_collision.cpp.
References SELECTION::Contains(), SCH_ITEM::GetConnectionPoints(), SELECTION::GetSize(), SCH_ITEM::IsConnectable(), EDA_ITEM::IsSelected(), m_frame, m_originalConnections, and EE_RTREE::Overlapping().
Referenced by Initialize().
void SCH_DRAG_NET_COLLISION_MONITOR::Reset | ( | ) |
Definition at line 206 of file sch_drag_net_collision.cpp.
References clearOverlay(), m_hasCollision, m_itemNetCodes, and m_originalConnections.
Referenced by ~SCH_DRAG_NET_COLLISION_MONITOR().
bool SCH_DRAG_NET_COLLISION_MONITOR::Update | ( | const std::vector< SCH_JUNCTION * > & | aJunctions, |
const SCH_SELECTION & | aSelection, | ||
std::span< const PREVIEW_NET_ASSIGNMENT > | aPreviewAssignments = {} ) |
Definition at line 95 of file sch_drag_net_collision.cpp.
References KIGFX::COLOR4D::a, analyzeJunction(), clearOverlay(), collectDisconnectedMarkers(), ensureOverlay(), SELECTION::GetSize(), LAYER_DRAG_NET_COLLISION, m_frame, m_hasCollision, m_overlay, m_view, COLOR4D::UNSPECIFIED, and KIGFX::COLOR4D::WithAlpha().
|
private |
Definition at line 113 of file sch_drag_net_collision.h.
Referenced by analyzeJunction(), Initialize(), recordOriginalConnections(), SCH_DRAG_NET_COLLISION_MONITOR(), and Update().
|
private |
Definition at line 119 of file sch_drag_net_collision.h.
Referenced by AdjustCursor(), Initialize(), Reset(), SCH_DRAG_NET_COLLISION_MONITOR(), and Update().
|
private |
Definition at line 116 of file sch_drag_net_collision.h.
Referenced by analyzeJunction(), GetNetCode(), Initialize(), recordItemNet(), Reset(), and SCH_DRAG_NET_COLLISION_MONITOR().
|
private |
Definition at line 118 of file sch_drag_net_collision.h.
Referenced by collectDisconnectedMarkers(), Initialize(), recordOriginalConnections(), Reset(), and SCH_DRAG_NET_COLLISION_MONITOR().
|
private |
Definition at line 115 of file sch_drag_net_collision.h.
Referenced by clearOverlay(), ensureOverlay(), SCH_DRAG_NET_COLLISION_MONITOR(), and Update().
|
private |
Definition at line 117 of file sch_drag_net_collision.h.
Referenced by GetNetCode(), Initialize(), recordItemNet(), and SCH_DRAG_NET_COLLISION_MONITOR().
|
private |
Definition at line 114 of file sch_drag_net_collision.h.
Referenced by clearOverlay(), ensureOverlay(), SCH_DRAG_NET_COLLISION_MONITOR(), and Update().