50 std::unique_ptr<PCB_CONSTRAINT> c =
54 BOOST_REQUIRE_EQUAL( c->GetMembers().size(), 2 );
55 BOOST_CHECK( c->GetMembers()[0].m_item == a->
m_Uuid );
57 BOOST_CHECK( c->GetMembers()[1].m_item == b->m_Uuid );
66 std::unique_ptr<PCB_CONSTRAINT> c =
71 BOOST_CHECK_CLOSE( *c->GetValue(), 7.0 *
MM, 1e-6 );
81 std::unique_ptr<PCB_CONSTRAINT> c =
85 BOOST_REQUIRE_EQUAL( c->GetMembers().size(), 2 );
87 BOOST_CHECK_CLOSE( *c->GetValue(), 90.0, 1e-6 );
97 std::unique_ptr<PCB_CONSTRAINT> c =
104 BOOST_CHECK_CLOSE( *c->GetValue(), 90.0, 1e-3 );
116 for(
bool swapA : {
false,
true } )
118 for(
bool swapB : {
false,
true } )
120 for(
bool swapOrder : {
false,
true } )
128 std::vector<BOARD_ITEM*> items = swapOrder ? std::vector<BOARD_ITEM*>{ b, a }
129 : std::vector<BOARD_ITEM*>{ a, b };
136 BOOST_CHECK_CLOSE( *c->GetValue(), 120.0, 0.05 );
152 BOOST_CHECK_SMALL( *c->GetValue(), 1e-3 );
161 BOOST_CHECK_CLOSE( *c->GetValue(), 180.0, 1e-3 );
174 std::unique_ptr<PCB_CONSTRAINT> c =
180 BOOST_CHECK_CLOSE( *c->GetValue(), 90.0, 1e-3 );
220 BOOST_CHECK( hit->m_item == seg->
m_Uuid );
241 std::optional<CONSTRAINT_MEMBER> second =
244 BOOST_CHECK( *second != *first );
245 BOOST_CHECK( second->m_item != first->m_item );
250 BOOST_CHECK( ( first->m_item == a->
m_Uuid && second->m_item == b->m_Uuid )
251 || ( first->m_item == b->m_Uuid && second->m_item == a->
m_Uuid ) );
270 std::unique_ptr<PCB_CONSTRAINT> c =
275 commit.
Add( c.release() );
276 commit.
Push( wxT(
"add constraint" ) );
283 removeCommit.
Remove( added );
284 removeCommit.
Push( wxT(
"remove constraint" ) );
314 std::map<PCB_CONSTRAINT_TYPE, double> remembered;
326 std::map<PCB_CONSTRAINT_TYPE, double> remembered;
337 std::map<PCB_CONSTRAINT_TYPE, double> remembered;
373 const double tol = 3 *
MM;
404 const double tol = 3 *
MM;
414 BOOST_CHECK( picked->m_item == shown->
m_Uuid );
BASE_SET & set(size_t pos)
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
Information pertinent to a Pcbnew printed circuit board.
void SetVisibleLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
const CONSTRAINTS & Constraints() const
Geometric constraints (#2329) owned by this board.
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
COMMIT & Remove(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Remove a new item from the model.
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Add a new item to the model.
LSET is a set of PCB_LAYER_IDs.
static const LSET & AllLayersMask()
A geometric constraint between board items (issue #2329).
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Load a project or sets up a new project with a specified path.
PROJECT & Prj() const
A helper while we are not MDI-capable – return the one and only project.
double InitialConstraintValue(PCB_CONSTRAINT_TYPE aType, double aMeasured, const std::map< PCB_CONSTRAINT_TYPE, double > &aRemembered)
Value a freshly authored constraint dialog should open with.
std::optional< KIID > NearestOutlineShape(BOARD *aBoard, const VECTOR2I &aPos, double aMaxDist, bool aAllowCircle, PCB_LAYER_ID aLayer)
The shape whose outline is nearest aPos within aMaxDist.
std::unique_ptr< PCB_CONSTRAINT > BuildConstraintFromItems(BOARD_ITEM *aParent, PCB_CONSTRAINT_TYPE aType, const std::vector< BOARD_ITEM * > &aItems)
Build a constraint of aType from a set of selected board items, or nullptr if the selection does not ...
std::optional< CONSTRAINT_MEMBER > NearestConstraintAnchor(BOARD *aBoard, const VECTOR2I &aPos, double aMaxDist, const std::vector< CONSTRAINT_MEMBER > &aExclude, PCB_LAYER_ID aLayer)
Find the constrainable-item anchor (a shape's segment/arc endpoint or centre, or a dimension's featur...
std::optional< VECTOR2I > ConstraintAnchorPosition(BOARD *aBoard, const CONSTRAINT_MEMBER &aMember)
Current location of a constraint member's anchor (its shape's START/END/CENTER, or a dimension's feat...
PCB_SHAPE * addSegment(BOARD &aBoard, const VECTOR2I &aStart, const VECTOR2I &aEnd)
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 * addEllipse(BOARD &aBoard, const VECTOR2I &aCenter, int aMajor, int aMinor, const EDA_ANGLE &aRotation)
@ 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.
@ CONCENTRIC
Two arcs/circles share a center.
@ COINCIDENT
Two points are made to coincide.
@ FIXED_RADIUS
An arc/circle has a driving radius value.
@ EQUAL_RADIUS
Two arcs/circles have equal radius.
@ FIXED_LENGTH
A segment has a driving length value.
@ ANGULAR_DIMENSION
An angle between members (driving or reference).
@ ARC_ANGLE
An arc has a driving or reference swept-angle value.
@ PARALLEL
Two segments are parallel.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_CASE(BuildParallelFromTwoSegments)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
SHAPE_CIRCLE circle(c.m_circle_center, c.m_circle_radius)
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I