|
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 | SetDimensionBrackets (std::vector< SEG > aBrackets) |
| void | Clear () |
| 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 275 of file construction_manager.h.
| using SNAP_MANAGER::GFX_UPDATE_CALLBACK = std::function<void( bool aShowAnything )> |
Definition at line 278 of file construction_manager.h.
| SNAP_MANAGER::SNAP_MANAGER | ( | KIGFX::CONSTRUCTION_GEOM & | aHelper | ) |
Definition at line 751 of file construction_manager.cpp.
References CONSTRUCTION_VIEW_HANDLER::CONSTRUCTION_VIEW_HANDLER(), m_constructionManager, m_snapGuideColor, m_snapGuideHighlightColor, m_snapLineManager, and WHITE.
| void SNAP_MANAGER::Clear | ( | ) |
Definition at line 898 of file construction_manager.cpp.
References CONSTRUCTION_VIEW_HANDLER::GetViewItem(), m_constructionManager, m_snapLineManager, KIGFX::CONSTRUCTION_GEOM::SetDimensionBrackets(), and UpdateSnapGuides().
Referenced by BOOST_AUTO_TEST_CASE().
| 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 845 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 290 of file construction_manager.h.
References m_constructionManager.
Referenced by EE_GRID_HELPER::AddConstructionItems(), PCB_GRID_HELPER::AddConstructionItems(), PCB_GRID_HELPER::nearestAnchor(), EE_GRID_HELPER::ResolveSnap(), and PCB_GRID_HELPER::ResolveSnap().
|
inline |
Definition at line 301 of file construction_manager.h.
References m_referenceOnlyPoints.
Referenced by PCB_GRID_HELPER::ResolveSnap().
|
inline |
Definition at line 287 of file construction_manager.h.
References m_snapLineManager.
Referenced by PCB_GRID_HELPER::ClearSnapFeedback(), EE_GRID_HELPER::ResolveSnap(), and PCB_GRID_HELPER::ResolveSnap().
|
inline |
Definition at line 288 of file construction_manager.h.
References m_snapLineManager.
|
inlineinherited |
Definition at line 49 of file construction_manager.h.
References m_constructionGeomPreview.
Referenced by SNAP_MANAGER::Clear(), SNAP_MANAGER::SetDimensionBrackets(), SNAP_MANAGER::UpdateSnapGuides(), and SNAP_MANAGER::updateView().
| void SNAP_MANAGER::SetDimensionBrackets | ( | std::vector< SEG > | aBrackets | ) |
Definition at line 774 of file construction_manager.cpp.
References CONSTRUCTION_VIEW_HANDLER::GetViewItem(), KIGFX::CONSTRUCTION_GEOM::SetDimensionBrackets(), and updateView().
Referenced by BOOST_AUTO_TEST_CASE(), and PCB_GRID_HELPER::ClearSnapFeedback().
|
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 296 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 785 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 285 of file construction_manager.h.
References m_updateCallback.
| void SNAP_MANAGER::UpdateSnapGuides | ( | ) |
Definition at line 793 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 Clear(), and SetSnapGuideColors().
|
overridevirtual |
Implements CONSTRUCTION_VIEW_HANDLER.
Definition at line 759 of file construction_manager.cpp.
References CONSTRUCTION_VIEW_HANDLER::GetViewItem(), KIGFX::CONSTRUCTION_GEOM::HasDimensionBrackets(), m_constructionManager, m_snapLineManager, and m_updateCallback.
Referenced by SetDimensionBrackets(), and UpdateSnapGuides().
|
privateinherited |
Definition at line 54 of file construction_manager.h.
Referenced by CONSTRUCTION_VIEW_HANDLER(), and GetViewItem().
| CONSTRUCTION_MANAGER SNAP_MANAGER::m_constructionManager |
Definition at line 323 of file construction_manager.h.
Referenced by Clear(), GetConstructionItems(), GetConstructionManager(), SNAP_MANAGER(), and updateView().
| std::vector<VECTOR2I> SNAP_MANAGER::m_referenceOnlyPoints |
Definition at line 325 of file construction_manager.h.
Referenced by GetReferenceOnlyPoints(), and SetReferenceOnlyPoints().
| KIGFX::COLOR4D SNAP_MANAGER::m_snapGuideColor |
Definition at line 326 of file construction_manager.h.
Referenced by SetSnapGuideColors(), SNAP_MANAGER(), and UpdateSnapGuides().
| KIGFX::COLOR4D SNAP_MANAGER::m_snapGuideHighlightColor |
Definition at line 327 of file construction_manager.h.
Referenced by SetSnapGuideColors(), SNAP_MANAGER(), and UpdateSnapGuides().
| SNAP_LINE_MANAGER SNAP_MANAGER::m_snapLineManager |
Definition at line 322 of file construction_manager.h.
Referenced by Clear(), GetConstructionItems(), GetSnapLineManager(), GetSnapLineManager(), SNAP_MANAGER(), UpdateSnapGuides(), and updateView().
| GFX_UPDATE_CALLBACK SNAP_MANAGER::m_updateCallback |
Definition at line 320 of file construction_manager.h.
Referenced by SetUpdateCallback(), and updateView().