KiCad PCB EDA Suite
|
#include <ee_grid_helper.h>
Public Types | |
enum | ANCHOR_FLAGS { CORNER = 1 , OUTLINE = 2 , SNAPPABLE = 4 , ORIGIN = 8 , VERTICAL = 16 , HORIZONTAL = 32 , ALL = CORNER | OUTLINE | SNAPPABLE | ORIGIN | VERTICAL | HORIZONTAL } |
Public Member Functions | |
EE_GRID_HELPER (TOOL_MANAGER *aToolMgr) | |
SCH_ITEM * | GetSnapped () const |
Function GetSnapped If the EE_GRID_HELPER has highlighted a snap point (target shown), this function will return a pointer to the item to which it snapped. More... | |
VECTOR2I | BestDragOrigin (const VECTOR2I &aMousePos, int aLayer, const EE_SELECTION &aItems) |
VECTOR2I | BestSnapAnchor (const VECTOR2I &aOrigin, int aLayer, SCH_ITEM *aDraggedItem) |
VECTOR2I | BestSnapAnchor (const VECTOR2I &aOrigin, int aLayer, const EE_SELECTION &aSkip={}) |
VECTOR2I | GetGrid () const |
VECTOR2I | GetVisibleGrid () const |
VECTOR2I | GetOrigin () const |
void | SetAuxAxes (bool aEnable, const VECTOR2I &aOrigin=VECTOR2I(0, 0)) |
virtual VECTOR2I | Align (const VECTOR2I &aPoint) const |
VECTOR2I | AlignGrid (const VECTOR2I &aPoint) const |
void | SetSkipPoint (const VECTOR2I &aPoint) |
void | ClearSkipPoint () |
We clear the skip point by setting it to an unreachable position, thereby preventing matching. More... | |
void | SetSnap (bool aSnap) |
bool | GetSnap () const |
void | SetUseGrid (bool aSnapToGrid) |
bool | GetUseGrid () const |
void | SetSnapLine (bool aSnap) |
void | SetMask (int aMask) |
void | SetMaskFlag (int aFlag) |
void | ClearMaskFlag (int aFlag) |
Protected Member Functions | |
void | addAnchor (const VECTOR2I &aPos, int aFlags, EDA_ITEM *aItem) |
void | clearAnchors () |
bool | canUseGrid () const |
Check whether it is possible to use the grid – this depends both on local grid helper settings and global (tool manager) KiCad settings. More... | |
Protected Attributes | |
std::vector< ANCHOR > | m_anchors |
TOOL_MANAGER * | m_toolMgr |
std::optional< VECTOR2I > | m_auxAxis |
int | m_maskTypes |
bool | m_enableSnap |
bool | m_enableGrid |
bool | m_enableSnapLine |
ANCHOR * | m_snapItem |
VECTOR2I | m_skipPoint |
KIGFX::ORIGIN_VIEWITEM | m_viewSnapPoint |
KIGFX::ORIGIN_VIEWITEM | m_viewSnapLine |
KIGFX::ORIGIN_VIEWITEM | m_viewAxis |
Private Member Functions | |
std::set< SCH_ITEM * > | queryVisible (const BOX2I &aArea, const EE_SELECTION &aSkipList) const |
ANCHOR * | nearestAnchor (const VECTOR2I &aPos, int aFlags, int aMatchLayer) |
void | computeAnchors (SCH_ITEM *aItem, const VECTOR2I &aRefPos, bool aFrom=false, bool aIncludeText=false) |
Insert the local anchor points in to the grid helper for the specified schematic item, given the reference point and the direction of use for the point. More... | |
Definition at line 45 of file ee_grid_helper.h.
|
inherited |
Enumerator | |
---|---|
CORNER | |
OUTLINE | |
SNAPPABLE | |
ORIGIN | |
VERTICAL | |
HORIZONTAL | |
ALL |
Definition at line 77 of file grid_helper.h.
EE_GRID_HELPER::EE_GRID_HELPER | ( | TOOL_MANAGER * | aToolMgr | ) |
Definition at line 37 of file ee_grid_helper.cpp.
References KIGFX::VIEW::Add(), KIGFX::ORIGIN_VIEWITEM::CIRCLE_CROSS, KIGFX::ORIGIN_VIEWITEM::CROSS, KIGFX::ORIGIN_VIEWITEM::DASH_LINE, TOOL_MANAGER::GetView(), GRID_HELPER::m_toolMgr, GRID_HELPER::m_viewAxis, GRID_HELPER::m_viewSnapLine, GRID_HELPER::m_viewSnapPoint, KIGFX::ORIGIN_VIEWITEM::SetColor(), KIGFX::ORIGIN_VIEWITEM::SetDrawAtZero(), KIGFX::ORIGIN_VIEWITEM::SetSize(), KIGFX::ORIGIN_VIEWITEM::SetStyle(), and KIGFX::VIEW::SetVisible().
|
inlineprotectedinherited |
Definition at line 107 of file grid_helper.h.
References GRID_HELPER::m_anchors, and GRID_HELPER::m_maskTypes.
Referenced by PCB_GRID_HELPER::computeAnchors(), and computeAnchors().
Definition at line 103 of file grid_helper.cpp.
References std::abs(), GRID_HELPER::AlignGrid(), GRID_HELPER::canUseGrid(), GRID_HELPER::m_auxAxis, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by PCB_GRID_HELPER::AlignToArc(), PCB_GRID_HELPER::AlignToSegment(), PCB_GRID_HELPER::BestSnapAnchor(), BestSnapAnchor(), computeAnchors(), PNS::TOOL_BASE::snapToItem(), and PNS::TOOL_BASE::updateEndItem().
Definition at line 91 of file grid_helper.cpp.
References GRID_HELPER::GetGrid(), GRID_HELPER::GetOrigin(), grid, KiROUND(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by GRID_HELPER::Align(), EC_VERTICAL::Apply(), EC_HORIZONTAL::Apply(), EC_45DEGREE::Apply(), EC_LINE::Apply(), and EE_POINT_EDITOR::pinEditedCorner().
VECTOR2I EE_GRID_HELPER::BestDragOrigin | ( | const VECTOR2I & | aMousePos, |
int | aLayer, | ||
const EE_SELECTION & | aItems | ||
) |
Definition at line 63 of file ee_grid_helper.cpp.
References GRID_HELPER::clearAnchors(), computeAnchors(), GRID_HELPER::CORNER, GRID_HELPER::ANCHOR::Distance(), KIGFX::VIEW::GetGAL(), TOOL_MANAGER::GetView(), KIGFX::GAL::GetWorldScale(), GRID_HELPER::m_toolMgr, nearestAnchor(), SELECTION::OnlyContains(), GRID_HELPER::ORIGIN, GRID_HELPER::OUTLINE, GRID_HELPER::ANCHOR::pos, SCH_FIELD_T, SCH_TEXT_T, SCH_TEXTBOX_T, and SELECTION::Size().
VECTOR2I EE_GRID_HELPER::BestSnapAnchor | ( | const VECTOR2I & | aOrigin, |
int | aLayer, | ||
const EE_SELECTION & | aSkip = {} |
||
) |
Definition at line 124 of file ee_grid_helper.cpp.
References std::abs(), GRID_HELPER::Align(), GRID_HELPER::canUseGrid(), GRID_HELPER::clearAnchors(), computeAnchors(), GRID_HELPER::ANCHOR::Distance(), VECTOR2< T >::EuclideanNorm(), EuclideanNorm(), KIGFX::GEOMETRY, KIGFX::ORIGIN_VIEWITEM::GetPosition(), TOOL_MANAGER::GetView(), KIGFX::VIEW::IsVisible(), EDA_IU_SCALE::IU_PER_MILS, GRID_HELPER::m_enableSnap, GRID_HELPER::m_enableSnapLine, GRID_HELPER::m_skipPoint, GRID_HELPER::m_snapItem, GRID_HELPER::m_toolMgr, GRID_HELPER::m_viewSnapLine, GRID_HELPER::m_viewSnapPoint, nearestAnchor(), GRID_HELPER::ANCHOR::pos, queryVisible(), schIUScale, KIGFX::ORIGIN_VIEWITEM::SetEndPosition(), KIGFX::ORIGIN_VIEWITEM::SetPosition(), KIGFX::VIEW::SetVisible(), SNAP_RANGE, GRID_HELPER::SNAPPABLE, KIGFX::VIEW::Update(), VECTOR2< T >::x, and VECTOR2< T >::y.
VECTOR2I EE_GRID_HELPER::BestSnapAnchor | ( | const VECTOR2I & | aOrigin, |
int | aLayer, | ||
SCH_ITEM * | aDraggedItem | ||
) |
Definition at line 115 of file ee_grid_helper.cpp.
References SELECTION::Add(), and BestSnapAnchor().
Referenced by EE_SELECTION_TOOL::autostartEvent(), and BestSnapAnchor().
|
inlineprotectedinherited |
Check whether it is possible to use the grid – this depends both on local grid helper settings and global (tool manager) KiCad settings.
Definition at line 123 of file grid_helper.h.
References KIGFX::VIEW::GetGAL(), KIGFX::GAL::GetGridSnapping(), TOOL_MANAGER::GetView(), GRID_HELPER::m_enableGrid, and GRID_HELPER::m_toolMgr.
Referenced by GRID_HELPER::Align(), and BestSnapAnchor().
|
inlineprotectedinherited |
Definition at line 113 of file grid_helper.h.
References GRID_HELPER::m_anchors, and GRID_HELPER::m_snapItem.
Referenced by PCB_GRID_HELPER::AlignToNearestPad(), BestDragOrigin(), PCB_GRID_HELPER::BestDragOrigin(), PCB_GRID_HELPER::BestSnapAnchor(), and BestSnapAnchor().
|
inlineinherited |
Definition at line 75 of file grid_helper.h.
References GRID_HELPER::m_maskTypes.
|
inlineinherited |
We clear the skip point by setting it to an unreachable position, thereby preventing matching.
Definition at line 60 of file grid_helper.h.
References GRID_HELPER::m_skipPoint.
|
private |
Insert the local anchor points in to the grid helper for the specified schematic item, given the reference point and the direction of use for the point.
aItem | The schematic item for which to compute the anchors |
aRefPos | The point for which to compute the anchors (if used by the symbol) |
aFrom | Is this for an anchor that is designating a source point (aFrom=true) or not |
aIncludeText | if true will compute anchors for text items |
Definition at line 271 of file ee_grid_helper.cpp.
References GRID_HELPER::addAnchor(), GRID_HELPER::Align(), GRID_HELPER::CORNER, SCH_ITEM::GetConnectionPoints(), EDA_ITEM::GetPosition(), GRID_HELPER::HORIZONTAL, KI_FALLTHROUGH, GRID_HELPER::ORIGIN, SCH_BUS_WIRE_ENTRY_T, SCH_DIRECTIVE_LABEL_T, SCH_FIELD_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_JUNCTION_T, SCH_LABEL_T, SCH_LINE_T, SCH_NO_CONNECT_T, SCH_SHEET_PIN_T, SCH_SHEET_T, SCH_SYMBOL_T, SCH_TEXT_T, SCH_TEXTBOX_T, GRID_HELPER::SNAPPABLE, TestSegmentHit(), EDA_ITEM::Type(), GRID_HELPER::VERTICAL, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by BestDragOrigin(), and BestSnapAnchor().
|
inherited |
Definition at line 51 of file grid_helper.cpp.
References KIGFX::VIEW::GetGAL(), KIGFX::GAL::GetGridSize(), TOOL_MANAGER::GetView(), KiROUND(), GRID_HELPER::m_toolMgr, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by GRID_HELPER::AlignGrid(), and PCB_GRID_HELPER::computeAnchors().
|
inherited |
Definition at line 67 of file grid_helper.cpp.
References KIGFX::VIEW::GetGAL(), KIGFX::GAL::GetGridOrigin(), TOOL_MANAGER::GetView(), and GRID_HELPER::m_toolMgr.
Referenced by GRID_HELPER::AlignGrid().
|
inlineinherited |
Definition at line 66 of file grid_helper.h.
References GRID_HELPER::m_enableSnap.
Referenced by DRAWING_TOOL::DrawVia(), EE_POINT_EDITOR::pinEditedCorner(), and PNS::TOOL_BASE::updateEndItem().
SCH_ITEM * EE_GRID_HELPER::GetSnapped | ( | ) | const |
Function GetSnapped If the EE_GRID_HELPER has highlighted a snap point (target shown), this function will return a pointer to the item to which it snapped.
Definition at line 236 of file ee_grid_helper.cpp.
References GRID_HELPER::ANCHOR::item, and GRID_HELPER::m_snapItem.
|
inlineinherited |
Definition at line 69 of file grid_helper.h.
References GRID_HELPER::m_enableGrid.
Referenced by PNS::TOOL_BASE::updateStartItem().
|
inherited |
Definition at line 59 of file grid_helper.cpp.
References KIGFX::VIEW::GetGAL(), TOOL_MANAGER::GetView(), KIGFX::GAL::GetVisibleGridSize(), KiROUND(), GRID_HELPER::m_toolMgr, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by PCB_GRID_HELPER::BestSnapAnchor().
|
private |
Definition at line 336 of file ee_grid_helper.cpp.
References SCH_ITEM::IsConnectable(), LAYER_CONNECTABLE, LAYER_GRAPHICS, and GRID_HELPER::m_anchors.
Referenced by BestDragOrigin(), and BestSnapAnchor().
|
private |
Definition at line 245 of file ee_grid_helper.cpp.
References KIGFX::VIEW::GetScale(), TOOL_MANAGER::GetView(), KIGFX::VIEW::IsVisible(), GRID_HELPER::m_toolMgr, KIGFX::VIEW::Query(), and KIGFX::VIEW_ITEM::ViewGetLOD().
Referenced by BestSnapAnchor().
|
inherited |
Definition at line 75 of file grid_helper.cpp.
References TOOL_MANAGER::GetView(), GRID_HELPER::m_auxAxis, GRID_HELPER::m_toolMgr, GRID_HELPER::m_viewAxis, KIGFX::ORIGIN_VIEWITEM::SetPosition(), and KIGFX::VIEW::SetVisible().
Referenced by ROUTER_TOOL::InlineDrag(), and ROUTER_TOOL::performDragging().
|
inlineinherited |
Definition at line 73 of file grid_helper.h.
References GRID_HELPER::m_maskTypes.
|
inlineinherited |
Definition at line 74 of file grid_helper.h.
References GRID_HELPER::m_maskTypes.
|
inlineinherited |
Definition at line 52 of file grid_helper.h.
References GRID_HELPER::m_skipPoint.
|
inlineinherited |
Definition at line 65 of file grid_helper.h.
References GRID_HELPER::m_enableSnap.
Referenced by DRAWING_TOOL::DrawVia(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PNS::TOOL_BASE::updateEndItem(), EE_POINT_EDITOR::updateParentItem(), and PNS::TOOL_BASE::updateStartItem().
|
inlineinherited |
Definition at line 71 of file grid_helper.h.
References GRID_HELPER::m_enableSnapLine.
|
inlineinherited |
Definition at line 68 of file grid_helper.h.
References GRID_HELPER::m_enableGrid.
Referenced by ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PNS::TOOL_BASE::updateEndItem(), and PNS::TOOL_BASE::updateStartItem().
|
protectedinherited |
Definition at line 129 of file grid_helper.h.
Referenced by GRID_HELPER::addAnchor(), PCB_GRID_HELPER::AlignToNearestPad(), GRID_HELPER::clearAnchors(), nearestAnchor(), and PCB_GRID_HELPER::nearestAnchor().
|
protectedinherited |
Definition at line 132 of file grid_helper.h.
Referenced by GRID_HELPER::Align(), and GRID_HELPER::SetAuxAxes().
|
protectedinherited |
Definition at line 137 of file grid_helper.h.
Referenced by PCB_GRID_HELPER::BestSnapAnchor(), GRID_HELPER::canUseGrid(), GRID_HELPER::GetUseGrid(), GRID_HELPER::GRID_HELPER(), and GRID_HELPER::SetUseGrid().
|
protectedinherited |
Definition at line 136 of file grid_helper.h.
Referenced by PCB_GRID_HELPER::AlignToArc(), PCB_GRID_HELPER::AlignToSegment(), PCB_GRID_HELPER::BestSnapAnchor(), BestSnapAnchor(), GRID_HELPER::GetSnap(), GRID_HELPER::GRID_HELPER(), and GRID_HELPER::SetSnap().
|
protectedinherited |
Definition at line 138 of file grid_helper.h.
Referenced by PCB_GRID_HELPER::BestSnapAnchor(), BestSnapAnchor(), GRID_HELPER::GRID_HELPER(), and GRID_HELPER::SetSnapLine().
|
protectedinherited |
Definition at line 134 of file grid_helper.h.
Referenced by GRID_HELPER::addAnchor(), GRID_HELPER::ClearMaskFlag(), GRID_HELPER::GRID_HELPER(), GRID_HELPER::SetMask(), and GRID_HELPER::SetMaskFlag().
|
protectedinherited |
Definition at line 141 of file grid_helper.h.
Referenced by PCB_GRID_HELPER::BestSnapAnchor(), BestSnapAnchor(), GRID_HELPER::ClearSkipPoint(), and GRID_HELPER::SetSkipPoint().
|
protectedinherited |
Definition at line 139 of file grid_helper.h.
Referenced by PCB_GRID_HELPER::BestSnapAnchor(), BestSnapAnchor(), GRID_HELPER::clearAnchors(), GetSnapped(), PCB_GRID_HELPER::GetSnapped(), and GRID_HELPER::GRID_HELPER().
|
protectedinherited |
Definition at line 131 of file grid_helper.h.
Referenced by BestDragOrigin(), PCB_GRID_HELPER::BestDragOrigin(), PCB_GRID_HELPER::BestSnapAnchor(), BestSnapAnchor(), GRID_HELPER::canUseGrid(), PCB_GRID_HELPER::computeAnchors(), EE_GRID_HELPER(), GRID_HELPER::GetGrid(), GRID_HELPER::GetOrigin(), GRID_HELPER::GetVisibleGrid(), PCB_GRID_HELPER::PCB_GRID_HELPER(), queryVisible(), PCB_GRID_HELPER::queryVisible(), and GRID_HELPER::SetAuxAxes().
|
protectedinherited |
Definition at line 145 of file grid_helper.h.
Referenced by EE_GRID_HELPER(), PCB_GRID_HELPER::PCB_GRID_HELPER(), and GRID_HELPER::SetAuxAxes().
|
protectedinherited |
Definition at line 144 of file grid_helper.h.
Referenced by PCB_GRID_HELPER::BestSnapAnchor(), BestSnapAnchor(), EE_GRID_HELPER(), and PCB_GRID_HELPER::PCB_GRID_HELPER().
|
protectedinherited |
Definition at line 143 of file grid_helper.h.
Referenced by PCB_GRID_HELPER::BestSnapAnchor(), BestSnapAnchor(), EE_GRID_HELPER(), and PCB_GRID_HELPER::PCB_GRID_HELPER().