KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ZONE_FILLER Class Reference

#include <zone_filler.h>

Classes

struct  INDEXED_ITEM
 An item in one of the fill indexes. More...
 

Public Member Functions

 ZONE_FILLER (BOARD *aBoard, COMMIT *aCommit)
 
 ~ZONE_FILLER ()
 
void SetProgressReporter (PROGRESS_REPORTER *aReporter)
 
PROGRESS_REPORTERGetProgressReporter () const
 
bool Fill (const std::vector< ZONE * > &aZones, bool aCheck=false, wxWindow *aParent=nullptr)
 Fills the given list of zones.
 
bool IsDebug () const
 

Private Types

using FillSnapshot = std::map<std::pair<const ZONE*, PCB_LAYER_ID>, SHAPE_POLY_SET>
 Snapshot of zone fill polygons captured before an iterative refill wave.
 
using ITEM_RTREE = KIRTREE::PACKED_RTREE<INDEXED_ITEM, int, 2>
 

Private Member Functions

void addKnockout (BOARD_ITEM *aItem, PCB_LAYER_ID aLayer, int aGap, SHAPE_POLY_SET &aHoles)
 Add a knockout for a pad or via.
 
void addKnockout (BOARD_ITEM *aItem, PCB_LAYER_ID aLayer, int aGap, bool aIgnoreLineWidth, SHAPE_POLY_SET &aHoles)
 Add a knockout for a graphic item.
 
void addHoleKnockout (PAD *aPad, int aGap, SHAPE_POLY_SET &aHoles)
 Add a knockout for a pad's hole.
 
void knockoutThermalReliefs (const ZONE *aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aFill, std::vector< BOARD_ITEM * > &aThermalConnectionPads, std::vector< PAD * > &aNoConnectionPads, std::vector< BOARD_ITEM * > &aSolidConnectionItems)
 Removes thermal reliefs from the shape for any pads connected to the zone.
 
void buildCopperItemClearances (const ZONE *aZone, PCB_LAYER_ID aLayer, const std::vector< PAD * > &aNoConnectionPads, SHAPE_POLY_SET &aHoles, bool aIncludeZoneClearances=true)
 Removes clearance from the shape for copper items which share the zone's layer but are not connected to it.
 
void buildDifferentNetZoneClearances (const ZONE *aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aHoles)
 Build clearance knockout holes for higher-priority zones on different nets.
 
bool zoneKnockoutMayInteract (const ZONE *aZone, const ZONE *aKnockout) const
 Test whether aKnockout's fill can knock out any part of aZone's fill.
 
BOX2I zoneKnockoutQueryBox (const ZONE *aZone) const
 A window that holds every zone zoneKnockoutMayInteract() can accept for aZone.
 
bool mayHoldOutOfBoardCopper (const ZONE *aZone) const
 True if the fill of aZone can reach outside the board outline.
 
void subtractHigherPriorityZones (const ZONE *aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aRawFill)
 Removes the outlines of higher-proirity zones with the same net.
 
