KiCad PCB EDA Suite
|
#include <grid_helper.h>
Classes | |
struct | ANCHOR |
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 | |
GRID_HELPER (TOOL_MANAGER *aToolMgr) | |
virtual | ~GRID_HELPER () |
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 |
Definition at line 36 of file grid_helper.h.
Enumerator | |
---|---|
CORNER | |
OUTLINE | |
SNAPPABLE | |
ORIGIN | |
VERTICAL | |
HORIZONTAL | |
ALL |
Definition at line 77 of file grid_helper.h.
GRID_HELPER::GRID_HELPER | ( | TOOL_MANAGER * | aToolMgr | ) |
Definition at line 35 of file grid_helper.cpp.
References ALL, m_enableGrid, m_enableSnap, m_enableSnapLine, m_maskTypes, and m_snapItem.
|
virtual |
Definition at line 46 of file grid_helper.cpp.
Definition at line 107 of file grid_helper.h.
References m_anchors, and m_maskTypes.
Referenced by PCB_GRID_HELPER::computeAnchors(), and EE_GRID_HELPER::computeAnchors().
Definition at line 103 of file grid_helper.cpp.
References std::abs(), AlignGrid(), canUseGrid(), m_auxAxis, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by PCB_GRID_HELPER::AlignToArc(), PCB_GRID_HELPER::AlignToSegment(), PCB_GRID_HELPER::BestSnapAnchor(), EE_GRID_HELPER::BestSnapAnchor(), EE_GRID_HELPER::computeAnchors(), PNS::TOOL_BASE::snapToItem(), and PNS::TOOL_BASE::updateEndItem().
Definition at line 91 of file grid_helper.cpp.
References GetGrid(), GetOrigin(), grid, KiROUND(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by Align(), EC_VERTICAL::Apply(), EC_HORIZONTAL::Apply(), EC_45DEGREE::Apply(), EC_LINE::Apply(), and EE_POINT_EDITOR::pinEditedCorner().
|
inlineprotected |
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(), m_enableGrid, and m_toolMgr.
Referenced by Align(), and EE_GRID_HELPER::BestSnapAnchor().
|
inlineprotected |
Definition at line 113 of file grid_helper.h.
References m_anchors, and m_snapItem.
Referenced by PCB_GRID_HELPER::AlignToNearestPad(), EE_GRID_HELPER::BestDragOrigin(), PCB_GRID_HELPER::BestDragOrigin(), PCB_GRID_HELPER::BestSnapAnchor(), and EE_GRID_HELPER::BestSnapAnchor().
|
inline |
Definition at line 75 of file grid_helper.h.
References m_maskTypes.
|
inline |
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 m_skipPoint.
VECTOR2I GRID_HELPER::GetGrid | ( | ) | const |
Definition at line 51 of file grid_helper.cpp.
References KIGFX::VIEW::GetGAL(), KIGFX::GAL::GetGridSize(), TOOL_MANAGER::GetView(), KiROUND(), m_toolMgr, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by AlignGrid(), and PCB_GRID_HELPER::computeAnchors().
VECTOR2I GRID_HELPER::GetOrigin | ( | ) | const |
Definition at line 67 of file grid_helper.cpp.
References KIGFX::VIEW::GetGAL(), KIGFX::GAL::GetGridOrigin(), TOOL_MANAGER::GetView(), and m_toolMgr.
Referenced by AlignGrid().
|
inline |
Definition at line 66 of file grid_helper.h.
References m_enableSnap.
Referenced by DRAWING_TOOL::DrawVia(), EE_POINT_EDITOR::pinEditedCorner(), and PNS::TOOL_BASE::updateEndItem().
|
inline |
Definition at line 69 of file grid_helper.h.
References m_enableGrid.
Referenced by PNS::TOOL_BASE::updateStartItem().
VECTOR2I GRID_HELPER::GetVisibleGrid | ( | ) | const |
Definition at line 59 of file grid_helper.cpp.
References KIGFX::VIEW::GetGAL(), TOOL_MANAGER::GetView(), KIGFX::GAL::GetVisibleGridSize(), KiROUND(), m_toolMgr, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by PCB_GRID_HELPER::BestSnapAnchor().
Definition at line 75 of file grid_helper.cpp.
References TOOL_MANAGER::GetView(), m_auxAxis, m_toolMgr, m_viewAxis, KIGFX::ORIGIN_VIEWITEM::SetPosition(), and KIGFX::VIEW::SetVisible().
Referenced by ROUTER_TOOL::InlineDrag(), and ROUTER_TOOL::performDragging().
|
inline |
Definition at line 73 of file grid_helper.h.
References m_maskTypes.
|
inline |
Definition at line 74 of file grid_helper.h.
References m_maskTypes.
|
inline |
Definition at line 52 of file grid_helper.h.
References m_skipPoint.
|
inline |
Definition at line 65 of file grid_helper.h.
References 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().
|
inline |
Definition at line 71 of file grid_helper.h.
References m_enableSnapLine.
|
inline |
Definition at line 68 of file grid_helper.h.
References m_enableGrid.
Referenced by ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PNS::TOOL_BASE::updateEndItem(), and PNS::TOOL_BASE::updateStartItem().
|
protected |
Definition at line 129 of file grid_helper.h.
Referenced by addAnchor(), PCB_GRID_HELPER::AlignToNearestPad(), clearAnchors(), EE_GRID_HELPER::nearestAnchor(), and PCB_GRID_HELPER::nearestAnchor().
|
protected |
Definition at line 132 of file grid_helper.h.
Referenced by Align(), and SetAuxAxes().
|
protected |
Definition at line 137 of file grid_helper.h.
Referenced by PCB_GRID_HELPER::BestSnapAnchor(), canUseGrid(), GetUseGrid(), GRID_HELPER(), and SetUseGrid().
|
protected |
Definition at line 136 of file grid_helper.h.
Referenced by PCB_GRID_HELPER::AlignToArc(), PCB_GRID_HELPER::AlignToSegment(), PCB_GRID_HELPER::BestSnapAnchor(), EE_GRID_HELPER::BestSnapAnchor(), GetSnap(), GRID_HELPER(), and SetSnap().
|
protected |
Definition at line 138 of file grid_helper.h.
Referenced by PCB_GRID_HELPER::BestSnapAnchor(), EE_GRID_HELPER::BestSnapAnchor(), GRID_HELPER(), and SetSnapLine().
|
protected |
Definition at line 134 of file grid_helper.h.
Referenced by addAnchor(), ClearMaskFlag(), GRID_HELPER(), SetMask(), and SetMaskFlag().
|
protected |
Definition at line 141 of file grid_helper.h.
Referenced by PCB_GRID_HELPER::BestSnapAnchor(), EE_GRID_HELPER::BestSnapAnchor(), ClearSkipPoint(), and SetSkipPoint().
|
protected |
Definition at line 139 of file grid_helper.h.
Referenced by PCB_GRID_HELPER::BestSnapAnchor(), EE_GRID_HELPER::BestSnapAnchor(), clearAnchors(), EE_GRID_HELPER::GetSnapped(), PCB_GRID_HELPER::GetSnapped(), and GRID_HELPER().
|
protected |
Definition at line 131 of file grid_helper.h.
Referenced by EE_GRID_HELPER::BestDragOrigin(), PCB_GRID_HELPER::BestDragOrigin(), PCB_GRID_HELPER::BestSnapAnchor(), EE_GRID_HELPER::BestSnapAnchor(), canUseGrid(), PCB_GRID_HELPER::computeAnchors(), EE_GRID_HELPER::EE_GRID_HELPER(), GetGrid(), GetOrigin(), GetVisibleGrid(), PCB_GRID_HELPER::PCB_GRID_HELPER(), EE_GRID_HELPER::queryVisible(), PCB_GRID_HELPER::queryVisible(), and SetAuxAxes().
|
protected |
Definition at line 145 of file grid_helper.h.
Referenced by EE_GRID_HELPER::EE_GRID_HELPER(), PCB_GRID_HELPER::PCB_GRID_HELPER(), and SetAuxAxes().
|
protected |
Definition at line 144 of file grid_helper.h.
Referenced by PCB_GRID_HELPER::BestSnapAnchor(), EE_GRID_HELPER::BestSnapAnchor(), EE_GRID_HELPER::EE_GRID_HELPER(), and PCB_GRID_HELPER::PCB_GRID_HELPER().
|
protected |
Definition at line 143 of file grid_helper.h.
Referenced by PCB_GRID_HELPER::BestSnapAnchor(), EE_GRID_HELPER::BestSnapAnchor(), EE_GRID_HELPER::EE_GRID_HELPER(), and PCB_GRID_HELPER::PCB_GRID_HELPER().