Commit 2ba19844 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Eeschema net list object generation improvements.

* Define function to allow schematic objects to create their own net list
  objects.
* Add net list object creation functions to schematic line, junction, and
  no connect objects.
* Add license statements to all modified files that required one.
parent d4fb921b
This diff is collapsed.
/********************/
/* sch_junction.cpp */
/********************/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 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
*/
/**
* @file sch_junction.cpp
*/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -14,12 +39,9 @@
#include "general.h"
#include "protos.h"
#include "sch_junction.h"
#include "class_netlist_object.h"
/**********************/
/* class SCH_JUNCTION */
/**********************/
SCH_JUNCTION::SCH_JUNCTION( const wxPoint& pos ) :
SCH_ITEM( NULL, SCH_JUNCTION_T )
{
......@@ -155,6 +177,21 @@ void SCH_JUNCTION::GetConnectionPoints( vector< wxPoint >& aPoints ) const
}
void SCH_JUNCTION::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath )
{
NETLIST_OBJECT* item = new NETLIST_OBJECT();
item->m_SheetList = *aSheetPath;
item->m_SheetListInclude = *aSheetPath;
item->m_Comp = (SCH_ITEM*) this;
item->m_Type = NET_JUNCTION;
item->m_Start = item->m_End = m_Pos;
aNetListItems.push_back( item );
}
#if defined(DEBUG)
void SCH_JUNCTION::Show( int nestLevel, std::ostream& os )
{
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 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
*/
/**
* @file sch_junction.h
*
*/
#ifndef _SCH_JUNCTION_H_
......@@ -93,6 +117,9 @@ public:
virtual BITMAP_DEF GetMenuImage() const { return add_junction_xpm; }
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath );
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os );
#endif
......
/******************/
/* Class SCH_LINE */
/******************/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 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
*/
/**
* @file sch_line.cpp
* @brief Class SCH_LINE implementation
*/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -13,6 +39,7 @@
#include "general.h"
#include "protos.h"
#include "sch_line.h"
#include "class_netlist_object.h"
#include <boost/foreach.hpp>
......@@ -23,7 +50,7 @@ SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) :
m_Start = pos;
m_End = pos;
m_Width = 0; // Default thickness used
m_StartIsDangling = m_EndIsDangling = FALSE;
m_StartIsDangling = m_EndIsDangling = false;
switch( layer )
{
......@@ -421,6 +448,7 @@ void SCH_LINE::GetConnectionPoints( vector< wxPoint >& aPoints ) const
wxString SCH_LINE::GetSelectMenuText() const
{
wxString menuText, txtfmt, orient;
if( m_Start.x == m_End.x )
orient = _("Vert.");
else if( m_Start.y == m_End.y )
......@@ -465,6 +493,33 @@ BITMAP_DEF SCH_LINE::GetMenuImage() const
}
void SCH_LINE::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath )
{
// Net list item not required for graphic lines.
if( (GetLayer() != LAYER_BUS) && (GetLayer() != LAYER_WIRE) )
return;
NETLIST_OBJECT* item = new NETLIST_OBJECT();
item->m_SheetList = *aSheetPath;
item->m_SheetListInclude = *aSheetPath;
item->m_Comp = (SCH_ITEM*) this;
item->m_Start = m_Start;
item->m_End = m_End;
if( GetLayer() == LAYER_BUS )
{
item->m_Type = NET_BUS;
}
else /* WIRE */
{
item->m_Type = NET_SEGMENT;
}
aNetListItems.push_back( item );
}
bool SCH_LINE::operator <( const SCH_ITEM& aItem ) const
{
if( Type() != aItem.Type() )
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 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
*/
/**
* @file sch_line.h
*
*/
#ifndef _SCH_LINE_H_
......@@ -117,9 +141,9 @@ public:
*/
bool MergeOverlap( SCH_LINE* aLine );
virtual void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList );
virtual void GetEndPoints( vector <DANGLING_END_ITEM>& aItemList );
virtual bool IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList );
virtual bool IsDanglingStateChanged( vector< DANGLING_END_ITEM >& aItemList );
virtual bool IsDangling() const { return m_StartIsDangling || m_EndIsDangling; }
......@@ -137,6 +161,9 @@ public:
virtual BITMAP_DEF GetMenuImage() const;
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath );
virtual bool operator <( const SCH_ITEM& aItem ) const;
#if defined(DEBUG)
......
/************************/
/* Class SCH_NO_CONNECT */
/************************/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 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
*/
/**
* @file sch_no_connect.cpp
* @brief Class SCH_NO_CONNECT implementation.
*/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -14,6 +40,7 @@
#include "general.h"
#include "protos.h"
#include "sch_no_connect.h"
#include "class_netlist_object.h"
SCH_NO_CONNECT::SCH_NO_CONNECT( const wxPoint& pos ) :
......@@ -155,6 +182,22 @@ void SCH_NO_CONNECT::GetConnectionPoints( vector< wxPoint >& aPoints ) const
aPoints.push_back( m_Pos );
}
void SCH_NO_CONNECT::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath )
{
NETLIST_OBJECT* item = new NETLIST_OBJECT();
item->m_SheetList = *aSheetPath;
item->m_SheetListInclude = *aSheetPath;
item->m_Comp = this;
item->m_Type = NET_NOCONNECT;
item->m_Start = item->m_End = m_Pos;
aNetListItems.push_back( item );
}
bool SCH_NO_CONNECT::doIsConnected( const wxPoint& aPosition ) const
{
return m_Pos == aPosition;
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 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
*/
/**
* @file sch_no_connect.h
*
*/
#ifndef _SCH_NO_CONNECT_H_
......@@ -98,6 +122,9 @@ public:
virtual BITMAP_DEF GetMenuImage() const { return noconn_xpm; }
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath );
private:
virtual bool doIsConnected( const wxPoint& aPosition ) const;
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const;
......
/*****************************************************************************/
/* sch_item_struct.h : Basic classes for most eeschema items descriptions */
/*****************************************************************************/
/**
* @file sch_item_struct.h
* @brief Base schematic object class definition.
*/
#ifndef SCH_ITEM_STRUCT_H
#define SCH_ITEM_STRUCT_H
......@@ -12,10 +13,12 @@ using namespace std;
class SCH_ITEM;
class SCH_SHEET_PATH;
class LINE_READER;
class SCH_EDIT_FRAME;
class wxFindReplaceData;
class PLOTTER;
class NETLIST_OBJECT;
typedef boost::ptr_vector< SCH_ITEM > SCH_ITEMS;
......@@ -306,6 +309,18 @@ public:
void Plot( PLOTTER* aPlotter ) { doPlot( aPlotter ); }
/**
* Function GetNetListItem
* creates a new #NETLIST_OBJECT for the schematic object and adds it to
* \a aNetListItems.
* <p>
* Not all schematic objects have net list items associated with them. This
* method only needs to be overridden for those schematic objects that have
* net list objects associated with them.
*/
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath ) { }
virtual bool operator <( const SCH_ITEM& aItem ) const;
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment