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

#include <pcb_grid_helper.h>

Inheritance diagram for PCB_GRID_HELPER:
GRID_HELPER BOARD_LISTENER

Public Types

enum  ANCHOR_FLAGS {
  CORNER = 1 , OUTLINE = 2 , SNAPPABLE = 4 , ORIGIN = 8 ,
  VERTICAL = 16 , HORIZONTAL = 32 , CONSTRUCTED = 64 , ALL = CORNER | OUTLINE | SNAPPABLE | ORIGIN | VERTICAL | HORIZONTAL | CONSTRUCTED
}
 

Public Member Functions

 PCB_GRID_HELPER (TOOL_MANAGER *aToolMgr, MAGNETIC_SETTINGS *aMagneticSettings)
 
 ~PCB_GRID_HELPER () override
 
BOARD_ITEMGetSnapped () const
 Function GetSnapped If the PCB_GRID_HELPER has highlighted a snap point (target shown), this function will return a pointer to the item to which it snapped.
 
VECTOR2I AlignToSegment (const VECTOR2I &aPoint, const SEG &aSeg)
 
VECTOR2I BestDragOrigin (const VECTOR2I &aMousePos, std::vector< BOARD_ITEM * > &aItem, GRID_HELPER_GRIDS aGrid=GRID_HELPER_GRIDS::GRID_CURRENT, const PCB_SELECTION_FILTER_OPTIONS *aSelectionFilter=nullptr)
 
VECTOR2I AlignToArc (const VECTOR2I &aPoint, const SHAPE_ARC &aSeg)
 
VECTOR2I AlignToNearestPad (const VECTOR2I &aMousePos, std::deque< PAD * > &aPads)
 
virtual void OnBoardItemRemoved (BOARD &aBoard, BOARD_ITEM *aBoardItem) override
 
VECTOR2I BestSnapAnchor (const VECTOR2I &aOrigin, BOARD_ITEM *aReferenceItem, GRID_HELPER_GRIDS aGrid=GRID_HELPER_GRIDS::GRID_CURRENT)
 Chooses the "best" snap anchor around the given point, optionally taking layers from the reference item.
 
VECTOR2I BestSnapAnchor (const VECTOR2I &aOrigin, const LSET &aLayers, GRID_HELPER_GRIDS aGrid=GRID_HELPER_GRIDS::GRID_CURRENT, const std::vector< BOARD_ITEM * > &aSkip={})
 
GRID_HELPER_GRIDS GetItemGrid (const EDA_ITEM *aItem) const override
 Gets the coarsest grid that applies to an item.
 
VECTOR2D GetGridSize (GRID_HELPER_GRIDS aGrid) const override
 Return the size of the specified grid.
 
void AddConstructionItems (std::vector< BOARD_ITEM * > aItems, bool aExtensionOnly, bool aIsPersistent)
 Add construction geometry for a set of board items.
 
virtual VECTOR2I Align (const VECTOR2I &aPoint, GRID_HELPER_GRIDS aGrid) const
 
virtual VECTOR2I Align (const VECTOR2I &aPoint) const
 
virtual VECTOR2I Align (const VECTOR2I &aPoint, const VECTOR2D &aGrid, const VECTOR2D &aOffset) const
 
virtual VECTOR2I AlignGrid (const VECTOR2I &aPoint, GRID_HELPER_GRIDS aGrid) const
 
VECTOR2I AlignGrid (const VECTOR2I &aPoint) const
 
VECTOR2I AlignGrid (const VECTOR2I &aPoint, const VECTOR2D &aGrid, const VECTOR2D &aOffset) const
 
VECTOR2I GetGrid () const
 
VECTOR2D GetVisibleGrid () const
 
VECTOR2I GetOrigin () const
 
void SetAuxAxes (bool aEnable, const VECTOR2I &aOrigin=VECTOR2I(0, 0))
 
virtual GRID_HELPER_GRIDS GetSelectionGrid (const SELECTION &aSelection) const
 Gets the coarsest grid that applies to a selecion of items.
 
void SetSkipPoint (const VECTOR2I &aPoint)
 
void ClearSkipPoint ()
 We clear the skip point by setting it to an unreachable position, thereby preventing matching.
 
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)
 
std::optional< VECTOR2IGetSnappedPoint () const
 
virtual void OnBoardItemAdded (BOARD &aBoard, BOARD_ITEM *aBoardItem)
 
