50 std::unique_ptr<ZONE> zone = std::make_unique<ZONE>( &aParent );
51 zone->SetLayer( aLayer );
53 std::unique_ptr<SHAPE_POLY_SET> outline = std::make_unique<SHAPE_POLY_SET>();
56 zone->SetOutline( outline.release() );
67 auto zone = std::make_unique<ZONE>( &aParent );
68 zone->SetLayer( aLayer );
70 std::unique_ptr<SHAPE_POLY_SET> outline = std::make_unique<SHAPE_POLY_SET>( *aOther.
Outline() );
71 zone->SetOutline( outline.release() );
88 for(
const BOX2I& cutout : aCutouts )
100 ZONE zone( &m_board );
112 ZONE zone( &m_board );
132 ZONE zone( &m_board );
162 sourceOutline.
Append( fullCircle );
164 BOOST_TEST_REQUIRE( sourceOutline.
ArcCount() > 0 );
165 double sourceArea = sourceOutline.
Area();
166 BOOST_TEST_REQUIRE( sourceArea > 0.0 );
189 BOOST_TEST_REQUIRE( working.
HoleCount( 0 ) == 1 );
191 double expectedArea = sourceArea - cutoutOutline.
Area();
192 BOOST_CHECK_CLOSE( working.
Area(), expectedArea, 0.1 );
213 ZONE zone( &m_board );
224 std::vector<std::unique_ptr<ZONE>> zones;
226 zones.emplace_back( std::make_unique<ZONE>( &m_board ) );
227 zones.back()->SetLayer(
F_Cu );
229 zones.emplace_back( std::make_unique<ZONE>( &m_board ) );
230 zones.back()->SetLayer(
F_Cu );
241 std::vector<std::unique_ptr<ZONE>> zones;
255 std::vector<std::unique_ptr<ZONE>> zones;
266 BOOST_TEST( merged[0]->GetNumCorners() == 4 );
272 std::vector<std::unique_ptr<ZONE>> zones;
280 auto newPolyB = std::make_unique<SHAPE_POLY_SET>( *zones.back()->Outline() );
281 newPolyB->Outline( 0 ).Reverse();
282 zones.back()->SetOutline( newPolyB.release() );
290 BOOST_TEST( merged[0]->GetNumCorners() == 4 );
298 via->SetPosition( aPos );
299 via->SetLayerPair( aTopLayer, aBotLayer );
302 via->SetNetCode( aNetCode );
316 pad->SetPosition( aPos );
319 pad->SetLayerSet(
LSET( { aLayer } ) );
320 pad->SetNetCode( aNetCode );
337 zoneA->SetAssignedPriority( 5 );
343 zoneB->SetAssignedPriority( 10 );
345 ZONE* ptrA = zoneA.get();
346 ZONE* ptrB = zoneB.get();
347 m_board.Add( zoneA.release() );
348 m_board.Add( zoneB.release() );
373 ZONE* ptrA = zoneA.get();
374 ZONE* ptrB = zoneB.get();
375 m_board.Add( zoneA.release() );
376 m_board.Add( zoneB.release() );
378 for(
int i = 0; i < 5; i++ )
406 ZONE* ptrA = zoneA.get();
407 ZONE* ptrB = zoneB.get();
408 m_board.Add( zoneA.release() );
409 m_board.Add( zoneB.release() );
424 m_board.SetCopperLayerCount( 2 );
443 ZONE* ptrA = zoneA.get();
444 ZONE* ptrB = zoneB.get();
445 m_board.Add( zoneA.release() );
446 m_board.Add( zoneB.release() );
476 ZONE* ptrA = zoneA.get();
477 ZONE* ptrB = zoneB.get();
478 m_board.Add( zoneA.release() );
479 m_board.Add( zoneB.release() );
503 zoneA->SetAssignedPriority( 50 );
509 zoneB->SetAssignedPriority( 50 );
511 ZONE* ptrA = zoneA.get();
512 ZONE* ptrB = zoneB.get();
513 m_board.Add( zoneA.release() );
514 m_board.Add( zoneB.release() );
528 m_board.Add( netGND );
530 m_board.Add( netVCC );
550 ZONE* ptrA = zoneA.get();
551 ZONE* ptrB = zoneB.get();
552 ZONE* ptrC = zoneC.get();
553 m_board.Add( zoneA.release() );
554 m_board.Add( zoneB.release() );
555 m_board.Add( zoneC.release() );
558 for(
int i = 0; i < 4; i++ )
584 ruleArea->SetIsRuleArea(
true );
586 double zoneArea = ruleArea->GetCoverageArea( 0 );
598 double padArea =
pad->GetCoverageArea( 0 );
619 zone->SetFilledPolysList(
F_Cu, fill );
623 boost::test_tools::tolerance( 0.001 ) );
634 const int copperPass =
F_Cu;
659 "Identical rule areas must not report a mismatch" );
662 "A moved cutout with the same corner count must report a mismatch" );
679 ZONE* zone = oneCutout->Zones()[0];
688 BOOST_REQUIRE_EQUAL( twoCutouts->
Zones()[0]->Outline()->TotalVertices(),
689 oneCutout->Zones()[0]->Outline()->TotalVertices() );
692 "A changed cutout count with equal total vertices must report a mismatch" );
705 toolMgr.
SetEnvironment( &m_board, &view,
nullptr,
nullptr,
nullptr );
712 m_board.Add( named );
715 m_board.Add( unnamed );
constexpr EDA_IU_SCALE pcbIUScale
Abstract interface for BOARD_ITEMs capable of storing other items inside.
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.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
LSET is a set of PCB_LAYER_IDs.
Handle the data for a net.
@ NORMAL
Shape is the same on all layers.
static constexpr PCB_LAYER_ID ALL_LAYERS
! The layer identifier to use for the single defintion on normal padstacks
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
const std::optional< INTERSECTION > SelfIntersecting() const
Check if the line chain is self-intersecting.
bool IsClosed() const override
int PointCount() const
Return the number of points (vertices) in this line chain.
void Insert(size_t aVertex, const VECTOR2I &aP)
Represent a set of closed polygons.
void ClearArcs()
Removes all arc references from all the outlines and holes in the polyset.
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index.
double Area()
Return the area of this poly set.
int HoleCount(int aOutline) const
Returns the number of holes in a given outline.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
int AddHole(const SHAPE_LINE_CHAIN &aHole, int aOutline=-1)
Adds a new hole to the given outline (default: last) and returns its index.
int ArcCount() const
Count the number of arc shapes present.
int NewOutline()
Creates a new empty polygon in the set and returns its index.
const SHAPE_LINE_CHAIN & CHole(int aOutline, int aHole) const
int OutlineCount() const
Return the number of outlines in the set.
void BooleanSubtract(const SHAPE_POLY_SET &b)
Perform boolean polyset difference.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
An adjunct helper to the DRAWING_TOOL interactive tool, which handles incoming geometry changes from ...
std::unique_ptr< ZONE > createZoneFromExisting(const ZONE &aSrcZone)
Create a new zone with the settings from an existing zone.
Handle a list of polygons defining a copper zone.
virtual PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
SHAPE_POLY_SET * Outline()
void SetIsRuleArea(bool aEnable)
const wxString & GetZoneName() const
void SetLayerSet(const LSET &aLayerSet) override
VECTOR2I GetPosition() const override
bool IsOnCopperLayer() const override
void SetZoneName(const wxString &aName)
PCB_LAYER_ID GetFirstLayer() const
unsigned GetAssignedPriority() const
int GetNumCorners(void) const
Access to m_Poly parameters.
@ DIRECT
Unconstrained point-to-point.
PCB_LAYER_ID
A quick note on layer IDs:
#define ZONE_LAYER_FOR(boardLayer)
SHAPE_LINE_CHAIN BoxToLineChain(const BOX2I &aBox)
Get a SHAPE_LINE_CHAIN representing the outline of a box.
bool ZoneOutlineDrawnOnLayer(bool aOutlineOnly, int aLayer)
Decide which GAL draw pass paints a zone's outline.
@ SIMILAR
Add a new zone with the same settings as an existing one.
Utility functions for working with shapes.
Parameters used to fully describe a zone creation process.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_TEST(netlist.find("R_G1 ARM_OUT1 DIE_B R='0.001 / ((SW_STATE)") !=std::string::npos)
VECTOR3I expected(15, 30, 45)
BOOST_CHECK_EQUAL(result, "25.4")
static PCB_VIA * AddVia(BOARD &aBoard, const VECTOR2I &aPos, int aNetCode, PCB_LAYER_ID aTopLayer=F_Cu, PCB_LAYER_ID aBotLayer=B_Cu)
static std::unique_ptr< ZONE > CreateSquareZone(BOARD_ITEM_CONTAINER &aParent, PCB_LAYER_ID aLayer, const VECTOR2I &aOrigin, const VECTOR2I &aSize)
static std::unique_ptr< ZONE > CreateSimilarZone(BOARD_ITEM_CONTAINER &aParent, PCB_LAYER_ID aLayer, const ZONE &aOther)
Create a similar zone (same outline) on a different layer.
static FOOTPRINT * MakeFootprintWithRuleArea(BOARD &aBoard, const std::vector< BOX2I > &aCutouts)
BOOST_AUTO_TEST_CASE(SingleLayer)
static PAD * AddPadToBoard(BOARD &aBoard, const VECTOR2I &aPos, int aNetCode, PCB_LAYER_ID aLayer=F_Cu)
VECTOR2< int32_t > VECTOR2I
std::vector< std::unique_ptr< ZONE > > MergeZonesWithSameOutline(std::vector< std::unique_ptr< ZONE > > &&aZones)
Merges zones with identical outlines and nets on different layers into single multi-layer zones.
bool AutoAssignZonePriorities(BOARD *aBoard, PROGRESS_REPORTER *aReporter)
Automatically assign zone priorities based on connectivity analysis of overlapping regions.