KiCad PCB EDA Suite
|
A SNAP_MANAGER glues together the snap line manager and construction manager., along with some other state. More...
#include <construction_manager.h>
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_MANAGER & | GetSnapLineManager () |
const SNAP_LINE_MANAGER & | GetSnapLineManager () const |
CONSTRUCTION_MANAGER & | GetConstructionManager () |
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_BATCH > | GetConstructionItems () const |
Get a list of all the active construction geometry, computed from the combined state of the snap line and construction manager. | |
void | SetSnapGuideColors (const KIGFX::COLOR4D &aBase, const KIGFX::COLOR4D &aHighlight) |
void | UpdateSnapGuides () |
void | updateView () override |
KIGFX::CONSTRUCTION_GEOM & | GetViewItem () |
Private Attributes | |
KIGFX::CONSTRUCTION_GEOM & | m_constructionGeomPreview |
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 265 of file construction_manager.h.
using SNAP_MANAGER::GFX_UPDATE_CALLBACK = std::function<void( bool aShowAnything )> |
Definition at line 268 of file construction_manager.h.
SNAP_MANAGER::SNAP_MANAGER | ( | KIGFX::CONSTRUCTION_GEOM & | aHelper | ) |
Definition at line 628 of file construction_manager.cpp.
References CONSTRUCTION_VIEW_HANDLER::CONSTRUCTION_VIEW_HANDLER(), m_constructionManager, m_snapGuideColor, m_snapGuideHighlightColor, m_snapLineManager, and WHITE.
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 710 of file construction_manager.cpp.
References CONSTRUCTION_MANAGER::CONSTRUCTION_ITEM::Constructions, CONSTRUCTION_MANAGER::CONSTRUCTION_ITEM::DRAWABLE_ENTRY::Drawable, CONSTRUCTION_MANAGER::FROM_SNAP_LINE, CONSTRUCTION_MANAGER::CONSTRUCTION_ITEM::DRAWABLE_ENTRY::LineWidth, m_constructionManager, and m_snapLineManager.
|
inline |
Definition at line 280 of file construction_manager.h.
References m_constructionManager.
Referenced by PCB_GRID_HELPER::AddConstructionItems(), PCB_GRID_HELPER::BestSnapAnchor(), and PCB_GRID_HELPER::nearestAnchor().
|
inline |
Definition at line 291 of file construction_manager.h.
References m_referenceOnlyPoints.
Referenced by PCB_GRID_HELPER::BestSnapAnchor().
|
inline |
Definition at line 277 of file construction_manager.h.
References m_snapLineManager.
Referenced by EE_GRID_HELPER::BestSnapAnchor(), and PCB_GRID_HELPER::BestSnapAnchor().
|
inline |
Definition at line 278 of file construction_manager.h.
References m_snapLineManager.
|
inlineinherited |
Definition at line 53 of file construction_manager.h.
References m_constructionGeomPreview.
Referenced by SNAP_MANAGER::UpdateSnapGuides().
|
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 286 of file construction_manager.h.
References m_referenceOnlyPoints.
Referenced by PCB_GRID_HELPER::AddConstructionItems().
void SNAP_MANAGER::SetSnapGuideColors | ( | const KIGFX::COLOR4D & | aBase, |
const KIGFX::COLOR4D & | aHighlight ) |
Definition at line 650 of file construction_manager.cpp.
References m_snapGuideColor, m_snapGuideHighlightColor, and UpdateSnapGuides().
|
inline |
Set the callback to call when the construction geometry changes and a view may need updating.
Definition at line 275 of file construction_manager.h.
References m_updateCallback.
void SNAP_MANAGER::UpdateSnapGuides | ( | ) |
Definition at line 658 of file construction_manager.cpp.
References KIGFX::CONSTRUCTION_GEOM::SNAP_GUIDE::Color, CONSTRUCTION_VIEW_HANDLER::GetViewItem(), KIGFX::CONSTRUCTION_GEOM::SNAP_GUIDE::LineWidth, m_snapGuideColor, m_snapGuideHighlightColor, m_snapLineManager, KIGFX::CONSTRUCTION_GEOM::SNAP_GUIDE::Segment, KIGFX::CONSTRUCTION_GEOM::SetSnapGuides(), updateView(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by SetSnapGuideColors().
|
overridevirtual |
Implements CONSTRUCTION_VIEW_HANDLER.
Definition at line 636 of file construction_manager.cpp.
References m_constructionManager, m_snapLineManager, and m_updateCallback.
Referenced by UpdateSnapGuides().
|
privateinherited |
Definition at line 58 of file construction_manager.h.
Referenced by CONSTRUCTION_VIEW_HANDLER(), and GetViewItem().
CONSTRUCTION_MANAGER SNAP_MANAGER::m_constructionManager |
Definition at line 310 of file construction_manager.h.
Referenced by GetConstructionItems(), GetConstructionManager(), SNAP_MANAGER(), and updateView().
std::vector<VECTOR2I> SNAP_MANAGER::m_referenceOnlyPoints |
Definition at line 312 of file construction_manager.h.
Referenced by GetReferenceOnlyPoints(), and SetReferenceOnlyPoints().
KIGFX::COLOR4D SNAP_MANAGER::m_snapGuideColor |
Definition at line 313 of file construction_manager.h.
Referenced by SetSnapGuideColors(), SNAP_MANAGER(), and UpdateSnapGuides().
KIGFX::COLOR4D SNAP_MANAGER::m_snapGuideHighlightColor |
Definition at line 314 of file construction_manager.h.
Referenced by SetSnapGuideColors(), SNAP_MANAGER(), and UpdateSnapGuides().
SNAP_LINE_MANAGER SNAP_MANAGER::m_snapLineManager |
Definition at line 309 of file construction_manager.h.
Referenced by GetConstructionItems(), GetSnapLineManager(), GetSnapLineManager(), SNAP_MANAGER(), UpdateSnapGuides(), and updateView().
GFX_UPDATE_CALLBACK SNAP_MANAGER::m_updateCallback |
Definition at line 307 of file construction_manager.h.
Referenced by SetUpdateCallback(), and updateView().