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.
This commit is contained in:
parent
d4fb921b43
commit
2ba1984442
|
@ -1,3 +1,28 @@
|
||||||
|
/*
|
||||||
|
* 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 eeschema/netlist.cpp
|
* @file eeschema/netlist.cpp
|
||||||
*/
|
*/
|
||||||
|
@ -94,13 +119,10 @@ void SCH_EDIT_FRAME::BuildNetListBase()
|
||||||
FreeNetObjectsList( g_NetObjectslist );
|
FreeNetObjectsList( g_NetObjectslist );
|
||||||
|
|
||||||
/* Build the sheet (not screen) list (flattened)*/
|
/* Build the sheet (not screen) list (flattened)*/
|
||||||
SCH_SHEET_LIST SheetListList;
|
SCH_SHEET_LIST sheets;
|
||||||
|
|
||||||
/* Fill g_NetObjectslist with items used in connectivity calculation */
|
/* Fill g_NetObjectslist with items used in connectivity calculation */
|
||||||
|
for( sheet = sheets.GetFirst(); sheet != NULL; sheet = sheets.GetNext() )
|
||||||
sheet = SheetListList.GetFirst();
|
|
||||||
|
|
||||||
for( ; sheet != NULL; sheet = SheetListList.GetNext() )
|
|
||||||
AddConnectedObjects( sheet, g_NetObjectslist );
|
AddConnectedObjects( sheet, g_NetObjectslist );
|
||||||
|
|
||||||
if( g_NetObjectslist.size() == 0 )
|
if( g_NetObjectslist.size() == 0 )
|
||||||
|
@ -409,6 +431,7 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer )
|
||||||
|
|
||||||
// Calculate item priority (initial priority)
|
// Calculate item priority (initial priority)
|
||||||
int item_priority = 0;
|
int item_priority = 0;
|
||||||
|
|
||||||
for( unsigned ii = 0; ii <= NET_PRIO_MAX; ii++ )
|
for( unsigned ii = 0; ii <= NET_PRIO_MAX; ii++ )
|
||||||
{
|
{
|
||||||
if ( item->m_Type == priority_order[ii] )
|
if ( item->m_Type == priority_order[ii] )
|
||||||
|
@ -433,6 +456,7 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( candidate_priority > item_priority )
|
if( candidate_priority > item_priority )
|
||||||
{
|
{
|
||||||
item = candidate;
|
item = candidate;
|
||||||
|
@ -474,6 +498,7 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer )
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Connect sheets by sheetLabels
|
* Connect sheets by sheetLabels
|
||||||
*/
|
*/
|
||||||
|
@ -489,11 +514,11 @@ static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel )
|
||||||
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
||||||
{
|
{
|
||||||
NETLIST_OBJECT* ObjetNet = g_NetObjectslist[ii];
|
NETLIST_OBJECT* ObjetNet = g_NetObjectslist[ii];
|
||||||
|
|
||||||
if( ObjetNet->m_SheetList != SheetLabel->m_SheetListInclude )
|
if( ObjetNet->m_SheetList != SheetLabel->m_SheetListInclude )
|
||||||
continue; //use SheetInclude, not the sheet!!
|
continue; //use SheetInclude, not the sheet!!
|
||||||
|
|
||||||
if( (ObjetNet->m_Type != NET_HIERLABEL )
|
if( (ObjetNet->m_Type != NET_HIERLABEL ) && (ObjetNet->m_Type != NET_HIERBUSLABELMEMBER ) )
|
||||||
&& (ObjetNet->m_Type != NET_HIERBUSLABELMEMBER ) )
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( ObjetNet->GetNet() == SheetLabel->GetNet() )
|
if( ObjetNet->GetNet() == SheetLabel->GetNet() )
|
||||||
|
@ -524,105 +549,33 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
|
||||||
std::vector<NETLIST_OBJECT*>& aNetItemBuffer )
|
std::vector<NETLIST_OBJECT*>& aNetItemBuffer )
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
SCH_ITEM* DrawList;
|
SCH_ITEM* item;
|
||||||
NETLIST_OBJECT* new_item;
|
NETLIST_OBJECT* new_item;
|
||||||
SCH_COMPONENT* DrawLibItem;
|
SCH_COMPONENT* DrawLibItem;
|
||||||
LIB_COMPONENT* Entry;
|
LIB_COMPONENT* Entry;
|
||||||
SCH_SHEET_PATH list;
|
SCH_SHEET_PATH list;
|
||||||
|
|
||||||
DrawList = sheetlist->LastScreen()->GetDrawItems();
|
item = sheetlist->LastScreen()->GetDrawItems();
|
||||||
|
|
||||||
for( ; DrawList; DrawList = DrawList->Next() )
|
for( ; item; item = item->Next() )
|
||||||
{
|
{
|
||||||
switch( DrawList->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
|
case SCH_POLYLINE_T:
|
||||||
|
case SCH_BUS_ENTRY_T:
|
||||||
|
case SCH_MARKER_T:
|
||||||
|
case SCH_TEXT_T:
|
||||||
case SCH_LINE_T:
|
case SCH_LINE_T:
|
||||||
#undef STRUCT
|
|
||||||
#define STRUCT ( (SCH_LINE*) DrawList )
|
|
||||||
|
|
||||||
if( (STRUCT->GetLayer() != LAYER_BUS) && (STRUCT->GetLayer() != LAYER_WIRE) )
|
|
||||||
break;
|
|
||||||
|
|
||||||
new_item = new NETLIST_OBJECT();
|
|
||||||
new_item->m_SheetList = *sheetlist;
|
|
||||||
new_item->m_SheetListInclude = *sheetlist;
|
|
||||||
new_item->m_Comp = STRUCT;
|
|
||||||
new_item->m_Start = STRUCT->m_Start;
|
|
||||||
new_item->m_End = STRUCT->m_End;
|
|
||||||
|
|
||||||
if( STRUCT->GetLayer() == LAYER_BUS )
|
|
||||||
{
|
|
||||||
new_item->m_Type = NET_BUS;
|
|
||||||
}
|
|
||||||
else /* WIRE */
|
|
||||||
{
|
|
||||||
new_item->m_Type = NET_SEGMENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
aNetItemBuffer.push_back( new_item );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCH_JUNCTION_T:
|
case SCH_JUNCTION_T:
|
||||||
#undef STRUCT
|
|
||||||
#define STRUCT ( (SCH_JUNCTION*) DrawList )
|
|
||||||
new_item = new NETLIST_OBJECT();
|
|
||||||
|
|
||||||
new_item->m_SheetList = *sheetlist;
|
|
||||||
new_item->m_SheetListInclude = *sheetlist;
|
|
||||||
new_item->m_Comp = STRUCT;
|
|
||||||
new_item->m_Type = NET_JUNCTION;
|
|
||||||
new_item->m_Start = new_item->m_End = STRUCT->m_Pos;
|
|
||||||
|
|
||||||
aNetItemBuffer.push_back( new_item );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCH_NO_CONNECT_T:
|
case SCH_NO_CONNECT_T:
|
||||||
#undef STRUCT
|
item->GetNetListItem( aNetItemBuffer, sheetlist );
|
||||||
#define STRUCT ( (SCH_NO_CONNECT*) DrawList )
|
|
||||||
new_item = new NETLIST_OBJECT();
|
|
||||||
|
|
||||||
new_item->m_SheetList = *sheetlist;
|
|
||||||
new_item->m_SheetListInclude = *sheetlist;
|
|
||||||
new_item->m_Comp = STRUCT;
|
|
||||||
new_item->m_Type = NET_NOCONNECT;
|
|
||||||
new_item->m_Start = new_item->m_End = STRUCT->m_Pos;
|
|
||||||
|
|
||||||
aNetItemBuffer.push_back( new_item );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCH_LABEL_T:
|
case SCH_LABEL_T:
|
||||||
#undef STRUCT
|
|
||||||
#define STRUCT ( (SCH_LABEL*) DrawList )
|
|
||||||
ii = IsBusLabel( STRUCT->m_Text );
|
|
||||||
|
|
||||||
new_item = new NETLIST_OBJECT();
|
|
||||||
new_item->m_SheetList = *sheetlist;
|
|
||||||
new_item->m_SheetListInclude = *sheetlist;
|
|
||||||
new_item->m_Comp = STRUCT;
|
|
||||||
new_item->m_Type = NET_LABEL;
|
|
||||||
|
|
||||||
if( STRUCT->GetLayer() == LAYER_GLOBLABEL )
|
|
||||||
new_item->m_Type = NET_GLOBLABEL;
|
|
||||||
|
|
||||||
if( STRUCT->GetLayer() == LAYER_HIERLABEL )
|
|
||||||
new_item->m_Type = NET_HIERLABEL;
|
|
||||||
|
|
||||||
new_item->m_Label = STRUCT->m_Text;
|
|
||||||
new_item->m_Start = new_item->m_End = STRUCT->m_Pos;
|
|
||||||
|
|
||||||
aNetItemBuffer.push_back( new_item );
|
|
||||||
|
|
||||||
/* If a bus connects to label */
|
|
||||||
if( ii )
|
|
||||||
ConvertBusToMembers( aNetItemBuffer, *new_item );
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCH_GLOBAL_LABEL_T:
|
case SCH_GLOBAL_LABEL_T:
|
||||||
case SCH_HIERARCHICAL_LABEL_T:
|
case SCH_HIERARCHICAL_LABEL_T:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (SCH_LABEL*) DrawList )
|
#define STRUCT ( (SCH_LABEL*) item )
|
||||||
ii = IsBusLabel( STRUCT->m_Text );
|
ii = IsBusLabel( STRUCT->m_Text );
|
||||||
new_item = new NETLIST_OBJECT();
|
new_item = new NETLIST_OBJECT();
|
||||||
new_item->m_SheetList = *sheetlist;
|
new_item->m_SheetList = *sheetlist;
|
||||||
|
@ -650,7 +603,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCH_COMPONENT_T:
|
case SCH_COMPONENT_T:
|
||||||
DrawLibItem = (SCH_COMPONENT*) DrawList;
|
DrawLibItem = (SCH_COMPONENT*) item;
|
||||||
|
|
||||||
Entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->GetLibName() );
|
Entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->GetLibName() );
|
||||||
|
|
||||||
|
@ -703,32 +656,26 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCH_POLYLINE_T:
|
|
||||||
case SCH_BUS_ENTRY_T:
|
|
||||||
case SCH_MARKER_T:
|
|
||||||
case SCH_TEXT_T:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCH_SHEET_T:
|
case SCH_SHEET_T:
|
||||||
{
|
{
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (SCH_SHEET*) DrawList )
|
#define STRUCT ( (SCH_SHEET*) item )
|
||||||
list = *sheetlist;
|
list = *sheetlist;
|
||||||
list.Push( STRUCT );
|
list.Push( STRUCT );
|
||||||
SCH_SHEET* sheet = (SCH_SHEET*) DrawList;
|
SCH_SHEET* sheet = (SCH_SHEET*) item;
|
||||||
|
|
||||||
BOOST_FOREACH( SCH_SHEET_PIN pin, sheet->GetPins() )
|
BOOST_FOREACH( SCH_SHEET_PIN pin, sheet->GetPins() )
|
||||||
{
|
{
|
||||||
ii = IsBusLabel( pin.m_Text );
|
ii = IsBusLabel( pin.m_Text );
|
||||||
new_item = new NETLIST_OBJECT();
|
new_item = new NETLIST_OBJECT();
|
||||||
new_item->m_SheetListInclude = *sheetlist;
|
|
||||||
new_item->m_Comp = &pin;
|
|
||||||
new_item->m_SheetList = *sheetlist;
|
new_item->m_SheetList = *sheetlist;
|
||||||
new_item->m_Link = DrawList;
|
new_item->m_SheetListInclude = *sheetlist;
|
||||||
|
new_item->m_SheetListInclude = list;
|
||||||
|
new_item->m_Comp = &pin;
|
||||||
|
new_item->m_Link = item;
|
||||||
new_item->m_Type = NET_SHEETLABEL;
|
new_item->m_Type = NET_SHEETLABEL;
|
||||||
new_item->m_ElectricalType = pin.m_Shape;
|
new_item->m_ElectricalType = pin.m_Shape;
|
||||||
new_item->m_Label = pin.m_Text;
|
new_item->m_Label = pin.m_Text;
|
||||||
new_item->m_SheetListInclude = list;
|
|
||||||
new_item->m_Start = new_item->m_End = pin.m_Pos;
|
new_item->m_Start = new_item->m_End = pin.m_Pos;
|
||||||
aNetItemBuffer.push_back( new_item );
|
aNetItemBuffer.push_back( new_item );
|
||||||
|
|
||||||
|
@ -743,7 +690,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( wxT( "Netlist: unexpected struct type %d" ), DrawList->Type() );
|
msg.Printf( wxT( "Netlist: unexpected struct type %d" ), item->Type() );
|
||||||
wxMessageBox( msg );
|
wxMessageBox( msg );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1172,8 +1119,7 @@ void LabelConnect( NETLIST_OBJECT* LabelRef )
|
||||||
/* Comparison routine for sorting by increasing Netcode
|
/* Comparison routine for sorting by increasing Netcode
|
||||||
* table of elements connected (TabPinSort) by qsort ()
|
* table of elements connected (TabPinSort) by qsort ()
|
||||||
*/
|
*/
|
||||||
bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1,
|
bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1, const NETLIST_OBJECT* Objet2 )
|
||||||
const NETLIST_OBJECT* Objet2 )
|
|
||||||
{
|
{
|
||||||
return Objet1->GetNet() < Objet2->GetNet();
|
return Objet1->GetNet() < Objet2->GetNet();
|
||||||
}
|
}
|
||||||
|
@ -1182,8 +1128,7 @@ bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1,
|
||||||
/* Comparison routine for sorting items by Sheet Number ( used by qsort )
|
/* Comparison routine for sorting items by Sheet Number ( used by qsort )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool SortItemsBySheet( const NETLIST_OBJECT* Objet1,
|
bool SortItemsBySheet( const NETLIST_OBJECT* Objet1, const NETLIST_OBJECT* Objet2 )
|
||||||
const NETLIST_OBJECT* Objet2 )
|
|
||||||
{
|
{
|
||||||
return Objet1->m_SheetList.Cmp( Objet2->m_SheetList ) < 0;
|
return Objet1->m_SheetList.Cmp( Objet2->m_SheetList ) < 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,31 @@
|
||||||
/********************/
|
/*
|
||||||
/* 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 "fctsys.h"
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
|
@ -14,12 +39,9 @@
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
#include "sch_junction.h"
|
#include "sch_junction.h"
|
||||||
|
#include "class_netlist_object.h"
|
||||||
|
|
||||||
|
|
||||||
/**********************/
|
|
||||||
/* class SCH_JUNCTION */
|
|
||||||
/**********************/
|
|
||||||
|
|
||||||
SCH_JUNCTION::SCH_JUNCTION( const wxPoint& pos ) :
|
SCH_JUNCTION::SCH_JUNCTION( const wxPoint& pos ) :
|
||||||
SCH_ITEM( NULL, SCH_JUNCTION_T )
|
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)
|
#if defined(DEBUG)
|
||||||
void SCH_JUNCTION::Show( int nestLevel, std::ostream& os )
|
void SCH_JUNCTION::Show( int nestLevel, std::ostream& os )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,30 @@
|
||||||
|
/*
|
||||||
|
* 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
|
* @file sch_junction.h
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SCH_JUNCTION_H_
|
#ifndef _SCH_JUNCTION_H_
|
||||||
|
@ -93,6 +117,9 @@ public:
|
||||||
|
|
||||||
virtual BITMAP_DEF GetMenuImage() const { return add_junction_xpm; }
|
virtual BITMAP_DEF GetMenuImage() const { return add_junction_xpm; }
|
||||||
|
|
||||||
|
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
|
||||||
|
SCH_SHEET_PATH* aSheetPath );
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
void Show( int nestLevel, std::ostream& os );
|
void Show( int nestLevel, std::ostream& os );
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,32 @@
|
||||||
/******************/
|
/*
|
||||||
/* 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 "fctsys.h"
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
|
@ -13,6 +39,7 @@
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
#include "sch_line.h"
|
#include "sch_line.h"
|
||||||
|
#include "class_netlist_object.h"
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
|
@ -23,7 +50,7 @@ SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) :
|
||||||
m_Start = pos;
|
m_Start = pos;
|
||||||
m_End = pos;
|
m_End = pos;
|
||||||
m_Width = 0; // Default thickness used
|
m_Width = 0; // Default thickness used
|
||||||
m_StartIsDangling = m_EndIsDangling = FALSE;
|
m_StartIsDangling = m_EndIsDangling = false;
|
||||||
|
|
||||||
switch( layer )
|
switch( layer )
|
||||||
{
|
{
|
||||||
|
@ -421,6 +448,7 @@ void SCH_LINE::GetConnectionPoints( vector< wxPoint >& aPoints ) const
|
||||||
wxString SCH_LINE::GetSelectMenuText() const
|
wxString SCH_LINE::GetSelectMenuText() const
|
||||||
{
|
{
|
||||||
wxString menuText, txtfmt, orient;
|
wxString menuText, txtfmt, orient;
|
||||||
|
|
||||||
if( m_Start.x == m_End.x )
|
if( m_Start.x == m_End.x )
|
||||||
orient = _("Vert.");
|
orient = _("Vert.");
|
||||||
else if( m_Start.y == m_End.y )
|
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
|
bool SCH_LINE::operator <( const SCH_ITEM& aItem ) const
|
||||||
{
|
{
|
||||||
if( Type() != aItem.Type() )
|
if( Type() != aItem.Type() )
|
||||||
|
|
|
@ -1,6 +1,30 @@
|
||||||
|
/*
|
||||||
|
* 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
|
* @file sch_line.h
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SCH_LINE_H_
|
#ifndef _SCH_LINE_H_
|
||||||
|
@ -117,9 +141,9 @@ public:
|
||||||
*/
|
*/
|
||||||
bool MergeOverlap( SCH_LINE* aLine );
|
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; }
|
virtual bool IsDangling() const { return m_StartIsDangling || m_EndIsDangling; }
|
||||||
|
|
||||||
|
@ -137,6 +161,9 @@ public:
|
||||||
|
|
||||||
virtual BITMAP_DEF GetMenuImage() const;
|
virtual BITMAP_DEF GetMenuImage() const;
|
||||||
|
|
||||||
|
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
|
||||||
|
SCH_SHEET_PATH* aSheetPath );
|
||||||
|
|
||||||
virtual bool operator <( const SCH_ITEM& aItem ) const;
|
virtual bool operator <( const SCH_ITEM& aItem ) const;
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
|
|
|
@ -1,6 +1,32 @@
|
||||||
/************************/
|
/*
|
||||||
/* 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 "fctsys.h"
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
|
@ -14,6 +40,7 @@
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
#include "sch_no_connect.h"
|
#include "sch_no_connect.h"
|
||||||
|
#include "class_netlist_object.h"
|
||||||
|
|
||||||
|
|
||||||
SCH_NO_CONNECT::SCH_NO_CONNECT( const wxPoint& pos ) :
|
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 );
|
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
|
bool SCH_NO_CONNECT::doIsConnected( const wxPoint& aPosition ) const
|
||||||
{
|
{
|
||||||
return m_Pos == aPosition;
|
return m_Pos == aPosition;
|
||||||
|
|
|
@ -1,6 +1,30 @@
|
||||||
|
/*
|
||||||
|
* 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
|
* @file sch_no_connect.h
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SCH_NO_CONNECT_H_
|
#ifndef _SCH_NO_CONNECT_H_
|
||||||
|
@ -98,6 +122,9 @@ public:
|
||||||
|
|
||||||
virtual BITMAP_DEF GetMenuImage() const { return noconn_xpm; }
|
virtual BITMAP_DEF GetMenuImage() const { return noconn_xpm; }
|
||||||
|
|
||||||
|
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
|
||||||
|
SCH_SHEET_PATH* aSheetPath );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool doIsConnected( const wxPoint& aPosition ) const;
|
virtual bool doIsConnected( const wxPoint& aPosition ) const;
|
||||||
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const;
|
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/*****************************************************************************/
|
/**
|
||||||
/* 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
|
#ifndef SCH_ITEM_STRUCT_H
|
||||||
#define SCH_ITEM_STRUCT_H
|
#define SCH_ITEM_STRUCT_H
|
||||||
|
@ -12,10 +13,12 @@ using namespace std;
|
||||||
|
|
||||||
|
|
||||||
class SCH_ITEM;
|
class SCH_ITEM;
|
||||||
|
class SCH_SHEET_PATH;
|
||||||
class LINE_READER;
|
class LINE_READER;
|
||||||
class SCH_EDIT_FRAME;
|
class SCH_EDIT_FRAME;
|
||||||
class wxFindReplaceData;
|
class wxFindReplaceData;
|
||||||
class PLOTTER;
|
class PLOTTER;
|
||||||
|
class NETLIST_OBJECT;
|
||||||
|
|
||||||
|
|
||||||
typedef boost::ptr_vector< SCH_ITEM > SCH_ITEMS;
|
typedef boost::ptr_vector< SCH_ITEM > SCH_ITEMS;
|
||||||
|
@ -306,6 +309,18 @@ public:
|
||||||
|
|
||||||
void Plot( PLOTTER* aPlotter ) { doPlot( aPlotter ); }
|
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;
|
virtual bool operator <( const SCH_ITEM& aItem ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue