43constexpr int MM = 1000000;
54 return { aKind, targetId( aName ) };
62 KI_TEST::DUMMY_TOOL* tool;
65 tool( new KI_TEST::DUMMY_TOOL() )
67 mgr.SetEnvironment( &board,
nullptr,
nullptr,
nullptr,
nullptr );
68 mgr.RegisterTool( tool );
106 PCB_SHAPE*
addPoly(
const std::vector<VECTOR2I>& aPoints )
114 PCB_CONSTRAINT* addCoincident( PCB_SHAPE* aA,
CONSTRAINT_ANCHOR aAnchorA, PCB_SHAPE* aB,
130 std::vector<PCB_SHAPE*>* aModified )
137 aShape->
SetEnd( aCursor );
144 aCommit.
Modify( aNeighbor );
163 const VECTOR2I bStart0 = b->GetStart();
165 std::vector<PCB_SHAPE*> modified;
171 BOOST_CHECK_LE( ( a->
GetEnd() - b->GetStart() ).EuclideanNorm(), 100 );
172 BOOST_CHECK( std::find( modified.begin(), modified.end(), b ) != modified.end() );
173 BOOST_CHECK( a->
GetEnd() != aEnd0 );
190 std::vector<PCB_SHAPE*> modified;
193 const VECTOR2I originalBStart = b->GetStart();
196 BOOST_CHECK( session.
Matches( dragged ) );
200 { 12 *
MM, 2 *
MM }, &modified,
207 BOOST_CHECK_LE( ( a->
GetEnd() - b->GetStart() ).EuclideanNorm(), 100 );
210 { 14 *
MM, 4 *
MM }, &modified,
217 BOOST_CHECK_LE( ( a->
GetEnd() - b->GetStart() ).EuclideanNorm(), 100 );
232 length->SetValue( 10.0 *
MM );
250 length->SetValue( 10.0 *
MM );
255 board.
Add( horizontal );
269 BOOST_REQUIRE_EQUAL(
result.quantizedResiduals.size(), 1 );
294 BOOST_REQUIRE_EQUAL(
result.quantizedResiduals.size(), 1 );
300 std::vector<PCB_SHAPE*> modified;
313 ellipse->SetEllipseCenter( { 30 *
MM, 0 } );
314 ellipse->SetEllipseMajorRadius( 6 *
MM );
315 ellipse->SetEllipseMinorRadius( 3 *
MM );
316 board.
Add( ellipse );
318 const int circleRadius =
circle->GetRadius();
319 const int arcRadius = arc->GetRadius();
320 const int ellipseMinorRadius = ellipse->GetEllipseMinorRadius();
325 adapter.
SolveRigidTranslation( { circle->m_Uuid, arc->m_Uuid, ellipse->m_Uuid }, { 3 * MM, 2 * MM } ) );
352 locked->SetLocked(
true );
373 locked->SetLocked(
true );
376 auto session = std::make_shared<BOARD_CONSTRAINT_MOVE_SESSION>();
377 BOOST_REQUIRE( session->Build( &board, { moved }, { 0, 0 } ) );
385 [session](
const SNAP_SOURCE_CONTEXT& aContext,
const std::vector<SNAP_CANDIDATE>& aCandidates )
387 return session->ResolveCandidates( aContext, aCandidates );
397 BOOST_CHECK( !
result.Accepted( objectId ) );
398 BOOST_CHECK(
result.Accepted( gridId ) );
409 auto session = std::make_shared<BOARD_CONSTRAINT_MOVE_SESSION>();
410 BOOST_REQUIRE( session->Build( &board, { moved }, { 0, 0 } ) );
421 [session](
const SNAP_SOURCE_CONTEXT& aContext,
const std::vector<SNAP_CANDIDATE>& aCandidates )
423 return session->ResolveCandidates( aContext, aCandidates );
454 { 0.0, 40.0 *
MM }, 0.0 );
462 BOOST_REQUIRE_EQUAL(
result.quantizedResiduals.size(), 1 );
476 secondGuide->SetLocked(
true );
481 board.
Add( firstOnLine );
486 board.
Add( secondOnLine );
506 board.
Add( horizontal );
515 { 0.0, 40.0 *
MM }, 0.0 );
536 length->SetValue( 10.0 *
MM );
545 BOOST_CHECK( !diagnosis.
solved );
569 board.
Add( horizontal );
575 std::vector<PCB_SHAPE*> modified;
602 std::vector<PCB_SHAPE*> modified;
604 BOOST_CHECK( !session.
Solve( { 5 * MM, 5 * MM }, &modified, {} ) );
629 BOOST_CHECK( diagnosis.
solved );
631 BOOST_CHECK_LE( (
right->GetStart() -
VECTOR2I( 12 *
MM, 3 *
MM ) ).EuclideanNorm(), 1000 );
632 BOOST_CHECK_LE( ( bottom->
GetEnd() -
right->GetStart() ).EuclideanNorm(), 1000 );
677 std::vector<PCB_SHAPE*>
moved;
682 BOOST_CHECK_LE( ( bottom->
GetEnd() -
right->GetStart() ).EuclideanNorm(), 1000 );
698 std::vector<PCB_SHAPE*> modified;
704 BOOST_CHECK_LE( ( a->
GetCenter() - b->GetCenter() ).EuclideanNorm(), 2000 );
705 BOOST_CHECK( std::find( modified.begin(), modified.end(), b ) != modified.end() );
725 const VECTOR2I bStart0 = b->GetStart();
728 std::vector<PCB_SHAPE*> modified;
733 BOOST_CHECK( modified.empty() );
756 BOOST_REQUIRE_EQUAL( board.
Constraints().size(), 1 );
760 commit.
Push( wxT(
"delete segment" ) );
763 BOOST_REQUIRE_EQUAL( board.
Constraints().size(), 1 );
765 BOOST_REQUIRE_EQUAL( survivor->
GetMembers().size(), 2 );
767 bool referencesDeleted =
false;
771 if( m.m_item == aId )
772 referencesDeleted =
true;
775 BOOST_CHECK( referencesDeleted );
776 BOOST_CHECK( board.
ResolveItem( aId,
true ) ==
nullptr );
800 seg->Move( { 0, 3 *
MM } );
803 std::vector<PCB_SHAPE*> modified;
807 BOOST_CHECK_LE(
std::abs( seg->GetEnd().y ), 5000 );
808 BOOST_CHECK_LE( ( seg->GetStart() -
VECTOR2I( 2 *
MM, 8 *
MM ) ).EuclideanNorm(), 5000.0 );
811 BOOST_CHECK( std::find( modified.begin(), modified.end(), seg ) != modified.end() );
826 const VECTOR2I bStart0 = b->GetStart();
831 std::vector<PCB_SHAPE*> modified;
840 BOOST_CHECK_LE( ( a->
GetEnd() - b->GetStart() ).EuclideanNorm(), 100 );
841 BOOST_CHECK( b->GetStart() != bStart0 );
861 std::vector<PCB_SHAPE*> modified;
872 const std::array<VECTOR2I, 4> painted = { a->
GetStart(), a->
GetEnd(), b->GetStart(), b->GetEnd() };
874 commit.
Push( wxT(
"Move" ) );
876 const std::array<VECTOR2I, 4> committed = { a->
GetStart(), a->
GetEnd(), b->GetStart(), b->GetEnd() };
892 const VECTOR2I bStart0 = b->GetStart();
895 std::vector<PCB_SHAPE*> modified;
902 BOOST_CHECK( modified.empty() );
904 BOOST_CHECK( commit.
Empty() );
917 len->SetValue( 10.0 *
MM );
922 std::vector<PCB_SHAPE*> modified;
930 BOOST_CHECK_LE( ( seg->
GetStart() - start0 ).EuclideanNorm(), 5000.0 );
934 BOOST_CHECK_LE( ( seg->
GetEnd() -
VECTOR2I( 6 *
MM, 8 *
MM ) ).EuclideanNorm(), 20000.0 );
948 len->SetValue( 10.0 *
MM );
953 std::vector<PCB_SHAPE*> modified;
959 BOOST_CHECK_LE( ( seg->
GetStart() - start0 ).EuclideanNorm(), 5000.0 );
961 BOOST_CHECK_LE( ( seg->
GetEnd() -
VECTOR2I( 10 *
MM, 0 ) ).EuclideanNorm(), 20000.0 );
971 PCB_SHAPE* arc = addArc( { 10 *
MM, 0 }, { 7071068, 7071068 }, { 0, 10 *
MM } );
981 std::vector<PCB_SHAPE*> modified;
986 BOOST_CHECK_LE( ( arc->
GetCenter() - center0 ).EuclideanNorm(), 20000.0 );
988 BOOST_CHECK_LE( ( arc->
GetEnd() - end0 ).EuclideanNorm(), 20000.0 );
989 BOOST_CHECK( ( arc->
GetStart() -
VECTOR2I( 10 *
MM, 0 ) ).EuclideanNorm() > 20000.0 );
997 PCB_SHAPE* arc = addArc( { 10 *
MM, 0 }, { 7071068, 7071068 }, { 0, 10 *
MM } );
1001 r->SetValue( 12.0 *
MM );
1004 std::vector<PCB_SHAPE*> modified;
1019 PCB_SHAPE* rect = addRect( { 10 *
MM, 10 *
MM }, { 0, 0 } );
1031 std::vector<PCB_SHAPE*> modified;
1042 BOOST_CHECK_LE( (
VECTOR2I( br.
x, tl.y ) -
cursor ).EuclideanNorm(), 5000.0 );
1043 BOOST_CHECK_LE( ( seg->GetStart() -
cursor ).EuclideanNorm(), 5000.0 );
1046 BOOST_CHECK_LE( (
VECTOR2I( tl.x, br.
y ) -
VECTOR2I( 0, 10 *
MM ) ).EuclideanNorm(), 5000.0 );
1054 const std::vector<VECTOR2I> points{ { 0, 0 },
1056 { 13 *
MM, 8 *
MM },
1057 { 5 *
MM, 14 *
MM },
1058 { -3 *
MM, 8 *
MM } };
1071 std::vector<PCB_SHAPE*> modified;
1078 BOOST_REQUIRE_EQUAL( outline.PointCount(), 5 );
1079 BOOST_CHECK_LE( ( outline.CPoint( 2 ) -
cursor ).EuclideanNorm(), 5000.0 );
1081 for(
int i : { 0, 1, 3, 4 } )
1082 BOOST_CHECK_LE( ( outline.CPoint( i ) - points[i] ).EuclideanNorm(), 5000.0 );
1091 PCB_SHAPE* rect = addRect( { 0, 0 }, { 10 *
MM, 10 *
MM } );
1092 PCB_SHAPE* swapped = addRect( { 10 *
MM, 10 *
MM }, { 0, 0 } );
1094 for(
PCB_SHAPE* shape : { rect, swapped } )
1096 const std::vector<VECTOR2I> corners{ { 0, 0 },
1098 { 10 *
MM, 10 *
MM },
1101 for(
size_t i = 0; i < corners.size(); ++i )
1108 BOOST_CHECK( vertex->pos == corners[i] );
1125 const std::vector<VECTOR2I> points{ { 0, 0 },
1127 { 13 *
MM, 8 *
MM },
1128 { 5 *
MM, 14 *
MM },
1129 { -3 *
MM, 8 *
MM } };
1133 for(
size_t i = 0; i < points.size(); ++i )
1140 BOOST_CHECK( vertex->pos == points[i] );
1152 chain.SetClosed(
true );
1155 board.
Add( arcPoly );
1168 PCB_SHAPE* rect = addRect( { 0, 0 }, { 10 *
MM, 10 *
MM } );
1184 BOOST_CHECK( vertex->pos ==
cursor );
1186 std::vector<PCB_SHAPE*> modified;
1188 SolveCluster( &board, { rect->
m_Uuid, vertex->anchor, vertex->index }, vertex->pos, &modified,
1191 BOOST_CHECK_LE( ( seg->GetStart() -
cursor ).EuclideanNorm(), 5000.0 );
1199 PCB_SHAPE* rect = addRect( { 0, 0 }, { 10 *
MM, 10 *
MM } );
1210 const int minWidth = 25400;
1211 const VECTOR2I clamped( minWidth, rawCursor.
y );
1219 BOOST_CHECK( vertex->pos == clamped );
1220 BOOST_CHECK( vertex->pos != rawCursor );
1222 std::vector<PCB_SHAPE*> modified;
1224 SolveCluster( &board, { rect->
m_Uuid, vertex->anchor, vertex->index }, vertex->pos, &modified,
1227 BOOST_CHECK_LE( ( seg->GetStart() - clamped ).EuclideanNorm(), 5000.0 );
1265 PCB_SHAPE* rect = addRect( { 0, 0 }, { 10 *
MM, 10 *
MM } );
1267 addDrivingVertexLength( board, rect, 0, 1, 10.0 *
MM );
1276 BOOST_CHECK( corner->pos ==
VECTOR2I( 15 *
MM, 0 ) );
1278 std::vector<PCB_SHAPE*> modified;
1280 SolveCluster( &board, { rect->
m_Uuid, corner->anchor, corner->index }, corner->pos, &modified,
1283 const VECTOR2I tl = dragRectTopLeft( rect );
1284 const VECTOR2I br = dragRectBotRight( rect );
1287 BOOST_CHECK_LE(
std::abs( ( br.
x - tl.x ) - 10 *
MM ), 20000 );
1288 BOOST_CHECK_LE(
std::abs( ( br.
y - tl.y ) - 10 *
MM ), 20000 );
1291 BOOST_CHECK_GT( tl.x, 1 *
MM );
1292 BOOST_CHECK_LT( br.
x, 14 *
MM );
1294 BOOST_TEST_MESSAGE(
"side drag under driving width settled TL at " << tl.x <<
"," << tl.y );
1299 BOOST_REQUIRE_EQUAL( corners.size(), 4 );
1309 PCB_SHAPE* rect = addRect( { 0, 0 }, { 10 *
MM, 10 *
MM } );
1311 addDrivingVertexLength( board, rect, 0, 1, 10.0 *
MM );
1319 BOOST_CHECK( corner->pos ==
VECTOR2I( 10 *
MM, 15 *
MM ) );
1321 std::vector<PCB_SHAPE*> modified;
1323 SolveCluster( &board, { rect->
m_Uuid, corner->anchor, corner->index }, corner->pos, &modified,
1326 const VECTOR2I tl = dragRectTopLeft( rect );
1327 const VECTOR2I br = dragRectBotRight( rect );
1329 BOOST_CHECK_LE( tl.EuclideanNorm(), 5000.0 );
1330 BOOST_CHECK_LE(
std::abs( ( br.
x - tl.x ) - 10 *
MM ), 5000 );
1331 BOOST_CHECK_LE(
std::abs( ( br.
y - tl.y ) - 15 *
MM ), 5000 );
1339 PCB_SHAPE* rect = addRect( { 0, 0 }, { 10 *
MM, 10 *
MM } );
1353 std::vector<PCB_SHAPE*> modified;
1355 SolveCluster( &board, { rect->
m_Uuid, corner->anchor, corner->index }, corner->pos, &modified,
1358 BOOST_CHECK_LE( dragRectTopLeft( rect ).EuclideanNorm(), 5000.0 );
1359 BOOST_CHECK_LE( ( dragRectBotRight( rect ) -
VECTOR2I( 15 *
MM, 10 *
MM ) ).EuclideanNorm(), 5000.0 );
1360 BOOST_CHECK_LE( seg->GetStart().EuclideanNorm(), 5000.0 );
1368 const std::vector<VECTOR2I> points{ { 0, 0 },
1370 { 13 *
MM, 8 *
MM },
1371 { 5 *
MM, 14 *
MM },
1372 { -3 *
MM, 8 *
MM } };
1375 const double edgeLen = std::hypot( 3.0, 8.0 ) *
MM;
1377 addDrivingVertexLength( board, poly, 1, 2, edgeLen );
1380 std::vector<VECTOR2I> dragged = points;
1381 dragged[1] = { 8 *
MM, -2 *
MM };
1382 dragged[2] = { 16 *
MM, 9 *
MM };
1385 std::vector<PCB_SHAPE*> modified;
1394 double solvedLen = ( outline.CPoint( 2 ) - outline.CPoint( 1 ) ).EuclideanNorm();
1396 BOOST_CHECK_LE(
std::abs( solvedLen - edgeLen ), 20000.0 );
1400 const VECTOR2I midBefore = ( points[1] + points[2] ) / 2;
1401 const VECTOR2I midTarget = ( dragged[1] + dragged[2] ) / 2;
1402 const VECTOR2I midSolved = ( outline.CPoint( 1 ) + outline.CPoint( 2 ) ) / 2;
1404 BOOST_CHECK_LT( ( midSolved - midTarget ).EuclideanNorm(), ( midBefore - midTarget ).EuclideanNorm() );
1405 BOOST_CHECK_GT( ( midSolved - midBefore ).EuclideanNorm(), 250000.0 );
1407 for(
int i : { 0, 3, 4 } )
1408 BOOST_CHECK_LE( ( outline.CPoint( i ) - points[i] ).EuclideanNorm(), 5000.0 );
1416 const std::vector<VECTOR2I> points{ { 0, 0 },
1418 { 13 *
MM, 8 *
MM },
1419 { 5 *
MM, 14 *
MM },
1420 { -3 *
MM, 8 *
MM } };
1431 std::vector<VECTOR2I> dragged = points;
1436 std::vector<PCB_SHAPE*> modified;
1445 BOOST_CHECK_LE( ( outline.CPoint( 1 ) - dragged[1] ).EuclideanNorm(), 5000.0 );
1446 BOOST_CHECK_LE( ( outline.CPoint( 2 ) - dragged[2] ).EuclideanNorm(), 5000.0 );
1447 BOOST_CHECK_LE( ( seg->
GetStart() - dragged[1] ).EuclideanNorm(), 5000.0 );
1448 BOOST_CHECK( std::find( modified.begin(), modified.end(), seg ) != modified.end() );
1450 for(
int i : { 0, 3, 4 } )
1451 BOOST_CHECK_LE( ( outline.CPoint( i ) - points[i] ).EuclideanNorm(), 5000.0 );
1458 PCB_SHAPE* arc = addArc( { 10 *
MM, 0 }, { 7071068, 7071068 }, { 0, 10 *
MM } );
1466 std::vector<PCB_SHAPE*> modified;
1474 BOOST_CHECK_LE( ( arc->
GetStart() - start0 ).EuclideanNorm(), 20000.0 );
1475 BOOST_CHECK_LE( ( arc->
GetEnd() - end0 ).EuclideanNorm(), 20000.0 );
1476 BOOST_CHECK( ( arc->
GetCenter() -
VECTOR2I( 0, 0 ) ).EuclideanNorm() > 100000.0 );
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 ...
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.
void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
void Revert() override
Revert the commit by restoring the modified items state.
Translates KiCad board geometry to and from the planegcs solver (issue #2329).
bool SolveRigidTranslation(const std::set< KIID > &aEditedShapes, const VECTOR2I &aTranslation)
bool Build(const std::vector< PCB_SHAPE * > &aShapes, const std::vector< PCB_CONSTRAINT * > &aConstraints, const std::set< KIID > *aFixedShapes=nullptr, const std::vector< PCB_DIMENSION_BASE * > &aDimensions={})
Translate a cluster into a planegcs system.
std::vector< PCB_SHAPE * > Apply(const std::function< void(BOARD_ITEM *)> &aBeforeWrite={})
Write the solved coordinates back into the shapes, de-normalized to IU.
bool IsExactFeasible(const VECTOR2I &aTarget)
bool Build(BOARD *aBoard, const CONSTRAINT_MEMBER &aDragged)
CONSTRAINT_DIAGNOSIS Solve(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=std::nullopt)
SNAP_RESULT ResolveCandidates(const SNAP_SOURCE_CONTEXT &aContext, const std::vector< SNAP_CANDIDATE > &aCandidates)
bool Matches(const CONSTRAINT_MEMBER &aDragged) const
bool Solve(const VECTOR2I &aTarget, std::vector< PCB_SHAPE * > *aModified, const std::function< void(BOARD_ITEM *)> &aBeforeModify)
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 HasBaseConflict() const
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
void SetLocked(bool aLocked) override
Information pertinent to a Pcbnew printed circuit board.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
const CONSTRAINTS & Constraints() const
Geometric constraints (#2329) owned by this board.
BOARD_ITEM * ResolveItem(const KIID &aID, bool aAllowNullptrReturn=false) const
COMMIT & Remove(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Remove a new item from the model.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
SHAPE_POLY_SET & GetPolyShape()
virtual void SetBottom(int val)
virtual void SetTop(int val)
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
void SetPolyPoints(const std::vector< VECTOR2I > &aPoints)
virtual void SetRight(int val)
std::array< uint8_t, 16 > AsBytes() const
static KIID FromName(const std::string &aName)
Return a KIID derived from a name, the same name always gives the same KIID.
A geometric constraint between board items (issue #2329).
const std::vector< CONSTRAINT_MEMBER > & GetMembers() const
void AddMember(const KIID &aItem, CONSTRAINT_ANCHOR aAnchor=CONSTRAINT_ANCHOR::WHOLE, int aIndex=-1)
void SetValue(std::optional< double > aValue)
void SetDriving(bool aDriving)
void SetCenter(const VECTOR2I &aCenter) override
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
void SetEnd(const VECTOR2I &aEnd) override
void Move(const VECTOR2I &aMoveVector) override
Move this object.
void SetStart(const VECTOR2I &aStart) override
void SetArcGeometry(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd) override
Set the three controlling points for an arc.
void SetRadius(int aRadius)
void SetCenter(const VECTOR2I &aCenter)
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
SNAP_RESULT Resolve(const SNAP_SOURCE_CONTEXT &aContext) const
void SetFeasibilityCallback(FEASIBILITY_CALLBACK aCallback)
void AddCandidate(SNAP_CANDIDATE aCandidate)
std::optional< CONSTRAINT_ANCHOR_POINT > ConstraintShapeVertex(const PCB_SHAPE *aShape, int aIndex)
VERTEX anchor at ordinal aIndex of a rectangle or eligible polygon or std::nullopt if the shape has n...
std::vector< CONSTRAINT_ANCHOR_POINT > ConstraintShapeAnchors(const PCB_SHAPE *aShape)
Enumerate a shape constraint anchors with positions segment and arc endpoints arc centre circle centr...
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
PCB_SHAPE * addPoly(BOARD &aBoard, const std::vector< VECTOR2I > &aPoints)
PCB_SHAPE * addArc(BOARD &aBoard, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
PCB_SHAPE * addCircle(BOARD &aBoard, const VECTOR2I &aCenter, int aRadius)
PCB_SHAPE * addRect(BOARD &aBoard, const VECTOR2I &aStart, const VECTOR2I &aEnd)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
CONSTRAINT_ANCHOR
Which feature of a referenced board item participates in a constraint.
@ VERTEX
An indexed rectangle corner or polygon outline vertex; pairs with CONSTRAINT_MEMBER::m_index.
@ WHOLE
The item as a whole (a segment as a line, a circle).
@ START
First endpoint of a segment or arc.
@ END
Second endpoint of a segment or arc.
@ CENTER
Center of an arc or circle.
@ CONCENTRIC
Two arcs/circles share a center.
@ FIXED_POSITION
A point is locked at its current location.
@ COINCIDENT
Two points are made to coincide.
@ FIXED_RADIUS
An arc/circle has a driving radius value.
@ HORIZONTAL
A segment (or two points) is horizontal.
@ POINT_ON_LINE
A point lies on a segment's supporting line.
@ FIXED_LENGTH
A segment has a driving length value.
static bool addSegment(VRML_LAYER &model, IDF_SEGMENT *seg, int icont, int iseg)
std::array< uint8_t, 16 > SNAP_TARGET_ID
The outcome of a constraint solve, in plain data so callers need not know planegcs.
bool solved
Solver reached Success or Converged.
std::vector< KIID > conflicting
Constraints the solver reports as over-constraining.
One participant in a constraint: a referenced board item plus the feature of that item that participa...
static SNAP_CANDIDATE Point(SNAP_STABLE_ID aId, SNAP_PRIORITY_TIER aPriority, SNAP_CANDIDATE_SUBTYPE aSubtype, const VECTOR2I &aPoint, double aResidual)
static SNAP_CANDIDATE Line(SNAP_STABLE_ID aId, SNAP_PRIORITY_TIER aPriority, SNAP_CANDIDATE_SUBTYPE aSubtype, const VECTOR2I &aOrigin, const VECTOR2D &aDirection, double aResidual)
static SNAP_CANDIDATE AxisX(SNAP_STABLE_ID aId, SNAP_PRIORITY_TIER aPriority, SNAP_CANDIDATE_SUBTYPE aSubtype, int aCoordinate, double aResidual)
std::vector< SNAP_GUIDE > guides
SNAP_RESULT_STATUS status
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_FIXTURE_TEST_CASE(DragReDerivesNeighborRevertRestores, DRAG_FIXTURE)
BOOST_AUTO_TEST_CASE(UnbuiltMoveSessionRejectsCandidates)
BOOST_CHECK_EQUAL_COLLECTIONS(mixed.begin(), mixed.end(), expMixed.begin(), expMixed.end())
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
static const long long MM
const SHAPE_LINE_CHAIN chain
SHAPE_CIRCLE circle(c.m_circle_center, c.m_circle_radius)
BOOST_TEST_MESSAGE("Polyline has "<< chain.PointCount()<< " points")
wxString result
Test unit parsing edge cases and error handling.
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I