Solved netlist problems for multiple parts per package components in complex hierarchies.
B.O.M. generation still have a minor problem wih this.
This commit is contained in:
parent
88055164d5
commit
b8ea76fe63
|
@ -5,6 +5,15 @@ Started 2007-June-11
|
||||||
Please add newer entries at the top, list the date and your name with
|
Please add newer entries at the top, list the date and your name with
|
||||||
email address.
|
email address.
|
||||||
|
|
||||||
|
2008-May-15 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||||
|
================================================================================
|
||||||
|
+eeschema:
|
||||||
|
Solved netlist problems for multiple parts per package components
|
||||||
|
in complex hierarchies.
|
||||||
|
B.O.M. generation still have a minor problem wih this.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
2008-May-5 UPDATE Dick Hollenbeck <dick@softplc.com>
|
2008-May-5 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||||
================================================================================
|
================================================================================
|
||||||
+common.c
|
+common.c
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "gr_basic.h"
|
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
|
@ -15,8 +14,6 @@
|
||||||
|
|
||||||
#include "dialog_backanno.cpp"
|
#include "dialog_backanno.cpp"
|
||||||
|
|
||||||
#include "protos.h"
|
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
SCH_COMPONENT * WinEDA_SchematicFrame::FindComponentByRef(
|
SCH_COMPONENT * WinEDA_SchematicFrame::FindComponentByRef(
|
||||||
const wxString& reference )
|
const wxString& reference )
|
||||||
|
@ -72,7 +69,7 @@ bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* StuffFile )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
printf( " %s %s\n", CONV_TO_UTF8(Cmp->m_Field[REFERENCE].m_Text),
|
printf( " %s %s\n", CONV_TO_UTF8(Cmp->m_Field[REFERENCE].m_Text),
|
||||||
CONV_TO_UTF8(Cmp->m_Field[VALUE].m_Text) );
|
CONV_TO_UTF8(Cmp->m_Field[VALUE].m_Text) );
|
||||||
#endif
|
#endif
|
||||||
TextField = &Cmp->m_Field[FOOTPRINT];
|
TextField = &Cmp->m_Field[FOOTPRINT];
|
||||||
|
|
|
@ -293,9 +293,7 @@ SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos ) :
|
||||||
|
|
||||||
m_Pos = aPos;
|
m_Pos = aPos;
|
||||||
|
|
||||||
//m_FlagControlMulti = 0;
|
m_Convert = 0; /* De Morgan Handling */
|
||||||
m_UsedOnSheets.Clear();
|
|
||||||
m_Convert = 0; /* Gestion des mutiples representations (conversion De Morgan) */
|
|
||||||
|
|
||||||
/* The rotation/mirror transformation matrix. pos normal*/
|
/* The rotation/mirror transformation matrix. pos normal*/
|
||||||
m_Transform[0][0] = 1;
|
m_Transform[0][0] = 1;
|
||||||
|
@ -469,32 +467,40 @@ void SCH_COMPONENT::ClearAnnotation( DrawSheetPath* aSheet )
|
||||||
defRef.Append( wxT( "?" ) );
|
defRef.Append( wxT( "?" ) );
|
||||||
|
|
||||||
wxString multi = wxT( "1" );
|
wxString multi = wxT( "1" );
|
||||||
wxString NewHref;
|
|
||||||
wxString path;
|
if ( KeepMulti ) // We cannot remove all annotations: part selection must be kept
|
||||||
if( aSheet )
|
|
||||||
path = GetPath( aSheet );;
|
|
||||||
for( unsigned int ii = 0; ii< m_PathsAndReferences.GetCount(); ii++ )
|
|
||||||
{
|
{
|
||||||
// Break hierachical reference in path, ref and multi selection:
|
wxString NewHref;
|
||||||
reference_fields = wxStringTokenize( m_PathsAndReferences[ii], separators );
|
wxString path;
|
||||||
if( aSheet == NULL || reference_fields[0].Cmp( path ) == 0 )
|
if( aSheet )
|
||||||
|
path = GetPath( aSheet );;
|
||||||
|
for( unsigned int ii = 0; ii< m_PathsAndReferences.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
if( KeepMulti ) // Get and keep part selection
|
// Break hierachical reference in path, ref and multi selection:
|
||||||
multi = reference_fields[2];
|
reference_fields = wxStringTokenize( m_PathsAndReferences[ii], separators );
|
||||||
NewHref = reference_fields[0];
|
if( aSheet == NULL || reference_fields[0].Cmp( path ) == 0 )
|
||||||
NewHref << wxT( " " ) << defRef << wxT( " " ) << multi;
|
{
|
||||||
m_PathsAndReferences[ii] = NewHref;
|
if( KeepMulti ) // Get and keep part selection
|
||||||
|
multi = reference_fields[2];
|
||||||
|
NewHref = reference_fields[0];
|
||||||
|
NewHref << wxT( " " ) << defRef << wxT( " " ) << multi;
|
||||||
|
m_PathsAndReferences[ii] = NewHref;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_PathsAndReferences.Empty(); // Empty strings, but does not free memory because a new annotation will reuse it
|
||||||
|
m_Multi = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// These 2 changes do not work in complex hierarchy.
|
// These 2 changes do not work in complex hierarchy.
|
||||||
// When a clear annotation is made, the calling function must call a
|
// When a clear annotation is made, the calling function must call a
|
||||||
// UpdateAllScreenReferences for the active sheet.
|
// UpdateAllScreenReferences for the active sheet.
|
||||||
// But this call does not made here.
|
// But this call cannot made here.
|
||||||
m_Field[REFERENCE].m_Text = defRef; //for drawing.
|
m_Field[REFERENCE].m_Text = defRef; //for drawing.
|
||||||
|
|
||||||
if( !KeepMulti )
|
|
||||||
m_Multi = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -510,8 +516,6 @@ SCH_COMPONENT* SCH_COMPONENT::GenCopy()
|
||||||
new_item->m_ChipName = m_ChipName;
|
new_item->m_ChipName = m_ChipName;
|
||||||
new_item->m_PrefixString = m_PrefixString;
|
new_item->m_PrefixString = m_PrefixString;
|
||||||
|
|
||||||
//new_item->m_FlagControlMulti = m_FlagControlMulti;
|
|
||||||
new_item->m_UsedOnSheets = m_UsedOnSheets;
|
|
||||||
new_item->m_Convert = m_Convert;
|
new_item->m_Convert = m_Convert;
|
||||||
new_item->m_Transform[0][0] = m_Transform[0][0];
|
new_item->m_Transform[0][0] = m_Transform[0][0];
|
||||||
new_item->m_Transform[0][1] = m_Transform[0][1];
|
new_item->m_Transform[0][1] = m_Transform[0][1];
|
||||||
|
|
|
@ -100,8 +100,6 @@ public:
|
||||||
* determined, upon file load, by the first non-digits in the reference fields. */
|
* determined, upon file load, by the first non-digits in the reference fields. */
|
||||||
PartTextStruct m_Field[NUMBER_OF_FIELDS];
|
PartTextStruct m_Field[NUMBER_OF_FIELDS];
|
||||||
|
|
||||||
//int m_FlagControlMulti;
|
|
||||||
ArrayOfSheetLists m_UsedOnSheets; // Used as flags when calculating netlist
|
|
||||||
int m_Convert; /* Gestion (management) des mutiples representations (ex: conversion De Morgan) */
|
int m_Convert; /* Gestion (management) des mutiples representations (ex: conversion De Morgan) */
|
||||||
int m_Transform[2][2]; /* The rotation/mirror transformation matrix. */
|
int m_Transform[2][2]; /* The rotation/mirror transformation matrix. */
|
||||||
|
|
||||||
|
|
|
@ -402,7 +402,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (SCH_COMPONENT*) DrawItem )
|
#define STRUCT ( (SCH_COMPONENT*) DrawItem )
|
||||||
EDA_LibComponentStruct* Entry;
|
EDA_LibComponentStruct* Entry;
|
||||||
Entry = FindLibPart( STRUCT->m_ChipName, wxEmptyString, FIND_ROOT );
|
Entry = FindLibPart( STRUCT->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
||||||
if( Entry == NULL )
|
if( Entry == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -691,13 +691,6 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName )
|
||||||
|
|
||||||
GenListeCmp( List );
|
GenListeCmp( List );
|
||||||
|
|
||||||
#if 0
|
|
||||||
for( int i = 0; i<NbItems; i++ )
|
|
||||||
{
|
|
||||||
printf( "found component: %s\n", List[i].m_Ref );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* generation du fichier listing */
|
/* generation du fichier listing */
|
||||||
DateAndTime( Line );
|
DateAndTime( Line );
|
||||||
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
|
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
|
||||||
|
@ -707,13 +700,7 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName )
|
||||||
|
|
||||||
qsort( List, NbItems, sizeof( ListComponent ),
|
qsort( List, NbItems, sizeof( ListComponent ),
|
||||||
( int( * ) ( const void*, const void* ) )ListTriComposantByRef );
|
( int( * ) ( const void*, const void* ) )ListTriComposantByRef );
|
||||||
#if 0
|
|
||||||
printf( "sorted by reference:\n" );
|
|
||||||
for( int i = 0; i<NbItems; i++ )
|
|
||||||
{
|
|
||||||
printf( "found component: %s\n", List[i].m_Ref );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// if( ! s_ListWithSubCmponents )
|
// if( ! s_ListWithSubCmponents )
|
||||||
if( !m_ListSubCmpItems->GetValue() )
|
if( !m_ListSubCmpItems->GetValue() )
|
||||||
DeleteSubCmp( List, NbItems );
|
DeleteSubCmp( List, NbItems );
|
||||||
|
@ -785,20 +772,17 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName )
|
||||||
int GenListeCmp( ListComponent* List )
|
int GenListeCmp( ListComponent* List )
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
|
||||||
/* Routine de generation de la liste des elements utiles du dessin
|
/* Creates the list of components in the schematic
|
||||||
* Si List == NULL: comptage des elements
|
|
||||||
* Sinon remplissage de la liste
|
|
||||||
* Initialise "FlagControlMulti" a SheetNumber pour la sortie des listes
|
|
||||||
* et m_Father comme pointeur sur la sheet d'appartenance
|
|
||||||
*
|
*
|
||||||
* routine for generating a list of the used components.
|
* routine for generating a list of the used components.
|
||||||
* if List == null, just returns the count. if not, fills the list.
|
* if List == null, just returns the count. if not, fills the list.
|
||||||
* goes through the sheets, not the screens, so that we account for
|
* goes through the sheets, not the screens, so that we account for
|
||||||
* multiple instances of a given screen.
|
* multiple instances of a given screen.
|
||||||
|
* Also Initialise m_Father as pointer pointeur of the SCH_SCREN parent
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int ItemCount = 0;
|
int ItemCount = 0;
|
||||||
EDA_BaseStruct* DrawList;
|
EDA_BaseStruct* SchItem;
|
||||||
SCH_COMPONENT* DrawLibItem;
|
SCH_COMPONENT* DrawLibItem;
|
||||||
DrawSheetPath* sheet;
|
DrawSheetPath* sheet;
|
||||||
|
|
||||||
|
@ -807,31 +791,23 @@ int GenListeCmp( ListComponent* List )
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
||||||
{
|
{
|
||||||
DrawList = sheet->LastDrawList();
|
for ( SchItem = sheet->LastDrawList(); SchItem;SchItem = SchItem->Next() )
|
||||||
while( DrawList )
|
|
||||||
{
|
{
|
||||||
switch( DrawList->Type() )
|
if( SchItem->Type() != TYPE_SCH_COMPONENT )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ItemCount++;
|
||||||
|
DrawLibItem = (SCH_COMPONENT*) SchItem;
|
||||||
|
DrawLibItem->m_Parent = sheet->LastScreen();
|
||||||
|
if( List )
|
||||||
{
|
{
|
||||||
case TYPE_SCH_COMPONENT:
|
List->m_Comp = DrawLibItem;
|
||||||
ItemCount++;
|
List->m_SheetList = *sheet;
|
||||||
DrawLibItem = (SCH_COMPONENT*) DrawList;
|
strncpy( List->m_Ref,
|
||||||
DrawLibItem->m_Parent = sheet->LastScreen();
|
CONV_TO_UTF8( DrawLibItem->GetRef( sheet ) ),
|
||||||
if( List )
|
sizeof( List->m_Ref ) );
|
||||||
{
|
List++;
|
||||||
List->m_Comp = DrawLibItem;
|
|
||||||
List->m_SheetList = *sheet;
|
|
||||||
strncpy( List->m_Ref,
|
|
||||||
CONV_TO_UTF8( DrawLibItem->GetRef( sheet ) ),
|
|
||||||
sizeof( List->m_Ref ) );
|
|
||||||
List++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawList = DrawList->Pnext;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,19 +23,24 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f, bool use_
|
||||||
|
|
||||||
static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet );
|
static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet );
|
||||||
static void AddPinToComponentPinList( SCH_COMPONENT* Component,
|
static void AddPinToComponentPinList( SCH_COMPONENT* Component,
|
||||||
DrawSheetPath* sheet,
|
DrawSheetPath* sheet,
|
||||||
LibDrawPin* PinEntry );
|
LibDrawPin* PinEntry );
|
||||||
static void FindOthersUnits( SCH_COMPONENT* Component, DrawSheetPath* Sheet_in);
|
static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component,
|
||||||
|
EDA_LibComponentStruct* Entry,
|
||||||
|
DrawSheetPath* Sheet_in );
|
||||||
static int SortPinsByNum( ObjetNetListStruct** Pin1, ObjetNetListStruct** Pin2 );
|
static int SortPinsByNum( ObjetNetListStruct** Pin1, ObjetNetListStruct** Pin2 );
|
||||||
static void EraseDuplicatePins( ObjetNetListStruct** TabPin, int NbrPin );
|
static void EraseDuplicatePins( ObjetNetListStruct** TabPin, int NbrPin );
|
||||||
|
|
||||||
static void ClearUsedFlags( WinEDA_SchematicFrame* frame );
|
static void ClearUsedFlags( void );
|
||||||
|
|
||||||
|
|
||||||
/* Variable locales */
|
/* Local variables */
|
||||||
static int s_SortedPinCount;
|
static int s_SortedPinCount;
|
||||||
static ObjetNetListStruct** s_SortedComponentPinList;
|
static ObjetNetListStruct** s_SortedComponentPinList;
|
||||||
|
|
||||||
|
// list of references arready found for multi part per packages components
|
||||||
|
// (used to avoid to used more than one time a component)
|
||||||
|
static wxArrayString s_ReferencesAlreadyFound;
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
void WriteNetList( WinEDA_SchematicFrame* frame, const wxString& FileNameNL,
|
void WriteNetList( WinEDA_SchematicFrame* frame, const wxString& FileNameNL,
|
||||||
|
@ -82,16 +87,16 @@ void WriteNetList( WinEDA_SchematicFrame* frame, const wxString& FileNameNL,
|
||||||
fclose( f );
|
fclose( f );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Write_GENERIC_NetList( frame, FileNameNL );
|
Write_GENERIC_NetList( frame, FileNameNL );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
static SCH_COMPONENT* FindNextComponentAndCreatPinList(
|
static SCH_COMPONENT* FindNextComponentAndCreatPinList(
|
||||||
EDA_BaseStruct* DrawList, DrawSheetPath* sheet)
|
EDA_BaseStruct* DrawList, DrawSheetPath* sheet )
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
/* Find a "suitable" component from the DrawList
|
/* Find a "suitable" component from the DrawList
|
||||||
|
@ -103,7 +108,7 @@ static SCH_COMPONENT* FindNextComponentAndCreatPinList(
|
||||||
* Must be deallocated by the user
|
* Must be deallocated by the user
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
SCH_COMPONENT* Component = NULL;
|
SCH_COMPONENT* Component = NULL;
|
||||||
EDA_LibComponentStruct* Entry;
|
EDA_LibComponentStruct* Entry;
|
||||||
LibEDA_BaseStruct* DEntry;
|
LibEDA_BaseStruct* DEntry;
|
||||||
|
|
||||||
|
@ -115,15 +120,12 @@ static SCH_COMPONENT* FindNextComponentAndCreatPinList(
|
||||||
continue;
|
continue;
|
||||||
Component = (SCH_COMPONENT*) DrawList;
|
Component = (SCH_COMPONENT*) DrawList;
|
||||||
|
|
||||||
/* already tested ? : */
|
/* Power symbol and other component which have the reference starting by
|
||||||
bool found = false;
|
* "#" are not included in netlist (pseudo or virtual components) */
|
||||||
for(unsigned int i =0; i<Component->m_UsedOnSheets.GetCount(); i++){
|
wxString str = Component->GetRef( sheet );
|
||||||
if( Component->m_UsedOnSheets.Item(i) == *sheet ){
|
if( str[0] == '#' ) // ignore it
|
||||||
found = true;
|
continue;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( found ) continue;
|
|
||||||
//if( Component->m_FlagControlMulti == 1 )
|
//if( Component->m_FlagControlMulti == 1 )
|
||||||
// continue; /* yes */
|
// continue; /* yes */
|
||||||
// removed because with multiple instances of one schematic
|
// removed because with multiple instances of one schematic
|
||||||
|
@ -133,11 +135,26 @@ static SCH_COMPONENT* FindNextComponentAndCreatPinList(
|
||||||
if( Entry == NULL )
|
if( Entry == NULL )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Power symbol and other component which have the reference starting by
|
if( Entry->m_UnitCount > 1 ) // Multi parts per package: test if already visited:
|
||||||
* "#" are not included in netlist (pseudo components) */
|
{
|
||||||
wxString str = Component->GetRef(sheet);
|
bool found = false;
|
||||||
if( str[0] == '#' )
|
for( unsigned jj = 0; jj < s_ReferencesAlreadyFound.GetCount(); jj++ )
|
||||||
continue;
|
{
|
||||||
|
if( str == s_ReferencesAlreadyFound[jj] ) // Already visited
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( found )
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s_ReferencesAlreadyFound.Add( str ); // Mark as visited
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Create the pin table for this component */
|
/* Create the pin table for this component */
|
||||||
int ii = sizeof(ObjetNetListStruct*) * MAXPIN;
|
int ii = sizeof(ObjetNetListStruct*) * MAXPIN;
|
||||||
|
@ -146,32 +163,31 @@ static SCH_COMPONENT* FindNextComponentAndCreatPinList(
|
||||||
memset( s_SortedComponentPinList, 0, ii );
|
memset( s_SortedComponentPinList, 0, ii );
|
||||||
|
|
||||||
DEntry = Entry->m_Drawings;
|
DEntry = Entry->m_Drawings;
|
||||||
for( ; DEntry != NULL; DEntry = DEntry->Next() )
|
if( Entry->m_UnitCount <= 1 ) // One part per package
|
||||||
{
|
{
|
||||||
if( DEntry->Type() != COMPONENT_PIN_DRAW_TYPE )
|
for( ; DEntry != NULL; DEntry = DEntry->Next() )
|
||||||
continue;
|
|
||||||
if( DEntry->m_Unit
|
|
||||||
&& (DEntry->m_Unit != Component->m_Multi) )
|
|
||||||
continue;
|
|
||||||
if( DEntry->m_Convert
|
|
||||||
&& (DEntry->m_Convert != Component->m_Convert) )
|
|
||||||
continue;
|
|
||||||
{
|
{
|
||||||
AddPinToComponentPinList( Component, sheet, (LibDrawPin*) DEntry );
|
if( DEntry->Type() != COMPONENT_PIN_DRAW_TYPE )
|
||||||
|
continue;
|
||||||
|
if( DEntry->m_Unit
|
||||||
|
&& ( DEntry->m_Unit != Component->GetUnitSelection( sheet ) ) )
|
||||||
|
continue;
|
||||||
|
if( DEntry->m_Convert
|
||||||
|
&& (DEntry->m_Convert != Component->m_Convert) )
|
||||||
|
continue;
|
||||||
|
{
|
||||||
|
AddPinToComponentPinList( Component, sheet, (LibDrawPin*) DEntry );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else // Multiple parts per package: Collect all parts ans pins for this reference
|
||||||
|
FindAllsInstancesOfComponent( Component, Entry, sheet );
|
||||||
|
|
||||||
//Component->m_FlagControlMulti = 1;
|
/* Sort Pins in s_SortedComponentPinList by pin number */
|
||||||
Component->m_UsedOnSheets.Add(*sheet);
|
|
||||||
|
|
||||||
if( Entry->m_UnitCount > 1 )
|
|
||||||
FindOthersUnits( Component, sheet);
|
|
||||||
|
|
||||||
/* Tri sur le numero de Pin de TabListePin */
|
|
||||||
qsort( s_SortedComponentPinList, s_SortedPinCount, sizeof(ObjetNetListStruct*),
|
qsort( s_SortedComponentPinList, s_SortedPinCount, sizeof(ObjetNetListStruct*),
|
||||||
( int( * ) ( const void*, const void* ) )SortPinsByNum );
|
( int( * ) ( const void*, const void* ) )SortPinsByNum );
|
||||||
|
|
||||||
/* Elimination des Pins redondantes du s_SortedComponentPinList */
|
/* Remove duplicate Pins in s_SortedComponentPinList */
|
||||||
EraseDuplicatePins( s_SortedComponentPinList, s_SortedPinCount );
|
EraseDuplicatePins( s_SortedComponentPinList, s_SortedPinCount );
|
||||||
|
|
||||||
return Component;
|
return Component;
|
||||||
|
@ -209,7 +225,7 @@ static wxString ReturnPinNetName( ObjetNetListStruct* Pin,
|
||||||
continue;
|
continue;
|
||||||
if( ( g_TabObjNet[jj].m_Type != NET_HIERLABEL)
|
if( ( g_TabObjNet[jj].m_Type != NET_HIERLABEL)
|
||||||
&& ( g_TabObjNet[jj].m_Type != NET_LABEL)
|
&& ( g_TabObjNet[jj].m_Type != NET_LABEL)
|
||||||
&& ( g_TabObjNet[jj].m_Type != NET_PINLABEL) )
|
&& ( g_TabObjNet[jj].m_Type != NET_PINLABEL) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
NetName = *g_TabObjNet[jj].m_Label;
|
NetName = *g_TabObjNet[jj].m_Label;
|
||||||
|
@ -218,11 +234,13 @@ static wxString ReturnPinNetName( ObjetNetListStruct* Pin,
|
||||||
|
|
||||||
if( !NetName.IsEmpty() )
|
if( !NetName.IsEmpty() )
|
||||||
{
|
{
|
||||||
if( g_TabObjNet[jj].m_Type != NET_PINLABEL ){
|
if( g_TabObjNet[jj].m_Type != NET_PINLABEL )
|
||||||
|
{
|
||||||
NetName = g_TabObjNet[jj].m_SheetList.PathHumanReadable()
|
NetName = g_TabObjNet[jj].m_SheetList.PathHumanReadable()
|
||||||
+ NetName;
|
+ NetName;
|
||||||
}
|
}
|
||||||
//NetName << wxT("_") << g_TabObjNet[jj].m_SheetList.PathHumanReadable();
|
|
||||||
|
//NetName << wxT("_") << g_TabObjNet[jj].m_SheetList.PathHumanReadable();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -232,6 +250,7 @@ static wxString ReturnPinNetName( ObjetNetListStruct* Pin,
|
||||||
return NetName;
|
return NetName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
||||||
const wxString& FullFileName )
|
const wxString& FullFileName )
|
||||||
|
@ -239,17 +258,16 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
||||||
|
|
||||||
/* Create a generic netlist, and call an external netlister
|
/* Create a generic netlist, and call an external netlister
|
||||||
* to change the netlist syntax and create the file
|
* to change the netlist syntax and create the file
|
||||||
* -- does this still work?
|
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxString Line, FootprintName;
|
wxString Line, FootprintName;
|
||||||
DrawSheetPath* sheet;
|
DrawSheetPath* sheet;
|
||||||
EDA_BaseStruct* DrawList;
|
EDA_BaseStruct* SchItem;
|
||||||
SCH_COMPONENT* Component;
|
SCH_COMPONENT* Component;
|
||||||
wxString netname;
|
wxString netname;
|
||||||
int ii;
|
int ii;
|
||||||
FILE* tmpfile;
|
FILE* tmpfile;
|
||||||
wxString TmpFullFileName = FullFileName;
|
wxString TmpFullFileName = FullFileName;
|
||||||
|
|
||||||
ChangeFileNameExt( TmpFullFileName, wxT( ".tmp" ) );
|
ChangeFileNameExt( TmpFullFileName, wxT( ".tmp" ) );
|
||||||
|
|
||||||
|
@ -260,7 +278,7 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearUsedFlags( frame ); /* Reset the flags FlagControlMulti in all schematic files*/
|
ClearUsedFlags( ); /* Reset the flags FlagControlMulti in all schematic files*/
|
||||||
fprintf( tmpfile, "$BeginNetlist\n" );
|
fprintf( tmpfile, "$BeginNetlist\n" );
|
||||||
|
|
||||||
/* Create netlist module section */
|
/* Create netlist module section */
|
||||||
|
@ -269,12 +287,12 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
||||||
{
|
{
|
||||||
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Pnext )
|
for( SchItem = sheet->LastDrawList(); SchItem != NULL; SchItem = SchItem->Pnext )
|
||||||
{
|
{
|
||||||
DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet );
|
SchItem = Component = FindNextComponentAndCreatPinList( SchItem, sheet );
|
||||||
|
|
||||||
if( Component == NULL )
|
if( Component == NULL )
|
||||||
break; // No component left
|
break; // No component left
|
||||||
|
|
||||||
FootprintName.Empty();
|
FootprintName.Empty();
|
||||||
if( !Component->m_Field[FOOTPRINT].IsVoid() )
|
if( !Component->m_Field[FOOTPRINT].IsVoid() )
|
||||||
|
@ -286,7 +304,7 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
||||||
fprintf( tmpfile, "\n$BeginComponent\n" );
|
fprintf( tmpfile, "\n$BeginComponent\n" );
|
||||||
fprintf( tmpfile, "TimeStamp=%8.8lX\n", Component->m_TimeStamp );
|
fprintf( tmpfile, "TimeStamp=%8.8lX\n", Component->m_TimeStamp );
|
||||||
fprintf( tmpfile, "Footprint=%s\n", CONV_TO_UTF8( FootprintName ) );
|
fprintf( tmpfile, "Footprint=%s\n", CONV_TO_UTF8( FootprintName ) );
|
||||||
Line = wxT( "Reference=" ) + Component->GetRef(sheet) + wxT( "\n" );
|
Line = wxT( "Reference=" ) + Component->GetRef( sheet ) + wxT( "\n" );
|
||||||
Line.Replace( wxT( " " ), wxT( "_" ) );
|
Line.Replace( wxT( " " ), wxT( "_" ) );
|
||||||
fprintf( tmpfile, CONV_TO_UTF8( Line ) );
|
fprintf( tmpfile, CONV_TO_UTF8( Line ) );
|
||||||
|
|
||||||
|
@ -346,30 +364,12 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************/
|
/**********************************/
|
||||||
static void ClearUsedFlags( WinEDA_SchematicFrame* frame )
|
static void ClearUsedFlags( void )
|
||||||
/********************************************************/
|
/*********************************/
|
||||||
/* Clear flag list, used in netlist generation */
|
/* Clear flag list, used in netlist generation */
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen;
|
s_ReferencesAlreadyFound.Clear();
|
||||||
EDA_BaseStruct* DrawList;
|
|
||||||
|
|
||||||
EDA_ScreenList ScreenList;
|
|
||||||
|
|
||||||
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
|
|
||||||
{
|
|
||||||
DrawList = screen->EEDrawList;
|
|
||||||
while( DrawList )
|
|
||||||
{
|
|
||||||
if( DrawList->Type() == TYPE_SCH_COMPONENT )
|
|
||||||
{
|
|
||||||
SCH_COMPONENT* Component = (SCH_COMPONENT*) DrawList;
|
|
||||||
//Component->m_FlagControlMulti = 0;
|
|
||||||
Component->m_UsedOnSheets.Clear();
|
|
||||||
}
|
|
||||||
DrawList = DrawList->Pnext;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -384,22 +384,22 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
|
||||||
* sinon les nodes sont identifies par le netnumber
|
* sinon les nodes sont identifies par le netnumber
|
||||||
*
|
*
|
||||||
* tous les textes graphiques commen<EFBFBD>ant par [.-+]pspice ou [.-+]gnucap
|
* tous les textes graphiques commen<EFBFBD>ant par [.-+]pspice ou [.-+]gnucap
|
||||||
* sont consid<EFBFBD>r<EFBFBD>s comme des commandes a placer dans la netliste
|
* sont consideres comme des commandes a placer dans la netliste
|
||||||
* [.-]pspice ou gnucap sont en debut
|
* [.-]pspice ou gnucap sont en debut
|
||||||
+pspice et +gnucap sont en fin de netliste
|
+pspice et +gnucap sont en fin de netliste
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
char Line[1024];
|
char Line[1024];
|
||||||
DrawSheetPath* sheet;
|
DrawSheetPath* sheet;
|
||||||
EDA_BaseStruct* DrawList;
|
EDA_BaseStruct* DrawList;
|
||||||
SCH_COMPONENT* Component;
|
SCH_COMPONENT* Component;
|
||||||
int ii, nbitems;
|
int ii, nbitems;
|
||||||
wxString text;
|
wxString text;
|
||||||
wxArrayString SpiceCommandAtBeginFile, SpiceCommandAtEndFile;
|
wxArrayString SpiceCommandAtBeginFile, SpiceCommandAtEndFile;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
#define BUFYPOS_LEN 4
|
#define BUFYPOS_LEN 4
|
||||||
wxChar bufnum[BUFYPOS_LEN + 1];
|
wxChar bufnum[BUFYPOS_LEN + 1];
|
||||||
|
|
||||||
DateAndTime( Line );
|
DateAndTime( Line );
|
||||||
fprintf( f, "* %s (Spice format) creation date: %s\n\n", NETLIST_HEAD_STRING, Line );
|
fprintf( f, "* %s (Spice format) creation date: %s\n\n", NETLIST_HEAD_STRING, Line );
|
||||||
|
@ -417,7 +417,7 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
|
||||||
if( DrawList->Type() != TYPE_SCH_TEXT )
|
if( DrawList->Type() != TYPE_SCH_TEXT )
|
||||||
continue;
|
continue;
|
||||||
#define DRAWTEXT ( (SCH_TEXT*) DrawList )
|
#define DRAWTEXT ( (SCH_TEXT*) DrawList )
|
||||||
text = DRAWTEXT->m_Text; if( text.IsEmpty() )
|
text = DRAWTEXT->m_Text; if( text.IsEmpty() )
|
||||||
continue;
|
continue;
|
||||||
ident = text.GetChar( 0 );
|
ident = text.GetChar( 0 );
|
||||||
if( ident != '.' && ident != '-' && ident != '+' )
|
if( ident != '.' && ident != '-' && ident != '+' )
|
||||||
|
@ -461,7 +461,7 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
|
||||||
|
|
||||||
|
|
||||||
/* Create component list */
|
/* Create component list */
|
||||||
ClearUsedFlags( frame ); /* Reset the flags FlagControlMulti in all schematic files*/
|
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic files*/
|
||||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
||||||
{
|
{
|
||||||
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Pnext )
|
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Pnext )
|
||||||
|
@ -524,7 +524,7 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
|
|
||||||
/* Routine de generation du fichier netliste ( Format ORCAD PCB 2 ameliore )
|
/* Routine de generation du fichier netliste ( Format ORCAD PCB 2 ameliore )
|
||||||
* si with_pcbnew = FALSE
|
* si with_pcbnew = TRUE
|
||||||
* format PCBNEW (OrcadPcb2 + commentaires et liste des nets)
|
* format PCBNEW (OrcadPcb2 + commentaires et liste des nets)
|
||||||
* si with_pcbnew = FALSE
|
* si with_pcbnew = FALSE
|
||||||
* Format ORCADPCB2 strict
|
* Format ORCADPCB2 strict
|
||||||
|
@ -546,8 +546,8 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
|
||||||
fprintf( f, "( { %s created %s }\n", NETLIST_HEAD_STRING, Buf );
|
fprintf( f, "( { %s created %s }\n", NETLIST_HEAD_STRING, Buf );
|
||||||
|
|
||||||
|
|
||||||
/* Create netlist module section */
|
/* Create netlist module section */
|
||||||
ClearUsedFlags( frame ); /* Reset the flags FlagControlMulti in all schematic files*/
|
ClearUsedFlags( ); /* Reset the flags FlagControlMulti in all schematic files*/
|
||||||
|
|
||||||
EDA_SheetList SheetList( NULL );
|
EDA_SheetList SheetList( NULL );
|
||||||
|
|
||||||
|
@ -555,7 +555,7 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
|
||||||
{
|
{
|
||||||
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Pnext )
|
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Pnext )
|
||||||
{
|
{
|
||||||
DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet);
|
DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet );
|
||||||
if( Component == NULL )
|
if( Component == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -566,9 +566,10 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
|
||||||
{
|
{
|
||||||
if( Entry->m_FootprintList.GetCount() != 0 ) /* Put in list */
|
if( Entry->m_FootprintList.GetCount() != 0 ) /* Put in list */
|
||||||
{
|
{
|
||||||
if( CmpList == NULL ){
|
if( CmpList == NULL )
|
||||||
|
{
|
||||||
CmpList = (ListComponent*)
|
CmpList = (ListComponent*)
|
||||||
MyZMalloc( sizeof(ListComponent) * CmpListSize );
|
MyZMalloc( sizeof(ListComponent) * CmpListSize );
|
||||||
}
|
}
|
||||||
if( CmpListCount >= CmpListSize )
|
if( CmpListCount >= CmpListSize )
|
||||||
{
|
{
|
||||||
|
@ -578,7 +579,7 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
|
||||||
sizeof(ListComponent) * CmpListSize );
|
sizeof(ListComponent) * CmpListSize );
|
||||||
}
|
}
|
||||||
CmpList[CmpListCount].m_Comp = Component;
|
CmpList[CmpListCount].m_Comp = Component;
|
||||||
strcpy(CmpList[CmpListCount].m_Ref, Component->GetRef( sheet ).mb_str());
|
strcpy( CmpList[CmpListCount].m_Ref, Component->GetRef( sheet ).mb_str() );
|
||||||
CmpListCount++;
|
CmpListCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -591,9 +592,9 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
|
||||||
else
|
else
|
||||||
FootprintName = wxT( "$noname" );
|
FootprintName = wxT( "$noname" );
|
||||||
|
|
||||||
Line = Component->GetRef(sheet);
|
Line = Component->GetRef( sheet );
|
||||||
fprintf( f, " ( %s %s",
|
fprintf( f, " ( %s %s",
|
||||||
CONV_TO_UTF8(Component->GetPath(sheet)),
|
CONV_TO_UTF8( Component->GetPath( sheet ) ),
|
||||||
CONV_TO_UTF8( FootprintName ) );
|
CONV_TO_UTF8( FootprintName ) );
|
||||||
fprintf( f, " %s", CONV_TO_UTF8( Line ) );
|
fprintf( f, " %s", CONV_TO_UTF8( Line ) );
|
||||||
|
|
||||||
|
@ -640,13 +641,16 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
|
||||||
{
|
{
|
||||||
Component = CmpList[ii].m_Comp;
|
Component = CmpList[ii].m_Comp;
|
||||||
Entry = FindLibPart( Component->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
Entry = FindLibPart( Component->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
||||||
|
|
||||||
//Line.Printf(_("%s"), CmpList[ii].m_Ref);
|
//Line.Printf(_("%s"), CmpList[ii].m_Ref);
|
||||||
//Line.Replace( wxT( " " ), wxT( "_" ) );
|
//Line.Replace( wxT( " " ), wxT( "_" ) );
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for(i=0; i<sizeof(CmpList[ii].m_Ref) && CmpList[ii].m_Ref[i]; i++){
|
for( i = 0; i<sizeof(CmpList[ii].m_Ref) && CmpList[ii].m_Ref[i]; i++ )
|
||||||
if(CmpList[ii].m_Ref[i] == ' ')
|
{
|
||||||
|
if( CmpList[ii].m_Ref[i] == ' ' )
|
||||||
CmpList[ii].m_Ref[i] = '_';
|
CmpList[ii].m_Ref[i] = '_';
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( f, "$component %s\n", CmpList[ii].m_Ref );
|
fprintf( f, "$component %s\n", CmpList[ii].m_Ref );
|
||||||
/* Write the footprint list */
|
/* Write the footprint list */
|
||||||
for( unsigned int jj = 0; jj < Entry->m_FootprintList.GetCount(); jj++ )
|
for( unsigned int jj = 0; jj < Entry->m_FootprintList.GetCount(); jj++ )
|
||||||
|
@ -714,10 +718,12 @@ static void EraseDuplicatePins( ObjetNetListStruct** TabPin, int NbrPin )
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Routine qui elimine les Pins de meme Numero de la liste des objets
|
* Function to remove duplicate Pins in the TabPin pin list
|
||||||
* (Liste des Pins d'un boitier) passee en entree
|
* (This is a list of pins found in the whole schematic, for a given component)
|
||||||
* Ces pins redondantes proviennent des pins (alims... ) communes a plusieurs
|
* These duplicate pins were put in list because some pins (powers... )
|
||||||
* elements d'un boitier a multiple parts.
|
* are found more than one time when we have a multiple parts per package component
|
||||||
|
* for instance, a 74ls00 has 4 parts, and therefor the VCC pin and GND pin apperas 4 times
|
||||||
|
* in the list.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int ii, jj;
|
int ii, jj;
|
||||||
|
@ -725,7 +731,7 @@ static void EraseDuplicatePins( ObjetNetListStruct** TabPin, int NbrPin )
|
||||||
for( ii = 0; ii < NbrPin - 1; ii++ )
|
for( ii = 0; ii < NbrPin - 1; ii++ )
|
||||||
{
|
{
|
||||||
if( TabPin[ii] == NULL )
|
if( TabPin[ii] == NULL )
|
||||||
continue; /* Deja supprime */
|
continue; /* Deja supprime */
|
||||||
if( TabPin[ii]->m_PinNum != TabPin[ii + 1]->m_PinNum )
|
if( TabPin[ii]->m_PinNum != TabPin[ii + 1]->m_PinNum )
|
||||||
continue;
|
continue;
|
||||||
/* 2 Pins doublees */
|
/* 2 Pins doublees */
|
||||||
|
@ -739,82 +745,56 @@ static void EraseDuplicatePins( ObjetNetListStruct** TabPin, int NbrPin )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************************/
|
||||||
static void FindOthersUnits( SCH_COMPONENT* Component_in, DrawSheetPath* Sheet_in)
|
static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component_in,
|
||||||
/**********************************************************************/
|
EDA_LibComponentStruct* Entry,
|
||||||
|
DrawSheetPath* Sheet_in )
|
||||||
|
/**********************************************************************************/
|
||||||
|
|
||||||
/* Recherche les autres parts du boitier auquel appartient la part Component,
|
/**
|
||||||
* pour les boitiers a parts multiples.
|
* Used for multiple parts per package components
|
||||||
* Appelle AddPinToComponentPinList() pour classer les pins des parts trouvees
|
* Search all instances of Component_in,
|
||||||
|
* Calls AddPinToComponentPinList() to and pins founds to the current component pin list
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
EDA_BaseStruct* DrawList;
|
EDA_BaseStruct* SchItem;
|
||||||
SCH_COMPONENT* Component2;
|
SCH_COMPONENT* Component2;
|
||||||
EDA_LibComponentStruct* Entry;
|
|
||||||
LibEDA_BaseStruct* DEntry;
|
LibEDA_BaseStruct* DEntry;
|
||||||
DrawSheetPath* sheet;
|
DrawSheetPath* sheet;
|
||||||
wxString str;
|
wxString str, Reference = Component_in->GetRef( Sheet_in );
|
||||||
|
|
||||||
EDA_SheetList SheetList( NULL );
|
EDA_SheetList SheetList( NULL );
|
||||||
unsigned int i;
|
|
||||||
bool found;
|
|
||||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
||||||
{
|
{
|
||||||
DrawList = sheet->LastDrawList();
|
for( SchItem = sheet->LastDrawList(); SchItem; SchItem = SchItem->Pnext )
|
||||||
while( DrawList )
|
|
||||||
{
|
{
|
||||||
switch( DrawList->Type() )
|
if( SchItem->Type() != TYPE_SCH_COMPONENT )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Component2 = (SCH_COMPONENT*) SchItem;
|
||||||
|
|
||||||
|
str = Component2->GetRef( sheet );
|
||||||
|
if( str.CmpNoCase( Reference ) != 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( Entry && Entry->m_Drawings != NULL )
|
||||||
{
|
{
|
||||||
case TYPE_SCH_COMPONENT:
|
DEntry = Entry->m_Drawings;
|
||||||
Component2 = (SCH_COMPONENT*) DrawList;
|
for( ; DEntry != NULL; DEntry = DEntry->Next() )
|
||||||
|
|
||||||
found = false;
|
|
||||||
for( i =0; i<Component2->m_UsedOnSheets.GetCount(); i++){
|
|
||||||
if( Component2->m_UsedOnSheets.Item(i) == *Sheet_in ){
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( found ) break;
|
|
||||||
//if( Component2->m_FlagControlMulti == 1 ) //has it been used? (on this sheet?)
|
|
||||||
// break;
|
|
||||||
str = Component2->GetRef(sheet);
|
|
||||||
if( str.CmpNoCase( Component_in->GetRef(Sheet_in) ) != 0 )
|
|
||||||
break;
|
|
||||||
|
|
||||||
Entry = FindLibPart( Component2->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
|
||||||
if( Entry == NULL )
|
|
||||||
break;
|
|
||||||
|
|
||||||
if( str[0] == '#' )
|
|
||||||
break;
|
|
||||||
|
|
||||||
if( Entry->m_Drawings != NULL )
|
|
||||||
{
|
{
|
||||||
DEntry = Entry->m_Drawings;
|
if( DEntry->Type() != COMPONENT_PIN_DRAW_TYPE )
|
||||||
for( ; DEntry != NULL; DEntry = DEntry->Next() )
|
continue;
|
||||||
{
|
if( DEntry->m_Unit
|
||||||
if( DEntry->Type() != COMPONENT_PIN_DRAW_TYPE )
|
&& ( DEntry->m_Unit != Component2->GetUnitSelection( sheet ) ) )
|
||||||
continue;
|
continue;
|
||||||
if( DEntry->m_Unit
|
if( DEntry->m_Convert
|
||||||
&& (DEntry->m_Unit != Component2->m_Multi) )
|
&& (DEntry->m_Convert != Component2->m_Convert) )
|
||||||
continue;
|
continue;
|
||||||
if( DEntry->m_Convert
|
// A suitable pin in found: add it to the current list
|
||||||
&& (DEntry->m_Convert != Component2->m_Convert) )
|
AddPinToComponentPinList( Component2, sheet, (LibDrawPin*) DEntry );
|
||||||
continue;
|
|
||||||
{
|
|
||||||
AddPinToComponentPinList( Component2, sheet, (LibDrawPin*) DEntry );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Component2->m_UsedOnSheets.Add(*Sheet_in);
|
|
||||||
//Component2->m_FlagControlMulti = 1; //mark it as used..
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawList = DrawList->Pnext;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -858,11 +838,11 @@ static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet )
|
||||||
|
|
||||||
for( ii = 0; ii < g_NbrObjNet; ii++ )
|
for( ii = 0; ii < g_NbrObjNet; ii++ )
|
||||||
{
|
{
|
||||||
if( (NetCode = ObjNet[ii].GetNet()) != LastNetCode ) // New net found, write net id;
|
if( ( NetCode = ObjNet[ii].GetNet() ) != LastNetCode ) // New net found, write net id;
|
||||||
{
|
{
|
||||||
SameNetcodeCount = 0; // Items count for this net
|
SameNetcodeCount = 0; // Items count for this net
|
||||||
NetName.Empty();
|
NetName.Empty();
|
||||||
for( jj = 0; jj < g_NbrObjNet; jj++ ) // Find a label (if exists) for this net
|
for( jj = 0; jj < g_NbrObjNet; jj++ ) // Find a label (if exists) for this net
|
||||||
{
|
{
|
||||||
if( ObjNet[jj].GetNet() != NetCode )
|
if( ObjNet[jj].GetNet() != NetCode )
|
||||||
continue;
|
continue;
|
||||||
|
@ -879,10 +859,12 @@ static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet )
|
||||||
if( !NetName.IsEmpty() )
|
if( !NetName.IsEmpty() )
|
||||||
{
|
{
|
||||||
NetcodeName += NetName;
|
NetcodeName += NetName;
|
||||||
if( g_TabObjNet[jj].m_Type != NET_PINLABEL ){
|
if( g_TabObjNet[jj].m_Type != NET_PINLABEL )
|
||||||
|
{
|
||||||
// usual net name, add in the sheet path
|
// usual net name, add in the sheet path
|
||||||
NetcodeName = g_TabObjNet[jj].m_SheetList.PathHumanReadable()
|
NetcodeName = g_TabObjNet[jj].m_SheetList.PathHumanReadable()
|
||||||
+ NetcodeName;
|
+ NetcodeName;
|
||||||
|
|
||||||
//NetcodeName << wxT("_") <<
|
//NetcodeName << wxT("_") <<
|
||||||
// g_TabObjNet[jj].m_SheetList.PathHumanReadable();
|
// g_TabObjNet[jj].m_SheetList.PathHumanReadable();
|
||||||
}
|
}
|
||||||
|
@ -895,9 +877,9 @@ static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Cmp = (SCH_COMPONENT*) ObjNet[ii].m_Link;
|
Cmp = (SCH_COMPONENT*) ObjNet[ii].m_Link;
|
||||||
CmpRef = Cmp->GetRef(&ObjNet[ii].m_SheetList); //is this correct?
|
CmpRef = Cmp->GetRef( &ObjNet[ii].m_SheetList ); //is this correct?
|
||||||
if( CmpRef.StartsWith( wxT( "#" ) ) )
|
if( CmpRef.StartsWith( wxT( "#" ) ) )
|
||||||
continue; // Pseudo component (Like Power symbol)
|
continue; // Pseudo component (Like Power symbol)
|
||||||
|
|
||||||
// Print the pin list for this net, if 2 or more items are connected:
|
// Print the pin list for this net, if 2 or more items are connected:
|
||||||
SameNetcodeCount++;
|
SameNetcodeCount++;
|
||||||
|
@ -971,14 +953,14 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
|
||||||
fprintf( f, "\n" );
|
fprintf( f, "\n" );
|
||||||
|
|
||||||
/* Create netlist module section */
|
/* Create netlist module section */
|
||||||
ClearUsedFlags( frame ); /* Reset the flags FlagControlMulti in all schematic files*/
|
ClearUsedFlags( ); /* Reset the flags FlagControlMulti in all schematic files*/
|
||||||
EDA_SheetList SheetList( NULL );
|
EDA_SheetList SheetList( NULL );
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
||||||
{
|
{
|
||||||
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Pnext )
|
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Pnext )
|
||||||
{
|
{
|
||||||
DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet);
|
DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet );
|
||||||
if( Component == NULL )
|
if( Component == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -990,7 +972,7 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
|
||||||
else
|
else
|
||||||
FootprintName = wxT( "$noname" );
|
FootprintName = wxT( "$noname" );
|
||||||
|
|
||||||
msg = Component->GetRef(sheet);
|
msg = Component->GetRef( sheet );
|
||||||
fprintf( f, "%s ", CONV_TO_UTF8( StartCmpDesc ) );
|
fprintf( f, "%s ", CONV_TO_UTF8( StartCmpDesc ) );
|
||||||
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
|
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
|
||||||
|
|
||||||
|
@ -1038,7 +1020,7 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
|
||||||
for( ii = 0; ii < g_NbrObjNet; ii++ )
|
for( ii = 0; ii < g_NbrObjNet; ii++ )
|
||||||
{
|
{
|
||||||
// Get the NetName of the current net :
|
// Get the NetName of the current net :
|
||||||
if( (NetCode = ObjNet[ii].GetNet()) != LastNetCode )
|
if( ( NetCode = ObjNet[ii].GetNet() ) != LastNetCode )
|
||||||
{
|
{
|
||||||
NetName.Empty();
|
NetName.Empty();
|
||||||
for( jj = 0; jj < g_NbrObjNet; jj++ )
|
for( jj = 0; jj < g_NbrObjNet; jj++ )
|
||||||
|
@ -1057,9 +1039,11 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
|
||||||
if( !NetName.IsEmpty() )
|
if( !NetName.IsEmpty() )
|
||||||
{
|
{
|
||||||
NetcodeName += NetName;
|
NetcodeName += NetName;
|
||||||
if( g_TabObjNet[jj].m_Type != NET_PINLABEL ){
|
if( g_TabObjNet[jj].m_Type != NET_PINLABEL )
|
||||||
|
{
|
||||||
NetcodeName = g_TabObjNet[jj].m_SheetList.PathHumanReadable()
|
NetcodeName = g_TabObjNet[jj].m_SheetList.PathHumanReadable()
|
||||||
+ NetcodeName;
|
+ NetcodeName;
|
||||||
|
|
||||||
//NetcodeName << wxT("_") <<
|
//NetcodeName << wxT("_") <<
|
||||||
// g_TabObjNet[jj].m_SheetList.PathHumanReadable();
|
// g_TabObjNet[jj].m_SheetList.PathHumanReadable();
|
||||||
}
|
}
|
||||||
|
@ -1079,7 +1063,7 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Cmp = (SCH_COMPONENT*) ObjNet[ii].m_Link;
|
Cmp = (SCH_COMPONENT*) ObjNet[ii].m_Link;
|
||||||
wxString refstr = Cmp->GetRef(&(ObjNet[ii].m_SheetList));
|
wxString refstr = Cmp->GetRef( &(ObjNet[ii].m_SheetList) );
|
||||||
if( refstr[0] == '#' )
|
if( refstr[0] == '#' )
|
||||||
continue; // Pseudo composant (symboles d'alims)
|
continue; // Pseudo composant (symboles d'alims)
|
||||||
|
|
||||||
|
@ -1127,9 +1111,9 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
|
||||||
continue;
|
continue;
|
||||||
SCH_COMPONENT* tstcmp =
|
SCH_COMPONENT* tstcmp =
|
||||||
(SCH_COMPONENT*) ObjNet[jj].m_Link;
|
(SCH_COMPONENT*) ObjNet[jj].m_Link;
|
||||||
wxString p = Cmp->GetPath( &( ObjNet[ii].m_SheetList ) );
|
wxString p = Cmp->GetPath( &( ObjNet[ii].m_SheetList ) );
|
||||||
wxString tstp = tstcmp->GetPath( &( ObjNet[jj].m_SheetList ) );
|
wxString tstp = tstcmp->GetPath( &( ObjNet[jj].m_SheetList ) );
|
||||||
if( p.Cmp(tstp) != 0 )
|
if( p.Cmp( tstp ) != 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( ObjNet[jj].m_PinNum == ObjNet[ii].m_PinNum )
|
if( ObjNet[jj].m_PinNum == ObjNet[ii].m_PinNum )
|
||||||
|
|
|
@ -17,8 +17,7 @@
|
||||||
/* Routines locales */
|
/* Routines locales */
|
||||||
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus );
|
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus );
|
||||||
static void SheetLabelConnect( ObjetNetListStruct* SheetLabel );
|
static void SheetLabelConnect( ObjetNetListStruct* SheetLabel );
|
||||||
static int ListeObjetConnection( WinEDA_SchematicFrame* frame,
|
static int ListeObjetConnection( DrawSheetPath* sheetlist,
|
||||||
DrawSheetPath* sheetlist,
|
|
||||||
ObjetNetListStruct* ObjNet );
|
ObjetNetListStruct* ObjNet );
|
||||||
static int ConvertBusToMembers( ObjetNetListStruct* ObjNet );
|
static int ConvertBusToMembers( ObjetNetListStruct* ObjNet );
|
||||||
static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus,
|
static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus,
|
||||||
|
@ -165,7 +164,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
|
||||||
/* Build the sheet (not screen) list (flattened)*/
|
/* Build the sheet (not screen) list (flattened)*/
|
||||||
EDA_SheetList SheetListList( NULL );
|
EDA_SheetList SheetListList( NULL );
|
||||||
i=0;
|
i=0;
|
||||||
/* 1ere passe : Comptage du nombre d'objet de Net */
|
/* first pass : count objects used in connectivty calculation */
|
||||||
g_NbrObjNet = 0;
|
g_NbrObjNet = 0;
|
||||||
g_TabObjNet = NULL; /* Init pour le 1er passage dans ListeObjetConnection */
|
g_TabObjNet = NULL; /* Init pour le 1er passage dans ListeObjetConnection */
|
||||||
|
|
||||||
|
@ -174,7 +173,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
|
||||||
|
|
||||||
for( sheet = SheetListList.GetFirst(); sheet != NULL; sheet = SheetListList.GetNext() )
|
for( sheet = SheetListList.GetFirst(); sheet != NULL; sheet = SheetListList.GetNext() )
|
||||||
{
|
{
|
||||||
g_NbrObjNet += ListeObjetConnection( this, sheet, NULL );
|
g_NbrObjNet += ListeObjetConnection( sheet, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( g_NbrObjNet == 0 )
|
if( g_NbrObjNet == 0 )
|
||||||
|
@ -188,8 +187,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
|
||||||
if( g_TabObjNet == NULL )
|
if( g_TabObjNet == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* 2eme passe : Remplissage des champs des structures des objets de Net */
|
/* second pass: fill the fields of the structures used in connectivty calculation */
|
||||||
/* second pass: fill the fields of the structures in the Net */
|
|
||||||
|
|
||||||
s_PassNumber++;
|
s_PassNumber++;
|
||||||
|
|
||||||
|
@ -197,15 +195,14 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
|
||||||
for( ObjetNetListStruct* tabObjNet = g_TabObjNet;
|
for( ObjetNetListStruct* tabObjNet = g_TabObjNet;
|
||||||
sheet != NULL; sheet = SheetListList.GetNext() )
|
sheet != NULL; sheet = SheetListList.GetNext() )
|
||||||
{
|
{
|
||||||
tabObjNet += ListeObjetConnection( this, sheet, tabObjNet );
|
tabObjNet += ListeObjetConnection( sheet, tabObjNet );
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.Empty();
|
activity.Empty();
|
||||||
activity << wxT(" ") << _( "NbItems" ) << wxT(" ") << g_NbrObjNet;
|
activity << wxT(" ") << _( "NbItems" ) << wxT(" ") << g_NbrObjNet;
|
||||||
SetStatusText( activity );
|
SetStatusText( activity );
|
||||||
|
|
||||||
/* Recherche des connections pour les Segments et les Pins */
|
/* Sort objects by Sheet */
|
||||||
/* Tri du Tableau des objets de Net par Sheet */
|
|
||||||
|
|
||||||
qsort( g_TabObjNet, g_NbrObjNet, sizeof(ObjetNetListStruct), TriBySheet );
|
qsort( g_TabObjNet, g_NbrObjNet, sizeof(ObjetNetListStruct), TriBySheet );
|
||||||
|
|
||||||
|
@ -363,7 +360,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
|
||||||
SheetLabelConnect( g_TabObjNet + i );
|
SheetLabelConnect( g_TabObjNet + i );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tri du Tableau des objets de Net par NetCode */
|
/* Sort objects by NetCode */
|
||||||
qsort( g_TabObjNet, g_NbrObjNet, sizeof(ObjetNetListStruct), TriNetCode );
|
qsort( g_TabObjNet, g_NbrObjNet, sizeof(ObjetNetListStruct), TriNetCode );
|
||||||
|
|
||||||
|
|
||||||
|
@ -438,17 +435,14 @@ static void SheetLabelConnect( ObjetNetListStruct* SheetLabel )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/**************************************************************************************/
|
||||||
static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sheetlist,
|
static int ListeObjetConnection( DrawSheetPath* sheetlist, ObjetNetListStruct* ObjNet )
|
||||||
ObjetNetListStruct* ObjNet )
|
/**************************************************************************************/
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
/* Routine generant la liste des objets relatifs aux connection
|
/** Function ListeObjetConnection
|
||||||
* entree:
|
* Creates the list of objects related to connections (pins of components, wires, labels, junctions ...)
|
||||||
* sheetlist: pointer to a sheetlist.
|
* @param sheetlist: pointer to a sheetlist.
|
||||||
* ObjNet:
|
* @param ObjNet: if NULL, objects count else list to fill
|
||||||
* si NULL: la routine compte seulement le nombre des objets
|
|
||||||
* sinon: pointe le tableau a remplir
|
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int ii, NbrItem = 0;
|
int ii, NbrItem = 0;
|
||||||
|
@ -596,8 +590,7 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
|
||||||
if( DEntry->Type() != COMPONENT_PIN_DRAW_TYPE )
|
if( DEntry->Type() != COMPONENT_PIN_DRAW_TYPE )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( DEntry->m_Unit
|
if( DEntry->m_Unit && (DEntry->m_Unit != DrawLibItem->GetUnitSelection( sheetlist ) ) )
|
||||||
&& (DEntry->m_Unit != DrawLibItem->m_Multi) )
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( DEntry->m_Convert
|
if( DEntry->m_Convert
|
||||||
|
@ -684,7 +677,7 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
||||||
DisplayError( frame, wxT( "Netlist: Type DRAW_SHEETLABEL inattendu" ) );
|
DisplayError( NULL, wxT( "Netlist: Type DRAW_SHEETLABEL inattendu" ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -692,7 +685,7 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( wxT( "Netlist: unexpected type struct %d" ),
|
msg.Printf( wxT( "Netlist: unexpected type struct %d" ),
|
||||||
DrawList->Type() );
|
DrawList->Type() );
|
||||||
DisplayError( frame, msg );
|
DisplayError( NULL, msg );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ typedef enum {
|
||||||
* NET_TYPE_CUSTOM1+CUSTOMPANEL_COUNTMAX-1
|
* NET_TYPE_CUSTOM1+CUSTOMPANEL_COUNTMAX-1
|
||||||
* is the last id for user netlist format
|
* is the last id for user netlist format
|
||||||
*/
|
*/
|
||||||
NET_TYPE_CUSTOM_MAX = NET_TYPE_CUSTOM1+CUSTOMPANEL_COUNTMAX-1
|
NET_TYPE_CUSTOM_MAX = NET_TYPE_CUSTOM1 + CUSTOMPANEL_COUNTMAX - 1
|
||||||
} TypeNetForm;
|
} TypeNetForm;
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ enum NetObjetType { /* Type des objets de Net */
|
||||||
NET_JONCTION,
|
NET_JONCTION,
|
||||||
NET_LABEL,
|
NET_LABEL,
|
||||||
NET_GLOBLABEL,
|
NET_GLOBLABEL,
|
||||||
NET_HIERLABEL, //on a screen to indicate connection to a higher-level sheet
|
NET_HIERLABEL, //on a screen to indicate connection to a higher-level sheet
|
||||||
NET_SHEETLABEL, //on a drawscreen element to indicate connection to a lower-level sheet.
|
NET_SHEETLABEL, //on a drawscreen element to indicate connection to a lower-level sheet.
|
||||||
NET_BUSLABELMEMBER,
|
NET_BUSLABELMEMBER,
|
||||||
NET_GLOBBUSLABELMEMBER,
|
NET_GLOBBUSLABELMEMBER,
|
||||||
|
@ -51,9 +51,9 @@ enum NetObjetType { /* Type des objets de Net */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum IsConnectType { /* Valeur du Flag de connection */
|
enum IsConnectType { /* Valeur du Flag de connection */
|
||||||
UNCONNECT, /* Pin ou Label non connecte */
|
UNCONNECT, /* Pin ou Label non connecte */
|
||||||
NOCONNECT, /* Pin volontairement non connectee (Symb. NoConnect utilise) */
|
NOCONNECT, /* Pin volontairement non connectee (Symb. NoConnect utilise) */
|
||||||
PAD_CONNECT /* connexion normale */
|
PAD_CONNECT /* connexion normale */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -62,23 +62,23 @@ enum IsConnectType { /* Valeur du Flag de connection */
|
||||||
class ObjetNetListStruct
|
class ObjetNetListStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EDA_BaseStruct* m_Comp; /* Pointeur sur la definition de l'objet */
|
EDA_BaseStruct* m_Comp; /* Pointeur sur la definition de l'objet */
|
||||||
void* m_Link; /* Pour SheetLabelStruct: Pointeur sur la feuille de hierarchie
|
void* m_Link; /* Pour SheetLabelStruct: Pointeur sur la feuille de hierarchie
|
||||||
* Pour les Pins: pointeur sur le composant */
|
* Pour les Pins: pointeur sur le composant */
|
||||||
int m_Flag; /* flag pour calculs internes */
|
int m_Flag; /* flag pour calculs internes */
|
||||||
DrawSheetPath m_SheetList;
|
DrawSheetPath m_SheetList;
|
||||||
NetObjetType m_Type;
|
NetObjetType m_Type;
|
||||||
int m_ElectricalType;/* Pour Pins et sheet labels: type electrique */
|
int m_ElectricalType; /* Pour Pins et sheet labels: type electrique */
|
||||||
private:
|
private:
|
||||||
int m_NetCode; /* pour elements simples */
|
int m_NetCode; /* pour elements simples */
|
||||||
public:
|
public:
|
||||||
int m_BusNetCode; /* pour connexions type bus */
|
int m_BusNetCode; /* pour connexions type bus */
|
||||||
int m_Member; /* pour les labels type BUSWIRE ( labels de bus eclate )
|
int m_Member; /* pour les labels type BUSWIRE ( labels de bus eclate )
|
||||||
* numero de membre */
|
* numero de membre */
|
||||||
IsConnectType m_FlagOfConnection;
|
IsConnectType m_FlagOfConnection;
|
||||||
DrawSheetPath m_SheetListInclude; /* sheet that the hierarchal label connects to.*/
|
DrawSheetPath m_SheetListInclude; /* sheet that the hierarchal label connects to.*/
|
||||||
long m_PinNum; /* numero de pin( 4 octets -> 4 codes ascii) */
|
long m_PinNum; /* numero de pin( 4 octets -> 4 codes ascii) */
|
||||||
const wxString* m_Label; /* Tous types Labels:pointeur sur la wxString definissant le label */
|
const wxString* m_Label; /* Tous types Labels:pointeur sur la wxString definissant le label */
|
||||||
wxPoint m_Start, m_End;
|
wxPoint m_Start, m_End;
|
||||||
|
|
||||||
#if defined (DEBUG)
|
#if defined (DEBUG)
|
||||||
|
@ -93,15 +93,17 @@ public:
|
||||||
/* Structures pour memo et liste des elements */
|
/* Structures pour memo et liste des elements */
|
||||||
typedef struct ListLabel
|
typedef struct ListLabel
|
||||||
{
|
{
|
||||||
int m_LabelType;
|
int m_LabelType;
|
||||||
void * m_Label;
|
void* m_Label;
|
||||||
char m_SheetPath[64];
|
char m_SheetPath[64];
|
||||||
} ListLabel;
|
} ListLabel;
|
||||||
|
|
||||||
typedef struct ListComponent
|
typedef struct ListComponent
|
||||||
{
|
{
|
||||||
SCH_COMPONENT * m_Comp;
|
SCH_COMPONENT* m_Comp;
|
||||||
char m_Ref[32];
|
char m_Ref[32];
|
||||||
//have to store it here since the object refrerences will be duplicated.
|
|
||||||
|
//have to store it here since the object references will be duplicated.
|
||||||
DrawSheetPath m_SheetList; //composed of UIDs
|
DrawSheetPath m_SheetList; //composed of UIDs
|
||||||
} ListComponent;
|
} ListComponent;
|
||||||
|
|
||||||
|
@ -109,19 +111,19 @@ typedef struct ListComponent
|
||||||
struct CmpListStruct
|
struct CmpListStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SCH_COMPONENT* m_Cmp; /* Pointeur sur le composant */
|
SCH_COMPONENT* m_Cmp; /* Pointeur sur le composant */
|
||||||
int m_NbParts; /* Nombre de parts par boitier */
|
int m_NbParts; /* Nombre de parts par boitier */
|
||||||
bool m_PartsLocked; // For multi part components: True if the part cannot be changed
|
bool m_PartsLocked; // For multi part components: True if the part cannot be changed
|
||||||
int m_Unit; /* Numero de part */
|
int m_Unit; /* Numero de part */
|
||||||
DrawSheetPath m_SheetList;
|
DrawSheetPath m_SheetList;
|
||||||
unsigned long m_TimeStamp; /* unique identification number */
|
unsigned long m_TimeStamp; /* unique identification number */
|
||||||
int m_IsNew; /* != 0 pour composants non annotes */
|
int m_IsNew; /* != 0 pour composants non annotes */
|
||||||
char m_TextValue[32]; /* Valeur */
|
char m_TextValue[32]; /* Valeur */
|
||||||
char m_TextRef[32]; /* Reference ( hors numero ) */
|
char m_TextRef[32]; /* Reference ( hors numero ) */
|
||||||
int m_NumRef; /* Numero de reference */
|
int m_NumRef; /* Numero de reference */
|
||||||
int m_Flag; /* flag pour calculs internes */
|
int m_Flag; /* flag pour calculs internes */
|
||||||
wxPoint m_Pos; /* position components */
|
wxPoint m_Pos; /* position components */
|
||||||
char m_Path[128]; // the 'path' of the object in the sheet hierarchy.
|
char m_Path[128]; // the 'path' of the object in the sheet hierarchy.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -610,7 +610,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
EDA_LibComponentStruct* LibEntry;
|
EDA_LibComponentStruct* LibEntry;
|
||||||
LibEntry = FindLibPart(
|
LibEntry = FindLibPart(
|
||||||
( (SCH_COMPONENT*) screen->GetCurItem() )->m_ChipName,
|
( (SCH_COMPONENT*) screen->GetCurItem() )->m_ChipName.GetData(),
|
||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
FIND_ALIAS );
|
FIND_ALIAS );
|
||||||
if( LibEntry && LibEntry->m_DocFile != wxEmptyString )
|
if( LibEntry && LibEntry->m_DocFile != wxEmptyString )
|
||||||
|
|
|
@ -253,7 +253,7 @@ wxClientDC dc(DrawPanel);
|
||||||
g_ViewUnit = 1;
|
g_ViewUnit = 1;
|
||||||
g_ViewConvert = 1;
|
g_ViewConvert = 1;
|
||||||
|
|
||||||
LibEntry = FindLibPart(CmpName,Lib->m_Name, FIND_ALIAS);
|
LibEntry = FindLibPart(CmpName.GetData(),Lib->m_Name, FIND_ALIAS);
|
||||||
g_CurrentViewComponentName = CmpName;
|
g_CurrentViewComponentName = CmpName;
|
||||||
DisplayLibInfos();
|
DisplayLibInfos();
|
||||||
Zoom_Automatique(FALSE);
|
Zoom_Automatique(FALSE);
|
||||||
|
|
|
@ -208,24 +208,24 @@
|
||||||
#include "../bitmaps/Auto_track_width.xpm"
|
#include "../bitmaps/Auto_track_width.xpm"
|
||||||
#include "../bitmaps/fill_zone.xpm"
|
#include "../bitmaps/fill_zone.xpm"
|
||||||
#include "../bitmaps/Width_Segment.xpm"
|
#include "../bitmaps/Width_Segment.xpm"
|
||||||
|
|
||||||
#include "../bitmaps/annotate_right_down.xpm"
|
#include "../bitmaps/annotate_right_down.xpm"
|
||||||
#include "../bitmaps/annotate_down_right.xpm"
|
#include "../bitmaps/annotate_down_right.xpm"
|
||||||
|
|
||||||
#include "../bitmaps/new_sch.xpm"
|
// #include "../bitmaps/new_sch.xpm"
|
||||||
#include "../bitmaps/Open_Project.xpm"
|
#include "../bitmaps/Open_Project.xpm"
|
||||||
#include "../bitmaps/new_cvpcb.xpm"
|
// #include "../bitmaps/new_cvpcb.xpm"
|
||||||
#include "../bitmaps/zip.xpm"
|
#include "../bitmaps/zip.xpm"
|
||||||
#include "../bitmaps/icon_gerbview_small.xpm"
|
#include "../bitmaps/icon_gerbview_small.xpm"
|
||||||
#include "../bitmaps/zip_tool.xpm"
|
// #include "../bitmaps/zip_tool.xpm"
|
||||||
#include "../bitmaps/unzip.xpm"
|
#include "../bitmaps/unzip.xpm"
|
||||||
#include "../bitmaps/Browse_Files.xpm"
|
#include "../bitmaps/Browse_Files.xpm"
|
||||||
#include "../bitmaps/New_Project.xpm"
|
#include "../bitmaps/New_Project.xpm"
|
||||||
#include "../bitmaps/new_gerb.xpm"
|
// #include "../bitmaps/new_gerb.xpm"
|
||||||
#include "../bitmaps/new_python.xpm"
|
// #include "../bitmaps/new_python.xpm"
|
||||||
#include "../bitmaps/icon_cvpcb_small.xpm"
|
#include "../bitmaps/icon_cvpcb_small.xpm"
|
||||||
#include "../bitmaps/unknown.xpm"
|
#include "../bitmaps/unknown.xpm"
|
||||||
#include "../bitmaps/new_pcb.xpm"
|
// #include "../bitmaps/new_pcb.xpm"
|
||||||
|
|
||||||
#include "../bitmaps/reload.xpm"
|
#include "../bitmaps/reload.xpm"
|
||||||
|
|
||||||
|
|
|
@ -280,7 +280,7 @@ int BOARD::ClipAreaPolygon( ZONE_CONTAINER* CurrArea,
|
||||||
{
|
{
|
||||||
std::vector<CPolyLine*> * pa = new std::vector<CPolyLine*>;
|
std::vector<CPolyLine*> * pa = new std::vector<CPolyLine*>;
|
||||||
curr_polygon->Undraw();
|
curr_polygon->Undraw();
|
||||||
int n_poly = CurrArea->m_Poly->NormalizeWithGpc( pa, bRetainArcs );
|
int n_poly = CurrArea->m_Poly->NormalizeAreaOutlines( pa, bRetainArcs );
|
||||||
if( n_poly > 1 ) // i.e if clipping has created some polygons, we must add these new copper areas
|
if( n_poly > 1 ) // i.e if clipping has created some polygons, we must add these new copper areas
|
||||||
{
|
{
|
||||||
ZONE_CONTAINER* NewArea;
|
ZONE_CONTAINER* NewArea;
|
||||||
|
@ -310,7 +310,8 @@ int BOARD::ClipAreaPolygon( ZONE_CONTAINER* CurrArea,
|
||||||
* itself and the polygons for any other areas on the same net.
|
* itself and the polygons for any other areas on the same net.
|
||||||
* This may change the number and order of copper areas in the net.
|
* This may change the number and order of copper areas in the net.
|
||||||
* @param modified_area = area to test
|
* @param modified_area = area to test
|
||||||
* @param bMessageBox : if true, shows message boxes when clipping occurs.
|
* @param bMessageBoxInt == true, shows message when clipping occurs.
|
||||||
|
* @param bMessageBoxArc == true, shows message when clipping can't be done due to arcs.
|
||||||
* @return :
|
* @return :
|
||||||
* -1 if arcs intersect other sides, so polygon can't be clipped
|
* -1 if arcs intersect other sides, so polygon can't be clipped
|
||||||
* 0 if no intersecting sides
|
* 0 if no intersecting sides
|
||||||
|
@ -697,8 +698,11 @@ int BOARD::CombineAreas( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_combi
|
||||||
CPolyLine* poly2 = area_to_combine->m_Poly;
|
CPolyLine* poly2 = area_to_combine->m_Poly;
|
||||||
std::vector<CArc> arc_array1;
|
std::vector<CArc> arc_array1;
|
||||||
std::vector<CArc> arc_array2;
|
std::vector<CArc> arc_array2;
|
||||||
poly1->MakeGpcPoly( -1, &arc_array1 );
|
|
||||||
poly2->MakeGpcPoly( -1, &arc_array2 );
|
poly1->MakePolygonFromAreaOutlines( -1, &arc_array1 );
|
||||||
|
poly2->MakePolygonFromAreaOutlines( -1, &arc_array2 );
|
||||||
|
|
||||||
|
#ifdef USE_GPC_POLY_LIB
|
||||||
int n_ext_cont1 = 0;
|
int n_ext_cont1 = 0;
|
||||||
for( int ic = 0; ic<poly1->GetGpcPoly()->num_contours; ic++ )
|
for( int ic = 0; ic<poly1->GetGpcPoly()->num_contours; ic++ )
|
||||||
if( !( (poly1->GetGpcPoly()->hole)[ic] ) )
|
if( !( (poly1->GetGpcPoly()->hole)[ic] ) )
|
||||||
|
@ -776,7 +780,97 @@ int BOARD::CombineAreas( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_combi
|
||||||
area_ref->m_Poly->Draw();
|
area_ref->m_Poly->Draw();
|
||||||
gpc_free_polygon( union_gpc );
|
gpc_free_polygon( union_gpc );
|
||||||
delete union_gpc;
|
delete union_gpc;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_GPL_POLY_LIB
|
||||||
|
//@todo
|
||||||
|
#warning work in progress
|
||||||
|
wxString msg;
|
||||||
|
int n_ext_cont1 = poly1->GetPhpPoly()->m_cnt;
|
||||||
|
|
||||||
|
int n_ext_cont2 = poly2->GetPhpPoly()->m_cnt;
|
||||||
|
|
||||||
|
polygon* union_polygon = NULL;
|
||||||
|
union_polygon = poly1->GetPhpPoly()->boolean( poly2->GetPhpPoly(), A_OR_B );
|
||||||
|
|
||||||
|
if ( union_polygon == NULL )
|
||||||
|
return 0;
|
||||||
|
// get number of outside contours
|
||||||
|
int n_union_ext_cont = union_polygon->m_cnt;
|
||||||
|
msg.Printf(wxT("cnt res = %d, pts1,2 = %d,%d"), n_union_ext_cont , n_ext_cont1, n_ext_cont2);
|
||||||
|
wxMessageBox(msg);
|
||||||
|
|
||||||
|
// if no intersection, free new gpc and return
|
||||||
|
#if 0
|
||||||
|
if( n_union_ext_cont == n_ext_cont1 + n_ext_cont2 )
|
||||||
|
{
|
||||||
|
wxMessageBox(wxT("no change polys"));
|
||||||
|
delete union_polygon;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
wxMessageBox(wxT("merge areas"));
|
||||||
|
// intersection, replace area_ref->m_Poly with combined areas and remove area_to_combine
|
||||||
|
RemoveArea( area_to_combine );
|
||||||
|
area_ref->m_Poly->RemoveAllContours();
|
||||||
|
// create area with external contour
|
||||||
|
// for( int ic = 0; ic < union_polygon->m_cnt; ic++ )
|
||||||
|
{
|
||||||
|
// if( !(union_gpc->hole)[ic] ) // Recreate only area edges, NOT holes (todo..)
|
||||||
|
{
|
||||||
|
// external contour, replace this poly
|
||||||
|
vertex * curr_vertex = union_polygon->getFirst();
|
||||||
|
for( int ii = 0; ii < union_polygon->m_cnt; ii++ )
|
||||||
|
{
|
||||||
|
int x = (int) curr_vertex->X();
|
||||||
|
int y = (int) curr_vertex->Y();
|
||||||
|
msg.Printf(wxT("ii = %d, pts = %d,%d, wid = %d"), ii , x, y, curr_vertex->id());
|
||||||
|
wxMessageBox(msg);
|
||||||
|
|
||||||
|
if( ii==0 )
|
||||||
|
{
|
||||||
|
area_ref->m_Poly->Start( area_ref->GetLayer(
|
||||||
|
), x, y, area_ref->m_Poly->GetHatchStyle() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
area_ref->m_Poly->AppendCorner( x, y );
|
||||||
|
|
||||||
|
curr_vertex = curr_vertex->Next();
|
||||||
|
// if( curr_vertex->id() == union_polygon->getFirst()->id() ) break;
|
||||||
|
}
|
||||||
|
area_ref->m_Poly->Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// add holes
|
||||||
|
#if 0
|
||||||
|
for( int ic = 0; ic<union_gpc->num_contours; ic++ )
|
||||||
|
{
|
||||||
|
if( (union_gpc->hole)[ic] )
|
||||||
|
{
|
||||||
|
// hole
|
||||||
|
for( int i = 0; i<union_gpc->contour[ic].num_vertices; i++ )
|
||||||
|
{
|
||||||
|
int x = (int) ( (union_gpc->contour)[ic].vertex )[i].x;
|
||||||
|
int y = (int) ( (union_gpc->contour)[ic].vertex )[i].y;
|
||||||
|
area_ref->m_Poly->AppendCorner( x, y );
|
||||||
|
}
|
||||||
|
|
||||||
|
area_ref->m_Poly->Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
area_ref->utility = 1;
|
||||||
|
area_ref->m_Poly->RestoreArcs( &arc_array1 );
|
||||||
|
area_ref->m_Poly->RestoreArcs( &arc_array2 );
|
||||||
|
area_ref->m_Poly->Draw();
|
||||||
|
delete union_polygon;
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -785,7 +879,7 @@ int BOARD::CombineAreas( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_combi
|
||||||
/**
|
/**
|
||||||
* Function Is_Area_Inside_Area
|
* Function Is_Area_Inside_Area
|
||||||
* Test a given area to see if it is inside an other area, or an other area is inside the given area
|
* Test a given area to see if it is inside an other area, or an other area is inside the given area
|
||||||
* an area is inside an other are if ALL its corners are inside
|
* an area is inside an other are if ALL its edges are inside the other area
|
||||||
* @param Area_Ref: the given area to compare with other areas
|
* @param Area_Ref: the given area to compare with other areas
|
||||||
* used to remove redundant areas
|
* used to remove redundant areas
|
||||||
*/
|
*/
|
||||||
|
@ -1007,7 +1101,7 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
|
||||||
bool DRC::doEdgeZoneDrc( ZONE_CONTAINER * aArea, int aCornerIndex )
|
bool DRC::doEdgeZoneDrc( ZONE_CONTAINER * aArea, int aCornerIndex )
|
||||||
{
|
{
|
||||||
wxString str;
|
wxString str;
|
||||||
|
|
||||||
wxPoint start = aArea->GetCornerPosition(aCornerIndex);
|
wxPoint start = aArea->GetCornerPosition(aCornerIndex);
|
||||||
wxPoint end;
|
wxPoint end;
|
||||||
// Search the end point of the edge starting at aCornerIndex
|
// Search the end point of the edge starting at aCornerIndex
|
||||||
|
|
2637
polygon/PolyLine.cpp
2637
polygon/PolyLine.cpp
File diff suppressed because it is too large
Load Diff
|
@ -5,10 +5,10 @@
|
||||||
// There may be multiple contours in a polyline.
|
// There may be multiple contours in a polyline.
|
||||||
// The last contour may be open or closed, any others must be closed.
|
// The last contour may be open or closed, any others must be closed.
|
||||||
// All of the corners and side-styles are concatenated into 2 arrays,
|
// All of the corners and side-styles are concatenated into 2 arrays,
|
||||||
// separated by setting the end_contour flag of the last corner of
|
// separated by setting the end_contour flag of the last corner of
|
||||||
// each contour.
|
// each contour.
|
||||||
//
|
//
|
||||||
// When used for copper areas, the first contour is the outer edge
|
// When used for copper areas, the first contour is the outer edge
|
||||||
// of the area, subsequent ones are "holes" in the copper.
|
// of the area, subsequent ones are "holes" in the copper.
|
||||||
|
|
||||||
#ifndef POLYLINE_H
|
#ifndef POLYLINE_H
|
||||||
|
@ -16,6 +16,9 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#define USE_GPC_POLY_LIB
|
||||||
|
//#define USE_GPL_POLY_LIB
|
||||||
|
|
||||||
#include "defs-macros.h"
|
#include "defs-macros.h"
|
||||||
|
|
||||||
#include "GenericPolygonClipperLibrary.h"
|
#include "GenericPolygonClipperLibrary.h"
|
||||||
|
@ -37,12 +40,12 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
class CArc {
|
class CArc {
|
||||||
public:
|
public:
|
||||||
enum{ MAX_STEP = 50*25400 }; // max step is 20 mils
|
enum{ MAX_STEP = 50*25400 }; // max step is 20 mils
|
||||||
enum{ MIN_STEPS = 18 }; // min step is 5 degrees
|
enum{ MIN_STEPS = 18 }; // min step is 5 degrees
|
||||||
int style;
|
int style;
|
||||||
int xi, yi, xf, yf;
|
int xi, yi, xf, yf;
|
||||||
int n_steps; // number of straight-line segments in gpc_poly
|
int n_steps; // number of straight-line segments in gpc_poly
|
||||||
bool bFound;
|
bool bFound;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -117,22 +120,32 @@ public:
|
||||||
void SetEndContour( int ic, bool end_contour );
|
void SetEndContour( int ic, bool end_contour );
|
||||||
void SetSideStyle( int is, int style );
|
void SetSideStyle( int is, int style );
|
||||||
|
|
||||||
// GPC functions
|
|
||||||
int MakeGpcPoly( int icontour=0, std::vector<CArc> * arc_array=NULL );
|
|
||||||
int FreeGpcPoly();
|
|
||||||
gpc_polygon * GetGpcPoly(){ return m_gpc_poly; };
|
|
||||||
int NormalizeWithGpc( std::vector<CPolyLine*> * pa=NULL, bool bRetainArcs=FALSE );
|
|
||||||
int RestoreArcs( std::vector<CArc> * arc_array, std::vector<CPolyLine*> * pa=NULL );
|
int RestoreArcs( std::vector<CArc> * arc_array, std::vector<CPolyLine*> * pa=NULL );
|
||||||
CPolyLine * MakePolylineForPad( int type, int x, int y, int w, int l, int r, int angle );
|
CPolyLine * MakePolylineForPad( int type, int x, int y, int w, int l, int r, int angle );
|
||||||
void AddContourForPadClearance( int type, int x, int y, int w,
|
void AddContourForPadClearance( int type, int x, int y, int w,
|
||||||
int l, int r, int angle, int fill_clearance,
|
int l, int r, int angle, int fill_clearance,
|
||||||
int hole_w, int hole_clearance, bool bThermal=FALSE, int spoke_w=0 );
|
int hole_w, int hole_clearance, bool bThermal=FALSE, int spoke_w=0 );
|
||||||
void ClipGpcPolygon( gpc_op op, CPolyLine * poly );
|
|
||||||
|
int MakePolygonFromAreaOutlines( int icontour, std::vector<CArc> * arc_array );
|
||||||
|
void FreePolygon();
|
||||||
|
int NormalizeAreaOutlines( std::vector<CPolyLine*> * pa=NULL, bool bRetainArcs=FALSE );
|
||||||
|
|
||||||
|
#ifdef USE_GPC_POLY_LIB
|
||||||
|
// GPC functions
|
||||||
|
int MakeGpcPoly( int icontour=0, std::vector<CArc> * arc_array=NULL );
|
||||||
|
void FreeGpcPoly();
|
||||||
|
gpc_polygon * GetGpcPoly(){ return m_gpc_poly; };
|
||||||
|
int NormalizeWithGpc( std::vector<CPolyLine*> * pa=NULL, bool bRetainArcs=FALSE );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// PHP functions
|
// PHP functions
|
||||||
|
#ifdef USE_GPL_POLY_LIB
|
||||||
int MakePhpPoly();
|
int MakePhpPoly();
|
||||||
void FreePhpPoly();
|
void FreePhpPoly();
|
||||||
void ClipPhpPolygon( int php_op, CPolyLine * poly );
|
void ClipPhpPolygon( int php_op, CPolyLine * poly );
|
||||||
|
polygon * GetPhpPoly(){ return m_php_poly; };
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_layer; // layer to draw on
|
int m_layer; // layer to draw on
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,5 @@
|
||||||
// file php_polygon.h
|
// file php_polygon.h
|
||||||
|
|
||||||
// See comments in php_polygon.cpp
|
// See comments in php_polygon.cpp
|
||||||
|
|
||||||
#ifndef PHP_POLYGON_H
|
#ifndef PHP_POLYGON_H
|
||||||
|
@ -7,55 +8,65 @@
|
||||||
class vertex;
|
class vertex;
|
||||||
class segment;
|
class segment;
|
||||||
|
|
||||||
#define infinity 100000000 // for places that are far far away
|
#define infinity 100000000 // for places that are far far away
|
||||||
#define PI 3.14159265359
|
#define PI 3.14159265359
|
||||||
|
|
||||||
enum{ A_OR_B, A_AND_B, A_MINUS_B, B_MINUS_A };
|
enum {
|
||||||
|
A_OR_B,
|
||||||
|
A_AND_B,
|
||||||
|
A_MINUS_B,
|
||||||
|
B_MINUS_A
|
||||||
|
};
|
||||||
|
|
||||||
class polygon
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
** This class manages a doubly linked list of vertex objects that represents
|
** This class manages a doubly linked list of vertex objects that represents
|
||||||
** a polygon. The class consists of basic methods to manage the list
|
** a polygon. The class consists of basic methods to manage the list
|
||||||
** and methods to implement boolean operations between polygon objects.
|
** and methods to implement boolean operations between polygon objects.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
vertex * m_first; // Reference to first vertex in the linked list
|
|
||||||
int m_cnt; // Tracks number of vertices in the polygon
|
|
||||||
|
|
||||||
polygon( vertex * first = NULL );
|
class polygon
|
||||||
~polygon();
|
{
|
||||||
vertex * getFirst();
|
public:
|
||||||
polygon * NextPoly();
|
vertex* m_first; // Reference to first vertex in the linked list
|
||||||
|
int m_cnt; // Tracks number of vertices in the polygon
|
||||||
|
|
||||||
|
public:
|
||||||
|
polygon( vertex* first = NULL );
|
||||||
|
~polygon();
|
||||||
|
vertex* getFirst();
|
||||||
|
polygon* NextPoly();
|
||||||
|
|
||||||
|
void add( vertex* nv );
|
||||||
|
void addv( double x, double y,
|
||||||
|
double xc = 0, double yc = 0, int d = 0 );
|
||||||
|
vertex* del( vertex* v );
|
||||||
|
void res();
|
||||||
|
polygon* copy_poly();
|
||||||
|
void insertSort( vertex* nv, vertex* s, vertex* e );
|
||||||
|
vertex* nxt( vertex* v );
|
||||||
|
BOOL unckd_remain();
|
||||||
|
vertex* first_unckd_intersect();
|
||||||
|
double dist( double x1, double y1, double x2, double y2 );
|
||||||
|
double angle( double xc, double yc, double x1, double y1 );
|
||||||
|
double aAlpha( double x1, double y1, double x2, double y2,
|
||||||
|
double xc, double yc, double xi, double yi, double d );
|
||||||
|
void perturb( vertex* p1, vertex* p2, vertex* q1, vertex* q2,
|
||||||
|
double aP, double aQ );
|
||||||
|
|
||||||
|
BOOL ints( vertex * p1, vertex * p2, vertex * q1, vertex * q2,
|
||||||
|
int* n, double ix[], double iy[], double alphaP[], double alphaQ[] );
|
||||||
|
BOOL isInside( vertex* v );
|
||||||
|
polygon* boolean( polygon* polyB, int oper );
|
||||||
|
|
||||||
void add( vertex * nv );
|
|
||||||
void addv( double x, double y,
|
|
||||||
double xc=0, double yc=0, int d=0);
|
|
||||||
vertex * del( vertex * v );
|
|
||||||
void res();
|
|
||||||
polygon * copy_poly();
|
|
||||||
void insertSort( vertex * nv, vertex * s, vertex * e );
|
|
||||||
vertex * nxt( vertex * v );
|
|
||||||
BOOL unckd_remain();
|
|
||||||
vertex * first_unckd_intersect();
|
|
||||||
double dist( double x1, double y1, double x2, double y2 );
|
|
||||||
double angle( double xc, double yc, double x1, double y1 );
|
|
||||||
double aAlpha( double x1, double y1, double x2, double y2,
|
|
||||||
double xc, double yc, double xi, double yi, double d );
|
|
||||||
void perturb( vertex * p1, vertex * p2, vertex * q1, vertex * q2,
|
|
||||||
double aP, double aQ );
|
|
||||||
BOOL ints( vertex * p1, vertex * p2, vertex * q1, vertex * q2,
|
|
||||||
int * n, double ix[], double iy[], double alphaP[], double alphaQ[] );
|
|
||||||
BOOL isInside ( vertex * v );
|
|
||||||
polygon * boolean( polygon * polyB, int oper );
|
|
||||||
#if 0
|
#if 0
|
||||||
function isPolyInside (p);
|
function isPolyInside( p );
|
||||||
function move (dx, dy);
|
function move( dx, dy );
|
||||||
function rotate (xr, yr, a);
|
function rotate( xr, yr, a );
|
||||||
function &bRect ();
|
function& bRect();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}; //end of class polygon
|
}; //end of class polygon
|
||||||
|
|
||||||
|
|
||||||
#endif // ifndef PHP_POLYGON_H
|
#endif // ifndef PHP_POLYGON_H
|
||||||
|
|
Loading…
Reference in New Issue