39constexpr int MM = 1000000;
59 io.
SetWriter( [&](
const wxString& aData ) { data = aData; } );
67 return std::unique_ptr<BOARD>(
static_cast<BOARD*
>( parsed ) );
76 auto board = std::make_unique<BOARD>();
91 std::unique_ptr<BOARD> pasted =
roundTrip( board.get(), selection );
93 BOOST_REQUIRE_EQUAL( pasted->Constraints().size(), 1 );
97 BOOST_REQUIRE_EQUAL( pastedConstraint->
GetMembers().size(), 2 );
101 BOOST_CHECK( pasted->ResolveItem( member.m_item,
true ) !=
nullptr );
112 const int copperLayers = 2;
122 BOOST_CHECK(
group.FitsEnabledLayers( enabled, copperLayers ) );
149 auto board = std::make_unique<BOARD>();
160 std::map<KIID, KIID> idMap;
164 KIID oldUuid = shape->m_Uuid;
166 idMap[oldUuid] = shape->m_Uuid;
170 BOOST_CHECK( board->ResolveItem( c->GetMembers()[0].m_item,
true ) ==
nullptr );
172 c->RemapKIIDs( idMap );
174 BOOST_CHECK( c->GetMembers()[0].m_item == a->
m_Uuid );
175 BOOST_CHECK( c->GetMembers()[1].m_item == b->m_Uuid );
176 BOOST_CHECK( board->ResolveItem( c->GetMembers()[0].m_item,
true ) == a );
177 BOOST_CHECK( board->ResolveItem( c->GetMembers()[1].m_item,
true ) == b );
184 BOOST_CHECK( d->
GetMembers()[0].m_item == stranger );
192 auto board = std::make_unique<BOARD>();
206 std::unique_ptr<BOARD> pasted =
roundTrip( board.get(), selection );
208 BOOST_CHECK( pasted->Constraints().empty() );
216 auto board = std::make_unique<BOARD>();
234 PCB_SHAPE* a = addFpSegment( { 0, 0 }, { 10 *
MM, 0 } );
244 [&](
const PCB_SELECTION& aSelection ) -> std::unique_ptr<FOOTPRINT>
249 io.
SetWriter( [&](
const wxString& aData ) { data = aData; } );
258 return std::unique_ptr<FOOTPRINT>(
static_cast<FOOTPRINT*
>( parsed ) );
265 std::unique_ptr<FOOTPRINT> clip = fpRoundTrip( selection );
267 BOOST_REQUIRE_EQUAL( clip->Constraints().size(), 1 );
274 BOOST_CHECK( fpRoundTrip( partial )->Constraints().
empty() );
constexpr EDA_IU_SCALE pcbIUScale
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
virtual bool FitsEnabledLayers(const LSET &aEnabledLayers, int aCopperLayerCount) const
Check if a board offering aEnabledLayers can hold this item.
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.
void SaveSelection(const PCB_SELECTION &selected, bool isFootprintEditor)
void SetWriter(std::function< void(const wxString &)> aWriter)
void SetReader(std::function< wxString()> aReader)
void SetBoard(BOARD *aBoard)
KICAD_T Type() const
Returns the type of object.
LSET is a set of PCB_LAYER_IDs.
static const LSET & AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
A geometric constraint between board items (issue #2329).
const std::vector< CONSTRAINT_MEMBER > & GetMembers() const
PCB_CONSTRAINT_TYPE GetConstraintType() const
void AddMember(const KIID &aItem, CONSTRAINT_ANCHOR aAnchor=CONSTRAINT_ANCHOR::WHOLE, int aIndex=-1)
void RemapKIIDs(const std::map< KIID, KIID > &aIdMap) override
Remap KIIDs this item stores to reference other items (e.g.
A set of BOARD_ITEMs (i.e., without duplicates).
void SetEnd(const VECTOR2I &aEnd) override
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void SetStart(const VECTOR2I &aStart) override
void SetStroke(const STROKE_PARAMS &aStroke) override
virtual void Add(EDA_ITEM *aItem)
A null aItem is ignored; the selection never holds null members.
Simple container to manage line stroke parameters.
static bool empty(const wxTextEntryBase *aCtrl)
@ WHOLE
The item as a whole (a segment as a line, a circle).
@ PARALLEL
Two segments are parallel.
Class to handle a set of BOARD_ITEMs.
static bool addSegment(VRML_LAYER &model, IDF_SEGMENT *seg, int icont, int iseg)
One participant in a constraint: a referenced board item plus the feature of that item that participa...
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_CASE(ConstraintCopiedWhenAllMembersSelected)
static void roundTrip(const DIFF_VALUE &aValue)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
static const long long MM
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
VECTOR2< int32_t > VECTOR2I