|
KiCad PCB EDA Suite
|
EDIT_CONSTRAINT for polygon line dragging. More...
#include <edit_constraints.h>
Public Member Functions | |
| EC_CONVERGING (EDIT_LINE &aLine, EDIT_POINTS &aPoints, POLYGON_LINE_MODE aMode=POLYGON_LINE_MODE::CONVERGING) | |
| virtual | ~EC_CONVERGING () |
| virtual void | Apply (EDIT_LINE &aHandle, const GRID_HELPER &aGrid) override |
| Correct coordinates of the constrained edit handle. | |
| POLYGON_LINE_MODE | GetMode () const |
| Get the current constraint mode. | |
| void | SetMode (POLYGON_LINE_MODE aMode) |
| Set the constraint mode (allows switching between converging and fixed-length) | |
| void | Apply (const GRID_HELPER &aGrid) |
| Correct coordinates of the constrained edit handle. | |
Protected Attributes | |
| EDIT_LINE & | m_constrained |
| Point that is constrained by rules implemented by Apply(). | |
Private Member Functions | |
| void | applyConverging (EDIT_LINE &aHandle) |
| Apply converging mode: find intersections with adjacent lines. | |
| void | applyFixedLength (EDIT_LINE &aHandle) |
| Apply fixed-length mode: maintain line length, adjust adjacent line angles. | |
Private Attributes | |
| POLYGON_LINE_MODE | m_mode |
| Constraint mode. | |
| std::unique_ptr< EDIT_CONSTRAINT< EDIT_POINT > > | m_originSideConstraint |
| Constraint for origin side segment. | |
| std::unique_ptr< EDIT_CONSTRAINT< EDIT_POINT > > | m_endSideConstraint |
| Constraint for end side segment. | |
| EDIT_CONSTRAINT< EDIT_POINT > * | m_colinearConstraint |
| Additional constraint, applied when at least two points are collinear. | |
| EDIT_POINTS & | m_editPoints |
| EDIT_POINTS instance that stores currently modified lines. | |
| VECTOR2I | m_draggedVector |
| Vector that represents the initial direction of the dragged segment. | |
| VECTOR2I | m_originalCenter |
| Original center position of the line. | |
| VECTOR2I | m_perpVector |
| Perpendicular direction to the dragged segment (for constraining movement) | |
| double | m_halfLength |
| Original half-length of the line (for fixed-length mode) | |
| bool | m_originCollinear |
| Flags to indicate when dragged and neighbouring lines are (almost) collinear. | |
| bool | m_endCollinear |
| EDIT_POINT * | m_prevOrigin |
| Previous and next points to keep drag endpoints fixed. | |
| EDIT_POINT * | m_nextEnd |
| VECTOR2I | m_convergencePoint |
| Original convergence point of adjacent segments. | |
| VECTOR2I | m_midVector |
| Vector from the convergence point to the mid-line point. | |
EDIT_CONSTRAINT for polygon line dragging.
The line center moves perpendicular to the line itself. Two modes control what happens to the line length:
Definition at line 252 of file edit_constraints.h.
| EC_CONVERGING::EC_CONVERGING | ( | EDIT_LINE & | aLine, |
| EDIT_POINTS & | aPoints, | ||
| POLYGON_LINE_MODE | aMode = POLYGON_LINE_MODE::CONVERGING ) |
Definition at line 148 of file edit_constraints.cpp.
References SEG::Angle(), EDA_ANGLE::AsDegrees(), EDIT_CONSTRAINT< EDIT_LINE >::EDIT_CONSTRAINT(), end, EDIT_LINE::GetEnd(), EDIT_LINE::GetOrigin(), EDIT_LINE::GetPosition(), EDIT_POINT::GetPosition(), intersect(), SEG::IntersectLines(), m_colinearConstraint, m_convergencePoint, m_draggedVector, m_editPoints, m_endCollinear, m_endSideConstraint, m_halfLength, m_midVector, m_mode, m_nextEnd, m_originalCenter, m_originCollinear, m_originSideConstraint, m_perpVector, and m_prevOrigin.
|
virtual |
Definition at line 198 of file edit_constraints.cpp.
|
overridevirtual |
Correct coordinates of the constrained edit handle.
Implements EDIT_CONSTRAINT< EDIT_LINE >.
Definition at line 204 of file edit_constraints.cpp.
References applyConverging(), applyFixedLength(), CONVERGING, VECTOR2< T >::Dot(), FIXED_LENGTH, EDIT_LINE::GetPosition(), intersect(), SEG::IntersectLines(), m_convergencePoint, m_draggedVector, m_mode, m_originalCenter, m_perpVector, and EDIT_LINE::SetPosition().
|
inlineinherited |
Correct coordinates of the constrained edit handle.
Definition at line 93 of file edit_constraints.h.
|
private |
Apply converging mode: find intersections with adjacent lines.
Definition at line 245 of file edit_constraints.cpp.
References end, EDIT_LINE::GetEnd(), EC_LINE::GetLineVector(), EDIT_LINE::GetOrigin(), EDIT_LINE::GetPosition(), EDIT_POINT::GetPosition(), SEG::Intersect(), SEG::IntersectLines(), m_colinearConstraint, m_draggedVector, m_editPoints, m_endCollinear, m_endSideConstraint, m_nextEnd, m_originCollinear, m_originSideConstraint, m_prevOrigin, and EDIT_POINT::SetPosition().
Referenced by Apply().
|
private |
Apply fixed-length mode: maintain line length, adjust adjacent line angles.
Definition at line 303 of file edit_constraints.cpp.
References end, VECTOR2< T >::EuclideanNorm(), EDIT_LINE::GetEnd(), EDIT_LINE::GetOrigin(), EDIT_LINE::GetPosition(), KiROUND(), m_draggedVector, m_halfLength, and EDIT_POINT::SetPosition().
Referenced by Apply().
|
inline |
Get the current constraint mode.
Definition at line 264 of file edit_constraints.h.
References m_mode.
Referenced by PCB_POINT_EDITOR::OnSelectionChange().
|
inline |
Set the constraint mode (allows switching between converging and fixed-length)
Definition at line 267 of file edit_constraints.h.
References m_mode.
Referenced by PCB_POINT_EDITOR::OnSelectionChange(), and PCB_POINT_EDITOR::setAltConstraint().
|
private |
Additional constraint, applied when at least two points are collinear.
It is a pointer to m_[origin/end]SideConstraint, so it should not be freed.
Definition at line 287 of file edit_constraints.h.
Referenced by applyConverging(), and EC_CONVERGING().
|
protectedinherited |
Point that is constrained by rules implemented by Apply().
Definition at line 99 of file edit_constraints.h.
|
private |
Original convergence point of adjacent segments.
Definition at line 313 of file edit_constraints.h.
Referenced by Apply(), and EC_CONVERGING().
|
private |
Vector that represents the initial direction of the dragged segment.
Definition at line 293 of file edit_constraints.h.
Referenced by Apply(), applyConverging(), applyFixedLength(), and EC_CONVERGING().
|
private |
EDIT_POINTS instance that stores currently modified lines.
Definition at line 290 of file edit_constraints.h.
Referenced by applyConverging(), and EC_CONVERGING().
|
private |
Definition at line 306 of file edit_constraints.h.
Referenced by applyConverging(), and EC_CONVERGING().
|
private |
Constraint for end side segment.
Definition at line 283 of file edit_constraints.h.
Referenced by applyConverging(), and EC_CONVERGING().
|
private |
Original half-length of the line (for fixed-length mode)
Definition at line 302 of file edit_constraints.h.
Referenced by applyFixedLength(), and EC_CONVERGING().
|
private |
Vector from the convergence point to the mid-line point.
Definition at line 316 of file edit_constraints.h.
Referenced by EC_CONVERGING().
|
private |
Constraint mode.
Definition at line 277 of file edit_constraints.h.
Referenced by Apply(), EC_CONVERGING(), GetMode(), and SetMode().
|
private |
Definition at line 310 of file edit_constraints.h.
Referenced by applyConverging(), and EC_CONVERGING().
|
private |
Original center position of the line.
Definition at line 296 of file edit_constraints.h.
Referenced by Apply(), and EC_CONVERGING().
|
private |
Flags to indicate when dragged and neighbouring lines are (almost) collinear.
Definition at line 305 of file edit_constraints.h.
Referenced by applyConverging(), and EC_CONVERGING().
|
private |
Constraint for origin side segment.
Definition at line 280 of file edit_constraints.h.
Referenced by applyConverging(), and EC_CONVERGING().
|
private |
Perpendicular direction to the dragged segment (for constraining movement)
Definition at line 299 of file edit_constraints.h.
Referenced by Apply(), and EC_CONVERGING().
|
private |
Previous and next points to keep drag endpoints fixed.
Definition at line 309 of file edit_constraints.h.
Referenced by applyConverging(), and EC_CONVERGING().