166 return std::optional<int>();
169 *aSource =
_(
"zone" );
188 virtual void ViewGetLayers(
int aLayers[],
int& aCount )
const override;
274 || (
m_fillMode == ZONE_FILL_MODE::HATCH_PATTERN
309 int globalIndex = -1;
330 throw( std::out_of_range(
"aCorner-th vertex does not exist" ) );
343 virtual std::shared_ptr<SHAPE>
345 FLASHING aFlash = FLASHING::DEFAULT )
const override;
353 bool HitTest(
const VECTOR2I& aPosition,
int aAccuracy = 0 )
const override;
374 int* aHoleIdx =
nullptr )
const;
382 std::vector<ZONE*>* aOtherNetIntersectingZones )
const;
424 int aClearance,
int aError,
ERROR_LOC aErrorLoc,
425 bool ignoreLineWidth =
false )
const override;
455 bool HitTest(
const BOX2I& aRect,
bool aContained =
true,
int aAccuracy = 0 )
const override;
510 return wxT(
"ZONE" );
562 throw( std::out_of_range(
"aCornerIndex-th vertex does not exist" ) );
583 throw( std::out_of_range(
"aCornerIndex-th vertex does not exist" ) );
683 void AddPolygon( std::vector<VECTOR2I>& aPolygon );
780 bool aRebuilBorderdHatch );
819 virtual void Show(
int nestLevel, std::ostream& os )
const override { ShowDummy( os ); }
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
BITMAPS
A list of all bitmap identifiers.
BASE_SET & set(size_t pos)
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
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...
Information pertinent to a Pcbnew printed circuit board.
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
LSET is a set of PCB_LAYER_IDs.
EDA_MSG_PANEL items for displaying messages.
The main frame for Pcbnew.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Base class for iterating over all vertices in a given SHAPE_POLY_SET.
Represent a set of closed polygons.
void RemoveAllContours()
Remove all outlines & holes (clears) the polygon set.
ITERATOR IterateWithHoles(int aOutline)
void SetVertex(const VERTEX_INDEX &aIndex, const VECTOR2I &aPos)
Accessor function to set the position of a specific point.
int TotalVertices() const
Return total number of vertices stored in the set.
bool GetRelativeIndices(int aGlobalIdx, VERTEX_INDEX *aRelativeIndices) const
Convert a global vertex index —i.e., a number that globally identifies a vertex in a concatenated lis...
bool GetGlobalIndex(VERTEX_INDEX aRelativeIndices, int &aGlobalIdx) const
Compute the global index of a vertex from the relative indices of polygon, contour and vertex.
int NewHole(int aOutline=-1)
Creates a new hole in a given outline.
ITERATOR Iterate(int aFirst, int aLast, bool aIterateHoles=false)
Return an object to iterate through the points of the polygons between aFirst and aLast.
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the index-th vertex in a given hole outline within a given outline.
CONST_ITERATOR CIterateWithHoles(int aOutline) const
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)
double GetOutlineArea()
This area is cached from the most recent call to CalculateOutlineArea().
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, bool aFull) const override
Return a user-visible description string of this item.
void SetHatchBorderAlgorithm(int aAlgo)
const SHAPE_POLY_SET * Outline() const
void SetDoNotAllowPads(bool aEnable)
int GetHatchBorderAlgorithm() const
ZONE & operator=(const ZONE &aOther)
int m_cornerSmoothingType
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
std::optional< int > GetLocalClearance() const override
void SetRuleAreaPlacementEnabled(bool aEnabled)
void SetLocalClearance(std::optional< int > aClearance)
bool UnFill()
Removes the zone filling.
wxString GetRuleAreaPlacementSource() const
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:
const std::vector< SEG > & GetHatchLines() const
void SetPosition(const VECTOR2I &aPos) override
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
const std::shared_ptr< SHAPE_POLY_SET > & GetFilledPolysList(PCB_LAYER_ID aLayer) const
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,...
void SetCornerSmoothingType(int aType)
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...
void Mirror(const VECTOR2I &aMirrorRef, FLIP_DIRECTION aFlipDirection) override
Mirror the outlines relative to a given horizontal axis the layer is not changed.
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
std::optional< int > GetLocalClearance(wxString *aSource) const override
Return any local clearances set in the "classic" (ie: pre-rule) system.
void SetBorderDisplayStyle(ZONE_BORDER_DISPLAY_STYLE aBorderHatchStyle, int aBorderHatchPitch, bool aRebuilBorderdHatch)
Set all hatch parameters for the zone.
bool GetDoNotAllowPads() const
const BOX2I GetBoundingBox() const override
void SetMinThickness(int aMinThickness)
double GetFilledArea()
This area is cached from the most recent call to CalculateFilledArea().
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
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)
wxString GetClass() const override
bool m_doNotAllowCopperPour
bool GetRuleAreaPlacementEnabled() const
void SetHatchSmoothingValue(double aValue)
bool m_needRefill
False when a zone was refilled, true after changes in zone params.
SHAPE_POLY_SET::ITERATOR IterateWithHoles()
Return an iterator to visit all points of the zone's main outline with holes.
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 SetHatchSmoothingLevel(int aLevel)
bool IsConnected() const override
Not all ZONEs are really BOARD_CONNECTED_ITEMs....
RULE_AREA_PLACEMENT_SOURCE_TYPE m_ruleAreaPlacementSourceType
void SetDoNotAllowCopperPour(bool aEnable)
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.
ISLAND_REMOVAL_MODE GetIslandRemovalMode() const
LSET m_fillFlags
Temp variables used while filling.
void SetSelectedCorner(int aCorner)
int GetSelectedCorner() const
SHAPE_POLY_SET * Outline()
void SetHatchStyle(ZONE_BORDER_DISPLAY_STYLE aStyle)
void NewHole()
Create a new hole on the zone; i.e., a new contour on the zone's outline.
void SetFillFlag(PCB_LAYER_ID aLayer, bool aFlag)
void SetCornerPosition(int aCornerIndex, const VECTOR2I &new_pos)
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
std::map< PCB_LAYER_ID, HASH_128 > m_filledPolysHash
A hash value used in zone filling calculations to see if the filled areas are up to date.
long long int GetMinIslandArea() const
int m_hatchSmoothingLevel
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
SHAPE_POLY_SET * GetFill(PCB_LAYER_ID aLayer)
void SetRuleAreaPlacementSourceType(RULE_AREA_PLACEMENT_SOURCE_TYPE aType)
void SetIsRuleArea(bool aEnable)
void SetDoNotAllowTracks(bool aEnable)
void SetFilledPolysList(PCB_LAYER_ID aLayer, const SHAPE_POLY_SET &aPolysList)
Set the list of filled polygons.
const 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.
static bool ClassOf(const EDA_ITEM *aItem)
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 SetIsFilled(bool isFilled)
void SetFillMode(ZONE_FILL_MODE aFillMode)
int GetFillFlag(PCB_LAYER_ID aLayer)
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.
bool HasFilledPolysForLayer(PCB_LAYER_ID aLayer) const
int GetHatchThickness() const
double GetHatchHoleMinArea() const
void SetLayerSet(const LSET &aLayerSet) override
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
void SetDoNotAllowVias(bool aEnable)
bool IsTeardropArea() const
std::vector< SEG > m_borderHatchLines
wxString m_ruleAreaPlacementSource
VECTOR2I GetPosition() const override
int GetThermalReliefSpokeWidth() const
int GetBorderHatchPitch() const
HatchBorder related methods.
virtual void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
ZONE_BORDER_DISPLAY_STYLE GetHatchStyle() const
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
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
SHAPE_POLY_SET::CONST_ITERATOR CIterateWithHoles() const
Return an iterator to visit all points of the zone's main outline with holes.
SHAPE_POLY_SET::ITERATOR Iterate()
Return an iterator to visit all points of the zone's main outline without holes.
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
void SetDoNotAllowFootprints(bool aEnable)
bool GetDoNotAllowCopperPour() const
bool HasKeepoutParametersSet() const
Accessor to determine if any keepout parameters are set.
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...
bool m_ruleAreaPlacementEnabled
Placement rule area data.
double CalculateOutlineArea()
Compute the area of the zone outline (not the filled area).
RULE_AREA_PLACEMENT_SOURCE_TYPE GetRuleAreaPlacementSourceType() const
std::mutex m_lock
Lock used for multi-threaded filling on multi-layer zones.
void SetHatchHoleMinArea(double aPct)
TEARDROP_TYPE GetTeardropAreaType() const
bool IsConflicting() const
For rule areas which exclude footprints (and therefore participate in courtyard conflicts during move...
ISLAND_REMOVAL_MODE m_islandRemovalMode
bool m_isFilled
True when a zone was filled, false after deleting the filled areas.
double GetHatchSmoothingValue() const
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.
int GetHatchSmoothingLevel() const
unsigned int GetCornerRadius() const
int GetCornerSmoothingType() const
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
void SetIsIsland(PCB_LAYER_ID aLayer, int aPolyIdx)
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)
bool operator==(const ZONE &aOther) const
void SetTeardropAreaType(TEARDROP_TYPE aType)
Set the type of teardrop if the zone is a teardrop area for non teardrop area, the type must be TEARD...
void UnHatchBorder()
Clear the zone's hatch.
void SetIslandRemovalMode(ISLAND_REMOVAL_MODE aRemove)
void SetOutline(SHAPE_POLY_SET *aOutline)
PCB_LAYER_ID GetFirstLayer() const
void SetMinIslandArea(long long int aArea)
HASH_128 GetHashValue(PCB_LAYER_ID aLayer)
ZONE_CONNECTION m_PadConnection
void SetRuleAreaPlacementSource(const wxString &aSource)
int GetThermalReliefGap() const
void RemoveAllContours(void)
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.
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
PCB_LAYER_ID
A quick note on layer IDs:
#define DECLARE_ENUM_TO_WXANY(type)
A storage class for 128-bit hash value.
A struct recording the isolated and single-pad islands within a zone.
std::vector< int > m_SingleConnectionOutlines
std::vector< int > m_IsolatedOutlines
Structure to hold the necessary information in order to index a vertex on a SHAPE_POLY_SET object: th...
TEARDROP_TYPE
define the type of a teardrop: on a via or pad, or a track end
@ PCB_ZONE_T
class ZONE, a copper pour area
Class ZONE_SETTINGS used to handle zones parameters in dialogs.
RULE_AREA_PLACEMENT_SOURCE_TYPE
ISLAND_REMOVAL_MODE
Whether or not to remove isolated islands from a zone.
ZONE_BORDER_DISPLAY_STYLE
Zone border styles.
ZONE_CONNECTION
How pads are covered by copper in zone.