bool fillCopperZone (const ZONE *aZone, PCB_LAYER_ID aLayer, PCB_LAYER_ID aDebugLayer, const SHAPE_POLY_SET &aSmoothedOutline, const SHAPE_POLY_SET &aMaxExtents, SHAPE_POLY_SET &aFillPolys)
 Function fillCopperZone Add non copper areas polygons (pads and tracks with clearance) to a filled copper area used in BuildFilledSolidAreasPolygons when calculating filled areas in a zone Non copper areas are pads and track and their clearance area The filled copper area must be computed before BuildFilledSolidAreasPolygons() call this function just after creating the filled copper area polygon (without clearance areas.
 
bool fillNonCopperZone (const ZONE *candidate, PCB_LAYER_ID aLayer, const SHAPE_POLY_SET &aSmoothedOutline, SHAPE_POLY_SET &aFillPolys)
 
void buildThermalSpokes (const ZONE *box, PCB_LAYER_ID aLayer, const std::vector< BOARD_ITEM * > &aSpokedPadsList, std::deque< SHAPE_LINE_CHAIN > &aSpokes)
 Function buildThermalSpokes Constructs a list of all thermal spokes for the given zone.
 
void buildHatchZoneThermalRings (const ZONE *aZone, PCB_LAYER_ID aLayer, const SHAPE_POLY_SET &aSmoothedOutline, const std::vector< BOARD_ITEM * > &aThermalConnectionPads, SHAPE_POLY_SET &aFillPolys, SHAPE_POLY_SET &aThermalRings)
 Build thermal rings for pads in hatch zones.
 
void connect_nearby_polys (SHAPE_POLY_SET &aPolys, double aDistance)
 Create strands of zero-width between elements of SHAPE_POLY_SET that are within aDistance of each other.
 
bool fillSingleZone (ZONE *aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aFillPolys)
 Build the filled solid areas polygons from zone outlines (stored in m_Poly) The solid areas can be more than one on copper layers, and do not have holes ( holes are linked by overlapping segments to the main outline) in order to have drawable (and plottable) filled polygons.
 
bool addHatchFillTypeOnZone (const ZONE *aZone, PCB_LAYER_ID aLayer, PCB_LAYER_ID aDebugLayer, SHAPE_POLY_SET &aFillPolys, const SHAPE_POLY_SET &aThermalRings)
 for zones having the ZONE_FILL_MODE::ZONE_FILL_MODE::HATCH_PATTERN, create a grid pattern in filled areas of aZone, giving to the filled polygons a fill style like a grid
 
bool addCopperThievingPattern (const ZONE *aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aFillPolys)
 Stamp a regular grid of pattern shapes onto a zone's filled area for copper thieving.
 
void postKnockoutMinWidthPrune (const ZONE *aZone, SHAPE_POLY_SET &aFillPolys, const SHAPE_POLY_SET &aSameNetApron)
 Remove minimum-width violations introduced by zone-to-zone knockouts.
 
bool refillZoneFromCache (ZONE *aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aFillPolys, const FillSnapshot *aSnapshot=nullptr)
 Refill a zone from cached pre-knockout fill.
 
void buildItemIndexes ()
 Index the static board items once per fill.
 

Static Private Member Functions

static void queryIndex (const ITEM_RTREE &aIndex, const BOX2I &aBBox, std::vector< INDEXED_ITEM > &aResult)
 Collect the items whose bounding box overlaps aBBox, in board order.
 

Private Attributes

BOARDm_board
 
SHAPE_POLY_SET m_boardOutline
 
bool m_brdOutlinesValid
 
COMMITm_commit
 
PROGRESS_REPORTERm_progressReporter
 
ITEM_RTREE m_graphicIndex
 
ITEM_RTREE m_footprintIndex
 
ITEM_RTREE m_padIndex
 
std::map< PCB_LAYER_ID, ITEM_RTREEm_trackIndex
 
std::map< PCB_LAYER_ID, ITEM_RTREEm_zoneIndex
 
int m_maxError
 
int m_worstClearance
 
int m_zoneKnockoutSlack
 
int m_maxZoneCornerRadius
 
bool m_debugZoneFiller
 
std::map< std::pair< const ZONE *, PCB_LAYER_ID >, SHAPE_POLY_SETm_preKnockoutFillCache
 
std::map< std::pair< const ZONE *, PCB_LAYER_ID >, SHAPE_POLY_SETm_preHatchSolidFillCache
 
std::map< std::pair< const ZONE *, PCB_LAYER_ID >, SHAPE_POLY_SETm_sameNetApronCache
 
std::map< std::pair< const ZONE *, PCB_LAYER_ID >, std::pair< HASH_128, SHAPE_POLY_SET > > m_refillResultCache
 
std::mutex m_cacheMutex
 

Detailed Description

Definition at line 40 of file zone_filler.h.

Member Typedef Documentation

◆ FillSnapshot

using ZONE_FILLER::FillSnapshot = std::map<std::pair<const ZONE*, PCB_LAYER_ID>, SHAPE_POLY_SET>
private

Snapshot of zone fill polygons captured before an iterative refill wave.

Definition at line 214 of file zone_filler.h.

◆ ITEM_RTREE

Definition at line 239 of file zone_filler.h.

Constructor & Destructor Documentation

◆ ZONE_FILLER()

◆ ~ZONE_FILLER()

ZONE_FILLER::~ZONE_FILLER ( )

Definition at line 392 of file zone_filler.cpp.

Member Function Documentation

◆ addCopperThievingPattern()

bool ZONE_FILLER::addCopperThievingPattern ( const ZONE * aZone,
PCB_LAYER_ID aLayer,
SHAPE_POLY_SET & aFillPolys )
private

Stamp a regular grid of pattern shapes onto a zone's filled area for copper thieving.

Replaces aFillPolys with the clipped pattern.

Thieving zones are netless dummy copper used to balance plating current density on outer layers (and copper distribution on inner layers). Runs after electrical clearances have already been subtracted into aFillPolys, so the stamps inherit those keepouts automatically.

v1 supports the dots pattern only. Squares + crosshatch land in a follow-up.

Parameters
aZonethe zone, fill mode must be COPPER_THIEVING.
aLayerthe copper layer.
aFillPolysIN: pre-cleared valid fill region. OUT: stamped pattern.

Definition at line 4098 of file zone_filler.cpp.

References SHAPE_POLY_SET::AddOutline(), ANGLE_0, SHAPE_LINE_CHAIN::Append(), SHAPE_POLY_SET::BBox(), SHAPE_POLY_SET::BooleanIntersection(), SHAPE_POLY_SET::BooleanSubtract(), SHAPE_POLY_SET::BuildBBoxCaches(), CHAMFER_ALL_CORNERS, SHAPE_POLY_SET::CloneDropTriangulation(), SHAPE_POLY_SET::Contains(), SHAPE_POLY_SET::Deflate(), THIEVING_SETTINGS::element_size, ERROR_OUTSIDE, THIEVING_SETTINGS::gap, BOX2< Vec >::GetBottom(), BOX2< Vec >::GetLeft(), ZONE::GetMinThickness(), BOX2< Vec >::GetRight(), ZONE::GetThievingSettings(), BOX2< Vec >::GetTop(), HATCH, ZONE::IsCopperThieving(), EDA_ANGLE::IsZero(), ZONE::LayerProperties(), THIEVING_SETTINGS::line_width, m_board, m_maxError, THIEVING_SETTINGS::orientation, SHAPE_POLY_SET::OutlineCount(), THIEVING_SETTINGS::pattern, SHAPE_POLY_SET::RemoveAllContours(), SHAPE_POLY_SET::Rotate(), RotatePoint(), SHAPE_LINE_CHAIN::SetClosed(), SQUARES, THIEVING_SETTINGS::stagger, TransformCircleToPolygon(), TransformTrapezoidToPolygon(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by fillCopperZone(), and fillNonCopperZone().

◆ addHatchFillTypeOnZone()

bool ZONE_FILLER::addHatchFillTypeOnZone ( const ZONE * aZone,
PCB_LAYER_ID aLayer,
PCB_LAYER_ID aDebugLayer,
SHAPE_POLY_SET & aFillPolys,
const SHAPE_POLY_SET & aThermalRings )
private

for zones having the ZONE_FILL_MODE::ZONE_FILL_MODE::HATCH_PATTERN, create a grid pattern in filled areas of aZone, giving to the filled polygons a fill style like a grid

Parameters
aZoneis the zone to modify
aFillPolysA reference to a SHAPE_POLY_SET buffer containing the initial filled areas, and after adding the grid pattern, the modified filled areas with holes
aThermalRingsThermal ring geometry used to drop hatch holes that would isolate thermal reliefs from the zone fill.

Definition at line 4303 of file zone_filler.cpp.

References SHAPE_POLY_SET::AddOutline(), SHAPE_LINE_CHAIN::Append(), SHAPE_LINE_CHAIN::Area(), SHAPE_LINE_CHAIN::BBox(), SHAPE_POLY_SET::BBox(), SHAPE_POLY_SET::BooleanIntersection(), SHAPE_POLY_SET::BooleanSubtract(), BOX2< Vec >::Centre(), SHAPE_POLY_SET::Chamfer(), CHAMFER_ALL_CORNERS, SHAPE_POLY_SET::ClearArcs(), SHAPE_POLY_SET::CloneDropTriangulation(), BOX2< Vec >::Contains(), SHAPE_LINE_CHAIN::CPoint(), SHAPE_POLY_SET::Deflate(), SHAPE_POLY_SET::DeletePolygon(), DUMP_POLYS_TO_COPPER_LAYER, SHAPE_POLY_SET::Fillet(), ZONE::GetBoardOutline(), BOX2< Vec >::GetBottom(), ZONE::GetHatchGap(), ZONE::GetHatchHoleMinArea(), ZONE::GetHatchOrientation(), ZONE::GetHatchSmoothingLevel(), ZONE::GetHatchSmoothingValue(), ZONE::GetHatchThickness(), ZONE::GetMinThickness(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), In10_Cu, In11_Cu, In12_Cu, In14_Cu, SHAPE_LINE_CHAIN::Intersect(), BOX2< Vec >::Intersects(), EDA_ANGLE::IsZero(), KiROUND(), ZONE::LayerProperties(), m_board, SHAPE_LINE_CHAIN::Move(), SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), pcbIUScale, SHAPE_LINE_CHAIN::PointCount(), SHAPE_LINE_CHAIN::PointInside(), SHAPE_LINE_CHAIN::Rotate(), SHAPE_POLY_SET::Rotate(), SHAPE_LINE_CHAIN::SetClosed(), SMOOTH_MIN_VAL_MM, SMOOTH_SMALL_VAL_MM, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by fillCopperZone(), and fillNonCopperZone().

◆ addHoleKnockout()

void ZONE_FILLER::addHoleKnockout ( PAD * aPad,
int aGap,
SHAPE_POLY_SET & aHoles )
private

Add a knockout for a pad's hole.

Definition at line 1946 of file zone_filler.cpp.

References ERROR_OUTSIDE, m_maxError, and PAD::TransformHoleToPolygon().

Referenced by buildCopperItemClearances(), and fillCopperZone().

◆ addKnockout() [1/2]

void ZONE_FILLER::addKnockout ( BOARD_ITEM * aItem,
PCB_LAYER_ID aLayer,
int aGap,
bool aIgnoreLineWidth,
SHAPE_POLY_SET & aHoles )
private

◆ addKnockout() [2/2]

void ZONE_FILLER::addKnockout ( BOARD_ITEM * aItem,
PCB_LAYER_ID aLayer,
int aGap,
SHAPE_POLY_SET & aHoles )
private

Add a knockout for a pad or via.

The knockout is 'aGap' larger than the pad (which might be either the thermal clearance or the electrical clearance).

Definition at line 1912 of file zone_filler.cpp.

References SHAPE_POLY_SET::Append(), BuildConvexHull(), CONVEXHULL, CUSTOM, ERROR_OUTSIDE, PAD::GetShape(), m_maxError, SHAPE_POLY_SET::NewOutline(), pad, PCB_PAD_T, BOARD_ITEM::TransformShapeToPolygon(), and EDA_ITEM::Type().

Referenced by buildCopperItemClearances(), fillNonCopperZone(), and knockoutThermalReliefs().

◆ buildCopperItemClearances()

void ZONE_FILLER::buildCopperItemClearances ( const ZONE * aZone,
PCB_LAYER_ID aLayer,
const std::vector< PAD * > & aNoConnectionPads,
SHAPE_POLY_SET & aHoles,
bool aIncludeZoneClearances = true )
private

◆ buildDifferentNetZoneClearances()

void ZONE_FILLER::buildDifferentNetZoneClearances ( const ZONE * aZone,
PCB_LAYER_ID aLayer,
SHAPE_POLY_SET & aHoles )
private

Build clearance knockout holes for higher-priority zones on different nets.

Builds clearance knockout holes for higher-priority zones on different nets.

Separated from buildCopperItemClearances to allow caching before zone knockouts.

This is separated from buildCopperItemClearances to allow caching before zone knockouts.

Definition at line 2819 of file zone_filler.cpp.

References SHAPE_POLY_SET::Append(), CLEARANCE_CONSTRAINT, ERROR_OUTSIDE, DRC_ENGINE::EvalRules(), ADVANCED_CFG::GetCfg(), DRC_CONSTRAINT::GetValue(), DRC_CONSTRAINT::IsNull(), m_board, BOARD_DESIGN_SETTINGS::m_DRCEngine, m_maxError, m_zoneIndex, MINOPTMAX< T >::Min(), pcbIUScale, PHYSICAL_CLEARANCE_CONSTRAINT, queryIndex(), SHAPE_POLY_SET::Simplify(), zoneKnockoutMayInteract(), and zoneKnockoutQueryBox().

Referenced by fillCopperZone().

◆ buildHatchZoneThermalRings()

void ZONE_FILLER::buildHatchZoneThermalRings ( const ZONE * aZone,
PCB_LAYER_ID aLayer,
const SHAPE_POLY_SET & aSmoothedOutline,
const std::vector< BOARD_ITEM * > & aThermalConnectionPads,
SHAPE_POLY_SET & aFillPolys,
SHAPE_POLY_SET & aThermalRings )
private

Build thermal rings for pads in hatch zones.

For circular pads, creates an arc ring; for other shapes, creates an inflated ring. Rings are clipped to the zone boundary.

Parameters
aThermalRingsOutput parameter to collect the thermal ring geometry. Used later to drop hatch holes that would isolate the thermal relief.

Definition at line 3985 of file zone_filler.cpp.

References SHAPE_POLY_SET::BooleanAdd(), SHAPE_POLY_SET::BooleanIntersection(), SHAPE_POLY_SET::BooleanSubtract(), CIRCLE, ERROR_OUTSIDE, DRC_ENGINE::EvalRules(), DRC_CONSTRAINT::GetValue(), m_board, BOARD_DESIGN_SETTINGS::m_DRCEngine, m_maxError, MINOPTMAX< T >::Min(), MINOPTMAX< T >::Opt(), OVAL, pad, PCB_PAD_T, PCB_VIA_T, THERMAL_RELIEF_GAP_CONSTRAINT, THERMAL_SPOKE_WIDTH_CONSTRAINT, TransformRingToPolygon(), via, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by fillCopperZone().

◆ buildItemIndexes()

void ZONE_FILLER::buildItemIndexes ( )
private

◆ buildThermalSpokes()

void ZONE_FILLER::buildThermalSpokes ( const ZONE * box,
PCB_LAYER_ID aLayer,
const std::vector< BOARD_ITEM * > & aSpokedPadsList,
std::deque< SHAPE_LINE_CHAIN > & aSpokes )
private

◆ connect_nearby_polys()

void ZONE_FILLER::connect_nearby_polys ( SHAPE_POLY_SET & aPolys,
double aDistance )
private

Create strands of zero-width between elements of SHAPE_POLY_SET that are within aDistance of each other.

When we inflate these strands, they will create minimum width bands

Definition at line 2926 of file zone_filler.cpp.

References SHAPE_POLY_SET::BBoxFromCaches(), SHAPE_LINE_CHAIN::CPoint(), VERTEX_CONNECTOR::FindResults(), VERTEX_CONNECTOR::GetResults(), SHAPE_LINE_CHAIN::Insert(), SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), and result.

