|
KiCad PCB EDA Suite
|
#include <construction_manager.h>
Public Member Functions | |
| SNAP_LINE_MANAGER (CONSTRUCTION_VIEW_HANDLER &aViewHandler) | |
| void | SetSnapLineOrigin (const VECTOR2I &aOrigin) |
| The snap point is a special point that is located at the last point the cursor snapped to. | |
| void | SetSnapLineEnd (const OPT_VECTOR2I &aSnapPoint) |
| Set the end point of the snap line. | |
| void | ClearSnapLine () |
| Clear the snap line origin and end points. | |
| const OPT_VECTOR2I & | GetSnapLineOrigin () const |
| bool | HasCompleteSnapLine () const |
| void | SetSnappedAnchor (const VECTOR2I &aAnchorPos) |
| Inform this manager that an anchor snap has been made. | |
| OPT_VECTOR2I | GetNearestSnapLinePoint (const VECTOR2I &aCursor, const VECTOR2I &aNearestGrid, std::optional< int > aDistToNearest, int snapRange, const VECTOR2D &aGridSize=VECTOR2D(0, 0), const VECTOR2I &aGridOrigin=VECTOR2I(0, 0)) const |
| If the snap line is active, return the best snap point that is closest to the cursor. | |
| void | SetDirections (const std::vector< VECTOR2I > &aDirections) |
| const std::vector< VECTOR2I > & | GetDirections () const |
| std::optional< int > | GetActiveDirection () const |
Private Member Functions | |
| void | notifyGuideChange () |
Private Attributes | |
| OPT_VECTOR2I | m_snapLineOrigin |
| OPT_VECTOR2I | m_snapLineEnd |
| std::vector< VECTOR2I > | m_directions |
| std::optional< int > | m_activeDirection |
| CONSTRUCTION_VIEW_HANDLER & | m_viewHandler |
| SNAP_MANAGER * | m_snapManager |
Definition at line 71 of file construction_manager.h.
| SNAP_LINE_MANAGER::SNAP_LINE_MANAGER | ( | CONSTRUCTION_VIEW_HANDLER & | aViewHandler | ) |
Definition at line 398 of file construction_manager.cpp.
References m_snapManager, m_viewHandler, and SetDirections().
| void SNAP_LINE_MANAGER::ClearSnapLine | ( | ) |
Clear the snap line origin and end points.
Definition at line 528 of file construction_manager.cpp.
References m_activeDirection, m_snapLineEnd, m_snapLineOrigin, m_viewHandler, and notifyGuideChange().
Referenced by SetDirections().
|
inline |
Definition at line 134 of file construction_manager.h.
References m_activeDirection.
Referenced by GRID_HELPER::SnapToConstructionLines().
|
inline |
Definition at line 132 of file construction_manager.h.
References m_directions.
Referenced by GRID_HELPER::SnapToConstructionLines().
| OPT_VECTOR2I SNAP_LINE_MANAGER::GetNearestSnapLinePoint | ( | const VECTOR2I & | aCursor, |
| const VECTOR2I & | aNearestGrid, | ||
| std::optional< int > | aDistToNearest, | ||
| int | snapRange, | ||
| const VECTOR2D & | aGridSize = VECTOR2D( 0, 0 ), | ||
| const VECTOR2I & | aGridOrigin = VECTOR2I( 0, 0 ) ) const |
If the snap line is active, return the best snap point that is closest to the cursor.
If there's no active snap line, return std::nullopt.
If there's a snap very near, use that otherwise, use the grid point. With this point, snap to it on an H/V axis.
Then, if there's a grid point near, snap to it on an H/V axis.
| aCursor | The cursor position. |
| aNearestGrid | The nearest grid point to the cursor. |
| aDistToNearest | The distance to the nearest non-grid snap point, if any. |
| snapRange | The snap range. |
| aGridSize | The grid size (for snapping to grid intersections). |
| aGridOrigin | The grid origin (for snapping to grid intersections). |
Definition at line 561 of file construction_manager.cpp.
References std::abs(), EDA_ANGLE::AsDegrees(), cursor, DEGREES_T, delta, VECTOR2< T >::Dot(), VECTOR2< T >::EuclideanNorm(), KiROUND(), m_directions, m_snapLineOrigin, traceSnap, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by PCB_GRID_HELPER::BestSnapAnchor().
|
inline |
Definition at line 97 of file construction_manager.h.
References m_snapLineOrigin.
Referenced by GRID_HELPER::SnapToConstructionLines().
|
inline |
Definition at line 99 of file construction_manager.h.
References m_snapLineEnd, and m_snapLineOrigin.
|
private |
Definition at line 824 of file construction_manager.cpp.
References m_snapManager.
Referenced by ClearSnapLine(), SetDirections(), SetSnapLineEnd(), and SetSnapLineOrigin().
| void SNAP_LINE_MANAGER::SetDirections | ( | const std::vector< VECTOR2I > & | aDirections | ) |
Definition at line 450 of file construction_manager.cpp.
References ClearSnapLine(), findDirectionIndex(), m_activeDirection, m_directions, m_snapLineEnd, m_snapLineOrigin, normalizeDirection(), notifyGuideChange(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by SNAP_LINE_MANAGER().
| void SNAP_LINE_MANAGER::SetSnapLineEnd | ( | const OPT_VECTOR2I & | aSnapPoint | ) |
Set the end point of the snap line.
Passing std::nullopt will unset the end point, but keep the origin.
Definition at line 507 of file construction_manager.cpp.
References findDirectionIndex(), m_activeDirection, m_directions, m_snapLineEnd, m_snapLineOrigin, m_viewHandler, and notifyGuideChange().
Referenced by EE_GRID_HELPER::BestSnapAnchor(), PCB_GRID_HELPER::BestSnapAnchor(), and SetSnappedAnchor().
| void SNAP_LINE_MANAGER::SetSnapLineOrigin | ( | const VECTOR2I & | aOrigin | ) |
The snap point is a special point that is located at the last point the cursor snapped to.
If it is set, the construction manager may add extra construction geometry to the helper extending from the snap point origin to the cursor, which is the 'snap line'.
Definition at line 491 of file construction_manager.cpp.
References m_activeDirection, m_snapLineEnd, m_snapLineOrigin, m_viewHandler, and notifyGuideChange().
Referenced by EE_GRID_HELPER::BestSnapAnchor(), PCB_GRID_HELPER::BestSnapAnchor(), and SetSnappedAnchor().
| void SNAP_LINE_MANAGER::SetSnappedAnchor | ( | const VECTOR2I & | aAnchorPos | ) |
Inform this manager that an anchor snap has been made.
This will also update the start or end of the snap line as appropriate.
Definition at line 538 of file construction_manager.cpp.
References findDirectionIndex(), m_directions, m_snapLineOrigin, SetSnapLineEnd(), and SetSnapLineOrigin().
Referenced by PCB_GRID_HELPER::BestSnapAnchor().
|
private |
Definition at line 143 of file construction_manager.h.
Referenced by ClearSnapLine(), GetActiveDirection(), SetDirections(), SetSnapLineEnd(), and SetSnapLineOrigin().
|
private |
Definition at line 142 of file construction_manager.h.
Referenced by GetDirections(), GetNearestSnapLinePoint(), SetDirections(), SetSnapLineEnd(), and SetSnappedAnchor().
|
private |
Definition at line 140 of file construction_manager.h.
Referenced by ClearSnapLine(), HasCompleteSnapLine(), SetDirections(), SetSnapLineEnd(), and SetSnapLineOrigin().
|
private |
Definition at line 139 of file construction_manager.h.
Referenced by ClearSnapLine(), GetNearestSnapLinePoint(), GetSnapLineOrigin(), HasCompleteSnapLine(), SetDirections(), SetSnapLineEnd(), SetSnapLineOrigin(), and SetSnappedAnchor().
|
private |
Definition at line 147 of file construction_manager.h.
Referenced by notifyGuideChange(), and SNAP_LINE_MANAGER().
|
private |
Definition at line 146 of file construction_manager.h.
Referenced by ClearSnapLine(), SetSnapLineEnd(), SetSnapLineOrigin(), and SNAP_LINE_MANAGER().