virtual void OnBoardItemsAdded (BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
 
virtual void OnBoardItemsRemoved (BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
 
virtual void OnBoardNetSettingsChanged (BOARD &aBoard)
 
virtual void OnBoardItemChanged (BOARD &aBoard, BOARD_ITEM *aBoardItem)
 
virtual void OnBoardItemsChanged (BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
 
virtual void OnBoardHighlightNetChanged (BOARD &aBoard)
 
virtual void OnBoardRatsnestChanged (BOARD &aBoard)
 
virtual void OnBoardCompositeUpdate (BOARD &aBoard, std::vector< BOARD_ITEM * > &aAddedItems, std::vector< BOARD_ITEM * > &aRemovedItems, std::vector< BOARD_ITEM * > &aDeletedItems)
 

Protected Member Functions

void addAnchor (const VECTOR2I &aPos, int aFlags, EDA_ITEM *aItem, int aPointTypes=POINT_TYPE::PT_NONE)
 
void addAnchor (const VECTOR2I &aPos, int aFlags, std::vector< EDA_ITEM * > aItems, int aPointTypes)
 
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.
 
VECTOR2I computeNearest (const VECTOR2I &aPoint, const VECTOR2I &aGrid, const VECTOR2I &aOffset) const
 
void showConstructionGeometry (bool aShow)
 
SNAP_MANAGERgetSnapManager ()
 
void updateSnapPoint (const TYPED_POINT2I &aPoint)
 
KIGFX::ANCHOR_DEBUGenableAndGetAnchorDebug ()
 Enable the anchor debug if permitted and return it.
 

Protected Attributes

std::vector< ANCHORm_anchors
 
TOOL_MANAGERm_toolMgr
 
std::optional< VECTOR2Im_auxAxis
 
int m_maskTypes
 
bool m_enableSnap
 
bool m_enableGrid
 
bool m_enableSnapLine
 
std::optional< ANCHORm_snapItem
 
VECTOR2I m_skipPoint
 
KIGFX::SNAP_INDICATOR m_viewSnapPoint
 
KIGFX::ORIGIN_VIEWITEM m_viewAxis
 

Private Member Functions

std::vector< BOARD_ITEM * > queryVisible (const BOX2I &aArea, const std::vector< BOARD_ITEM * > &aSkip) const
 
ANCHORnearestAnchor (const VECTOR2I &aPos, int aFlags)
 Find the nearest anchor point to the given position with matching flags.
 
void computeAnchors (const std::vector< BOARD_ITEM * > &aItems, const VECTOR2I &aRefPos, bool aFrom, const PCB_SELECTION_FILTER_OPTIONS *aSelectionFilter, const LSET *aLayers, bool aForDrag)
 computeAnchors inserts the local anchor points in to the grid helper for the specified container of board items, including points implied by intersections or other relationships between the items.
 
void computeAnchors (BOARD_ITEM *aItem, const VECTOR2I &aRefPos, bool aFrom, const PCB_SELECTION_FILTER_OPTIONS *aSelectionFilter)
 computeAnchors inserts the local anchor points in to the grid helper for the specified board item, given the reference point and the direction of use for the point.
 

Private Attributes

MAGNETIC_SETTINGSm_magneticSettings
 
std::vector< NEARABLE_GEOMm_pointOnLineCandidates
 
KIGFX::CONSTRUCTION_GEOM m_constructionGeomPreview
 
SNAP_MANAGER m_snapManager
 
std::unique_ptr< KIGFX::ANCHOR_DEBUGm_anchorDebug
 VIEW_ITEM for visualising anchor points, if enabled.
 

Detailed Description

Definition at line 44 of file pcb_grid_helper.h.

Member Enumeration Documentation

◆ ANCHOR_FLAGS

enum GRID_HELPER::ANCHOR_FLAGS
inherited
Enumerator
CORNER 
OUTLINE 
SNAPPABLE 
ORIGIN 
VERTICAL 
HORIZONTAL 
CONSTRUCTED 
ALL 

Definition at line 125 of file grid_helper.h.

Constructor & Destructor Documentation

◆ PCB_GRID_HELPER()

◆ ~PCB_GRID_HELPER()

PCB_GRID_HELPER::~PCB_GRID_HELPER ( )
override

Member Function Documentation

◆ addAnchor() [1/2]

void GRID_HELPER::addAnchor ( const VECTOR2I aPos,
int  aFlags,
EDA_ITEM aItem,
int  aPointTypes = POINT_TYPE::PT_NONE 
)
inlineprotectedinherited

◆ addAnchor() [2/2]

void GRID_HELPER::addAnchor ( const VECTOR2I aPos,
int  aFlags,
std::vector< EDA_ITEM * >  aItems,
int  aPointTypes 
)
inlineprotectedinherited

Definition at line 182 of file grid_helper.h.

References GRID_HELPER::m_anchors, and GRID_HELPER::m_maskTypes.

◆ AddConstructionItems()

void PCB_GRID_HELPER::AddConstructionItems ( std::vector< BOARD_ITEM * >  aItems,
bool  aExtensionOnly,
bool  aIsPersistent 
)

Add construction geometry for a set of board items.

Parameters
aItemsThe items for which to add construction geometry
aExtensionOnlyIf true, the construction geometry only includes extensions of the items, if false it also overlays the items themselves.
aIsPersistentIf true, the construction geometry is considered "persistent" and will always be shown and won't be replaced by later temporary geometry.

Definition at line 176 of file pcb_grid_helper.cpp.

References CONSTRUCTION_MANAGER::FROM_ITEMS, EDA_SHAPE::GetArcMid(), PCB_SHAPE::GetCenter(), ADVANCED_CFG::GetCfg(), SNAP_MANAGER::GetConstructionManager(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetRadius(), EDA_SHAPE::GetShape(), GRID_HELPER::getSnapManager(), EDA_SHAPE::GetStart(), PCB_SHAPE_T, CONSTRUCTION_MANAGER::ProposeConstructionItems(), SNAP_MANAGER::SetReferenceOnlyPoints(), and EDA_ITEM::Type().

Referenced by BestSnapAnchor().

◆ Align() [1/3]

VECTOR2I GRID_HELPER::Align ( const VECTOR2I aPoint) const
virtual

Reimplemented from GRID_HELPER.

Definition at line 75 of file grid_helper.cpp.

◆ Align() [2/3]

VECTOR2I GRID_HELPER::Align ( const VECTOR2I aPoint,
const VECTOR2D aGrid,
const VECTOR2D aOffset 
) const
virtual

◆ Align() [3/3]

virtual VECTOR2I GRID_HELPER::Align ( const VECTOR2I aPoint,
GRID_HELPER_GRIDS  aGrid 
) const
inlinevirtual

◆ AlignGrid() [1/3]

VECTOR2I GRID_HELPER::AlignGrid ( const VECTOR2I aPoint) const

Definition at line 79 of file grid_helper.cpp.

◆ AlignGrid() [2/3]

VECTOR2I GRID_HELPER::AlignGrid ( const VECTOR2I aPoint,
const VECTOR2D aGrid,
const VECTOR2D aOffset 
) const

Definition at line 80 of file grid_helper.cpp.

◆ AlignGrid() [3/3]

virtual VECTOR2I GRID_HELPER::AlignGrid ( const VECTOR2I aPoint,
GRID_HELPER_GRIDS  aGrid 
) const
inlinevirtual

Reimplemented from GRID_HELPER.

Definition at line 70 of file grid_helper.h.

◆ AlignToArc()

VECTOR2I PCB_GRID_HELPER::AlignToArc ( const VECTOR2I aPoint,
const SHAPE_ARC aSeg 
)

◆ AlignToNearestPad()

VECTOR2I PCB_GRID_HELPER::AlignToNearestPad ( const VECTOR2I aMousePos,
std::deque< PAD * > &  aPads 
)

◆ AlignToSegment()

VECTOR2I PCB_GRID_HELPER::AlignToSegment ( const VECTOR2I aPoint,
const SEG aSeg 
)

◆ BestDragOrigin()

VECTOR2I PCB_GRID_HELPER::BestDragOrigin ( const VECTOR2I aMousePos,
std::vector< BOARD_ITEM * > &  aItem,
GRID_HELPER_GRIDS  aGrid = GRID_HELPER_GRIDS::GRID_CURRENT,
const PCB_SELECTION_FILTER_OPTIONS aSelectionFilter = nullptr 
)

◆ BestSnapAnchor() [1/2]

VECTOR2I PCB_GRID_HELPER::BestSnapAnchor ( const VECTOR2I aOrigin,
BOARD_ITEM aReferenceItem,
GRID_HELPER_GRIDS  aGrid = GRID_HELPER_GRIDS::GRID_CURRENT 
)

Chooses the "best" snap anchor around the given point, optionally taking layers from the reference item.

The reference item will not be snapped to (it is being dragged or created) and we choose the layers that can be snapped based on the reference item layer

Parameters
aOriginPoint we want to snap from
aReferenceItemReference item for layer/type special casing
Returns
snapped screen point

Definition at line 477 of file pcb_grid_helper.cpp.

References LSET::AllLayersMask(), BestSnapAnchor(), and BOARD_ITEM::GetLayerSet().

Referenced by BestSnapAnchor().

◆ BestSnapAnchor() [2/2]

VECTOR2I PCB_GRID_HELPER::BestSnapAnchor ( const VECTOR2I aOrigin,
const LSET aLayers,
GRID_HELPER_GRIDS  aGrid = GRID_HELPER_GRIDS::GRID_CURRENT,
const std::vector< BOARD_ITEM * > &  aSkip = {} 
)

Definition at line 497 of file pcb_grid_helper.cpp.

References AddConstructionItems(), Align(), MAGNETIC_SETTINGS::allLayers, anchor, BOX2ISafe(), CONSTRUCTION_MANAGER::CancelProposal(), GRID_HELPER::clearAnchors(), SNAP_LINE_MANAGER::ClearSnapLine(), computeAnchors(), GRID_HELPER::CONSTRUCTED, GRID_HELPER::ANCHOR::Distance(), GRID_HELPER::enableAndGetAnchorDebug(), GRID_HELPER::ANCHOR::flags, KIGFX::GEOMETRY, ADVANCED_CFG::GetCfg(), SNAP_MANAGER::GetConstructionManager(), BOARD_ITEM::GetLayerSet(), GetNearestPoint(), SNAP_LINE_MANAGER::GetNearestSnapLinePoint(), SNAP_MANAGER::GetReferenceOnlyPoints(), SNAP_MANAGER::GetSnapLineManager(), GRID_HELPER::getSnapManager(), TOOL_MANAGER::GetView(), GRID_HELPER::GetVisibleGrid(), EDA_ITEM::HitTest(), CONSTRUCTION_MANAGER::InvolvesAllGivenRealItems(), GRID_HELPER::ANCHOR::items, KiROUND(), GRID_HELPER::m_anchors, ADVANCED_CFG::m_EnableExtensionSnaps, GRID_HELPER::m_enableGrid, GRID_HELPER::m_enableSnap, GRID_HELPER::m_enableSnapLine, ADVANCED_CFG::m_ExtensionSnapActivateOnHover, m_magneticSettings, m_pointOnLineCandidates, GRID_HELPER::m_skipPoint, GRID_HELPER::m_snapItem, GRID_HELPER::m_toolMgr, GRID_HELPER::m_viewSnapPoint, nearestAnchor(), GRID_HELPER::ANCHOR::pos, queryVisible(), SNAP_LINE_MANAGER::SetSnapLineEnd(), SNAP_LINE_MANAGER::SetSnapLineOrigin(), SNAP_LINE_MANAGER::SetSnappedAnchor(), KIGFX::SNAP_INDICATOR::SetSnapTypes(), KIGFX::VIEW::SetVisible(), GRID_HELPER::showConstructionGeometry(), GRID_HELPER::SNAPPABLE, KIGFX::VIEW::ToWorld(), KIGFX::VIEW::Update(), and GRID_HELPER::updateSnapPoint().

◆ canUseGrid()

bool GRID_HELPER::canUseGrid ( ) const
protectedinherited

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 226 of file grid_helper.cpp.

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 EE_GRID_HELPER::BestSnapAnchor().

◆ clearAnchors()

void GRID_HELPER::clearAnchors ( )
inlineprotectedinherited

◆ ClearMaskFlag()

void GRID_HELPER::ClearMaskFlag ( int  aFlag)
inlineinherited

Definition at line 121 of file grid_helper.h.

References GRID_HELPER::m_maskTypes.

◆ ClearSkipPoint()

void GRID_HELPER::ClearSkipPoint ( )
inlineinherited

We clear the skip point by setting it to an unreachable position, thereby preventing matching.

Definition at line 106 of file grid_helper.h.

References GRID_HELPER::m_skipPoint.

◆ computeAnchors() [1/2]

void PCB_GRID_HELPER::computeAnchors ( BOARD_ITEM aItem,
const VECTOR2I aRefPos,
bool  aFrom,
const PCB_SELECTION_FILTER_OPTIONS aSelectionFilter 
)
private

computeAnchors inserts the local anchor points in to the grid helper for the specified board item, given the reference point and the direction of use for the point.

Parameters
aItemThe board item for which to compute the anchors
aRefPosThe point for which to compute the anchors (if used by the component)
aFromIs this for an anchor that is designating a source point (aFrom=true) or not

If we are getting a drag point, we don't want to center the edge of pads

Definition at line 1071 of file pcb_grid_helper.cpp.

References SEG::A, GRID_HELPER::addAnchor(), ANGLE_90, SHAPE_LINE_CHAIN::Append(), SEG::B, SEG::Center(), BOX2< Vec >::Centre(), SHAPE_POLY_SET::CIterateWithHoles(), computeAnchors(), GRID_HELPER::CORNER, PCB_SELECTION_FILTER_OPTIONS::dimensions, EDA_SHAPE::DupPolyPointsList(), ERROR_INSIDE, PCB_SELECTION_FILTER_OPTIONS::footprints, EDA_SHAPE::GetArcMid(), FOOTPRINT::GetBoundingBox(), BOARD_ITEM::GetCenter(), PCB_SHAPE::GetCenter(), KIGEOM::GetCircleKeyPoints(), PCB_DIM_ALIGNED::GetCrossbarEnd(), PCB_DIM_ALIGNED::GetCrossbarStart(), PAD::GetDelta(), PAD::GetDrillSize(), PAD::GetEffectivePolygon(), EDA_SHAPE::GetEnd(), PCB_DIMENSION_BASE::GetEnd(), PCB_TRACK::GetEnd(), GRID_HELPER::GetGrid(), KIGFX::RENDER_SETTINGS::GetHighContrast(), KIGFX::RENDER_SETTINGS::GetHighContrastLayers(), PCB_DIM_RADIAL::GetKnee(), BOARD_ITEM::GetLayerSet(), PAD::GetOrientation(), KIGEOM::GetOvalKeyPoints(), KIGFX::VIEW::GetPainter(), EDA_ITEM::GetPosition(), FOOTPRINT::GetPosition(), PAD::GetPosition(), PCB_SHAPE::GetPosition(), KIGFX::VIEW::GetScale(), SHAPE_LINE_CHAIN::GetSegment(), SHAPE_LINE_CHAIN::GetSegmentCount(), KIGFX::PAINTER::GetSettings(), EDA_SHAPE::GetShape(), PAD::GetShape(), PAD::GetSize(), PAD::GetSizeX(), EDA_SHAPE::GetStart(), PCB_DIMENSION_BASE::GetStart(), PCB_TRACK::GetStart(), EDA_TEXT::GetTextPos(), TOOL_MANAGER::GetView(), PCB_SELECTION_FILTER_OPTIONS::graphics, MAGNETIC_SETTINGS::graphics, grid, PAD::HasHole(), KIGFX::VIEW::IsLayerVisible(), KIGFX::VIEW::IsVisible(), KI_FALLTHROUGH, LAYER_ANCHOR, m_magneticSettings, GRID_HELPER::m_toolMgr, SHAPE_LINE_CHAIN::Move(), SHAPE_LINE_CHAIN::NearestPoint(), GRID_HELPER::ORIGIN, GRID_HELPER::OUTLINE, KIGEOM::OVAL_CAP_TIPS, KIGEOM::OVAL_CARDINAL_EXTREMES, KIGEOM::OVAL_CENTER, KIGEOM::OVAL_SIDE_MIDPOINTS, pad, PCB_SELECTION_FILTER_OPTIONS::pads, FOOTPRINT::Pads(), MAGNETIC_SETTINGS::pads, PCB_ARC_T, PCB_DIM_ALIGNED_T, PCB_DIM_CENTER_T, PCB_DIM_LEADER_T, PCB_DIM_ORTHOGONAL_T, PCB_DIM_RADIAL_T, PCB_FIELD_T, PCB_FOOTPRINT_T, PCB_GROUP_T, PCB_MARKER_T, PCB_PAD_T, PCB_SHAPE_T, PCB_TARGET_T, PCB_TEXT_T, PCB_TEXTBOX_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_T, SHAPE_LINE_CHAIN::Rotate(), RotatePoint(), LSET::Seq(), SHAPE_LINE_CHAIN::SetClosed(), PAD::ShapePos(), GRID_HELPER::SNAPPABLE, PCB_SELECTION_FILTER_OPTIONS::text, PCB_SELECTION_FILTER_OPTIONS::tracks, MAGNETIC_SETTINGS::tracks, EDA_ITEM::Type(), PCB_SELECTION_FILTER_OPTIONS::vias, KIGFX::VIEW_ITEM::ViewGetLOD(), VECTOR2< T >::x, VECTOR2< T >::y, and PCB_SELECTION_FILTER_OPTIONS::zones.

◆ computeAnchors() [2/2]

void PCB_GRID_HELPER::computeAnchors ( const std::vector< BOARD_ITEM * > &  aItems,
const VECTOR2I aRefPos,
bool  aFrom,
const PCB_SELECTION_FILTER_OPTIONS aSelectionFilter,
const LSET aLayers,
bool  aForDrag 
)
private

◆ computeNearest()

VECTOR2I GRID_HELPER::computeNearest ( const VECTOR2I aPoint,
const VECTOR2I aGrid,
const VECTOR2I aOffset 
) const
protectedinherited

Definition at line 191 of file grid_helper.cpp.

References KiROUND(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by GRID_HELPER::AlignGrid().

◆ enableAndGetAnchorDebug()

KIGFX::ANCHOR_DEBUG * GRID_HELPER::enableAndGetAnchorDebug ( )
protectedinherited

Enable the anchor debug if permitted and return it.

Returns nullptr if not permitted by the advancd config

Definition at line 85 of file grid_helper.cpp.

References KIGFX::VIEW::Add(), ADVANCED_CFG::GetCfg(), TOOL_MANAGER::GetView(), GRID_HELPER::m_anchorDebug, ADVANCED_CFG::m_EnableSnapAnchorsDebug, GRID_HELPER::m_toolMgr, and KIGFX::VIEW::SetVisible().

Referenced by BestSnapAnchor(), and EE_GRID_HELPER::BestSnapAnchor().

◆ GetGrid()

◆ GetGridSize()

VECTOR2D PCB_GRID_HELPER::GetGridSize ( GRID_HELPER_GRIDS  aGrid) const
overridevirtual

◆ GetItemGrid()

GRID_HELPER_GRIDS PCB_GRID_HELPER::GetItemGrid ( const EDA_ITEM aItem) const
overridevirtual

◆ GetOrigin()

VECTOR2I GRID_HELPER::GetOrigin ( ) const
inherited

◆ GetSelectionGrid()

GRID_HELPER_GRIDS GRID_HELPER::GetSelectionGrid ( const SELECTION aSelection) const
virtualinherited

Gets the coarsest grid that applies to a selecion of items.

Reimplemented in EE_GRID_HELPER.

Definition at line 139 of file grid_helper.cpp.

References SELECTION::Front(), GRID_HELPER::GetGridSize(), GRID_HELPER::GetItemGrid(), and grid.

◆ GetSnap()

bool GRID_HELPER::GetSnap ( ) const
inlineinherited

Definition at line 112 of file grid_helper.h.

References GRID_HELPER::m_enableSnap.

Referenced by DRAWING_TOOL::DrawVia(), and PNS::TOOL_BASE::updateEndItem().

◆ getSnapManager()

SNAP_MANAGER & GRID_HELPER::getSnapManager ( )
inlineprotectedinherited

◆ GetSnapped()

BOARD_ITEM * PCB_GRID_HELPER::GetSnapped ( ) const

Function GetSnapped If the PCB_GRID_HELPER has highlighted a snap point (target shown), this function will return a pointer to the item to which it snapped.

Returns
NULL if not snapped. Pointer to snapped item otherwise

Definition at line 738 of file pcb_grid_helper.cpp.

References GRID_HELPER::m_snapItem.

◆ GetSnappedPoint()

std::optional< VECTOR2I > GRID_HELPER::GetSnappedPoint ( ) const
inherited

Definition at line 232 of file grid_helper.cpp.

References GRID_HELPER::m_snapItem.

Referenced by PCB_PICKER_TOOL::SelectPointInteractively().

◆ GetUseGrid()

bool GRID_HELPER::GetUseGrid ( ) const
inlineinherited

Definition at line 115 of file grid_helper.h.

References GRID_HELPER::m_enableGrid.

Referenced by PNS::TOOL_BASE::updateStartItem().

◆ GetVisibleGrid()

VECTOR2D GRID_HELPER::GetVisibleGrid ( ) const
inherited

◆ nearestAnchor()

PCB_GRID_HELPER::ANCHOR * PCB_GRID_HELPER::nearestAnchor ( const VECTOR2I aPos,
int  aFlags 
)
private

Find the nearest anchor point to the given position with matching flags.

Parameters
returnThe nearest anchor point, or nullptr if none found

Definition at line 1587 of file pcb_grid_helper.cpp.

References anchor, and GRID_HELPER::m_anchors.

Referenced by BestDragOrigin(), and BestSnapAnchor().

◆ OnBoardCompositeUpdate()

virtual void BOARD_LISTENER::OnBoardCompositeUpdate ( BOARD aBoard,
std::vector< BOARD_ITEM * > &  aAddedItems,
std::vector< BOARD_ITEM * > &  aRemovedItems,
std::vector< BOARD_ITEM * > &  aDeletedItems 
)
inlinevirtualinherited

◆ OnBoardHighlightNetChanged()

virtual void BOARD_LISTENER::OnBoardHighlightNetChanged ( BOARD aBoard)
inlinevirtualinherited

Reimplemented in PCB_NET_INSPECTOR_PANEL, and PCB_SEARCH_PANE.

Definition at line 262 of file board.h.

Referenced by BOARD::HighLightON(), BOARD::ResetNetHighLight(), and BOARD::SetHighLightNet().

◆ OnBoardItemAdded()

virtual void BOARD_LISTENER::OnBoardItemAdded ( BOARD aBoard,
BOARD_ITEM aBoardItem 
)
inlinevirtualinherited

Reimplemented in DIALOG_GENERATORS, PCB_NET_INSPECTOR_PANEL, PCB_SEARCH_PANE, and APPEARANCE_CONTROLS.

Definition at line 255 of file board.h.

Referenced by BOARD::Add().

◆ OnBoardItemChanged()

virtual void BOARD_LISTENER::OnBoardItemChanged ( BOARD aBoard,
BOARD_ITEM aBoardItem 
)
inlinevirtualinherited

Reimplemented in DIALOG_GENERATORS, PCB_NET_INSPECTOR_PANEL, PCB_SEARCH_PANE, and APPEARANCE_CONTROLS.

Definition at line 260 of file board.h.

Referenced by BOARD::OnItemChanged().

◆ OnBoardItemRemoved()

virtual void PCB_GRID_HELPER::OnBoardItemRemoved ( BOARD aBoard,
BOARD_ITEM aBoardItem 
)
inlineoverridevirtual

Reimplemented from BOARD_LISTENER.

Definition at line 73 of file pcb_grid_helper.h.

References GRID_HELPER::m_snapItem.

◆ OnBoardItemsAdded()

virtual void BOARD_LISTENER::OnBoardItemsAdded ( BOARD aBoard,
std::vector< BOARD_ITEM * > &  aBoardItem 
)
inlinevirtualinherited

Reimplemented in DIALOG_GENERATORS, PCB_NET_INSPECTOR_PANEL, PCB_SEARCH_PANE, and APPEARANCE_CONTROLS.

Definition at line 256 of file board.h.

Referenced by BOARD::FinalizeBulkAdd().

◆ OnBoardItemsChanged()

virtual void BOARD_LISTENER::OnBoardItemsChanged ( BOARD aBoard,
std::vector< BOARD_ITEM * > &  aBoardItem 
)
inlinevirtualinherited

Reimplemented in DIALOG_GENERATORS, PCB_NET_INSPECTOR_PANEL, PCB_SEARCH_PANE, and APPEARANCE_CONTROLS.

Definition at line 261 of file board.h.

Referenced by BOARD::OnItemsChanged().

◆ OnBoardItemsRemoved()

virtual void BOARD_LISTENER::OnBoardItemsRemoved ( BOARD aBoard,
std::vector< BOARD_ITEM * > &  aBoardItem 
)
inlinevirtualinherited

Reimplemented in DIALOG_GENERATORS, PCB_NET_INSPECTOR_PANEL, PCB_SEARCH_PANE, and APPEARANCE_CONTROLS.

Definition at line 258 of file board.h.

Referenced by BOARD::FinalizeBulkRemove().

◆ OnBoardNetSettingsChanged()

virtual void BOARD_LISTENER::OnBoardNetSettingsChanged ( BOARD aBoard)
inlinevirtualinherited

Reimplemented in APPEARANCE_CONTROLS, PCB_NET_INSPECTOR_PANEL, and PCB_SEARCH_PANE.

Definition at line 259 of file board.h.

Referenced by BOARD::SynchronizeNetsAndNetClasses().

◆ OnBoardRatsnestChanged()

virtual void BOARD_LISTENER::OnBoardRatsnestChanged ( BOARD aBoard)
inlinevirtualinherited

Reimplemented in PCB_SEARCH_PANE.

Definition at line 263 of file board.h.

Referenced by BOARD::OnRatsnestChanged().

◆ queryVisible()

◆ SetAuxAxes()

void GRID_HELPER::SetAuxAxes ( bool  aEnable,
const VECTOR2I aOrigin = VECTOR2I( 0, 0 ) 
)
inherited

◆ SetMask()

void GRID_HELPER::SetMask ( int  aMask)
inlineinherited

Definition at line 119 of file grid_helper.h.

References GRID_HELPER::m_maskTypes.

◆ SetMaskFlag()

void GRID_HELPER::SetMaskFlag ( int  aFlag)
inlineinherited

Definition at line 120 of file grid_helper.h.

References GRID_HELPER::m_maskTypes.

◆ SetSkipPoint()

void GRID_HELPER::SetSkipPoint ( const VECTOR2I aPoint)
inlineinherited

Definition at line 98 of file grid_helper.h.

References GRID_HELPER::m_skipPoint.

◆ SetSnap()

◆ SetSnapLine()

void GRID_HELPER::SetSnapLine ( bool  aSnap)
inlineinherited

Definition at line 117 of file grid_helper.h.

References GRID_HELPER::m_enableSnapLine.

◆ SetUseGrid()

void GRID_HELPER::SetUseGrid ( bool  aSnapToGrid)
inlineinherited

◆ showConstructionGeometry()

void GRID_HELPER::showConstructionGeometry ( bool  aShow)
protectedinherited

◆ updateSnapPoint()

Member Data Documentation

◆ m_anchorDebug

std::unique_ptr<KIGFX::ANCHOR_DEBUG> GRID_HELPER::m_anchorDebug
privateinherited

VIEW_ITEM for visualising anchor points, if enabled.

Definition at line 244 of file grid_helper.h.

Referenced by GRID_HELPER::enableAndGetAnchorDebug().

◆ m_anchors

◆ m_auxAxis

std::optional<VECTOR2I> GRID_HELPER::m_auxAxis
protectedinherited

Definition at line 220 of file grid_helper.h.

Referenced by GRID_HELPER::Align(), and GRID_HELPER::SetAuxAxes().

◆ m_constructionGeomPreview

KIGFX::CONSTRUCTION_GEOM GRID_HELPER::m_constructionGeomPreview
privateinherited

◆ m_enableGrid

bool GRID_HELPER::m_enableGrid
protectedinherited

◆ m_enableSnap

bool GRID_HELPER::m_enableSnap
protectedinherited

◆ m_enableSnapLine

bool GRID_HELPER::m_enableSnapLine
protectedinherited

◆ m_magneticSettings

MAGNETIC_SETTINGS* PCB_GRID_HELPER::m_magneticSettings
private

Definition at line 150 of file pcb_grid_helper.h.

Referenced by BestSnapAnchor(), and computeAnchors().

◆ m_maskTypes

int GRID_HELPER::m_maskTypes
protectedinherited

◆ m_pointOnLineCandidates

std::vector<NEARABLE_GEOM> PCB_GRID_HELPER::m_pointOnLineCandidates
private

Definition at line 152 of file pcb_grid_helper.h.

Referenced by BestSnapAnchor(), and computeAnchors().

◆ m_skipPoint

VECTOR2I GRID_HELPER::m_skipPoint
protectedinherited

◆ m_snapItem

◆ m_snapManager

SNAP_MANAGER GRID_HELPER::m_snapManager
privateinherited

Definition at line 241 of file grid_helper.h.

Referenced by GRID_HELPER::getSnapManager(), and GRID_HELPER::GRID_HELPER().

◆ m_toolMgr

◆ m_viewAxis

◆ m_viewSnapPoint


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