Referenced by fillCopperZone(), and postKnockoutMinWidthPrune().

◆ Fill()

bool ZONE_FILLER::Fill ( const std::vector< ZONE * > & aZones,
bool aCheck = false,
wxWindow * aParent = nullptr )

Fills the given list of zones.

NB: Invalidates connectivity - it is up to the caller to obtain a lock on the connectivity data before calling Fill to prevent access to stale data by other coroutines (for example, ratsnest redraw). This will generally be required if a UI-based progress reporter has been installed.

Caller is also responsible for re-building connectivity afterwards.

Definition at line 588 of file zone_filler.cpp.

References _, SHAPE_POLY_SET::AddOutline(), LSET::AllCuMask(), ALWAYS, AREA, SHAPE_LINE_CHAIN::Area(), SHAPE_POLY_SET::Area(), SHAPE_POLY_SET::BooleanIntersection(), buildItemIndexes(), ZONE::CacheTriangulation(), ZONE::CalculateFilledArea(), center, SHAPE_POLY_SET::Contains(), KIDIALOG::DoNotShowCheckbox(), PADSTACK::Drill(), PADSTACK::DRILL_PROPS::end, ERROR_OUTSIDE, fillSingleZone(), ZONE::GetAssignedPriority(), BOARD_ITEM::GetBoard(), ZONE::GetBoardOutline(), ZONE::GetBoundingBox(), ADVANCED_CFG::GetCfg(), BOARD::GetCopperLayerCount(), ZONE::GetFilledPolysList(), ZONE::GetIslandRemovalMode(), ZONE::GetIsRuleArea(), GetKiCadThreadPool(), ZONE::GetLayerSet(), ZONE::GetMinIslandArea(), BOARD_CONNECTED_ITEM::GetNetCode(), ZONE::HasFilledPolysForLayer(), ZONE::HigherPriority(), index, BOX2< Vec >::Inflate(), LSET::InternalCuMask(), ZONE::IsCopperThieving(), ZONE::IsTeardropArea(), m_board, m_boardOutline, m_brdOutlinesValid, m_commit, m_debugZoneFiller, BOARD_DESIGN_SETTINGS::m_DRCEngine, m_preHatchSolidFillCache, m_progressReporter, m_refillResultCache, m_sameNetApronCache, m_worstClearance, ADVANCED_CFG::m_ZoneFillIterativeRefill, mayHoldOutOfBoardCopper(), SHAPE_POLY_SET::OutlineCount(), pad, PCB_VIA_T, process, refillZoneFromCache(), LSET::Seq(), BASE_SET::set(), ZONE::SetFilledPolysList(), ZONE::SetFillFlag(), ZONE::SetIsIsland(), KIDIALOG::SetOKCancelLabels(), KIDIALOG::ShowModal(), PADSTACK::DRILL_PROPS::start, START_END_ONLY, tp, PADSTACK::UnconnectedLayerMode(), via, VECTOR2< T >::x, VECTOR2< T >::y, ZLO_FORCE_FLASHED, ZLO_FORCE_NO_ZONE_CONNECTION, and zoneKnockoutMayInteract().

