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

A SNAP_MANAGER glues together the snap line manager and construction manager., along with some other state. More...

#include <construction_manager.h>

Inheritance diagram for SNAP_MANAGER:
CONSTRUCTION_VIEW_HANDLER

Public Types

using GFX_UPDATE_CALLBACK = std::function< void(bool aShowAnything)>
 

Public Member Functions

 SNAP_MANAGER (KIGFX::CONSTRUCTION_GEOM &aHelper)
 
void SetUpdateCallback (GFX_UPDATE_CALLBACK aCallback)
 Set the callback to call when the construction geometry changes and a view may need updating.
 
SNAP_LINE_MANAGERGetSnapLineManager ()
 
CONSTRUCTION_MANAGERGetConstructionManager ()
 
void SetReferenceOnlyPoints (std::vector< VECTOR2I > aPoints)
 Set the reference-only points - these are points that are not snapped to, but can still be used for connection to the snap line.
 
const std::vector< VECTOR2I > & GetReferenceOnlyPoints () const
 
std::vector< CONSTRUCTION_MANAGER::CONSTRUCTION_ITEM_BATCHGetConstructionItems () const
 Get a list of all the active construction geometry, computed from the combined state of the snap line and construction manager.
 
void updateView () override
 
KIGFX::CONSTRUCTION_GEOMGetViewItem ()
 

Public Attributes

GFX_UPDATE_CALLBACK m_updateCallback
 
SNAP_LINE_MANAGER m_snapLineManager
 
CONSTRUCTION_MANAGER m_constructionManager
 
std::vector< VECTOR2Im_referenceOnlyPoints
 

Private Attributes

KIGFX::CONSTRUCTION_GEOMm_constructionGeomPreview
 

Detailed Description

A SNAP_MANAGER glues together the snap line manager and construction manager., along with some other state.

It provides information for generating snap anchors based on this state, as well as keeping the state of visible construction geometry involved in that process.

Probably only used by GRID_HELPERs, but it's neater to keep it separate, as there's quite a bit of state to manage.

This is also where you may wish to add other 'virtual' snapping state, such as 'equal-space' snapping, etc.

Definition at line 230 of file construction_manager.h.

Member Typedef Documentation

◆ GFX_UPDATE_CALLBACK

using SNAP_MANAGER::GFX_UPDATE_CALLBACK = std::function<void( bool aShowAnything )>

Definition at line 233 of file construction_manager.h.

Constructor & Destructor Documentation

◆ SNAP_MANAGER()

SNAP_MANAGER::SNAP_MANAGER ( KIGFX::CONSTRUCTION_GEOM aHelper)

Definition at line 508 of file construction_manager.cpp.

Member Function Documentation

◆ GetConstructionItems()

std::vector< CONSTRUCTION_MANAGER::CONSTRUCTION_ITEM_BATCH > SNAP_MANAGER::GetConstructionItems ( ) const

Get a list of all the active construction geometry, computed from the combined state of the snap line and construction manager.

This can be combined with other external geometry to compute snap anchors.

Definition at line 528 of file construction_manager.cpp.

References CONSTRUCTION_MANAGER::CONSTRUCTION_ITEM::Constructions, CONSTRUCTION_MANAGER::FROM_SNAP_LINE, CONSTRUCTION_MANAGER::GetConstructionItems(), SNAP_LINE_MANAGER::GetSnapLineOrigin(), m_constructionManager, and m_snapLineManager.

◆ GetConstructionManager()

CONSTRUCTION_MANAGER & SNAP_MANAGER::GetConstructionManager ( )
inline

◆ GetReferenceOnlyPoints()

const std::vector< VECTOR2I > & SNAP_MANAGER::GetReferenceOnlyPoints ( ) const
inline

Definition at line 255 of file construction_manager.h.

References m_referenceOnlyPoints.

Referenced by PCB_GRID_HELPER::BestSnapAnchor().

◆ GetSnapLineManager()

SNAP_LINE_MANAGER & SNAP_MANAGER::GetSnapLineManager ( )
inline

◆ GetViewItem()

◆ SetReferenceOnlyPoints()

void SNAP_MANAGER::SetReferenceOnlyPoints ( std::vector< VECTOR2I aPoints)
inline

Set the reference-only points - these are points that are not snapped to, but can still be used for connection to the snap line.

Definition at line 250 of file construction_manager.h.

References m_referenceOnlyPoints.

Referenced by PCB_GRID_HELPER::AddConstructionItems().

◆ SetUpdateCallback()

void SNAP_MANAGER::SetUpdateCallback ( GFX_UPDATE_CALLBACK  aCallback)
inline

Set the callback to call when the construction geometry changes and a view may need updating.

Definition at line 240 of file construction_manager.h.

References m_updateCallback.

Referenced by GRID_HELPER::GRID_HELPER().

◆ updateView()

Member Data Documentation

◆ m_constructionGeomPreview

KIGFX::CONSTRUCTION_GEOM& CONSTRUCTION_VIEW_HANDLER::m_constructionGeomPreview
privateinherited

Definition at line 58 of file construction_manager.h.

Referenced by CONSTRUCTION_VIEW_HANDLER::GetViewItem().

◆ m_constructionManager

CONSTRUCTION_MANAGER SNAP_MANAGER::m_constructionManager

◆ m_referenceOnlyPoints

std::vector<VECTOR2I> SNAP_MANAGER::m_referenceOnlyPoints

Definition at line 273 of file construction_manager.h.

Referenced by GetReferenceOnlyPoints(), and SetReferenceOnlyPoints().

◆ m_snapLineManager

SNAP_LINE_MANAGER SNAP_MANAGER::m_snapLineManager

Definition at line 270 of file construction_manager.h.

Referenced by GetConstructionItems(), GetSnapLineManager(), and updateView().

◆ m_updateCallback

GFX_UPDATE_CALLBACK SNAP_MANAGER::m_updateCallback

Definition at line 268 of file construction_manager.h.

Referenced by SetUpdateCallback(), and updateView().


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