|
KiCad PCB EDA Suite
|
#include <board_constraint_adapter.h>
Public Member Functions | |
| bool | Build (BOARD *aBoard, const std::vector< PCB_SHAPE * > &aEditedShapes, const VECTOR2I &aReference) |
| SNAP_RESULT | ResolveCandidates (const SNAP_SOURCE_CONTEXT &aContext, const std::vector< SNAP_CANDIDATE > &aCandidates) |
| bool | Solve (const VECTOR2I &aTarget, std::vector< PCB_SHAPE * > *aModified, const std::function< void(BOARD_ITEM *)> &aBeforeModify) |
| bool | HasBaseConflict () const |
Protected Member Functions | |
| bool | buildCluster (BOARD *aBoard, const std::unordered_set< KIID > &aClusterShapes, const std::vector< PCB_CONSTRAINT * > &aConstraints) |
| Assemble the adapter for one cluster and record its baseline. | |
| void | reset () |
| Drop the built cluster, leaving the session unusable until the next successful build. | |
| bool | usable () const |
| bool | rewind () |
| Rewind to the state the next speculative solve starts from. | |
| SNAP_RESULT | startResult (const SNAP_SOURCE_CONTEXT &aContext) const |
| Seed a snap result at the cursor, rejecting a cluster that was already broken. | |
Static Protected Member Functions | |
| static void | accept (SNAP_RESULT &aResult, const SNAP_CANDIDATE &aCandidate, double aResidual) |
| Record one candidate the session honoured. | |
Protected Attributes | |
| BOARD * | m_board = nullptr |
| std::unique_ptr< BOARD_CONSTRAINT_ADAPTER > | m_adapter |
| BOARD_CONSTRAINT_ADAPTER::SNAPSHOT | m_baseline |
| bool | m_baseConflict = false |
Private Member Functions | |
| bool | feasibleAt (const VECTOR2I &aTarget) |
Private Attributes | |
| VECTOR2I | m_reference |
| std::set< KIID > | m_edited |
Definition at line 454 of file board_constraint_adapter.h.
|
staticprotectedinherited |
Record one candidate the session honoured.
Only the residual and the freedom consumed belong here. SNAP_RESOLVER appends the id and the guides to whatever a feasibility callback returns, so reporting them again would draw every guide twice and enter the id in the sticky set twice.
Definition at line 2871 of file board_constraint_adapter.cpp.
References SNAP_CANDIDATE::consumedDof, SNAP_RESULT::quantizedResiduals, and SNAP_RESULT::remainingDof.
Referenced by BOARD_CONSTRAINT_DRAG_SESSION::ResolveCandidates(), and BOARD_CONSTRAINT_MOVE_SESSION::ResolveCandidates().
| bool BOARD_CONSTRAINT_MOVE_SESSION::Build | ( | BOARD * | aBoard, |
| const std::vector< PCB_SHAPE * > & | aEditedShapes, | ||
| const VECTOR2I & | aReference ) |
Definition at line 2879 of file board_constraint_adapter.cpp.
References BOARD_CONSTRAINT_SESSION::buildCluster(), buildShapeConstraintMap(), collectAllConstraints(), collectConstraintCluster(), m_edited, m_reference, and BOARD_CONSTRAINT_SESSION::reset().
Referenced by BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), and BOOST_FIXTURE_TEST_CASE().
|
protectedinherited |
Assemble the adapter for one cluster and record its baseline.
Sets the base-conflict flag when the cluster's relations were already unsatisfied, which every solve then refuses rather than trying to repair an edit the user did not make.
Definition at line 2832 of file board_constraint_adapter.cpp.
References m_adapter, m_baseConflict, m_baseline, m_board, reset(), resolveClusterDimensions(), and resolveClusterShapes().
Referenced by BOARD_CONSTRAINT_DRAG_SESSION::Build(), and BOARD_CONSTRAINT_MOVE_SESSION::Build().
|
private |
Definition at line 2928 of file board_constraint_adapter.cpp.
References BOARD_CONSTRAINT_SESSION::m_adapter, m_edited, m_reference, BOARD_CONSTRAINT_SESSION::rewind(), and BOARD_CONSTRAINT_SESSION::usable().
Referenced by ResolveCandidates().
|
inlineinherited |
Definition at line 394 of file board_constraint_adapter.h.
References m_baseConflict.
Referenced by BOOST_FIXTURE_TEST_CASE(), and BOARD_CONSTRAINT_MOVE_SESSION::Solve().
|
protectedinherited |
Drop the built cluster, leaving the session unusable until the next successful build.
Definition at line 2824 of file board_constraint_adapter.cpp.
References m_adapter, m_baseConflict, and m_baseline.
Referenced by BOARD_CONSTRAINT_DRAG_SESSION::Build(), BOARD_CONSTRAINT_MOVE_SESSION::Build(), and buildCluster().
| SNAP_RESULT BOARD_CONSTRAINT_MOVE_SESSION::ResolveCandidates | ( | const SNAP_SOURCE_CONTEXT & | aContext, |
| const std::vector< SNAP_CANDIDATE > & | aCandidates ) |
Definition at line 2939 of file board_constraint_adapter.cpp.
References BOARD_CONSTRAINT_SESSION::accept(), SNAP_RESULT::Accepted(), SNAP_RESOLVER::AddCandidate(), feasibleAt(), INCOMPATIBLE, BOARD_CONSTRAINT_SESSION::m_adapter, m_edited, m_reference, SNAP_RESULT::position, SNAP_RESOLVER::Resolve(), result, BOARD_CONSTRAINT_SESSION::rewind(), SNAP_SOURCE_CONTEXT::sourcePoint, BOARD_CONSTRAINT_SESSION::startResult(), and SUCCESS.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), and BOOST_FIXTURE_TEST_CASE().
|
inlineprotectedinherited |
Rewind to the state the next speculative solve starts from.
Definition at line 412 of file board_constraint_adapter.h.
References m_adapter, and m_baseline.
Referenced by BOARD_CONSTRAINT_MOVE_SESSION::feasibleAt(), BOARD_CONSTRAINT_DRAG_SESSION::IsExactFeasible(), BOARD_CONSTRAINT_DRAG_SESSION::ResolveCandidates(), BOARD_CONSTRAINT_MOVE_SESSION::ResolveCandidates(), BOARD_CONSTRAINT_DRAG_SESSION::Solve(), and BOARD_CONSTRAINT_MOVE_SESSION::Solve().
| bool BOARD_CONSTRAINT_MOVE_SESSION::Solve | ( | const VECTOR2I & | aTarget, |
| std::vector< PCB_SHAPE * > * | aModified, | ||
| const std::function< void(BOARD_ITEM *)> & | aBeforeModify ) |
Definition at line 3002 of file board_constraint_adapter.cpp.
References BOARD_CONSTRAINT_SESSION::HasBaseConflict(), BOARD_CONSTRAINT_SESSION::m_adapter, m_edited, m_reference, and BOARD_CONSTRAINT_SESSION::rewind().
Referenced by BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), and BOOST_FIXTURE_TEST_CASE().
|
protectedinherited |
Seed a snap result at the cursor, rejecting a cluster that was already broken.
Definition at line 2857 of file board_constraint_adapter.cpp.
References BASE_CONFLICT, INCOMPATIBLE, m_adapter, m_baseConflict, result, and SNAP_SOURCE_CONTEXT::sourcePoint.
Referenced by BOARD_CONSTRAINT_DRAG_SESSION::ResolveCandidates(), and BOARD_CONSTRAINT_MOVE_SESSION::ResolveCandidates().
|
inlineprotectedinherited |
Definition at line 409 of file board_constraint_adapter.h.
References m_adapter, and m_baseConflict.
Referenced by BOARD_CONSTRAINT_MOVE_SESSION::feasibleAt(), and BOARD_CONSTRAINT_DRAG_SESSION::IsExactFeasible().
|
protectedinherited |
Definition at line 427 of file board_constraint_adapter.h.
Referenced by buildCluster(), BOARD_CONSTRAINT_MOVE_SESSION::feasibleAt(), BOARD_CONSTRAINT_DRAG_SESSION::IsExactFeasible(), BOARD_CONSTRAINT_DRAG_SESSION::Matches(), reset(), BOARD_CONSTRAINT_DRAG_SESSION::ResolveCandidates(), BOARD_CONSTRAINT_MOVE_SESSION::ResolveCandidates(), rewind(), BOARD_CONSTRAINT_DRAG_SESSION::Solve(), BOARD_CONSTRAINT_MOVE_SESSION::Solve(), startResult(), and usable().
|
protectedinherited |
Definition at line 429 of file board_constraint_adapter.h.
Referenced by buildCluster(), HasBaseConflict(), reset(), BOARD_CONSTRAINT_DRAG_SESSION::Solve(), startResult(), and usable().
|
protectedinherited |
Definition at line 428 of file board_constraint_adapter.h.
Referenced by buildCluster(), reset(), rewind(), and BOARD_CONSTRAINT_DRAG_SESSION::Solve().
|
protectedinherited |
Definition at line 426 of file board_constraint_adapter.h.
Referenced by BOARD_CONSTRAINT_DRAG_SESSION::Build(), and buildCluster().
|
private |
Definition at line 468 of file board_constraint_adapter.h.
Referenced by Build(), feasibleAt(), ResolveCandidates(), and Solve().
|
private |
Definition at line 467 of file board_constraint_adapter.h.
Referenced by Build(), feasibleAt(), ResolveCandidates(), and Solve().