Referenced by BOOST_FIXTURE_TEST_CASE(), fill_bench_main_func(), KI_TEST::FillZones(), API_HANDLER_PCB::handleRefillZones(), ZONE_FILLER_TOOL::refillAroundGenerators(), and DIALOG_GLOBAL_EDIT_TEARDROPS::TransferDataFromWindow().

◆ fillCopperZone()

bool ZONE_FILLER::fillCopperZone ( const ZONE * aZone,
PCB_LAYER_ID aLayer,
PCB_LAYER_ID aDebugLayer,
const SHAPE_POLY_SET & aSmoothedOutline,
const SHAPE_POLY_SET & aMaxExtents,
SHAPE_POLY_SET & aFillPolys )
private

Function fillCopperZone Add non copper areas polygons (pads and tracks with clearance) to a filled copper area used in BuildFilledSolidAreasPolygons when calculating filled areas in a zone Non copper areas are pads and track and their clearance area The filled copper area must be computed before BuildFilledSolidAreasPolygons() call this function just after creating the filled copper area polygon (without clearance areas.

Parameters
aPcbthe current board

Definition at line 3049 of file zone_filler.cpp.

References addCopperThievingPattern(), addHatchFillTypeOnZone(), addHoleKnockout(), SHAPE_POLY_SET::AddOutline(), SHAPE_POLY_SET::BooleanAdd(), SHAPE_POLY_SET::BooleanIntersection(), SHAPE_POLY_SET::BooleanSubtract(), POLY_YSTRIPES_INDEX::Build(), buildCopperItemClearances(), buildDifferentNetZoneClearances(), buildHatchZoneThermalRings(), buildThermalSpokes(), CHAMFER_ALL_CORNERS, SHAPE_POLY_SET::CloneDropTriangulation(), connect_nearby_polys(), POLY_YSTRIPES_INDEX::Contains(), COPPER_THIEVING, SHAPE_POLY_SET::Deflate(), SHAPE_POLY_SET::DeletePolygon(), dropSubResolutionOutlines(), DUMP_POLYS_TO_COPPER_LAYER, epsilon, ERROR_OUTSIDE, SHAPE_POLY_SET::Fracture(), ZONE::GetBoundingBox(), ADVANCED_CFG::GetCfg(), ZONE::GetFillMode(), ZONE::GetMinThickness(), BOX2< Vec >::GetSizeMax(), HATCH_PATTERN, In10_Cu, In15_Cu, In16_Cu, In17_Cu, In18_Cu, In19_Cu, In1_Cu, In2_Cu, In3_Cu, In4_Cu, In5_Cu, In6_Cu, In7_Cu, In8_Cu, In9_Cu, SHAPE_POLY_SET::Inflate(), ZONE::IsTeardropArea(), knockoutThermalReliefs(), m_board, m_cacheMutex, m_debugZoneFiller, m_maxError, m_preHatchSolidFillCache, m_preKnockoutFillCache, m_progressReporter, m_sameNetApronCache, ADVANCED_CFG::m_ZoneFillIterativeRefill, BOX2< Vec >::Merge(), SHAPE_POLY_SET::OutlineCount(), PCB_PAD_T, PCB_VIA_T, pcbIUScale, SHAPE_POLY_SET::Polygon(), postKnockoutMinWidthPrune(), ROUND_ALL_CORNERS, SHAPE_POLY_SET::Simplify(), subtractHigherPriorityZones(), TransformCircleToPolygon(), and via.

Referenced by fillSingleZone().

◆ fillNonCopperZone()

◆ fillSingleZone()

bool ZONE_FILLER::fillSingleZone ( ZONE * aZone,
PCB_LAYER_ID aLayer,
SHAPE_POLY_SET & aFillPolys )
private

Build the filled solid areas polygons from zone outlines (stored in m_Poly) The solid areas can be more than one on copper layers, and do not have holes ( holes are linked by overlapping segments to the main outline) in order to have drawable (and plottable) filled polygons.

Returns
true if OK, false if the solid polygons cannot be built
Parameters
aZoneis the zone to fill
aFillPolysA reference to a SHAPE_POLY_SET buffer to store polygons with no holes (holes are linked to main outline by overlapping segments, and these polygons are shrunk by aZone->GetMinThickness() / 2 to be drawn with a outline thickness = aZone->GetMinThickness() aFillPolys are polygons that will be drawn on screen and plotted

Definition at line 3573 of file zone_filler.cpp.

References ZONE::BuildSmoothedPoly(), F_Cu, fillCopperZone(), fillNonCopperZone(), LSET::InternalCuMask(), ZONE::IsOnCopperLayer(), m_boardOutline, m_brdOutlinesValid, m_debugZoneFiller, m_progressReporter, ZONE::SetNeedRefill(), and UNDEFINED_LAYER.

Referenced by Fill().

◆ GetProgressReporter()

PROGRESS_REPORTER * ZONE_FILLER::GetProgressReporter ( ) const
inline

Definition at line 47 of file zone_filler.h.

References m_progressReporter.

◆ IsDebug()

bool ZONE_FILLER::IsDebug ( ) const
inline

Definition at line 61 of file zone_filler.h.

References m_debugZoneFiller.

◆ knockoutThermalReliefs()

void ZONE_FILLER::knockoutThermalReliefs ( const ZONE * aZone,
PCB_LAYER_ID aLayer,
SHAPE_POLY_SET & aFill,
std::vector< BOARD_ITEM * > & aThermalConnectionPads,
std::vector< PAD * > & aNoConnectionPads,
std::vector< BOARD_ITEM * > & aSolidConnectionItems )
private

◆ mayHoldOutOfBoardCopper()

bool ZONE_FILLER::mayHoldOutOfBoardCopper ( const ZONE * aZone) const
private

True if the fill of aZone can reach outside the board outline.

Definition at line 518 of file zone_filler.cpp.

References ZONE_SETTINGS::CHAMFER, ZONE_SETTINGS::FILLET, ZONE::GetCornerSmoothingType(), ZONE::IsTeardropArea(), and m_brdOutlinesValid.

Referenced by Fill().

◆ postKnockoutMinWidthPrune()

void ZONE_FILLER::postKnockoutMinWidthPrune ( const ZONE * aZone,
SHAPE_POLY_SET & aFillPolys,
const SHAPE_POLY_SET & aSameNetApron )
private

Remove minimum-width violations introduced by zone-to-zone knockouts.

Runs a deflate/reconnect/inflate cycle and intersects with the pre-deflate boundary to avoid re-inflating into cleared areas.

Parameters
aSameNetAproncopper an abutting same-net zone will supply just outside this zone's boundary. It is unioned in for the deflate/inflate cycle and clipped back off afterwards, so a shared border is not treated as a convex corner and rounded away.

Definition at line 2987 of file zone_filler.cpp.

References SHAPE_POLY_SET::BooleanAdd(), SHAPE_POLY_SET::BooleanIntersection(), CHAMFER_ALL_CORNERS, SHAPE_POLY_SET::CloneDropTriangulation(), connect_nearby_polys(), SHAPE_POLY_SET::Deflate(), SHAPE_POLY_SET::DeletePolygon(), epsilon, SHAPE_POLY_SET::Fracture(), ZONE::GetMinThickness(), BOX2< Vec >::GetSizeMax(), SHAPE_POLY_SET::Inflate(), m_maxError, BOX2< Vec >::Merge(), SHAPE_POLY_SET::OutlineCount(), pcbIUScale, SHAPE_POLY_SET::Polygon(), and ROUND_ALL_CORNERS.

Referenced by fillCopperZone(), and refillZoneFromCache().

◆ queryIndex()

◆ refillZoneFromCache()

bool ZONE_FILLER::refillZoneFromCache ( ZONE * aZone,
PCB_LAYER_ID aLayer,
SHAPE_POLY_SET & aFillPolys,
const FillSnapshot * aSnapshot = nullptr )
private

◆ SetProgressReporter()

void ZONE_FILLER::SetProgressReporter ( PROGRESS_REPORTER * aReporter)

Definition at line 397 of file zone_filler.cpp.

References m_progressReporter.

Referenced by DIALOG_GLOBAL_EDIT_TEARDROPS::TransferDataFromWindow().

◆ subtractHigherPriorityZones()

void ZONE_FILLER::subtractHigherPriorityZones ( const ZONE * aZone,
PCB_LAYER_ID aLayer,
SHAPE_POLY_SET & aRawFill )
private

Removes the outlines of higher-proirity zones with the same net.

These zones should be in charge of the fill parameters within their own outlines.

Definition at line 2886 of file zone_filler.cpp.

References SHAPE_POLY_SET::BooleanSubtract(), ZONE::GetAssignedPriority(), ZONE::GetBoundingBox(), ZONE::IsTeardropArea(), m_zoneIndex, SHAPE_POLY_SET::OutlineCount(), queryIndex(), and ZONE::SameNet().

Referenced by fillCopperZone().

◆ zoneKnockoutMayInteract()

bool ZONE_FILLER::zoneKnockoutMayInteract ( const ZONE * aZone,
const ZONE * aKnockout ) const
private

Test whether aKnockout's fill can knock out any part of aZone's fill.

Every reader of another zone's fill must gate on this same predicate; see the implementation for why and for the reach rationale.

Definition at line 549 of file zone_filler.cpp.

References ZONE_SETTINGS::CHAMFER, SHAPE_POLY_SET::Collide(), ZONE_SETTINGS::FILLET, ZONE::GetBoardOutline(), ZONE::GetBoundingBox(), ZONE::GetMinThickness(), BOX2< Vec >::Inflate(), BOX2< Vec >::Intersects(), m_board, m_worstClearance, and m_zoneKnockoutSlack.

Referenced by buildCopperItemClearances(), buildDifferentNetZoneClearances(), Fill(), and refillZoneFromCache().

◆ zoneKnockoutQueryBox()

BOX2I ZONE_FILLER::zoneKnockoutQueryBox ( const ZONE * aZone) const
private

Member Data Documentation

◆ m_board

◆ m_boardOutline

SHAPE_POLY_SET ZONE_FILLER::m_boardOutline
private

Definition at line 249 of file zone_filler.h.

Referenced by Fill(), and fillSingleZone().

◆ m_brdOutlinesValid

bool ZONE_FILLER::m_brdOutlinesValid
private

Definition at line 250 of file zone_filler.h.

Referenced by Fill(), fillSingleZone(), mayHoldOutOfBoardCopper(), and ZONE_FILLER().

◆ m_cacheMutex

std::mutex ZONE_FILLER::m_cacheMutex
mutableprivate

Definition at line 287 of file zone_filler.h.

Referenced by fillCopperZone(), and refillZoneFromCache().

◆ m_commit

COMMIT* ZONE_FILLER::m_commit
private

Definition at line 251 of file zone_filler.h.

Referenced by Fill(), and ZONE_FILLER().

◆ m_debugZoneFiller

bool ZONE_FILLER::m_debugZoneFiller
private

Definition at line 270 of file zone_filler.h.

Referenced by Fill(), fillCopperZone(), fillSingleZone(), IsDebug(), and ZONE_FILLER().

◆ m_footprintIndex

ITEM_RTREE ZONE_FILLER::m_footprintIndex
private

Definition at line 256 of file zone_filler.h.

Referenced by buildCopperItemClearances(), and buildItemIndexes().

◆ m_graphicIndex

ITEM_RTREE ZONE_FILLER::m_graphicIndex
private

Definition at line 255 of file zone_filler.h.

Referenced by buildCopperItemClearances(), and buildItemIndexes().

◆ m_maxError

◆ m_maxZoneCornerRadius

int ZONE_FILLER::m_maxZoneCornerRadius
private

Definition at line 268 of file zone_filler.h.

Referenced by buildItemIndexes(), ZONE_FILLER(), and zoneKnockoutQueryBox().

◆ m_padIndex

ITEM_RTREE ZONE_FILLER::m_padIndex
private

Definition at line 257 of file zone_filler.h.

Referenced by buildItemIndexes(), and knockoutThermalReliefs().

◆ m_preHatchSolidFillCache

std::map<std::pair<const ZONE*, PCB_LAYER_ID>, SHAPE_POLY_SET> ZONE_FILLER::m_preHatchSolidFillCache
private

Definition at line 277 of file zone_filler.h.

Referenced by Fill(), fillCopperZone(), and refillZoneFromCache().

◆ m_preKnockoutFillCache

std::map<std::pair<const ZONE*, PCB_LAYER_ID>, SHAPE_POLY_SET> ZONE_FILLER::m_preKnockoutFillCache
private

Definition at line 274 of file zone_filler.h.

Referenced by fillCopperZone(), and refillZoneFromCache().

◆ m_progressReporter

◆ m_refillResultCache

std::map<std::pair<const ZONE*, PCB_LAYER_ID>, std::pair<HASH_128, SHAPE_POLY_SET> > ZONE_FILLER::m_refillResultCache
private

Definition at line 286 of file zone_filler.h.

Referenced by Fill(), and refillZoneFromCache().

◆ m_sameNetApronCache

std::map<std::pair<const ZONE*, PCB_LAYER_ID>, SHAPE_POLY_SET> ZONE_FILLER::m_sameNetApronCache
private

Definition at line 281 of file zone_filler.h.

Referenced by Fill(), fillCopperZone(), and refillZoneFromCache().

◆ m_trackIndex

std::map<PCB_LAYER_ID, ITEM_RTREE> ZONE_FILLER::m_trackIndex
private

Definition at line 258 of file zone_filler.h.

Referenced by buildCopperItemClearances(), and buildItemIndexes().

◆ m_worstClearance

int ZONE_FILLER::m_worstClearance
private

◆ m_zoneIndex

◆ m_zoneKnockoutSlack

int ZONE_FILLER::m_zoneKnockoutSlack
private

Definition at line 265 of file zone_filler.h.

Referenced by ZONE_FILLER(), zoneKnockoutMayInteract(), and zoneKnockoutQueryBox().


The documentation for this class was generated from the following files: