34 if( a.size() != b.size() )
39 for(
size_t lineChainId = 0; lineChainId < a.size(); lineChainId++ )
57 const auto zonesAreMergeable = [&](
const ZONE& a,
const ZONE& b ) ->
bool
59 if( a.GetNetCode() != b.GetNetCode() )
63 if( a.GetIsRuleArea() != b.GetIsRuleArea() )
83 return polygonsAreMergeable( polyA, polyB );
86 std::vector<std::unique_ptr<ZONE>> deduplicatedZones;
87 size_t mergedCount = 0;
89 std::vector<bool> merged( aZones.size(),
false );
91 for(
size_t i = 0; i < aZones.size(); i++ )
98 ZONE& primary = *aZones[i];
100 std::unordered_map<PCB_LAYER_ID, SHAPE_POLY_SET> mergedFills;
102 for(
size_t j = i + 1; j < aZones.size(); j++ )
109 ZONE& candidate = *aZones[j];
110 bool canMerge = zonesAreMergeable( primary, candidate );
117 mergedFills[layer] = *fill;
131 mergedFills[layer] = *fill;
136 for(
const auto& [layer, fill] : mergedFills )
144 deduplicatedZones.push_back( std::move( aZones[i] ) );
147 return deduplicatedZones;
LSET is a set of PCB_LAYER_IDs.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
int PointCount() const
Return the number of points (vertices) in this line chain.
bool CompareGeometry(const SHAPE_LINE_CHAIN &aOther, bool aCyclicalCompare=false, int aEpsilon=0) const
Compare this line chain with another one.
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
Represent a set of closed polygons.
std::vector< SHAPE_LINE_CHAIN > POLYGON
represents a single polygon outline with holes.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
int OutlineCount() const
Return the number of outlines in the set.
const POLYGON & CPolygon(int aIndex) const
Handle a list of polygons defining a copper zone.
void SetNeedRefill(bool aNeedRefill)
SHAPE_POLY_SET * GetFill(PCB_LAYER_ID aLayer)
void SetFilledPolysList(PCB_LAYER_ID aLayer, const SHAPE_POLY_SET &aPolysList)
Set the list of filled polygons.
void SetIsFilled(bool isFilled)
void SetLayerSet(const LSET &aLayerSet) override
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
PCB_LAYER_ID
A quick note on layer IDs:
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.