|
KiCad PCB EDA Suite
|
#include <constraints/board_constraint_adapter.h>#include <algorithm>#include <iterator>#include <ranges>#include <cmath>#include <cstdint>#include <cstring>#include <functional>#include <limits>#include <set>#include <unordered_map>#include <unordered_set>#include <wx/debug.h>#include <board.h>#include <footprint.h>#include <geometry/seg.h>#include <math/util.h>#include <pad.h>#include <pcb_dimension.h>#include <pcb_shape.h>#include <constraints/constraint_builder.h>#include <GCS.h>Go to the source code of this file.
Classes | |
| struct | CONSTRAINT_GRAPH |
Functions | |
| bool | BoardHasConstraints (BOARD *aBoard) |
True if aBoard resolves at least one geometric constraint (see CollectResolvedConstraints()). | |
| std::vector< VECTOR2I > | ConstraintPinnedPositions (BOARD *aBoard, const std::set< KIID > &aItems) |
The distinct board positions that fixed positions pin on aItems. | |
| bool | ConstraintItemIsLocked (const BOARD_ITEM *aItem) |
True when the solver must treat aItem as immovable, either locked itself or living inside a locked footprint. | |
| static FOOTPRINT * | boardFootprintOf (const BOARD_ITEM *aItem) |
| static BOARD_ITEM * | resolveMember (BOARD *aBoard, const std::unordered_set< KIID > *aOnBoard, const KIID &aId) |
| static CONSTRAINT_GRAPH | buildShapeConstraintMap (BOARD *aBoard, const std::vector< PCB_CONSTRAINT * > &aConstraints, std::vector< KIID > *aErrored=nullptr, const std::unordered_set< KIID > *aOnBoard=nullptr) |
| static void | collectConstraintCluster (const CONSTRAINT_GRAPH &aGraph, const KIID &aSeed, std::unordered_set< KIID > &aClusterShapes, std::vector< PCB_CONSTRAINT * > &aClusterConstraints, std::set< KIID > *aVisited=nullptr) |
| template<typename T> | |
| static std::vector< T * > | resolveClusterItems (BOARD *aBoard, const std::unordered_set< KIID > &aIds, const std::unordered_set< KIID > *aOnBoard) |
| static std::vector< PCB_SHAPE * > | resolveClusterShapes (BOARD *aBoard, const std::unordered_set< KIID > &aIds, const std::unordered_set< KIID > *aOnBoard=nullptr) |
| static std::vector< PCB_DIMENSION_BASE * > | resolveClusterDimensions (BOARD *aBoard, const std::unordered_set< KIID > &aIds, const std::unordered_set< KIID > *aOnBoard=nullptr) |
| static std::vector< PAD * > | resolveClusterPads (BOARD *aBoard, const std::unordered_set< KIID > &aIds, const std::unordered_set< KIID > *aOnBoard=nullptr) |
| static bool | isDegenerateLine (const GCS::Line &aLine) |
| static double | directedAngleForCorner (const GCS::Line &aL1, const GCS::Line &aL2, double aCornerDeg) |
| static double | arcSweepTarget (double aStartAngle, double aEndAngle, double aSweepDeg) |
| CONSTRAINT_DIAGNOSIS | SolveCluster (BOARD *aBoard, const CONSTRAINT_MEMBER &aDragged, const VECTOR2I &aCursor, std::vector< PCB_SHAPE * > *aModified, const std::function< void(BOARD_ITEM *)> &aBeforeModify, bool aIncludeDragged, bool aStabilize, const std::set< KIID > &aEdited, const std::optional< std::pair< CONSTRAINT_MEMBER, VECTOR2I > > &aCoDragged, const std::set< KIID > &aFixedShapes, bool aHoldDraggedRigid) |
| Gather the cluster of shapes transitively constrained with the dragged shape, solve with the dragged anchor pinned to the cursor, and apply the result. | |
| std::set< KIID > | ConstraintReferenceShapes (BOARD *aBoard, const PCB_CONSTRAINT *aConstraint) |
| The shapes a just-authored constraint should treat as an immovable reference, for the caller to pass to ApplyConstraintImmediately(). | |
| CONSTRAINT_DIAGNOSIS | ApplyConstraintImmediately (BOARD *aBoard, const PCB_CONSTRAINT *aConstraint, std::vector< PCB_SHAPE * > *aModified, const std::function< void(BOARD_ITEM *)> &aBeforeModify, const std::set< KIID > &aFixedShapes) |
| Solve a just-created constraint's cluster so the geometry snaps to satisfy it (SolidWorks-style), pinning the constraint's first member at its current position and letting the solver move the rest. | |
| void | ReSolveShapeClusters (BOARD *aBoard, const std::vector< PCB_SHAPE * > &aShapes, std::vector< PCB_SHAPE * > *aModified, const std::function< void(BOARD_ITEM *)> &aBeforeModify) |
| Re-solve the clusters of shapes edited outside the solver, e.g. | |
| bool | ReSolveShapeClustersHoldingEdited (BOARD *aBoard, const std::vector< PCB_SHAPE * > &aEditedShapes, std::vector< PCB_SHAPE * > *aModified, const std::function< void(BOARD_ITEM *)> &aBeforeModify) |
| Re-solve clusters whose new geometry is authoritative holding every edited shape fully fixed so only constrained neighbors move a failed solve leaves that cluster untouched. | |
| void | ReSolveAfterShapeResize (BOARD *aBoard, PCB_SHAPE *aShape, std::vector< PCB_SHAPE * > *aModified, const std::function< void(BOARD_ITEM *)> &aBeforeModify) |
| Re-solve after a resize, e.g. a circle radius edit. Holds aShape fixed so its neighbors adjust. | |
| static CLUSTER_DIAGNOSIS | diagnoseSingleCluster (BOARD *aBoard, const std::unordered_set< KIID > &aClusterShapes, const std::vector< PCB_CONSTRAINT * > &aClusterConstraints, const std::unordered_set< KIID > &aOnBoard) |
| static void | assembleClusterInto (BOARD_CONSTRAINT_DIAGNOSTICS &aResult, const CLUSTER_DIAGNOSIS &aCluster) |
| static void | dedupErrored (BOARD_CONSTRAINT_DIAGNOSTICS &aResult) |
| BOARD_CONSTRAINT_DIAGNOSTICS | DiagnoseBoardConstraints (BOARD *aBoard) |
| Diagnose every constraint cluster on the board (validate only – geometry is not changed) and return the per-shape state plus the conflicting/redundant constraints and total free DOF, for the diagnostics overlay and info bar. | |
| static void | hashCombine (std::size_t &aSeed, std::size_t aValue) |
| static void | hashInt (std::size_t &aSeed, long long aValue) |
| static void | hashDouble (std::size_t &aSeed, double aValue) |
| static void | hashPoint (std::size_t &aSeed, const VECTOR2I &aPoint) |
| static void | hashKiid (std::size_t &aSeed, const KIID &aId) |
| static void | hashShape (std::size_t &aSeed, const PCB_SHAPE *aShape) |
| static void | hashDimension (std::size_t &aSeed, const PCB_DIMENSION_BASE *aDimension) |
| static void | hashConstraint (std::size_t &aSeed, const PCB_CONSTRAINT *aConstraint) |
| static std::size_t | hashCluster (BOARD *aBoard, const std::unordered_set< KIID > &aClusterShapes, const std::vector< PCB_CONSTRAINT * > &aClusterConstraints, const std::unordered_set< KIID > &aOnBoard) |
Variables | |
| static constexpr double | IU_PER_NORM_UNIT = 1e6 |
| static constexpr int | MAX_SOLVE_ITERATIONS = 100 |
| static constexpr double | STAY_PUT_WEIGHT = 1e-4 |
| static constexpr double | CURSOR_WEIGHT = 1e-2 |
| CONSTRAINT_DIAGNOSIS ApplyConstraintImmediately | ( | BOARD * | aBoard, |
| const PCB_CONSTRAINT * | aConstraint, | ||
| std::vector< PCB_SHAPE * > * | aModified = nullptr, | ||
| const std::function< void(BOARD_ITEM *)> & | aBeforeModify = {}, | ||
| const std::set< KIID > & | aFixedShapes = {} ) |
Solve a just-created constraint's cluster so the geometry snaps to satisfy it (SolidWorks-style), pinning the constraint's first member at its current position and letting the solver move the rest.
aConstraint must already be on the board. A failed solve leaves geometry untouched.
| aBoard | is the BOARD object to constrain. | |
| [in] | aConstraint | is the constraint to apply to aBoard. |
| [out] | aModified | are the shapes the solve moved, for the caller to stage in a commit. |
| aBeforeModify | if set, invoked with each moved shape and each reference constraint whose value changed, just before it changes, so the caller can stage it in the commit. | |
| aFixedShapes | shapes to freeze whole for this solve, for a caller that knows which member is the reference the others should move to. |
Definition at line 3868 of file board_constraint_adapter.cpp.
References ConstraintAnchorPosition(), ConstraintShapeAnchors(), PCB_CONSTRAINT::GetMembers(), pin, BOARD::ResolveItem(), SolveCluster(), and WHOLE.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), EditConstraintValue(), DIALOG_DIMENSION_PROPERTIES::resolveDrivingConstraint(), snapAutoConstraints(), CONSTRAINT_EDIT_TOOL::solveAddedConstraint(), and PCB_PROPERTIES_PANEL::valueChanged().
|
static |
Definition at line 377 of file board_constraint_adapter.cpp.
References std::abs(), and M_PI.
Referenced by BOARD_CONSTRAINT_ADAPTER::Build().
|
static |
Definition at line 4121 of file board_constraint_adapter.cpp.
References BOARD_CONSTRAINT_DIAGNOSTICS::conflicting, CLUSTER_DIAGNOSIS::conflicting, CLUSTER_DIAGNOSIS::dimensionIds, BOARD_CONSTRAINT_DIAGNOSTICS::errored, CLUSTER_DIAGNOSIS::erroredUnmapped, CLUSTER_DIAGNOSIS::freeDof, CLUSTER_DIAGNOSIS::padIds, BOARD_CONSTRAINT_DIAGNOSTICS::redundant, CLUSTER_DIAGNOSIS::redundant, CLUSTER_DIAGNOSIS::shapeIds, BOARD_CONSTRAINT_DIAGNOSTICS::shapeStates, CLUSTER_DIAGNOSIS::state, and BOARD_CONSTRAINT_DIAGNOSTICS::totalFreeDof.
Referenced by BOARD_CONSTRAINT_DIAGNOSER::Diagnose(), and DiagnoseBoardConstraints().
|
static |
Definition at line 121 of file board_constraint_adapter.cpp.
References BOARD_ITEM::GetBoard(), BOARD_ITEM::GetParentFootprint(), and BOARD::IsFootprintHolder().
Referenced by BOARD_CONSTRAINT_ADAPTER::Build(), and BOARD_CONSTRAINT_ADAPTER::coupleRigidFootprints().
| bool BoardHasConstraints | ( | BOARD * | aBoard | ) |
True if aBoard resolves at least one geometric constraint (see CollectResolvedConstraints()).
Cheap, short-circuiting guard so an unconstrained board pays nothing on every edit.
Definition at line 62 of file board_constraint_adapter.cpp.
References BOARD::Constraints(), BOARD::Footprints(), and BOARD::IsFootprintHolder().
Referenced by BLOCK_DRAG_SESSION::Begin(), BOOST_AUTO_TEST_CASE(), CONSTRAINT_EDIT_TOOL::DiagnoseAfterMove(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::Move(), CONSTRAINT_EDIT_TOOL::onHoverMotion(), CONSTRAINT_EDIT_TOOL::SolveAfterEdit(), CONSTRAINT_EDIT_TOOL::SolveAfterMove(), and PCB_POINT_EDITOR::updateItem().
|
static |
Definition at line 161 of file board_constraint_adapter.cpp.
References CONSTRAINT_GRAPH::byMember, BOARD::Footprints(), IsConstrainableItem(), BOARD::IsFootprintHolder(), pad, resolveMember(), and CONSTRAINT_GRAPH::rigidSiblings.
Referenced by BOARD_CONSTRAINT_BLOCK_SESSION::Build(), BOARD_CONSTRAINT_DRAG_SESSION::Build(), BOARD_CONSTRAINT_MOVE_SESSION::Build(), BOARD_CONSTRAINT_DIAGNOSER::Diagnose(), DiagnoseBoardConstraints(), ReSolveAfterShapeResize(), ReSolveShapeClusters(), ReSolveShapeClustersHoldingEdited(), and SolveCluster().
|
static |
Definition at line 223 of file board_constraint_adapter.cpp.
References CONSTRAINT_GRAPH::byMember, PCB_CONSTRAINT::GetMembers(), EDA_ITEM::m_Uuid, and CONSTRAINT_GRAPH::rigidSiblings.
Referenced by BOARD_CONSTRAINT_BLOCK_SESSION::Build(), BOARD_CONSTRAINT_DRAG_SESSION::Build(), BOARD_CONSTRAINT_MOVE_SESSION::Build(), BOARD_CONSTRAINT_DIAGNOSER::Diagnose(), DiagnoseBoardConstraints(), ReSolveAfterShapeResize(), ReSolveShapeClusters(), ReSolveShapeClustersHoldingEdited(), and SolveCluster().
| bool ConstraintItemIsLocked | ( | const BOARD_ITEM * | aItem | ) |
True when the solver must treat aItem as immovable, either locked itself or living inside a locked footprint.
BOARD_ITEM::IsLocked() alone misses the parent-footprint case because most edit tools filter footprint children out before their lock checks run, while the solver collects footprint graphics directly.
Definition at line 105 of file board_constraint_adapter.cpp.
References BOARD_ITEM::GetParentFootprint(), and BOARD_ITEM::IsLocked().
Referenced by BLOCK_DRAG_SESSION::Begin(), BlockDragFindDependents(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOARD_CONSTRAINT_ADAPTER::Build(), ConstraintReferenceShapes(), BOARD_CONSTRAINT_ADAPTER::coupleRigidFootprints(), hashCluster(), hashShape(), BOARD_CONSTRAINT_ADAPTER::holdFreeArcRadii(), BOARD_CONSTRAINT_ADAPTER::holdFreeSegmentLengths(), BOARD_CONSTRAINT_ADAPTER::holdPolygonVertices(), BOARD_CONSTRAINT_ADAPTER::holdShapesRigid(), BOARD_CONSTRAINT_ADAPTER::pinUncommandedCoordinates(), BOARD_CONSTRAINT_ADAPTER::pinUneditedShapes(), and BOARD_CONSTRAINT_ADAPTER::TravelsWhole().
| std::vector< VECTOR2I > ConstraintPinnedPositions | ( | BOARD * | aBoard, |
| const std::set< KIID > & | aItems ) |
The distinct board positions that fixed positions pin on aItems.
A transform of those items has to leave every one of them where it is.
Definition at line 77 of file board_constraint_adapter.cpp.
References CollectResolvedConstraints(), ConstraintAnchorPosition(), and FIXED_POSITION.
Referenced by PCB_POINT_EDITOR::OnSelectionChange().
| std::set< KIID > ConstraintReferenceShapes | ( | BOARD * | aBoard, |
| const PCB_CONSTRAINT * | aConstraint ) |
The shapes a just-authored constraint should treat as an immovable reference, for the caller to pass to ApplyConstraintImmediately().
The point-on-line and midpoint pickers always take the point first, so the line is the reference and the point is what should move. Empty for every other type, and for the cases where freezing would leave nothing able to move.
Only the interactive authoring path may pass this. The drawing tool's auto-bindings build the same types with the same member roles, so nothing here can tell them apart – they are safe only because they never call this. Do not wire it into snapAutoConstraints(): a corridor pin's line is the shape just drawn, and freezing it would drag existing board geometry instead.
Definition at line 3829 of file board_constraint_adapter.cpp.
References CollectResolvedConstraints(), ConstraintItemIsLocked(), FIXED_POSITION, PCB_CONSTRAINT::GetConstraintType(), PCB_CONSTRAINT::GetMembers(), MIDPOINT, POINT_ON_LINE, BOARD::ResolveItem(), and WHOLE.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and CONSTRAINT_EDIT_TOOL::solveAddedConstraint().
|
static |
Definition at line 4145 of file board_constraint_adapter.cpp.
References BOARD_CONSTRAINT_DIAGNOSTICS::errored.
Referenced by BOARD_CONSTRAINT_DIAGNOSER::Diagnose(), and DiagnoseBoardConstraints().
| BOARD_CONSTRAINT_DIAGNOSTICS DiagnoseBoardConstraints | ( | BOARD * | aBoard | ) |
Diagnose every constraint cluster on the board (validate only – geometry is not changed) and return the per-shape state plus the conflicting/redundant constraints and total free DOF, for the diagnostics overlay and info bar.
Definition at line 4153 of file board_constraint_adapter.cpp.
References assembleClusterInto(), buildShapeConstraintMap(), CONSTRAINT_GRAPH::byMember, collectConstraintCluster(), CollectMemberCandidateIds(), CollectResolvedConstraints(), dedupErrored(), diagnoseSingleCluster(), and result.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), DIALOG_CONSTRAINT_LIST::Populate(), and PANEL_CONSTRAINTS::RefreshList().
|
static |
Definition at line 4062 of file board_constraint_adapter.cpp.
References BOARD_CONSTRAINT_ADAPTER::Build(), CONSTRAINT_DIAGNOSIS::conflicting, BOARD_CONSTRAINT_ADAPTER::Diagnose(), CONSTRAINT_DIAGNOSIS::freeDof, CONSTRAINT_DIAGNOSIS::IsOverConstrained(), CONSTRAINT_DIAGNOSIS::IsUnderConstrained(), OVER_CONSTRAINED, pad, CONSTRAINT_DIAGNOSIS::redundant, resolveClusterDimensions(), resolveClusterPads(), resolveClusterShapes(), result, BOARD_CONSTRAINT_ADAPTER::Solve(), UNDER_CONSTRAINED, BOARD_CONSTRAINT_ADAPTER::UnmappedConstraints(), and WELL_CONSTRAINED.
Referenced by BOARD_CONSTRAINT_DIAGNOSER::Diagnose(), and DiagnoseBoardConstraints().
|
static |
Definition at line 328 of file board_constraint_adapter.cpp.
References std::abs(), M_PI, and vA.
Referenced by BOARD_CONSTRAINT_ADAPTER::Build().
|
static |
Definition at line 4353 of file board_constraint_adapter.cpp.
References ConstraintItemIsLocked(), hashConstraint(), hashDimension(), hashInt(), hashPoint(), hashShape(), pad, and resolveMember().
Referenced by BOARD_CONSTRAINT_DIAGNOSER::Diagnose().
|
static |
Definition at line 4193 of file board_constraint_adapter.cpp.
Referenced by KICAD_DIFF::PCB_DIFFER::Diff(), hashDouble(), hashInt(), and hashKiid().
|
static |
Definition at line 4332 of file board_constraint_adapter.cpp.
References PCB_CONSTRAINT::GetConstraintType(), PCB_CONSTRAINT::GetMembers(), PCB_CONSTRAINT::GetValue(), hashDouble(), hashInt(), hashKiid(), PCB_CONSTRAINT::HasValue(), PCB_CONSTRAINT::IsDriving(), and EDA_ITEM::m_Uuid.
Referenced by hashCluster().
|
static |
Definition at line 4316 of file board_constraint_adapter.cpp.
References PCB_DIMENSION_BASE::GetEnd(), PCB_DIMENSION_BASE::GetStart(), hashInt(), hashPoint(), PCB_DIM_ORTHOGONAL_T, and EDA_ITEM::Type().
Referenced by hashCluster().
|
static |
Definition at line 4205 of file board_constraint_adapter.cpp.
References hashCombine().
Referenced by hashConstraint(), and hashShape().
|
static |
Definition at line 4199 of file board_constraint_adapter.cpp.
References hashCombine().
Referenced by hashCluster(), hashConstraint(), hashDimension(), hashPoint(), and hashShape().
|
static |
Definition at line 4224 of file board_constraint_adapter.cpp.
References hashCombine().
Referenced by hashConstraint().
|
static |
Definition at line 4217 of file board_constraint_adapter.cpp.
References hashInt(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by hashCluster(), hashDimension(), and hashShape().
|
static |
Definition at line 4232 of file board_constraint_adapter.cpp.
References ARC, SHAPE_LINE_CHAIN::ArcCount(), EDA_ANGLE::AsRadians(), BEZIER, CIRCLE, ConstraintItemIsLocked(), SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), ELLIPSE, ELLIPSE_ARC, EDA_SHAPE::GetBezierC1(), EDA_SHAPE::GetBezierC2(), PCB_SHAPE::GetCenter(), EDA_SHAPE::GetEllipseCenter(), EDA_SHAPE::GetEllipseEndAngle(), EDA_SHAPE::GetEllipseMajorRadius(), EDA_SHAPE::GetEllipseMinorRadius(), EDA_SHAPE::GetEllipseRotation(), EDA_SHAPE::GetEllipseStartAngle(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetPolyShape(), EDA_SHAPE::GetRadius(), EDA_SHAPE::GetShape(), EDA_SHAPE::GetStart(), hashDouble(), hashInt(), hashPoint(), SHAPE_POLY_SET::HoleCount(), SHAPE_POLY_SET::OutlineCount(), SHAPE_LINE_CHAIN::PointCount(), POLY, RECTANGLE, and SEGMENT.
Referenced by hashCluster().
|
static |
Definition at line 322 of file board_constraint_adapter.cpp.
Referenced by BOARD_CONSTRAINT_ADAPTER::Build().
| void ReSolveAfterShapeResize | ( | BOARD * | aBoard, |
| PCB_SHAPE * | aShape, | ||
| std::vector< PCB_SHAPE * > * | aModified, | ||
| const std::function< void(BOARD_ITEM *)> & | aBeforeModify ) |
Re-solve after a resize, e.g. a circle radius edit. Holds aShape fixed so its neighbors adjust.
Definition at line 4016 of file board_constraint_adapter.cpp.
References BOARD_CONSTRAINT_ADAPTER::Apply(), BOARD_CONSTRAINT_ADAPTER::ApplyReferenceValues(), BOARD_CONSTRAINT_ADAPTER::Build(), buildShapeConstraintMap(), collectConstraintCluster(), CollectResolvedConstraints(), EDA_ITEM::m_Uuid, resolveClusterDimensions(), resolveClusterPads(), resolveClusterShapes(), and BOARD_CONSTRAINT_ADAPTER::SolveAfterResize().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PCB_POINT_EDITOR::updateItem().
|
static |
Definition at line 295 of file board_constraint_adapter.cpp.
References resolveClusterItems().
Referenced by BOARD_CONSTRAINT_SESSION::buildCluster(), diagnoseSingleCluster(), ReSolveAfterShapeResize(), ReSolveShapeClustersHoldingEdited(), and SolveCluster().
|
static |
Definition at line 273 of file board_constraint_adapter.cpp.
References resolveMember(), and T.
Referenced by resolveClusterDimensions(), resolveClusterPads(), and resolveClusterShapes().
|
static |
Definition at line 303 of file board_constraint_adapter.cpp.
References resolveClusterItems().
Referenced by BOARD_CONSTRAINT_SESSION::buildCluster(), diagnoseSingleCluster(), ReSolveAfterShapeResize(), ReSolveShapeClustersHoldingEdited(), and SolveCluster().
|
static |
Definition at line 288 of file board_constraint_adapter.cpp.
References resolveClusterItems().
Referenced by BOARD_CONSTRAINT_SESSION::buildCluster(), diagnoseSingleCluster(), ReSolveAfterShapeResize(), ReSolveShapeClustersHoldingEdited(), and SolveCluster().
|
static |
Definition at line 136 of file board_constraint_adapter.cpp.
References BOARD::ResolveItem().
Referenced by buildShapeConstraintMap(), hashCluster(), and resolveClusterItems().
| void ReSolveShapeClusters | ( | BOARD * | aBoard, |
| const std::vector< PCB_SHAPE * > & | aShapes, | ||
| std::vector< PCB_SHAPE * > * | aModified = nullptr, | ||
| const std::function< void(BOARD_ITEM *)> & | aBeforeModify = {} ) |
Re-solve the clusters of shapes edited outside the solver, e.g.
a whole-shape move. Pins one anchor of each edited shape at its new position. A failed solve leaves geometry untouched.
Definition at line 3910 of file board_constraint_adapter.cpp.
References buildShapeConstraintMap(), collectConstraintCluster(), CollectResolvedConstraints(), ConstraintShapeAnchors(), and SolveCluster().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), and CONSTRAINT_EDIT_TOOL::SolveAfterMove().
| bool ReSolveShapeClustersHoldingEdited | ( | BOARD * | aBoard, |
| const std::vector< PCB_SHAPE * > & | aEditedShapes, | ||
| std::vector< PCB_SHAPE * > * | aModified, | ||
| const std::function< void(BOARD_ITEM *)> & | aBeforeModify ) |
Re-solve clusters whose new geometry is authoritative holding every edited shape fully fixed so only constrained neighbors move a failed solve leaves that cluster untouched.
Definition at line 3952 of file board_constraint_adapter.cpp.
References buildShapeConstraintMap(), collectConstraintCluster(), CollectResolvedConstraints(), resolveClusterDimensions(), resolveClusterPads(), and resolveClusterShapes().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), EDIT_TOOL::doMoveSelection(), CONSTRAINT_EDIT_TOOL::SolveAfterEdit(), and PCB_POINT_EDITOR::updateItem().
| CONSTRAINT_DIAGNOSIS SolveCluster | ( | BOARD * | aBoard, |
| const CONSTRAINT_MEMBER & | aDragged, | ||
| const VECTOR2I & | aCursor, | ||
| std::vector< PCB_SHAPE * > * | aModified = nullptr, | ||
| const std::function< void(BOARD_ITEM *)> & | aBeforeModify = {}, | ||
| bool | aIncludeDragged = false, | ||
| bool | aStabilize = false, | ||
| const std::set< KIID > & | aEdited = {}, | ||
| const std::optional< std::pair< CONSTRAINT_MEMBER, VECTOR2I > > & | aCoDragged = std::nullopt, | ||
| const std::set< KIID > & | aFixedShapes = {}, | ||
| bool | aHoldDraggedRigid = false ) |
Gather the cluster of shapes transitively constrained with the dragged shape, solve with the dragged anchor pinned to the cursor, and apply the result.
Kept free-standing so the interactive drag hook stays thin and this logic is headless-testable.
| aBoard | the board (or footprint-holder board) owning the constraints. | |
| aDragged | the anchor being dragged. | |
| aCursor | the cursor target, in IU. | |
| [out] | aModified | the neighbor shapes whose geometry the solve changed (excludes the dragged shape itself), for the caller to stage in a commit. |
| aBeforeModify | if set, invoked with each item (neighbor shape or reference constraint whose measured value changed) immediately before it is modified, so the caller can BOARD_COMMIT::Modify it for a clean undo. The dragged shape is excluded unless aIncludeDragged, since the caller stages it itself. | |
| aIncludeDragged | if true, the dragged shape is also reported in aModified and passed to aBeforeModify – for callers (e.g. solve-on-create) that pin where the shape already is and do not stage it themselves. | |
| aStabilize | is? | |
| aEdited | other shapes in this cluster edited alongside the dragged one left free instead of stay-pinned back. | |
| aCoDragged | second anchor moved by the same handle with its own target for a polygon edge drag pinned at the same weight as the primary. | |
| aFixedShapes | shapes to freeze whole, so the solve moves the rest of the cluster around them | |
| aHoldDraggedRigid | holds the dragged shape's geometry, so it travels whole instead of stretching to meet the relation. |
Definition at line 3765 of file board_constraint_adapter.cpp.
References BOARD_CONSTRAINT_ADAPTER::Apply(), BOARD_CONSTRAINT_ADAPTER::ApplyReferenceValues(), BOARD_CONSTRAINT_ADAPTER::Build(), buildShapeConstraintMap(), collectConstraintCluster(), CollectResolvedConstraints(), BOARD_CONSTRAINT_ADAPTER::Diagnose(), CONSTRAINT_MEMBER::m_item, resolveClusterDimensions(), resolveClusterPads(), resolveClusterShapes(), BOARD::ResolveItem(), BOARD_CONSTRAINT_ADAPTER::Solve(), and CONSTRAINT_DIAGNOSIS::solved.
Referenced by ApplyConstraintImmediately(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_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(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), ReSolveShapeClusters(), and PCB_POINT_EDITOR::updateItem().
|
staticconstexpr |
Definition at line 59 of file board_constraint_adapter.cpp.
Referenced by BOARD_CONSTRAINT_ADAPTER::SolveRigidSnapRelations(), and BOARD_CONSTRAINT_ADAPTER::SolveSnapRelations().
|
staticconstexpr |
Definition at line 51 of file board_constraint_adapter.cpp.
Referenced by BOARD_CONSTRAINT_ADAPTER::Build().
|
staticconstexpr |
Definition at line 54 of file board_constraint_adapter.cpp.
Referenced by BOARD_CONSTRAINT_ADAPTER::Build().
|
staticconstexpr |
Definition at line 58 of file board_constraint_adapter.cpp.
Referenced by BOARD_CONSTRAINT_ADAPTER::holdPolygonVertices(), BOARD_CONSTRAINT_ADAPTER::pinUncommandedCoordinates(), and BOARD_CONSTRAINT_ADAPTER::pinUneditedShapes().