36#include <math_for_graphics.h>
76 m_CornerSelection( nullptr )
98 board->IncrementTimeStamp();
182 return new ZONE( *
this );
215 change |= !pair.second->IsEmpty();
217 pair.second->RemoveAllContours();
268 if( aLayerSet.count() == 0 )
300 aLayers[ aCount++ ] = layer;
311 constexpr double HIDE = std::numeric_limits<double>::max();
327 std::unordered_map<const ZONE*, BOX2I>& cache = board->m_ZoneBBoxCache;
328 auto cacheIter = cache.find(
this );
330 if( cacheIter != cache.end() )
331 return cacheIter->second;
335 std::unique_lock<std::mutex> cacheLock(
const_cast<BOARD*
>( board )->m_CachesMutex );
336 cache[ this ] = bbox;
348 std::unordered_map<const ZONE*, BOX2I>& cache = board->
m_ZoneBBoxCache;
350 auto cacheIter = cache.find(
this );
352 if( cacheIter == cache.end() )
354 std::unique_lock<std::mutex> cacheLock( board->
m_CachesMutex );
365 *aSource =
_(
"zone" );
451 for(
int ii = 0; ii < count; ii++ )
476 *aSource =
_(
"zone" );
528 msg << wxT(
" " ) <<
_(
"Cutout" );
530 aList.emplace_back(
_(
"Type" ), msg );
552 aList.emplace_back(
_(
"Restrictions" ), msg );
560 aList.emplace_back(
_(
"Resolved Netclass" ),
565 aList.emplace_back(
_(
"Priority" ),
572 aList.emplace_back(
_(
"Status" ),
_(
"Locked" ) );
587 layerDesc.Printf(
_(
"%s and %d more" ), layerDesc, count - 1 );
589 aList.emplace_back(
_(
"Layer" ), layerDesc );
598 default: msg =
_(
"Unknown" );
break;
601 aList.emplace_back(
_(
"Fill Mode" ), msg );
603 aList.emplace_back(
_(
"Filled Area" ),
609 if( !source.IsEmpty() )
622 count += ii.second->TotalVertices();
624 aList.emplace_back(
_(
"Corner Count" ),
wxString::Format( wxT(
"%d" ), count ) );
638 pair.second->Move( offset );
650 if( it !=
GetBoard()->m_ZoneBBoxCache.end() )
651 it->second.Move( offset );
659 return _(
"Rule Area" );
661 return _(
"Teardrop Area" );
663 return _(
"Copper Zone" );
665 return _(
"Non-copper Zone" );
691 pair.second->Rotate( aAngle, aCentre );
697 Mirror( aCentre, aFlipLeftRight );
705 m_Poly->
Mirror( aMirrorLeftRight, !aMirrorLeftRight, aMirrorRef );
710 pair.second->Mirror( aMirrorLeftRight, !aMirrorLeftRight, aMirrorRef );
745 if( aPolygon.empty() )
751 for(
const VECTOR2I& pt : aPolygon )
772 m_Poly->
Append( aPosition.
x, aPosition.
y, -1, aHoleIdx, aAllowDuplication );
794 layerDesc.Printf(
_(
"%s and %d more" ), layerDesc, count - 1 );
821 int aBorderHatchPitch,
bool aRebuildBorderHatch )
823 aBorderHatchPitch = std::max( aBorderHatchPitch,
825 aBorderHatchPitch = std::min( aBorderHatchPitch,
830 if( aRebuildBorderHatch )
851 return tst.
x < ref.
x;
874 if( iterator->x < min_x )
877 if( iterator->x > max_x )
880 if( iterator->y < min_y )
883 if( iterator->y > max_y )
900 int slope_flag = (layer & 1) ? 1 : -1;
901 double slope = 0.707106 * slope_flag;
904 if( slope_flag == 1 )
906 max_a =
KiROUND( max_y - slope * min_x );
907 min_a =
KiROUND( min_y - slope * max_x );
911 max_a =
KiROUND( max_y - slope * max_x );
912 min_a =
KiROUND( min_y - slope * min_x );
915 min_a = (min_a / spacing) * spacing;
919 int offset = (layer * 7) / 8;
923 std::vector<VECTOR2I> pointbuffer;
924 pointbuffer.reserve( 256 );
926 for(
int a = min_a; a < max_a; a += spacing )
933 const SEG seg = *iterator;
936 if( FindLineSegmentIntersection( a, slope, seg.
A.
x, seg.
A.
y, seg.
B.
x, seg.
B.
y, x, y ) )
943 if( pointbuffer.size() > 2 )
947 for(
size_t ip = 0; ip + 1 < pointbuffer.size(); ip += 2 )
949 int dx = pointbuffer[ip + 1].x - pointbuffer[ip].x;
955 ||
std::abs( dx ) < 2 * hatch_line_len )
961 double dy = pointbuffer[ip + 1].y - pointbuffer[ip].y;
967 dx = -hatch_line_len;
969 int x1 =
KiROUND( pointbuffer[ip].x + dx );
970 int x2 =
KiROUND( pointbuffer[ip + 1].x - dx );
971 int y1 =
KiROUND( pointbuffer[ip].y + dx * slope );
972 int y2 =
KiROUND( pointbuffer[ip + 1].y - dx * slope );
1001 std::swap( *
static_cast<ZONE*
>(
this ), *
static_cast<ZONE*
>( aImage) );
1010 poly->CacheTriangulation();
1035 std::vector<ZONE*>* aOtherNetIntersectingZones )
const
1044 if( candidate ==
this )
1047 if( !candidate->GetLayerSet().test( aLayer ) )
1050 if( candidate->GetIsRuleArea() || candidate->IsTeardropArea() )
1053 if( !candidate->GetBoundingBox().Intersects( bbox ) )
1056 if( candidate->GetNetCode() ==
GetNetCode() )
1059 aSameNetCollidingZones->push_back( candidate );
1063 aOtherNetIntersectingZones->push_back( candidate );
1084 aSmoothedPoly = flattened;
1090 bool keepExternalFillets =
false;
1097 smooth_requested =
false;
1110 if( !smooth_requested )
1133 aSmoothedPoly = flattened;
1138 if( keepExternalFillets && smooth_requested )
1140 withFillets = flattened;
1141 smooth( withFillets );
1143 maxExtents = &withFillets;
1151 std::vector<ZONE*> sameNetCollidingZones;
1152 std::vector<ZONE*> otherNetIntersectingZones;
1155 for(
ZONE* sameNetZone : sameNetCollidingZones )
1157 BOX2I sameNetBoundingBox = sameNetZone->GetBoundingBox();
1164 for(
ZONE* otherNetZone : otherNetIntersectingZones )
1166 if( otherNetZone->HigherPriority( sameNetZone )
1167 && otherNetZone->GetBoundingBox().Intersects( sameNetBoundingBox ) )
1179 smooth( aSmoothedPoly );
1181 if( aSmoothedPolyWithApron )
1185 *aSmoothedPolyWithApron = aSmoothedPoly;
1203 std::shared_ptr<SHAPE_POLY_SET>& poly = pair.second;
1205 for(
int i = 0; i < poly->OutlineCount(); i++ )
1207 m_area += poly->Outline( i ).Area();
1209 for(
int j = 0; j < poly->HoleCount( i ); j++ )
1210 m_area -= poly->Hole( i, j ).Area();
1248 aClearance += aMaxError;
1250 polybuffer.
Inflate( aClearance, segCount );
1254 aBuffer.
Append( polybuffer );
1259 ZONE( aParent, true )
1289 constexpr double HIDE = (double)std::numeric_limits<double>::max();
1314 return std::make_shared<SHAPE_NULL>();
1321 int aError,
ERROR_LOC aErrorLoc,
bool aIgnoreLineWidth )
const
1323 wxASSERT_MSG( !aIgnoreLineWidth, wxT(
"IgnoreLineWidth has no meaning for zones." ) );
1340 aClearance += aError;
1344 aBuffer.
Append( temp_buf );
1361 if( layerEnum.
Choices().GetCount() == 0 )
1371 if( zcMap.
Choices().GetCount() == 0 )
1383 if( zfmMap.
Choices().GetCount() == 0 )
1400 posX->SetIsInternal(
true );
1406 posY->SetIsInternal(
true );
1414 if(
ZONE* zone =
dynamic_cast<ZONE*
>( aItem ) )
1415 return !zone->GetIsRuleArea() &&
IsCopperLayer( zone->GetFirstLayer() );
1420 auto isHatchedFill =
1423 if(
ZONE* zone =
dynamic_cast<ZONE*
>( aItem ) )
1431 layer->SetIsInternal(
true );
1435 _HKI(
"Net" ), isCopperZone );
1437 _HKI(
"Net Class" ), isCopperZone );
1441 priority->SetAvailableFunc( isCopperZone );
1447 const wxString groupFill =
_HKI(
"Fill Style" );
1455 hatchOrientation->SetWriteableFunc( isHatchedFill );
1456 propMgr.
AddProperty( hatchOrientation, groupFill );
1462 hatchWidth->SetWriteableFunc( isHatchedFill );
1469 hatchGap->SetWriteableFunc( isHatchedFill );
1476 const wxString groupOverrides =
_HKI(
"Overrides" );
1481 clearanceOverride->SetAvailableFunc( isCopperZone );
1486 minWidth->SetAvailableFunc( isCopperZone );
1490 padConnections->SetAvailableFunc( isCopperZone );
1495 thermalGap->SetAvailableFunc( isCopperZone );
1500 thermalSpokeWidth->SetAvailableFunc( isCopperZone );
1502 propMgr.
AddProperty( clearanceOverride, groupOverrides );
1504 propMgr.
AddProperty( padConnections, groupOverrides );
1505 propMgr.
AddProperty( thermalGap, groupOverrides );
1506 propMgr.
AddProperty( thermalSpokeWidth, groupOverrides );
constexpr int ARC_HIGH_DEF
constexpr EDA_IU_SCALE pcbIUScale
BITMAPS
A list of all bitmap identifiers.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
wxString GetNetnameMsg() const
virtual NETCLASS * GetEffectiveNetClass() const
Return the NETCLASS for this item.
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
wxString GetNetname() const
NETINFO_ITEM * m_netinfo
Store all information about the net that item belongs to.
virtual int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const
Return an item's "own" clearance in internal units.
Container for design settings for a BOARD object.
bool m_ZoneKeepExternalFillets
Abstract interface for BOARD_ITEMs capable of storing other items inside.
virtual const ZONE_SETTINGS & GetZoneSettings() const
Fetch the zone settings for this container.
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.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
virtual bool IsLocked() const
BOARD_ITEM_CONTAINER * GetParent() const
Information pertinent to a Pcbnew printed circuit board.
std::unordered_map< const ZONE *, BOX2I > m_ZoneBBoxCache
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
bool Intersects(const BOX2< Vec > &aRect) const
bool Contains(const Vec &aPoint) const
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Assign the members of aItem to another object.
KICAD_T Type() const
Returns the type of object.
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
ENUM_MAP & Map(T aValue, const wxString &aName)
static ENUM_MAP< T > & Instance()
ENUM_MAP & Undefined(T aValue)
A specialization of ZONE for use in footprints.
FP_ZONE(BOARD_ITEM_CONTAINER *aParent)
FP_ZONE & operator=(const FP_ZONE &aOther)
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Class that other classes need to inherit from, in order to be inspectable.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
LSET is a set of PCB_LAYER_IDs.
static LSET AllLayersMask()
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static const wxChar * Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
int GetLocalThermalGapOverride(wxString *aSource=nullptr) const
Provide class metadata.Helper macro to map type hashes to names.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
void AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
void OverrideAvailability(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName, std::function< bool(INSPECTABLE *)> aFunc)
Sets an override availability functor for a base class property of a given derived class.
void ReplaceProperty(size_t aBase, const wxString &aName, PROPERTY_BASE *aNew, const wxString &aGroup=wxEmptyString)
Replace an existing property for a specific type.
bool PointInside(const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const
Check if point aP lies inside a polygon (any type) defined by the line chain.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
bool IsClosed() const override
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
Represent a set of closed polygons.
void Rotate(const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.
bool CollideEdge(const VECTOR2I &aPoint, VERTEX_INDEX *aClosestVertex=nullptr, int aClearance=0) const
Check whether aPoint collides with any edge of any of the contours of the polygon.
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset intersection For aFastMode meaning, see function booleanOp.
ITERATOR IterateWithHoles(int aOutline)
void Fracture(POLYGON_MODE aFastMode)
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes.
void ClearArcs()
Appends a vertex at the end of the given outline/hole (default: the last outline)
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
double Area()
Count the number of arc shapes present.
void SetVertex(const VERTEX_INDEX &aIndex, const VECTOR2I &aPos)
Accessor function to set the position of a specific point.
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset difference For aFastMode meaning, see function booleanOp.
void CacheTriangulation(bool aPartition=true, bool aSimplify=false)
Build a polygon triangulation, needed to draw a polygon on OpenGL and in some other calculations.
bool Collide(const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance,...
int TotalVertices() const
Delete aIdx-th polygon from the set.
void Inflate(int aAmount, int aCircleSegCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
Perform outline inflation/deflation.
void BooleanIntersection(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset union between a and b, store the result in it self For aFastMode meaning,...
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...
bool GetNeighbourIndexes(int aGlobalIndex, int *aPrevious, int *aNext)
Return the global indexes of the previous and the next corner of the aGlobalIndex-th corner of a cont...
int AddHole(const SHAPE_LINE_CHAIN &aHole, int aOutline=-1)
Return the area of this poly set.
void Mirror(bool aX=true, bool aY=false, const VECTOR2I &aRef={ 0, 0 })
Mirror the line points about y or x (or both)
SHAPE_LINE_CHAIN & Outline(int aIndex)
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the aIndex-th subpolygon in the set.
int NewOutline()
Creates a new hole in a given outline.
bool CollideVertex(const VECTOR2I &aPoint, VERTEX_INDEX *aClosestVertex=nullptr, int aClearance=0) const
Check whether aPoint collides with any vertex of any of the contours of the polygon.
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
int OutlineCount() const
Return the number of vertices in a given outline/hole.
void Move(const VECTOR2I &aVector) override
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, int aAccuracy=0, bool aUseBBoxCaches=false) const
Return true if a given subpolygon contains the point aP.
SHAPE_POLY_SET CloneDropTriangulation() const
Creates a new empty polygon in the set and returns its index.
void InflateWithLinkedHoles(int aFactor, int aCircleSegmentsCount, POLYGON_MODE aFastMode)
Perform outline inflation/deflation, using round corners.
SEGMENT_ITERATOR IterateSegmentsWithHoles()
Return an iterator object, for the aOutline-th outline in the set (with holes).
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
void ExportSetting(ZONE &aTarget, bool aFullExport=true) const
Function ExportSetting copy settings to a given zone.
Handle a list of polygons defining a copper zone.
void SetHatchThickness(int aThickness)
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
void SetNeedRefill(bool aNeedRefill)
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if a point is near an outline edge or a corner of this zone.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
ZONE & operator=(const ZONE &aOther)
int m_cornerSmoothingType
void Mirror(const VECTOR2I &aMirrorRef, bool aMirrorLeftRight)
Mirror the outlines relative to a given horizontal axis the layer is not changed.
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
bool UnFill()
Removes the zone filling.
bool GetDoNotAllowVias() const
void TransformSolidAreasShapesToPolygon(PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aBuffer) const
Convert solid areas full shapes to polygon set (the full shape is the polygon area with a thick outli...
void SetCornerRadius(unsigned int aRadius)
ZONE_FILL_MODE m_fillMode
How to fill areas:
bool m_doNotAllowFootprints
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
void AddPolygon(std::vector< VECTOR2I > &aPolygon)
Add a polygon to the zone outline.
double m_hatchSmoothingValue
void SetLocalFlags(int aFlags)
void TransformSmoothedOutlineToPolygon(SHAPE_POLY_SET &aBuffer, int aClearance, int aError, ERROR_LOC aErrorLoc, SHAPE_POLY_SET *aBoardOutline) const
Convert the outlines shape to a polygon with no holes inflated (optional) by max( aClearanceValue,...
int m_thermalReliefSpokeWidth
bool HitTestCutout(const VECTOR2I &aRefPos, int *aOutlineIdx=nullptr, int *aHoleIdx=nullptr) const
Test if the given point is contained within a cutout of the zone.
EDA_ANGLE m_hatchOrientation
void CacheTriangulation(PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
Create a list of triangles that "fill" the solid areas used for instance to draw these solid areas on...
std::map< PCB_LAYER_ID, std::set< int > > m_insulatedIslands
For each layer, a set of insulated islands that were not removed.
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
std::map< PCB_LAYER_ID, std::shared_ptr< SHAPE_POLY_SET > > m_FilledPolysList
void SetBorderDisplayStyle(ZONE_BORDER_DISPLAY_STYLE aBorderHatchStyle, int aBorderHatchPitch, bool aRebuilBorderdHatch)
Set all hatch parameters for the zone.
MD5_HASH GetHashValue(PCB_LAYER_ID aLayer)
bool GetDoNotAllowPads() const
const BOX2I GetBoundingBox() const override
void SetMinThickness(int aMinThickness)
wxString GetFriendlyName() const override
bool GetDoNotAllowTracks() const
int GetLocalFlags() const
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
void SetHatchOrientation(const EDA_ANGLE &aStep)
bool m_doNotAllowCopperPour
bool m_needRefill
False when a zone was refilled, true after changes in zone params.
virtual void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
bool HitTestForCorner(const VECTOR2I &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX *aCornerHit=nullptr) const
Test if the given VECTOR2I is near a corner.
void SetThermalReliefSpokeWidth(int aThermalReliefSpokeWidth)
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.
LSET m_fillFlags
Temp variables used while filling.
void Move(const VECTOR2I &offset) override
Move the outlines.
bool IsIsland(PCB_LAYER_ID aLayer, int aPolyIdx) const
Check if a given filled polygon is an insulated island.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
TEARDROP_TYPE m_teardropType
int m_hatchSmoothingLevel
int GetLocalClearance() const
void SetIsRuleArea(bool aEnable)
wxString GetZoneName() const
void CacheBoundingBox()
Used to preload the zone bounding box cache so we don't have to worry about mutex-locking it each tim...
int GetMinThickness() const
virtual void swapData(BOARD_ITEM *aImage) override
bool HitTestForEdge(const VECTOR2I &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX *aCornerHit=nullptr) const
Test if the given VECTOR2I is near a segment defined by 2 corners.
void RemoveCutout(int aOutlineIdx, int aHoleIdx)
Remove a cutout from the zone.
void Rotate(const VECTOR2I &aCentre, const EDA_ANGLE &aAngle) override
Rotate the outlines.
bool HigherPriority(const ZONE *aOther) const
bool HitTestFilledArea(PCB_LAYER_ID aLayer, const VECTOR2I &aRefPos, int aAccuracy=0) const
Test if the given VECTOR2I is within the bounds of a filled area of this zone.
void SetFillMode(ZONE_FILL_MODE aFillMode)
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
ZONE_CONNECTION GetPadConnection() const
void InitDataFromSrcInCopyCtor(const ZONE &aZone)
Copy aZone data to me.
int GetHatchThickness() const
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
virtual bool IsOnLayer(PCB_LAYER_ID) const override
Test to see if this object is on the given layer.
int m_hatchBorderAlgorithm
bool IsTeardropArea() const
std::vector< SEG > m_borderHatchLines
VECTOR2I GetPosition() const override
int GetThermalReliefSpokeWidth() const
int GetBorderHatchPitch() const
HatchBorder related methods.
void SetLocalClearance(int aClearance)
void BuildHashValue(PCB_LAYER_ID aLayer)
Build the hash value of m_FilledPolysList, and store it internally in m_filledPolysHash.
void SetThermalReliefGap(int aThermalReliefGap)
EDA_ANGLE GetHatchOrientation() const
void SetLayerSet(LSET aLayerSet) override
bool BuildSmoothedPoly(SHAPE_POLY_SET &aSmoothedPoly, PCB_LAYER_ID aLayer, SHAPE_POLY_SET *aBoardOutline, SHAPE_POLY_SET *aSmoothedPolyWithApron=nullptr) const
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
bool GetDoNotAllowFootprints() const
ZONE_FILL_MODE GetFillMode() const
double m_hatchHoleMinArea
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
bool GetDoNotAllowCopperPour() const
void SetBorderHatchPitch(int aPitch)
Set the hatch pitch parameter for the zone.
void GetInteractingZones(PCB_LAYER_ID aLayer, std::vector< ZONE * > *aSameNetCollidingZones, std::vector< ZONE * > *aOtherNetIntersectingZones) const
Some intersecting zones, despite being on the same layer with the same net, cannot be merged due to o...
double CalculateOutlineArea()
Compute the area of the zone outline (not the filled area).
bool IsConflicting() const
For rule areas which exclude footprints (and therefore participate in courtyard conflicts during move...
std::map< PCB_LAYER_ID, MD5_HASH > m_filledPolysHash
A hash value used in zone filling calculations to see if the filled areas are up to date.
ISLAND_REMOVAL_MODE m_islandRemovalMode
bool m_isFilled
True when a zone was filled, false after deleting the filled areas.
ZONE(BOARD_ITEM_CONTAINER *parent, bool aInFP=false)
The ctor to build ZONE, but compatible with FP_ZONE requirement.
bool AppendCorner(VECTOR2I aPosition, int aHoleIdx, bool aAllowDuplication=false)
Add a new corner to the zone outline (to the main outline or a hole)
void MoveEdge(const VECTOR2I &offset, int aEdge)
Move the outline Edge.
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
bool IsOnCopperLayer() const override
double CalculateFilledArea()
Compute the area currently occupied by the zone fill.
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the zone shape to a closed polygon Used in filling zones calculations Circles and arcs are ap...
void SetAssignedPriority(unsigned aPriority)
unsigned int m_cornerRadius
void SetPadConnection(ZONE_CONNECTION aPadConnection)
void SetZoneName(const wxString &aName)
void UnHatchBorder()
Clear the zone's hatch.
PCB_LAYER_ID GetFirstLayer() const
ZONE_CONNECTION m_PadConnection
int GetThermalReliefGap() const
void SetHatchGap(int aStep)
static int GetDefaultHatchPitch()
unsigned GetAssignedPriority() const
int GetNumCorners(void) const
Access to m_Poly parameters.
bool SameNet(const ZONE *aOther) const
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
long long int m_minIslandArea
When island removal mode is set to AREA, islands below this area will be removed.
static constexpr EDA_ANGLE & FULL_CIRCLE
#define PCB_EDIT_FRAME_NAME
#define COURTYARD_CONFLICT
temporary set when moving footprints having courtyard overlapping
a few functions useful in geometry calculations.
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
int GetArcToSegmentCount(int aRadius, int aErrorMax, const EDA_ANGLE &aArcAngle)
Some functions to handle hotkeys in KiCad.
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
@ LAYER_CONFLICTS_SHADOW
shadow layer for items flagged conficting
@ LAYER_ZONES
Control for copper zone opacity/visibility (color ignored)
@ LAYER_MOD_FR
show footprints on front
@ LAYER_ZONE_START
Virtual layers for stacking zones and tracks on a given copper layer.
@ LAYER_MOD_BK
show footprints on back
PCB_LAYER_ID
A quick note on layer IDs:
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint.
constexpr int Mils2IU(const EDA_IU_SCALE &aIuScale, int mils)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
#define IMPLEMENT_ENUM_TO_WXANY(type)
#define NO_SETTER(owner, type)
@ PT_DEGREE
Angle expressed in degrees.
@ PT_COORD
Coordinate expressed in distance units (mm/inch)
@ PT_SIZE
Size expressed in distance units (mm/inch)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
wxString UnescapeString(const wxString &aSource)
void AccumulateDescription(wxString &aDesc, const wxString &aItem)
Utility to build comma separated lists in messages.
constexpr int mmToIU(double mm) const
Structure to hold the necessary information in order to index a vertex on a SHAPE_POLY_SET object: th...
@ PCB_ZONE_T
class ZONE, a copper pour area
@ PCB_FP_ZONE_T
class ZONE, managed by a footprint
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
static SHAPE_POLY_SET g_nullPoly
bool sortEndsByDescendingX(const VECTOR2I &ref, const VECTOR2I &tst)
static struct ZONE_DESC _ZONE_DESC
ZONE_BORDER_DISPLAY_STYLE
Zone border styles.
ZONE_CONNECTION
How pads are covered by copper in zone.
@ THERMAL
Use thermal relief for pads.
@ THT_THERMAL
Thermal relief only for THT pads.
@ NONE
Pads are not covered.
@ FULL
pads are covered by copper
#define ZONE_BORDER_HATCH_MINDIST_MM
#define ZONE_THICKNESS_MIL
#define ZONE_THERMAL_RELIEF_GAP_MIL
#define ZONE_BORDER_HATCH_DIST_MIL
#define ZONE_THERMAL_RELIEF_COPPER_WIDTH_MIL
#define ZONE_BORDER_HATCH_MAXDIST_MM