2014-10-23 17:53:38 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2018-02-18 09:09:13 +00:00
|
|
|
* Copyright (C) 2008-2018 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
2022-05-29 20:28:10 +00:00
|
|
|
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
2014-10-23 17:53:38 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
/**
|
2023-04-19 11:51:26 +00:00
|
|
|
* @file zone_settings.h
|
2012-02-06 05:44:19 +00:00
|
|
|
* @brief Class ZONE_SETTINGS used to handle zones parameters in dialogs.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ZONE_SETTINGS_H_
|
|
|
|
#define ZONE_SETTINGS_H_
|
|
|
|
|
2021-07-29 09:47:43 +00:00
|
|
|
#include <layer_ids.h>
|
2018-05-25 14:56:04 +00:00
|
|
|
#include <zones.h>
|
2022-01-19 00:22:40 +00:00
|
|
|
#include <geometry/eda_angle.h>
|
2022-03-05 16:18:42 +00:00
|
|
|
#include <teardrop/teardrop_types.h>
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
class wxDataViewListCtrl;
|
2012-02-24 23:23:46 +00:00
|
|
|
|
2019-12-20 14:11:39 +00:00
|
|
|
enum class ZONE_FILL_MODE
|
2017-12-04 18:06:47 +00:00
|
|
|
{
|
2019-12-20 14:11:39 +00:00
|
|
|
POLYGONS = 0, // fill zone with polygons
|
|
|
|
HATCH_PATTERN = 1 // fill zone using a grid pattern
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-08-07 14:04:34 +00:00
|
|
|
/// Zone border styles
|
|
|
|
enum class ZONE_BORDER_DISPLAY_STYLE
|
2019-12-20 14:11:39 +00:00
|
|
|
{
|
|
|
|
NO_HATCH,
|
|
|
|
DIAGONAL_FULL,
|
|
|
|
DIAGONAL_EDGE
|
2017-12-04 18:06:47 +00:00
|
|
|
};
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2020-06-26 02:19:51 +00:00
|
|
|
/// Whether or not to remove isolated islands from a zone
|
2022-08-01 15:58:04 +00:00
|
|
|
enum class ISLAND_REMOVAL_MODE
|
2020-06-26 02:19:51 +00:00
|
|
|
{
|
2022-07-30 16:30:22 +00:00
|
|
|
ALWAYS = 0,
|
2020-06-26 02:19:51 +00:00
|
|
|
NEVER,
|
|
|
|
AREA
|
|
|
|
};
|
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
/**
|
2020-01-10 14:31:00 +00:00
|
|
|
* ZONE_SETTINGS
|
2012-02-06 05:44:19 +00:00
|
|
|
* handles zones parameters.
|
2012-07-13 18:55:29 +00:00
|
|
|
* Because a zone can be on copper or non copper layers, and can be also
|
|
|
|
* a keepout area, some parameters are irrelevant depending on the type of zone
|
2012-02-06 05:44:19 +00:00
|
|
|
*/
|
|
|
|
class ZONE_SETTINGS
|
|
|
|
{
|
|
|
|
public:
|
2020-01-26 17:01:11 +00:00
|
|
|
// the actual zone outline shape can be slightly modified (smoothed):
|
2012-02-06 05:44:19 +00:00
|
|
|
enum {
|
2018-07-19 20:08:31 +00:00
|
|
|
SMOOTHING_UNDEFINED = -1,
|
2020-01-26 17:01:11 +00:00
|
|
|
SMOOTHING_NONE = 0, // Zone outline is used without change
|
|
|
|
SMOOTHING_CHAMFER, // Zone outline is used after chamfering corners
|
|
|
|
SMOOTHING_FILLET, // Zone outline is used after rounding corners
|
|
|
|
SMOOTHING_LAST // sentinel
|
2012-02-06 05:44:19 +00:00
|
|
|
};
|
|
|
|
|
2022-08-24 23:34:53 +00:00
|
|
|
unsigned m_ZonePriority; // Priority (0 ... N) of the zone
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2020-09-17 13:14:45 +00:00
|
|
|
ZONE_FILL_MODE m_FillMode;
|
|
|
|
int m_ZoneClearance; // Minimal clearance value
|
|
|
|
int m_ZoneMinThickness; // Min thickness value in filled areas
|
|
|
|
int m_HatchThickness; // HatchBorder thickness of lines (if 0 -> solid shape)
|
|
|
|
int m_HatchGap; // HatchBorder clearance between lines (0 -> solid shape)
|
2022-01-19 00:22:40 +00:00
|
|
|
EDA_ANGLE m_HatchOrientation; // HatchBorder orientation of grid lines
|
2020-09-17 13:14:45 +00:00
|
|
|
int m_HatchSmoothingLevel; // HatchBorder smoothing type, similar to corner smoothing type
|
|
|
|
// 0 = no smoothing, 1 = fillet, >= 2 = arc
|
|
|
|
double m_HatchSmoothingValue; // HatchBorder chamfer/fillet size as a ratio of hole size
|
|
|
|
double m_HatchHoleMinArea; // min size before holes are dropped (ratio)
|
|
|
|
int m_HatchBorderAlgorithm; // 0 = use min zone thickness
|
2018-02-18 09:09:13 +00:00
|
|
|
|
2020-09-17 13:14:45 +00:00
|
|
|
int m_NetcodeSelection; // Net code selection for the current zone
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2020-09-17 13:14:45 +00:00
|
|
|
wxString m_Name; // Unique name for the current zone (can be blank)
|
2020-06-26 02:19:51 +00:00
|
|
|
|
2020-09-17 13:14:45 +00:00
|
|
|
LSET m_Layers; // Layers that this zone exists on
|
2012-02-06 05:44:19 +00:00
|
|
|
|
|
|
|
/// Option to show the zone area (outlines only, short hatches or full hatches
|
2020-08-07 14:04:34 +00:00
|
|
|
ZONE_BORDER_DISPLAY_STYLE m_ZoneBorderDisplayStyle;
|
2022-02-12 16:37:27 +00:00
|
|
|
int m_BorderHatchPitch; // for hatched outlines: dist between 2 hatches
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2021-08-08 13:37:14 +00:00
|
|
|
long m_ThermalReliefGap; // thickness of the gap in thermal reliefs
|
|
|
|
long m_ThermalReliefSpokeWidth; // thickness of the copper bridge in thermal reliefs
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2021-05-06 21:49:07 +00:00
|
|
|
bool m_Locked;
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2022-03-05 16:18:42 +00:00
|
|
|
/* A zone outline can be a teardrop zone with different rules
|
|
|
|
* priority, smoothed corners, thermal relief...
|
|
|
|
*/
|
|
|
|
TEARDROP_TYPE m_TeardropType;
|
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
private:
|
2020-09-17 13:14:45 +00:00
|
|
|
int m_cornerSmoothingType; // Corner smoothing type
|
|
|
|
unsigned int m_cornerRadius; // Corner chamfer distance / fillet radius
|
|
|
|
ZONE_CONNECTION m_padConnection;
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2020-09-17 13:14:45 +00:00
|
|
|
/*
|
|
|
|
* Keepout zones and keepout flags.
|
|
|
|
* Note that DRC rules can set keepouts on zones whether they're a keepout or not.
|
2012-07-13 18:55:29 +00:00
|
|
|
*/
|
2020-09-21 23:32:07 +00:00
|
|
|
bool m_isRuleArea;
|
2012-07-13 18:55:29 +00:00
|
|
|
|
2020-09-17 13:14:45 +00:00
|
|
|
bool m_keepoutDoNotAllowCopperPour;
|
|
|
|
bool m_keepoutDoNotAllowVias;
|
|
|
|
bool m_keepoutDoNotAllowTracks;
|
|
|
|
bool m_keepoutDoNotAllowPads;
|
|
|
|
bool m_keepoutDoNotAllowFootprints;
|
2012-07-13 18:55:29 +00:00
|
|
|
|
2020-06-26 02:19:51 +00:00
|
|
|
ISLAND_REMOVAL_MODE m_removeIslands;
|
|
|
|
long long int m_minIslandArea;
|
2012-07-13 18:55:29 +00:00
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
public:
|
|
|
|
ZONE_SETTINGS();
|
|
|
|
|
|
|
|
/**
|
2020-11-11 23:05:59 +00:00
|
|
|
* operator << ( const ZONE& )
|
2012-02-06 05:44:19 +00:00
|
|
|
* was Function ImportSetting
|
|
|
|
* copies settings from a given zone into this object.
|
|
|
|
* @param aSource: the given zone
|
|
|
|
*/
|
2020-11-11 23:05:59 +00:00
|
|
|
ZONE_SETTINGS& operator << ( const ZONE& aSource );
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2023-06-10 10:03:18 +00:00
|
|
|
/**
|
|
|
|
* @return Default ZONE_SETTINGS
|
|
|
|
*/
|
|
|
|
static const ZONE_SETTINGS& GetDefaultSettings();
|
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
/**
|
|
|
|
* A helper routine for the various zone dialogs (copper, non-copper, keepout).
|
2019-10-28 09:15:03 +00:00
|
|
|
* @param aList the wxDataViewListCtrl to populate
|
|
|
|
* @param aFrame the parent editor frame
|
2022-02-17 23:54:15 +00:00
|
|
|
* @param aFpEditorMode true to show a single "Inner Layers" item for all inner copper layers
|
2018-05-25 14:56:04 +00:00
|
|
|
*/
|
2022-02-17 23:54:15 +00:00
|
|
|
void SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME* aFrame, LSET aLayers,
|
|
|
|
bool aFpEditorMode );
|
2018-05-25 14:56:04 +00:00
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
/**
|
|
|
|
* Function ExportSetting
|
|
|
|
* copy settings to a given zone
|
|
|
|
* @param aTarget: the given zone
|
|
|
|
* @param aFullExport: if false: some parameters are NOT exported
|
|
|
|
* because they must not be exported when export settings from a zone to others zones
|
|
|
|
* Currently:
|
|
|
|
* m_NetcodeSelection
|
|
|
|
*/
|
2020-11-11 23:05:59 +00:00
|
|
|
void ExportSetting( ZONE& aTarget, bool aFullExport = true ) const;
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2012-07-13 18:55:29 +00:00
|
|
|
void SetCornerSmoothingType( int aType) { m_cornerSmoothingType = aType; }
|
|
|
|
int GetCornerSmoothingType() const { return m_cornerSmoothingType; }
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2015-05-15 12:49:11 +00:00
|
|
|
void SetCornerRadius( int aRadius );
|
2012-07-13 18:55:29 +00:00
|
|
|
unsigned int GetCornerRadius() const { return m_cornerRadius; }
|
2012-02-24 23:23:46 +00:00
|
|
|
|
2022-02-17 23:54:15 +00:00
|
|
|
ZONE_CONNECTION GetPadConnection() const { return m_padConnection; }
|
|
|
|
void SetPadConnection( ZONE_CONNECTION aPadConnection ) { m_padConnection = aPadConnection; }
|
2012-02-24 23:23:46 +00:00
|
|
|
|
2012-07-13 18:55:29 +00:00
|
|
|
/**
|
2020-09-21 23:32:07 +00:00
|
|
|
* Accessors to parameters used in Rule Area zones:
|
2012-07-13 18:55:29 +00:00
|
|
|
*/
|
2023-05-19 02:05:12 +00:00
|
|
|
bool GetIsRuleArea() const { return m_isRuleArea; }
|
|
|
|
bool GetDoNotAllowCopperPour() const { return m_keepoutDoNotAllowCopperPour; }
|
|
|
|
bool GetDoNotAllowVias() const { return m_keepoutDoNotAllowVias; }
|
|
|
|
bool GetDoNotAllowTracks() const { return m_keepoutDoNotAllowTracks; }
|
|
|
|
bool GetDoNotAllowPads() const { return m_keepoutDoNotAllowPads; }
|
|
|
|
bool GetDoNotAllowFootprints() const { return m_keepoutDoNotAllowFootprints; }
|
2012-07-13 18:55:29 +00:00
|
|
|
|
2020-09-21 23:32:07 +00:00
|
|
|
void SetIsRuleArea( bool aEnable ) { m_isRuleArea = aEnable; }
|
2012-07-14 16:27:25 +00:00
|
|
|
void SetDoNotAllowCopperPour( bool aEnable ) { m_keepoutDoNotAllowCopperPour = aEnable; }
|
2012-07-13 18:55:29 +00:00
|
|
|
void SetDoNotAllowVias( bool aEnable ) { m_keepoutDoNotAllowVias = aEnable; }
|
|
|
|
void SetDoNotAllowTracks( bool aEnable ) { m_keepoutDoNotAllowTracks = aEnable; }
|
2020-05-07 00:30:46 +00:00
|
|
|
void SetDoNotAllowPads( bool aEnable ) { m_keepoutDoNotAllowPads = aEnable; }
|
|
|
|
void SetDoNotAllowFootprints( bool aEnable ) { m_keepoutDoNotAllowFootprints = aEnable; }
|
2020-06-24 02:19:08 +00:00
|
|
|
|
2023-05-19 02:05:12 +00:00
|
|
|
ISLAND_REMOVAL_MODE GetIslandRemovalMode() const { return m_removeIslands; }
|
2020-06-26 02:19:51 +00:00
|
|
|
void SetIslandRemovalMode( ISLAND_REMOVAL_MODE aRemove ) { m_removeIslands = aRemove; }
|
|
|
|
|
|
|
|
long long int GetMinIslandArea() const { return m_minIslandArea; }
|
|
|
|
void SetMinIslandArea( long long int aArea ) { m_minIslandArea = aArea; }
|
2012-02-06 05:44:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // ZONE_SETTINGS_H_
|