36#include <api/board/board_types.pb.h>
37#include <shared_mutex>
39using namespace std::placeholders;
55 board->InvalidateClearanceCache(
m_Uuid );
63 wxString
name = wxString::FromUTF8( aProto.name() );
95 if( ( aNetCode >= 0 ) && board )
108 std::unique_lock<std::shared_mutex> writeLock( board->
m_CachesMutex );
140 static std::shared_ptr<NETCLASS> fallbackNetclass = std::make_shared<NETCLASS>(
NETCLASS::Default );
147 if( board->GetDesignSettings().m_NetSettings )
148 return board->GetDesignSettings().m_NetSettings->GetDefaultNetclass().get();
151 return fallbackNetclass.get();
170 return wxT(
"[** NO BOARD DEFINED **]" );
174 if( !netname.length() )
175 return wxT(
"[<no net>]" );
177 return wxT(
"[" ) +
UnescapeString( netname ) + wxT(
"](" ) +
_(
"Not Found" ) + wxT(
")" );
200 if( board->GetNetInfo().m_DisplayNetnamesDirty )
201 board->GetNetInfo().RebuildDisplayNetnames();
214 if( layerEnum.
Choices().GetCount() == 0 )
231 layer->SetChoices( layerEnum.
Choices() );
268 auto supportsTeardrops =
273 if( !bci->GetBoard() || bci->GetBoard()->LegacyTeardrops() )
282 auto supportsTeardropPreferZoneSetting =
287 if( !bci->GetBoard() || bci->GetBoard()->LegacyTeardrops() )
296 const wxString groupTeardrops =
_HKI(
"Teardrops" );
301 enableTeardrops->SetAvailableFunc( supportsTeardrops );
302 propMgr.
AddProperty( enableTeardrops, groupTeardrops );
307 bestLength->SetAvailableFunc( supportsTeardrops );
314 maxLength->SetAvailableFunc( supportsTeardrops );
320 bestWidth->SetAvailableFunc( supportsTeardrops );
327 maxWidth->SetAvailableFunc( supportsTeardrops );
333 curvePts->SetAvailableFunc( supportsTeardrops );
339 preferZones->SetAvailableFunc( supportsTeardropPreferZoneSetting );
340 propMgr.
AddProperty( preferZones, groupTeardrops );
345 twoTracks->SetAvailableFunc( supportsTeardrops );
351 maxTrackWidth->SetAvailableFunc( supportsTeardrops );
352 propMgr.
AddProperty( maxTrackWidth, groupTeardrops );
static struct BOARD_CONNECTED_ITEM_DESC _BOARD_CONNECTED_ITEM_DESC
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
wxString GetNetnameMsg() const
bool GetTeardropPreferZoneConnections() const
virtual NETCLASS * GetEffectiveNetClass() const
Return the NETCLASS for this item.
double GetTeardropBestLengthRatio() const
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
void SetTeardropBestWidthRatio(double aRatio)
wxString GetNetname() const
void SetTeardropMaxTrackWidth(double aRatio)
int GetTeardropMaxLength() const
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
void PackNet(kiapi::board::types::Net *aProto) const
double GetTeardropMaxTrackWidth() const
bool GetTeardropsEnabled() const
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
bool GetTeardropCurved() const
void SetTeardropAllowSpanTwoTracks(bool aAllow)
const wxString & GetDisplayNetname() const
const wxString & GetShortNetname() const
double GetTeardropBestWidthRatio() const
wxString GetNetClassName() const
Returns the name of the effective netclass.
void SetTeardropCurved(bool aCurve)
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.
void SetTeardropMaxWidth(int aMaxWidth)
int GetTeardropMaxWidth() const
void SetTeardropPreferZoneConnections(bool aPrefer)
void SetTeardropBestLengthRatio(double aRatio)
void SetTeardropMaxLength(int aMaxLength)
void UnpackNet(const kiapi::board::types::Net &aProto)
Assigns a net to this item from an API message.
bool GetTeardropAllowSpanTwoTracks() const
bool m_localRatsnestVisible
void SetTeardropsEnabled(bool aEnable)
Container for design settings for a BOARD object.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the 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 IsOnCopperLayer() const
Information pertinent to a Pcbnew printed circuit board.
std::unordered_map< const BOARD_ITEM *, wxString > m_ItemNetclassCache
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
void InvalidateClearanceCache(const KIID &aUuid)
Invalidate the clearance cache for a specific item.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
std::shared_mutex m_CachesMutex
int GetCachedOwnClearance(const BOARD_ITEM *aItem, PCB_LAYER_ID aLayer, wxString *aSource=nullptr)
Get the cached own clearance for an item on a specific layer.
ENUM_MAP & Map(T aValue, const wxString &aName)
static ENUM_MAP< T > & Instance()
ENUM_MAP & Undefined(T aValue)
Class that other classes need to inherit from, in order to be inspectable.
static const LSET & AllLayersMask()
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
A collection of nets and the parameters used to route or test these nets.
static const char Default[]
the name of the default NETCLASS
const wxString GetName() const
Gets the name of this (maybe aggregate) netclass in a format for internal usage or for export to exte...
Handle the data for a net.
Container for NETINFO_ITEM elements, which are the nets.
static NETINFO_ITEM * OrphanedItem()
NETINFO_ITEM meaning that there was no net assigned for an item, as there was no board storing net li...
PROPERTY_BASE & SetIsHiddenFromPropertiesManager(bool aHide=true)
PROPERTY_BASE & SetIsHiddenFromRulesEditor(bool aHide=true)
PROPERTY_BASE & SetIsHiddenFromLibraryEditors(bool aIsHidden=true)
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()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
PROPERTY_BASE & ReplaceProperty(size_t aBase, const wxString &aName, PROPERTY_BASE *aNew, const wxString &aGroup=wxEmptyString)
Replace an existing property for a specific type.
static VALIDATOR_RESULT PositiveRatioValidator(const wxAny &&aValue, EDA_ITEM *aItem)
Some functions to handle hotkeys in KiCad.
PCB_LAYER_ID
A quick note on layer IDs:
#define NO_SETTER(owner, type)
@ PT_SIZE
Size expressed in distance units (mm/inch)
@ PT_NET
Net selection property.
static const char * emptyString
wxString UnescapeString(const wxString &aSource)
BOARD_CONNECTED_ITEM_DESC()
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_PAD_T
class PAD, a pad in a footprint