47 auto zone = std::make_unique<ZONE>( &aParent );
48 zone->SetLayer( aLayer );
50 auto outline = std::make_unique<SHAPE_POLY_SET>();
53 zone->SetOutline( outline.release() );
64 auto zone = std::make_unique<ZONE>( &aParent );
65 zone->SetLayer( aLayer );
67 std::unique_ptr<SHAPE_POLY_SET> outline = std::make_unique<SHAPE_POLY_SET>( *aOther.
Outline() );
68 zone->SetOutline( outline.release() );
78 ZONE zone( &m_board );
90 ZONE zone( &m_board );
110 ZONE zone( &m_board );
132 ZONE* ruleArea =
new ZONE( &footprint );
135 footprint.
Add( ruleArea );
145 usedLayers |=
static_cast<ZONE*
>( aItem )->GetLayerSet();
156 usedLayers &= ~allowedLayers;
157 usedLayers &=
~LSET::AllTechMask();
158 usedLayers &=
~LSET::UserMask();
183 sourceOutline.
Append( fullCircle );
185 BOOST_TEST_REQUIRE( sourceOutline.
ArcCount() > 0 );
186 double sourceArea = sourceOutline.
Area();
187 BOOST_TEST_REQUIRE( sourceArea > 0.0 );
210 BOOST_TEST_REQUIRE( working.
HoleCount( 0 ) == 1 );
212 double expectedArea = sourceArea - cutoutOutline.
Area();
213 BOOST_CHECK_CLOSE( working.
Area(), expectedArea, 0.1 );
234 ZONE zone( &m_board );
245 std::vector<std::unique_ptr<ZONE>> zones;
247 zones.emplace_back( std::make_unique<ZONE>( &m_board ) );
248 zones.back()->SetLayer(
F_Cu );
250 zones.emplace_back( std::make_unique<ZONE>( &m_board ) );
251 zones.back()->SetLayer(
F_Cu );
262 std::vector<std::unique_ptr<ZONE>> zones;
276 std::vector<std::unique_ptr<ZONE>> zones;
287 BOOST_TEST( merged[0]->GetNumCorners() == 4 );
293 std::vector<std::unique_ptr<ZONE>> zones;
301 auto newPolyB = std::make_unique<SHAPE_POLY_SET>( *zones.back()->Outline() );
302 newPolyB->Outline( 0 ).Reverse();
303 zones.back()->SetOutline( newPolyB.release() );
311 BOOST_TEST( merged[0]->GetNumCorners() == 4 );
318 via->SetPosition( aPos );
319 via->SetLayerPair( aTopLayer, aBotLayer );
322 via->SetNetCode( aNetCode );
336 pad->SetPosition( aPos );
340 pad->SetLayerSet(
LSET( { aLayer } ) );
341 pad->SetNetCode( aNetCode );
359 zoneA->SetAssignedPriority( 5 );
366 zoneB->SetAssignedPriority( 10 );
368 ZONE* ptrA = zoneA.get();
369 ZONE* ptrB = zoneB.get();
370 m_board.Add( zoneA.release() );
371 m_board.Add( zoneB.release() );
398 ZONE* ptrA = zoneA.get();
399 ZONE* ptrB = zoneB.get();
400 m_board.Add( zoneA.release() );
401 m_board.Add( zoneB.release() );
403 for(
int i = 0; i < 5; i++ )
439 ZONE* ptrA = zoneA.get();
440 ZONE* ptrB = zoneB.get();
441 m_board.Add( zoneA.release() );
442 m_board.Add( zoneB.release() );
461 m_board.SetCopperLayerCount( 2 );
482 ZONE* ptrA = zoneA.get();
483 ZONE* ptrB = zoneB.get();
484 m_board.Add( zoneA.release() );
485 m_board.Add( zoneB.release() );
522 ZONE* ptrA = zoneA.get();
523 ZONE* ptrB = zoneB.get();
524 m_board.Add( zoneA.release() );
525 m_board.Add( zoneB.release() );
552 zoneA->SetAssignedPriority( 50 );
559 zoneB->SetAssignedPriority( 50 );
561 ZONE* ptrA = zoneA.get();
562 ZONE* ptrB = zoneB.get();
563 m_board.Add( zoneA.release() );
564 m_board.Add( zoneB.release() );
578 m_board.Add( netGND );
580 m_board.Add( netVCC );
603 ZONE* ptrA = zoneA.get();
604 ZONE* ptrB = zoneB.get();
605 ZONE* ptrC = zoneC.get();
606 m_board.Add( zoneA.release() );
607 m_board.Add( zoneB.release() );
608 m_board.Add( zoneC.release() );
611 for(
int i = 0; i < 4; i++ )
678 ruleArea->SetIsRuleArea(
true );
720 zone->SetFilledPolysList(
F_Cu, fill );
724 boost::test_tools::tolerance( 0.001 ) );
735 const int copperPass =
F_Cu;
constexpr EDA_IU_SCALE pcbIUScale
BASE_SET & set(size_t pos)
Abstract interface for BOARD_ITEMs capable of storing other items inside.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
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.
An abstract base class whose derivatives may be passed to a GENERAL_COLLECTOR telling it what should ...
KICAD_T Type() const
Returns the type of object.
Used when the right click button is pressed, or when the select tool is in effect.
void SetGuide(const COLLECTORS_GUIDE *aGuide)
Record which COLLECTORS_GUIDE to use.
LSET is a set of PCB_LAYER_IDs.
static LSET UserDefinedLayersMask(int aUserDefinedLayerCount=MAX_USER_DEFINED_LAYERS)
Return a mask with the requested number of user defined layers.
static const LSET & InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
Handle the data for a net.
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
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.
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 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
Minimal COLLECTORS_GUIDE so GetCoverageArea() can be exercised headlessly.
bool IgnoreMicroVias() const override
bool IgnoreThroughHolePads() const override
bool IgnoreBlindBuriedVias() const override
bool IgnorePadsOnFront() const override
int Accuracy() const override
bool IgnoreFootprintsOnFront() const override
bool IgnoreFPReferences() const override
bool IgnoreTracks() const override
bool IgnoreFPTextOnFront() const override
bool IgnoreNoNets() const override
bool IsLayerVisible(PCB_LAYER_ID) const override
bool IgnoreFootprintsOnBack() const override
PCB_LAYER_ID GetPreferredLayer() const override
bool IgnoreZoneFills() const override
bool IncludeSecondary() const override
Determine if the secondary criteria or 2nd choice items should be included.
bool IgnoreThroughVias() const override
bool IgnoreFPValues() const override
double OnePixelInIU() const override
bool IgnorePadsOnBack() const override
bool IgnoreLockedItems() const override
bool IgnoreFPTextOnBack() const override
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)
void SetLayerSet(const LSET &aLayerSet) override
VECTOR2I GetPosition() const override
bool IsOnCopperLayer() const override
PCB_LAYER_ID GetFirstLayer() const
unsigned GetAssignedPriority() const
int GetNumCorners(void) const
Access to m_Poly parameters.
PCB_LAYER_ID
A quick note on layer IDs:
#define ZONE_LAYER_FOR(boardLayer)
SHAPE_LINE_CHAIN BoxToLineChain(const BOX2I &aBox)
bool ZoneOutlineDrawnOnLayer(bool aIsRuleArea, int aLayer)
Decide which GAL draw pass paints a zone's outline.
Utility functions for working with shapes.
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)
static std::unique_ptr< ZONE > CreateSquareZone(BOARD_ITEM_CONTAINER &aParent, BOX2I aBox, PCB_LAYER_ID aLayer)
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 > CreateSimilarZone(BOARD_ITEM_CONTAINER &aParent, const ZONE &aOther, PCB_LAYER_ID aLayer)
Create a similar zone (same outline) on a different layer.
BOOST_AUTO_TEST_CASE(SingleLayer)
static PAD * AddPadToBoard(BOARD &aBoard, const VECTOR2I &aPos, int aNetCode, PCB_LAYER_ID aLayer=F_Cu)
@ PCB_ZONE_T
class ZONE, a copper pour area
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.