Removed D_PAD::SetNetname() function and D_PAD::m_Netname, D_PAD::m_ShortNetname fields.
D_PAD::GetNetname() and D_PAD::GetShortNetname() were moved to BOARD_CONNECTED_ITEM. Now they use the net name stored in NETINFO_ITEM.
Moved some one-line functions from class_board_connected_item.cpp to class_board_connected_item.h.
Added a copyright notice, moved Doxygen comments from class_board_connected_item.cpp to class_board_connected_item.h.
I have some doubts if changes introduced pcbnew/dialogs/dialog_pad_properties.cpp do not break anything, but I could not find a test case that breaks the pcbnew.
Performed tests:
- changed pad's net name from empty to existent - ok, name was changed
- changed pad's net name from empty to nonexistent - ok, error message is displayed, net name stays empty
- changed pad's net name from existent to empty - ok, net name became empty
- changed pad's net name from existent to nonexistent - ok, error message is displayed, net name is not changed
- (re)reading netlists, including net changes - fine, changes are applied, but empty nets are still kept
- loaded pcbnew/pcad2kicadpcb_plugin/examples/CK1202_V1.pcb to test P-CAD import plugin - ok, net names are correct
- imported an Eagle 6.0 board (Arduino Uno; http://arduino.cc/en/uploads/Main/arduino_Uno_Rev3-02-TH.zip) then saved in .kicad_pcb format and reloaded - ok, net names are correct
- saved demos/video/video.kicad_pcb in legacy format and then loaded it again - ok, net names are correct
2014-01-14 09:41:52 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
|
|
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
|
|
|
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2013-05-26 04:36:44 +00:00
|
|
|
#ifndef BOARD_CONNECTED_ITEM_H
|
|
|
|
#define BOARD_CONNECTED_ITEM_H
|
|
|
|
|
|
|
|
#include <class_board_item.h>
|
2018-01-30 14:34:09 +00:00
|
|
|
#include <netinfo.h>
|
2020-09-10 19:58:05 +00:00
|
|
|
#include <reporter.h>
|
2018-10-19 11:28:34 +00:00
|
|
|
#include <kicad_string.h>
|
2013-05-26 04:36:44 +00:00
|
|
|
|
|
|
|
class NETCLASS;
|
|
|
|
class TRACK;
|
|
|
|
class D_PAD;
|
|
|
|
|
|
|
|
/**
|
2020-01-10 14:31:00 +00:00
|
|
|
* BOARD_CONNECTED_ITEM
|
2013-05-26 04:36:44 +00:00
|
|
|
* is a base class derived from BOARD_ITEM for items that can be connected
|
|
|
|
* and have a net, a netname, a clearance ...
|
|
|
|
* mainly: tracks, pads and zones
|
|
|
|
* Handle connection info
|
|
|
|
*/
|
|
|
|
class BOARD_CONNECTED_ITEM : public BOARD_ITEM
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype );
|
|
|
|
|
2016-05-30 08:44:48 +00:00
|
|
|
// Do not create a copy constructor & operator=.
|
|
|
|
// The ones generated by the compiler are adequate.
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2014-06-06 09:44:21 +00:00
|
|
|
static inline bool ClassOf( const EDA_ITEM* aItem )
|
|
|
|
{
|
2014-06-12 20:03:57 +00:00
|
|
|
if( aItem == NULL )
|
|
|
|
return false;
|
|
|
|
|
2014-06-06 09:44:21 +00:00
|
|
|
switch( aItem->Type() )
|
|
|
|
{
|
2014-06-12 20:03:57 +00:00
|
|
|
case PCB_PAD_T:
|
2014-06-06 09:44:21 +00:00
|
|
|
case PCB_TRACE_T:
|
2019-05-17 00:13:21 +00:00
|
|
|
case PCB_ARC_T:
|
2014-06-06 09:44:21 +00:00
|
|
|
case PCB_VIA_T:
|
|
|
|
case PCB_ZONE_AREA_T:
|
|
|
|
return true;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-28 15:23:08 +00:00
|
|
|
///> @copydoc BOARD_ITEM::IsConnected()
|
2016-09-24 18:53:15 +00:00
|
|
|
bool IsConnected() const override
|
2014-01-28 15:23:08 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-05-26 04:36:44 +00:00
|
|
|
/**
|
|
|
|
* Function GetNet
|
2014-02-25 10:40:34 +00:00
|
|
|
* Returns NET_INFO object for a given item.
|
|
|
|
*/
|
|
|
|
NETINFO_ITEM* GetNet() const
|
|
|
|
{
|
|
|
|
return m_netinfo;
|
|
|
|
}
|
|
|
|
|
2016-09-05 13:38:01 +00:00
|
|
|
/**
|
|
|
|
* Function SetNet
|
|
|
|
* Sets a NET_INFO object for the item.
|
|
|
|
*/
|
|
|
|
void SetNet( NETINFO_ITEM* aNetInfo )
|
|
|
|
{
|
|
|
|
m_netinfo = aNetInfo;
|
|
|
|
}
|
|
|
|
|
2014-02-25 10:40:34 +00:00
|
|
|
/**
|
|
|
|
* Function GetNetCode
|
2013-05-26 04:36:44 +00:00
|
|
|
* @return int - the net code.
|
|
|
|
*/
|
2014-05-21 17:02:32 +00:00
|
|
|
int GetNetCode() const
|
|
|
|
{
|
2019-10-22 12:13:16 +00:00
|
|
|
return m_netinfo ? m_netinfo->GetNet() : -1;
|
2014-05-21 17:02:32 +00:00
|
|
|
}
|
Removed D_PAD::SetNetname() function and D_PAD::m_Netname, D_PAD::m_ShortNetname fields.
D_PAD::GetNetname() and D_PAD::GetShortNetname() were moved to BOARD_CONNECTED_ITEM. Now they use the net name stored in NETINFO_ITEM.
Moved some one-line functions from class_board_connected_item.cpp to class_board_connected_item.h.
Added a copyright notice, moved Doxygen comments from class_board_connected_item.cpp to class_board_connected_item.h.
I have some doubts if changes introduced pcbnew/dialogs/dialog_pad_properties.cpp do not break anything, but I could not find a test case that breaks the pcbnew.
Performed tests:
- changed pad's net name from empty to existent - ok, name was changed
- changed pad's net name from empty to nonexistent - ok, error message is displayed, net name stays empty
- changed pad's net name from existent to empty - ok, net name became empty
- changed pad's net name from existent to nonexistent - ok, error message is displayed, net name is not changed
- (re)reading netlists, including net changes - fine, changes are applied, but empty nets are still kept
- loaded pcbnew/pcad2kicadpcb_plugin/examples/CK1202_V1.pcb to test P-CAD import plugin - ok, net names are correct
- imported an Eagle 6.0 board (Arduino Uno; http://arduino.cc/en/uploads/Main/arduino_Uno_Rev3-02-TH.zip) then saved in .kicad_pcb format and reloaded - ok, net names are correct
- saved demos/video/video.kicad_pcb in legacy format and then loaded it again - ok, net names are correct
2014-01-14 09:41:52 +00:00
|
|
|
|
BOARD_CONNECTED_ITEMs do not store net code anymore (m_NetCode field), instead net info is stored using a pointer to NETINFO_ITEM.
GetNet() refers to the net code stored in the NETINFO_ITEM. SetNet() finds an appropriate NETINFO_ITEM and uses it.
Removing GetNet() & SetNet() (and the whole net code idea) requires too many changes in the code (~250 references to the mentioned functions).
BOARD_CONNECTED_ITEMs by default get a pointer to NETINFO_ITEM that stores unconnected items. This requires for all BOARD_CONNECTED_ITEMs to have a parent (so BOARD* is accessible). The only orphaned item is BOARD_DESIGN_SETTINGS::m_Pad_Master, but it does not cause any issues so far.
Items that do not have access to a BOARD (do not have set parents) and therefore cannot get net assigned, by default get const static NETINFO_LIST::ORPHANED.
Performed tests:
- loaded .kicad_pcb, KiCad legacy board, Eagle 6.0 board, P-CAD board - all ok
- load a simple project, reload netlist after changing connections in eeschema - ok
- save & reload a board - ok, but still contain empty nets
- remove everything, restore with undo - ok
- remove everything, reload netlist - ok
- changing net names (all possibilites: empty->existing, empty->not existing, existing->empty, existing->not existing) - all ok
- zones: when net is changed to a net that does not have any nodes besides the zone itself, it does not get filled
2014-01-15 17:03:06 +00:00
|
|
|
/**
|
2019-07-25 11:08:41 +00:00
|
|
|
* Sets net using a net code.
|
BOARD_CONNECTED_ITEMs do not store net code anymore (m_NetCode field), instead net info is stored using a pointer to NETINFO_ITEM.
GetNet() refers to the net code stored in the NETINFO_ITEM. SetNet() finds an appropriate NETINFO_ITEM and uses it.
Removing GetNet() & SetNet() (and the whole net code idea) requires too many changes in the code (~250 references to the mentioned functions).
BOARD_CONNECTED_ITEMs by default get a pointer to NETINFO_ITEM that stores unconnected items. This requires for all BOARD_CONNECTED_ITEMs to have a parent (so BOARD* is accessible). The only orphaned item is BOARD_DESIGN_SETTINGS::m_Pad_Master, but it does not cause any issues so far.
Items that do not have access to a BOARD (do not have set parents) and therefore cannot get net assigned, by default get const static NETINFO_LIST::ORPHANED.
Performed tests:
- loaded .kicad_pcb, KiCad legacy board, Eagle 6.0 board, P-CAD board - all ok
- load a simple project, reload netlist after changing connections in eeschema - ok
- save & reload a board - ok, but still contain empty nets
- remove everything, restore with undo - ok
- remove everything, reload netlist - ok
- changing net names (all possibilites: empty->existing, empty->not existing, existing->empty, existing->not existing) - all ok
- zones: when net is changed to a net that does not have any nodes besides the zone itself, it does not get filled
2014-01-15 17:03:06 +00:00
|
|
|
* @param aNetCode is a net code for the new net. It has to exist in NETINFO_LIST held by BOARD.
|
2015-06-08 19:28:04 +00:00
|
|
|
* @param aNoAssert if true, do not assert that the net exists.
|
BOARD_CONNECTED_ITEMs do not store net code anymore (m_NetCode field), instead net info is stored using a pointer to NETINFO_ITEM.
GetNet() refers to the net code stored in the NETINFO_ITEM. SetNet() finds an appropriate NETINFO_ITEM and uses it.
Removing GetNet() & SetNet() (and the whole net code idea) requires too many changes in the code (~250 references to the mentioned functions).
BOARD_CONNECTED_ITEMs by default get a pointer to NETINFO_ITEM that stores unconnected items. This requires for all BOARD_CONNECTED_ITEMs to have a parent (so BOARD* is accessible). The only orphaned item is BOARD_DESIGN_SETTINGS::m_Pad_Master, but it does not cause any issues so far.
Items that do not have access to a BOARD (do not have set parents) and therefore cannot get net assigned, by default get const static NETINFO_LIST::ORPHANED.
Performed tests:
- loaded .kicad_pcb, KiCad legacy board, Eagle 6.0 board, P-CAD board - all ok
- load a simple project, reload netlist after changing connections in eeschema - ok
- save & reload a board - ok, but still contain empty nets
- remove everything, restore with undo - ok
- remove everything, reload netlist - ok
- changing net names (all possibilites: empty->existing, empty->not existing, existing->empty, existing->not existing) - all ok
- zones: when net is changed to a net that does not have any nodes besides the zone itself, it does not get filled
2014-01-15 17:03:06 +00:00
|
|
|
* Otherwise, item is assigned to the unconnected net.
|
2015-06-08 19:28:04 +00:00
|
|
|
* @return true on success, false if the net did not exist
|
2019-07-25 11:08:41 +00:00
|
|
|
* Note also items (in fact pads) not on copper layers will have
|
|
|
|
* their net code always set to 0 (not connected)
|
BOARD_CONNECTED_ITEMs do not store net code anymore (m_NetCode field), instead net info is stored using a pointer to NETINFO_ITEM.
GetNet() refers to the net code stored in the NETINFO_ITEM. SetNet() finds an appropriate NETINFO_ITEM and uses it.
Removing GetNet() & SetNet() (and the whole net code idea) requires too many changes in the code (~250 references to the mentioned functions).
BOARD_CONNECTED_ITEMs by default get a pointer to NETINFO_ITEM that stores unconnected items. This requires for all BOARD_CONNECTED_ITEMs to have a parent (so BOARD* is accessible). The only orphaned item is BOARD_DESIGN_SETTINGS::m_Pad_Master, but it does not cause any issues so far.
Items that do not have access to a BOARD (do not have set parents) and therefore cannot get net assigned, by default get const static NETINFO_LIST::ORPHANED.
Performed tests:
- loaded .kicad_pcb, KiCad legacy board, Eagle 6.0 board, P-CAD board - all ok
- load a simple project, reload netlist after changing connections in eeschema - ok
- save & reload a board - ok, but still contain empty nets
- remove everything, restore with undo - ok
- remove everything, reload netlist - ok
- changing net names (all possibilites: empty->existing, empty->not existing, existing->empty, existing->not existing) - all ok
- zones: when net is changed to a net that does not have any nodes besides the zone itself, it does not get filled
2014-01-15 17:03:06 +00:00
|
|
|
*/
|
2020-02-05 10:54:25 +00:00
|
|
|
bool SetNetCode( int aNetCode, bool aNoAssert );
|
|
|
|
|
|
|
|
void SetNetCode( int aNetCode )
|
|
|
|
{
|
|
|
|
SetNetCode( aNetCode, false );
|
|
|
|
}
|
2013-05-26 04:36:44 +00:00
|
|
|
|
Removed D_PAD::SetNetname() function and D_PAD::m_Netname, D_PAD::m_ShortNetname fields.
D_PAD::GetNetname() and D_PAD::GetShortNetname() were moved to BOARD_CONNECTED_ITEM. Now they use the net name stored in NETINFO_ITEM.
Moved some one-line functions from class_board_connected_item.cpp to class_board_connected_item.h.
Added a copyright notice, moved Doxygen comments from class_board_connected_item.cpp to class_board_connected_item.h.
I have some doubts if changes introduced pcbnew/dialogs/dialog_pad_properties.cpp do not break anything, but I could not find a test case that breaks the pcbnew.
Performed tests:
- changed pad's net name from empty to existent - ok, name was changed
- changed pad's net name from empty to nonexistent - ok, error message is displayed, net name stays empty
- changed pad's net name from existent to empty - ok, net name became empty
- changed pad's net name from existent to nonexistent - ok, error message is displayed, net name is not changed
- (re)reading netlists, including net changes - fine, changes are applied, but empty nets are still kept
- loaded pcbnew/pcad2kicadpcb_plugin/examples/CK1202_V1.pcb to test P-CAD import plugin - ok, net names are correct
- imported an Eagle 6.0 board (Arduino Uno; http://arduino.cc/en/uploads/Main/arduino_Uno_Rev3-02-TH.zip) then saved in .kicad_pcb format and reloaded - ok, net names are correct
- saved demos/video/video.kicad_pcb in legacy format and then loaded it again - ok, net names are correct
2014-01-14 09:41:52 +00:00
|
|
|
/**
|
|
|
|
* Function GetNetname
|
BOARD_CONNECTED_ITEMs do not store net code anymore (m_NetCode field), instead net info is stored using a pointer to NETINFO_ITEM.
GetNet() refers to the net code stored in the NETINFO_ITEM. SetNet() finds an appropriate NETINFO_ITEM and uses it.
Removing GetNet() & SetNet() (and the whole net code idea) requires too many changes in the code (~250 references to the mentioned functions).
BOARD_CONNECTED_ITEMs by default get a pointer to NETINFO_ITEM that stores unconnected items. This requires for all BOARD_CONNECTED_ITEMs to have a parent (so BOARD* is accessible). The only orphaned item is BOARD_DESIGN_SETTINGS::m_Pad_Master, but it does not cause any issues so far.
Items that do not have access to a BOARD (do not have set parents) and therefore cannot get net assigned, by default get const static NETINFO_LIST::ORPHANED.
Performed tests:
- loaded .kicad_pcb, KiCad legacy board, Eagle 6.0 board, P-CAD board - all ok
- load a simple project, reload netlist after changing connections in eeschema - ok
- save & reload a board - ok, but still contain empty nets
- remove everything, restore with undo - ok
- remove everything, reload netlist - ok
- changing net names (all possibilites: empty->existing, empty->not existing, existing->empty, existing->not existing) - all ok
- zones: when net is changed to a net that does not have any nodes besides the zone itself, it does not get filled
2014-01-15 17:03:06 +00:00
|
|
|
* @return wxString - the full netname
|
Removed D_PAD::SetNetname() function and D_PAD::m_Netname, D_PAD::m_ShortNetname fields.
D_PAD::GetNetname() and D_PAD::GetShortNetname() were moved to BOARD_CONNECTED_ITEM. Now they use the net name stored in NETINFO_ITEM.
Moved some one-line functions from class_board_connected_item.cpp to class_board_connected_item.h.
Added a copyright notice, moved Doxygen comments from class_board_connected_item.cpp to class_board_connected_item.h.
I have some doubts if changes introduced pcbnew/dialogs/dialog_pad_properties.cpp do not break anything, but I could not find a test case that breaks the pcbnew.
Performed tests:
- changed pad's net name from empty to existent - ok, name was changed
- changed pad's net name from empty to nonexistent - ok, error message is displayed, net name stays empty
- changed pad's net name from existent to empty - ok, net name became empty
- changed pad's net name from existent to nonexistent - ok, error message is displayed, net name is not changed
- (re)reading netlists, including net changes - fine, changes are applied, but empty nets are still kept
- loaded pcbnew/pcad2kicadpcb_plugin/examples/CK1202_V1.pcb to test P-CAD import plugin - ok, net names are correct
- imported an Eagle 6.0 board (Arduino Uno; http://arduino.cc/en/uploads/Main/arduino_Uno_Rev3-02-TH.zip) then saved in .kicad_pcb format and reloaded - ok, net names are correct
- saved demos/video/video.kicad_pcb in legacy format and then loaded it again - ok, net names are correct
2014-01-14 09:41:52 +00:00
|
|
|
*/
|
2020-08-19 18:37:13 +00:00
|
|
|
wxString GetNetname() const
|
2014-05-21 17:02:32 +00:00
|
|
|
{
|
2020-08-19 18:37:13 +00:00
|
|
|
return m_netinfo ? m_netinfo->GetNetname() : wxString();
|
2014-05-21 17:02:32 +00:00
|
|
|
}
|
Removed D_PAD::SetNetname() function and D_PAD::m_Netname, D_PAD::m_ShortNetname fields.
D_PAD::GetNetname() and D_PAD::GetShortNetname() were moved to BOARD_CONNECTED_ITEM. Now they use the net name stored in NETINFO_ITEM.
Moved some one-line functions from class_board_connected_item.cpp to class_board_connected_item.h.
Added a copyright notice, moved Doxygen comments from class_board_connected_item.cpp to class_board_connected_item.h.
I have some doubts if changes introduced pcbnew/dialogs/dialog_pad_properties.cpp do not break anything, but I could not find a test case that breaks the pcbnew.
Performed tests:
- changed pad's net name from empty to existent - ok, name was changed
- changed pad's net name from empty to nonexistent - ok, error message is displayed, net name stays empty
- changed pad's net name from existent to empty - ok, net name became empty
- changed pad's net name from existent to nonexistent - ok, error message is displayed, net name is not changed
- (re)reading netlists, including net changes - fine, changes are applied, but empty nets are still kept
- loaded pcbnew/pcad2kicadpcb_plugin/examples/CK1202_V1.pcb to test P-CAD import plugin - ok, net names are correct
- imported an Eagle 6.0 board (Arduino Uno; http://arduino.cc/en/uploads/Main/arduino_Uno_Rev3-02-TH.zip) then saved in .kicad_pcb format and reloaded - ok, net names are correct
- saved demos/video/video.kicad_pcb in legacy format and then loaded it again - ok, net names are correct
2014-01-14 09:41:52 +00:00
|
|
|
|
2018-01-31 09:08:57 +00:00
|
|
|
/**
|
|
|
|
* Function GetNetnameMsg
|
|
|
|
* @return wxString - the full netname or "<no net>" in square braces, followed by
|
|
|
|
* "(Not Found)" if the netcode is undefined.
|
|
|
|
*/
|
|
|
|
wxString GetNetnameMsg() const
|
|
|
|
{
|
|
|
|
if( !GetBoard() )
|
|
|
|
return wxT( "[** NO BOARD DEFINED **]" );
|
|
|
|
|
|
|
|
wxString netname = GetNetname();
|
|
|
|
|
|
|
|
if( !netname.length() )
|
|
|
|
return wxT( "[<no net>]" );
|
|
|
|
else if( GetNetCode() < 0 )
|
2018-10-19 11:28:34 +00:00
|
|
|
return wxT( "[" + UnescapeString( netname ) + "](" + _( "Not Found" ) + ")" );
|
2018-01-31 09:08:57 +00:00
|
|
|
else
|
2018-10-19 11:28:34 +00:00
|
|
|
return wxT( "[" + UnescapeString( netname ) + "]" );
|
2018-01-31 09:08:57 +00:00
|
|
|
}
|
|
|
|
|
Removed D_PAD::SetNetname() function and D_PAD::m_Netname, D_PAD::m_ShortNetname fields.
D_PAD::GetNetname() and D_PAD::GetShortNetname() were moved to BOARD_CONNECTED_ITEM. Now they use the net name stored in NETINFO_ITEM.
Moved some one-line functions from class_board_connected_item.cpp to class_board_connected_item.h.
Added a copyright notice, moved Doxygen comments from class_board_connected_item.cpp to class_board_connected_item.h.
I have some doubts if changes introduced pcbnew/dialogs/dialog_pad_properties.cpp do not break anything, but I could not find a test case that breaks the pcbnew.
Performed tests:
- changed pad's net name from empty to existent - ok, name was changed
- changed pad's net name from empty to nonexistent - ok, error message is displayed, net name stays empty
- changed pad's net name from existent to empty - ok, net name became empty
- changed pad's net name from existent to nonexistent - ok, error message is displayed, net name is not changed
- (re)reading netlists, including net changes - fine, changes are applied, but empty nets are still kept
- loaded pcbnew/pcad2kicadpcb_plugin/examples/CK1202_V1.pcb to test P-CAD import plugin - ok, net names are correct
- imported an Eagle 6.0 board (Arduino Uno; http://arduino.cc/en/uploads/Main/arduino_Uno_Rev3-02-TH.zip) then saved in .kicad_pcb format and reloaded - ok, net names are correct
- saved demos/video/video.kicad_pcb in legacy format and then loaded it again - ok, net names are correct
2014-01-14 09:41:52 +00:00
|
|
|
/**
|
|
|
|
* Function GetShortNetname
|
BOARD_CONNECTED_ITEMs do not store net code anymore (m_NetCode field), instead net info is stored using a pointer to NETINFO_ITEM.
GetNet() refers to the net code stored in the NETINFO_ITEM. SetNet() finds an appropriate NETINFO_ITEM and uses it.
Removing GetNet() & SetNet() (and the whole net code idea) requires too many changes in the code (~250 references to the mentioned functions).
BOARD_CONNECTED_ITEMs by default get a pointer to NETINFO_ITEM that stores unconnected items. This requires for all BOARD_CONNECTED_ITEMs to have a parent (so BOARD* is accessible). The only orphaned item is BOARD_DESIGN_SETTINGS::m_Pad_Master, but it does not cause any issues so far.
Items that do not have access to a BOARD (do not have set parents) and therefore cannot get net assigned, by default get const static NETINFO_LIST::ORPHANED.
Performed tests:
- loaded .kicad_pcb, KiCad legacy board, Eagle 6.0 board, P-CAD board - all ok
- load a simple project, reload netlist after changing connections in eeschema - ok
- save & reload a board - ok, but still contain empty nets
- remove everything, restore with undo - ok
- remove everything, reload netlist - ok
- changing net names (all possibilites: empty->existing, empty->not existing, existing->empty, existing->not existing) - all ok
- zones: when net is changed to a net that does not have any nodes besides the zone itself, it does not get filled
2014-01-15 17:03:06 +00:00
|
|
|
* @return wxString - the short netname
|
Removed D_PAD::SetNetname() function and D_PAD::m_Netname, D_PAD::m_ShortNetname fields.
D_PAD::GetNetname() and D_PAD::GetShortNetname() were moved to BOARD_CONNECTED_ITEM. Now they use the net name stored in NETINFO_ITEM.
Moved some one-line functions from class_board_connected_item.cpp to class_board_connected_item.h.
Added a copyright notice, moved Doxygen comments from class_board_connected_item.cpp to class_board_connected_item.h.
I have some doubts if changes introduced pcbnew/dialogs/dialog_pad_properties.cpp do not break anything, but I could not find a test case that breaks the pcbnew.
Performed tests:
- changed pad's net name from empty to existent - ok, name was changed
- changed pad's net name from empty to nonexistent - ok, error message is displayed, net name stays empty
- changed pad's net name from existent to empty - ok, net name became empty
- changed pad's net name from existent to nonexistent - ok, error message is displayed, net name is not changed
- (re)reading netlists, including net changes - fine, changes are applied, but empty nets are still kept
- loaded pcbnew/pcad2kicadpcb_plugin/examples/CK1202_V1.pcb to test P-CAD import plugin - ok, net names are correct
- imported an Eagle 6.0 board (Arduino Uno; http://arduino.cc/en/uploads/Main/arduino_Uno_Rev3-02-TH.zip) then saved in .kicad_pcb format and reloaded - ok, net names are correct
- saved demos/video/video.kicad_pcb in legacy format and then loaded it again - ok, net names are correct
2014-01-14 09:41:52 +00:00
|
|
|
*/
|
2020-08-19 18:37:13 +00:00
|
|
|
wxString GetShortNetname() const
|
2014-05-21 17:02:32 +00:00
|
|
|
{
|
|
|
|
return m_netinfo->GetShortNetname();
|
|
|
|
}
|
2013-05-26 04:36:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetClearance
|
2020-10-12 17:40:03 +00:00
|
|
|
* returns an item's "own" clearance in internal units.
|
2020-08-07 20:18:33 +00:00
|
|
|
* @param aLayer the layer in question
|
2020-04-26 12:21:37 +00:00
|
|
|
* @param aSource [out] optionally reports the source as a user-readable string
|
2017-06-27 20:21:29 +00:00
|
|
|
* @return int - the clearance in internal units.
|
2013-05-26 04:36:44 +00:00
|
|
|
*/
|
2020-10-12 17:40:03 +00:00
|
|
|
virtual int GetOwnClearance( PCB_LAYER_ID aLayer, wxString* aSource = nullptr ) const;
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2020-05-29 12:36:45 +00:00
|
|
|
/**
|
|
|
|
* Function GetLocalClearanceOverrides
|
|
|
|
* returns any local clearance overrides set in the "classic" (ie: pre-rule) system.
|
|
|
|
* @param aSource [out] optionally reports the source as a user-readable string
|
|
|
|
* @return int - the clearance in internal units.
|
|
|
|
*/
|
2020-09-05 16:00:29 +00:00
|
|
|
virtual int GetLocalClearanceOverrides( wxString* aSource ) const { return 0; }
|
2020-05-29 12:36:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetLocalClearance
|
|
|
|
* returns any local clearances set in the "classic" (ie: pre-rule) system. These are
|
|
|
|
* things like zone clearance which are NOT an override.
|
|
|
|
* @param aSource [out] optionally reports the source as a user-readable string
|
|
|
|
* @return int - the clearance in internal units.
|
|
|
|
*/
|
2020-09-05 16:00:29 +00:00
|
|
|
virtual int GetLocalClearance( wxString* aSource ) const { return 0; }
|
2020-05-29 12:36:45 +00:00
|
|
|
|
2020-05-18 00:20:16 +00:00
|
|
|
/**
|
|
|
|
* Function GetNetClassPtr
|
|
|
|
* returns the NETCLASS for this item.
|
|
|
|
*
|
|
|
|
* Note: do NOT return a std::shared_ptr from this. It is used heavily in DRC, and the
|
|
|
|
* std::shared_ptr stuff shows up large in performance profiling.
|
|
|
|
*/
|
|
|
|
NETCLASS* GetNetClass() const;
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2020-05-23 21:48:24 +00:00
|
|
|
/**
|
|
|
|
* Function GetEffectiveNetclass
|
|
|
|
* returns the NETCLASS for this item, or the default netclass if none is defined.
|
|
|
|
*
|
|
|
|
* Note: do NOT return a std::shared_ptr from this. It is used heavily in DRC, and the
|
|
|
|
* std::shared_ptr stuff shows up large in performance profiling.
|
|
|
|
*/
|
|
|
|
NETCLASS* GetEffectiveNetclass() const;
|
|
|
|
|
2013-05-26 04:36:44 +00:00
|
|
|
/**
|
|
|
|
* Function GetNetClassName
|
Removed D_PAD::SetNetname() function and D_PAD::m_Netname, D_PAD::m_ShortNetname fields.
D_PAD::GetNetname() and D_PAD::GetShortNetname() were moved to BOARD_CONNECTED_ITEM. Now they use the net name stored in NETINFO_ITEM.
Moved some one-line functions from class_board_connected_item.cpp to class_board_connected_item.h.
Added a copyright notice, moved Doxygen comments from class_board_connected_item.cpp to class_board_connected_item.h.
I have some doubts if changes introduced pcbnew/dialogs/dialog_pad_properties.cpp do not break anything, but I could not find a test case that breaks the pcbnew.
Performed tests:
- changed pad's net name from empty to existent - ok, name was changed
- changed pad's net name from empty to nonexistent - ok, error message is displayed, net name stays empty
- changed pad's net name from existent to empty - ok, net name became empty
- changed pad's net name from existent to nonexistent - ok, error message is displayed, net name is not changed
- (re)reading netlists, including net changes - fine, changes are applied, but empty nets are still kept
- loaded pcbnew/pcad2kicadpcb_plugin/examples/CK1202_V1.pcb to test P-CAD import plugin - ok, net names are correct
- imported an Eagle 6.0 board (Arduino Uno; http://arduino.cc/en/uploads/Main/arduino_Uno_Rev3-02-TH.zip) then saved in .kicad_pcb format and reloaded - ok, net names are correct
- saved demos/video/video.kicad_pcb in legacy format and then loaded it again - ok, net names are correct
2014-01-14 09:41:52 +00:00
|
|
|
* returns a pointer to the netclass of the zone.
|
|
|
|
* If the net is not found (can happen when a netlist is reread,
|
|
|
|
* and the net name does not exist, return the default net class
|
|
|
|
* (should not return a null pointer).
|
2013-05-26 04:36:44 +00:00
|
|
|
* @return the Net Class name of this item
|
|
|
|
*/
|
|
|
|
wxString GetNetClassName() const;
|
2014-02-25 10:40:34 +00:00
|
|
|
|
2017-03-28 16:30:49 +00:00
|
|
|
void SetLocalRatsnestVisible( bool aVisible )
|
|
|
|
{
|
|
|
|
m_localRatsnestVisible = aVisible;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetLocalRatsnestVisible() const
|
|
|
|
{
|
|
|
|
return m_localRatsnestVisible;
|
|
|
|
}
|
|
|
|
|
2014-02-25 10:40:34 +00:00
|
|
|
protected:
|
|
|
|
/// Stores all informations about the net that item belongs to
|
|
|
|
NETINFO_ITEM* m_netinfo;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2017-03-28 16:30:49 +00:00
|
|
|
bool m_localRatsnestVisible;
|
2013-05-26 04:36:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // BOARD_CONNECTED_ITEM_H
|