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
|
|
|
/**
|
2018-02-02 20:57:12 +00:00
|
|
|
* @file board_connected_item.h
|
2013-05-26 04:36:44 +00:00
|
|
|
* @brief Class BOARD_CONNECTED_ITEM.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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>
|
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;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class BOARD_CONNECTED_ITEM
|
|
|
|
* 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:
|
|
|
|
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 )
|
|
|
|
{
|
|
|
|
assert( aNetInfo->GetBoard() == GetBoard() );
|
|
|
|
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
|
|
|
|
{
|
|
|
|
return m_netinfo->GetNet();
|
|
|
|
}
|
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
|
|
|
/**
|
2014-02-25 10:40:34 +00:00
|
|
|
* Function SetNetCode
|
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
|
|
|
* sets net using a net code.
|
|
|
|
* @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
|
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
|
|
|
*/
|
2015-06-08 19:28:04 +00:00
|
|
|
bool SetNetCode( int aNetCode, bool aNoAssert=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
|
|
|
*/
|
2014-05-21 17:02:32 +00:00
|
|
|
const wxString& GetNetname() const
|
|
|
|
{
|
|
|
|
return m_netinfo->GetNetname();
|
|
|
|
}
|
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
|
|
|
*/
|
2014-05-21 17:02:32 +00:00
|
|
|
const wxString& GetShortNetname() const
|
|
|
|
{
|
|
|
|
return m_netinfo->GetShortNetname();
|
|
|
|
}
|
2013-05-26 04:36:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetClearance
|
2017-06-27 20:21:29 +00:00
|
|
|
* returns the clearance in internal units. If \a aItem is not NULL then the
|
2013-05-26 04:36:44 +00:00
|
|
|
* returned clearance is the greater of this object's NETCLASS clearance and
|
|
|
|
* aItem's NETCLASS clearance. If \a aItem is NULL, then this objects clearance
|
|
|
|
* is returned.
|
|
|
|
* @param aItem is another BOARD_CONNECTED_ITEM or NULL
|
2017-06-27 20:21:29 +00:00
|
|
|
* @return int - the clearance in internal units.
|
2013-05-26 04:36:44 +00:00
|
|
|
*/
|
|
|
|
virtual int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetNetClass
|
|
|
|
* returns the NETCLASS for this item.
|
|
|
|
*/
|
2016-06-29 15:09:55 +00:00
|
|
|
std::shared_ptr<NETCLASS> GetNetClass() 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
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#if 0 // template for future
|
|
|
|
/**
|
|
|
|
* Class BOARD_ITEM_LIST
|
|
|
|
* is a container for a list of BOARD_ITEMs.
|
|
|
|
*/
|
|
|
|
class BOARD_ITEM_LIST : public BOARD_ITEM
|
|
|
|
{
|
|
|
|
typedef boost::ptr_vector<BOARD_ITEM> ITEM_ARRAY;
|
|
|
|
|
|
|
|
ITEM_ARRAY myItems;
|
|
|
|
|
|
|
|
BOARD_ITEM_LIST( const BOARD_ITEM_LIST& other ) :
|
|
|
|
BOARD_ITEM( NULL, PCB_ITEM_LIST_T )
|
|
|
|
{
|
|
|
|
// copy constructor is not supported, is private to cause compiler error
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
BOARD_ITEM_LIST( BOARD_ITEM* aParent = NULL ) :
|
|
|
|
BOARD_ITEM( aParent, PCB_ITEM_LIST_T )
|
|
|
|
{}
|
|
|
|
|
|
|
|
//-----< satisfy some virtual functions >------------------------------
|
|
|
|
const wxPoint GetPosition()
|
|
|
|
{
|
|
|
|
return wxPoint(0, 0); // dummy
|
|
|
|
}
|
|
|
|
|
|
|
|
void Draw( EDA_DRAW_PANEL* DrawPanel, wxDC* DC,
|
|
|
|
GR_DRAWMODE aDrawMode, const wxPoint& offset = ZeroOffset )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void UnLink()
|
|
|
|
{
|
|
|
|
/* if it were needed:
|
|
|
|
DHEAD* list = GetList();
|
|
|
|
|
|
|
|
wxASSERT( list );
|
|
|
|
|
|
|
|
list->remove( this );
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----</ satisfy some virtual functions >-----------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetCount
|
|
|
|
* returns the number of BOARD_ITEMs.
|
|
|
|
*/
|
|
|
|
int GetCount() const
|
|
|
|
{
|
|
|
|
return myItems.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Append( BOARD_ITEM* aItem )
|
|
|
|
{
|
|
|
|
myItems.push_back( aItem );
|
|
|
|
}
|
|
|
|
|
|
|
|
BOARD_ITEM* Replace( int aIndex, BOARD_ITEM* aItem )
|
|
|
|
{
|
|
|
|
ITEM_ARRAY::auto_type ret = myItems.replace( aIndex, aItem );
|
|
|
|
return ret.release();
|
|
|
|
}
|
|
|
|
|
|
|
|
BOARD_ITEM* Remove( int aIndex )
|
|
|
|
{
|
|
|
|
ITEM_ARRAY::auto_type ret = myItems.release( myItems.begin()+aIndex );
|
|
|
|
return ret.release();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Insert( int aIndex, BOARD_ITEM* aItem )
|
|
|
|
{
|
|
|
|
myItems.insert( myItems.begin()+aIndex, aItem );
|
|
|
|
}
|
|
|
|
|
|
|
|
BOARD_ITEM* At( int aIndex ) const
|
|
|
|
{
|
|
|
|
// we have varying sized objects and are using polymorphism, so we
|
|
|
|
// must return a pointer not a reference.
|
|
|
|
return (BOARD_ITEM*) &myItems[aIndex];
|
|
|
|
}
|
|
|
|
|
|
|
|
BOARD_ITEM* operator[]( int aIndex ) const
|
|
|
|
{
|
|
|
|
return At( aIndex );
|
|
|
|
}
|
|
|
|
|
|
|
|
void Delete( int aIndex )
|
|
|
|
{
|
|
|
|
myItems.erase( myItems.begin()+aIndex );
|
|
|
|
}
|
|
|
|
|
|
|
|
void PushBack( BOARD_ITEM* aItem )
|
|
|
|
{
|
|
|
|
Append( aItem );
|
|
|
|
}
|
|
|
|
|
|
|
|
BOARD_ITEM* PopBack()
|
|
|
|
{
|
|
|
|
if( GetCount() )
|
|
|
|
return Remove( GetCount()-1 );
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
#endif // future
|
|
|
|
|
|
|
|
#endif // BOARD_CONNECTED_ITEM_H
|