KiCad PCB EDA Suite
board_connected_item.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2012 Jean-Pierre Charras, [email protected]
5 * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
6 * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#ifndef BOARD_CONNECTED_ITEM_H
27#define BOARD_CONNECTED_ITEM_H
28
29#include <board_item.h>
30
31class NETCLASS;
32class NETINFO_ITEM;
33class PAD;
34
40{
41public:
42 BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype );
43
44 // Do not create a copy constructor & operator=.
45 // The ones generated by the compiler are adequate.
46
47 static inline bool ClassOf( const EDA_ITEM* aItem )
48 {
49 if( aItem == nullptr )
50 return false;
51
52 switch( aItem->Type() )
53 {
54 case PCB_PAD_T:
55 case PCB_TRACE_T:
56 case PCB_ARC_T:
57 case PCB_VIA_T:
58 case PCB_ZONE_T:
59 return true;
60
61 default:
62 return false;
63 }
64 }
65
67 bool IsConnected() const override
68 {
69 return true;
70 }
71
76 {
77 return m_netinfo;
78 }
79
83 void SetNet( NETINFO_ITEM* aNetInfo )
84 {
85 m_netinfo = aNetInfo;
86 }
87
91 int GetNetCode() const;
92
104 bool SetNetCode( int aNetCode, bool aNoAssert );
105
106 void SetNetCode( int aNetCode )
107 {
108 SetNetCode( aNetCode, false );
109 }
110
114 wxString GetNetname() const;
115
120 wxString GetNetnameMsg() const;
121
125 wxString GetShortNetname() const;
126
134 virtual int GetOwnClearance( PCB_LAYER_ID aLayer, wxString* aSource = nullptr ) const;
135
142 virtual int GetLocalClearanceOverrides( wxString* aSource ) const { return 0; }
143
151 virtual int GetLocalClearance( wxString* aSource ) const { return 0; }
152
159 virtual NETCLASS* GetEffectiveNetClass() const;
160
164 wxString GetNetClassName() const;
165
166 void SetLocalRatsnestVisible( bool aVisible )
167 {
168 m_localRatsnestVisible = aVisible;
169 }
170
172 {
174 }
175
176protected:
179
180private:
182};
183
184#endif // BOARD_CONNECTED_ITEM_H
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.
bool GetLocalRatsnestVisible() const
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
void SetLocalRatsnestVisible(bool aVisible)
void SetNetCode(int aNetCode)
virtual int GetLocalClearanceOverrides(wxString *aSource) const
Return any local clearance overrides set in the "classic" (ie: pre-rule) system.
static bool ClassOf(const EDA_ITEM *aItem)
Returns information if the object is derived from BOARD_CONNECTED_ITEM.
NETINFO_ITEM * GetNet() const
Return #NET_INFO object for a given item.
void SetNet(NETINFO_ITEM *aNetInfo)
Set a NET_INFO object for the item.
bool IsConnected() const override
Returns information if the object is derived from BOARD_CONNECTED_ITEM.
wxString GetNetClassName() const
Returns the name of the effective netclass.
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.
wxString GetShortNetname() const
virtual int GetLocalClearance(wxString *aSource) const
Return any local clearances set in the "classic" (ie: pre-rule) system.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:50
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
A collection of nets and the parameters used to route or test these nets.
Definition: netclass.h:47
Handle the data for a net.
Definition: netinfo.h:66
Definition: pad.h:58
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:102
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition: typeinfo.h:112
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:87
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:103
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:101