2007-08-24 15:10:46 +00:00
|
|
|
/*********************/
|
|
|
|
/* dangling_ends.cpp */
|
|
|
|
/*********************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "gr_basic.h"
|
|
|
|
#include "common.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "program.h"
|
|
|
|
#include "general.h"
|
2009-11-03 13:26:31 +00:00
|
|
|
#include "netlist.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "protos.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
#include "class_library.h"
|
2010-03-04 09:32:51 +00:00
|
|
|
#include "class_pin.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-02-27 19:38:16 +00:00
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
enum End_Type {
|
|
|
|
UNKNOWN = 0,
|
|
|
|
WIRE_START_END,
|
|
|
|
WIRE_END_END,
|
|
|
|
BUS_START_END,
|
|
|
|
BUS_END_END,
|
|
|
|
JUNCTION_END,
|
|
|
|
PIN_END,
|
|
|
|
LABEL_END,
|
|
|
|
ENTRY_END,
|
|
|
|
SHEET_LABEL_END
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
// A helper class to store a list of items that can be connected to something:
|
|
|
|
class DANGLING_END_ITEM
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
public:
|
2010-09-11 16:33:43 +00:00
|
|
|
const void* m_Item; // a pointer to the parent
|
|
|
|
wxPoint m_Pos; // the position of the connecting point
|
|
|
|
int m_Type; // type of parent
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
DANGLING_END_ITEM( int type, const void* aItem )
|
2009-11-03 13:26:31 +00:00
|
|
|
{
|
2010-09-11 16:33:43 +00:00
|
|
|
m_Item = aItem;
|
|
|
|
m_Type = type;
|
2007-08-24 15:10:46 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
static void TestWireForDangling( std::vector <DANGLING_END_ITEM>& aItemList,
|
|
|
|
SCH_LINE* DrawRef,
|
|
|
|
WinEDA_SchematicFrame* frame,
|
|
|
|
wxDC* aDC );
|
|
|
|
void TestLabelForDangling( std::vector <DANGLING_END_ITEM>& aItemList,
|
|
|
|
SCH_TEXT* aLabel,
|
|
|
|
WinEDA_SchematicFrame* aFrame,
|
|
|
|
wxDC* aDC );
|
|
|
|
void RebuildEndPointsList( std::vector <DANGLING_END_ITEM>& aItemList, SCH_ITEM* aDrawList );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
|
2010-07-17 11:14:57 +00:00
|
|
|
/* Returns true if the point P is on the segment S. */
|
|
|
|
bool SegmentIntersect( wxPoint aSegStart, wxPoint aSegEnd, wxPoint aTestPoint )
|
2009-12-02 21:44:03 +00:00
|
|
|
{
|
2010-09-05 17:01:48 +00:00
|
|
|
wxPoint vectSeg = aSegEnd - aSegStart; // Vector from S1 to S2
|
2010-07-17 11:14:57 +00:00
|
|
|
wxPoint vectPoint = aTestPoint - aSegStart; // Vector from S1 to P
|
2008-04-22 16:38:23 +00:00
|
|
|
|
2010-07-17 11:14:57 +00:00
|
|
|
// Use long long here to avoid overflow in calculations
|
2010-09-05 17:01:48 +00:00
|
|
|
if( (long long) vectSeg.x * vectPoint.y - (long long) vectSeg.y * vectPoint.x )
|
2010-07-17 11:14:57 +00:00
|
|
|
return false; /* Cross product non-zero, vectors not parallel */
|
2008-04-22 16:38:23 +00:00
|
|
|
|
2010-09-05 17:01:48 +00:00
|
|
|
if( ( (long long) vectSeg.x * vectPoint.x + (long long) vectSeg.y * vectPoint.y ) <
|
|
|
|
( (long long) vectPoint.x * vectPoint.x + (long long) vectPoint.y * vectPoint.y ) )
|
2010-07-17 11:14:57 +00:00
|
|
|
return false; /* Point not on segment */
|
2008-04-22 16:38:23 +00:00
|
|
|
|
2010-07-17 11:14:57 +00:00
|
|
|
return true;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
void WinEDA_SchematicFrame::TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-09-11 16:33:43 +00:00
|
|
|
// this list is static to avoid many useles memory allocation.
|
|
|
|
std::vector <DANGLING_END_ITEM> itemList;
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
RebuildEndPointsList( itemList, DrawList );
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
for( SCH_ITEM* item = DrawList; item; item = item->Next() )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2008-04-22 16:38:23 +00:00
|
|
|
switch( item->Type() )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
case TYPE_SCH_GLOBALLABEL:
|
|
|
|
case TYPE_SCH_HIERLABEL:
|
|
|
|
case TYPE_SCH_LABEL:
|
2010-09-11 16:33:43 +00:00
|
|
|
TestLabelForDangling( itemList, (SCH_LABEL*) item, this, DC );
|
2007-08-24 15:10:46 +00:00
|
|
|
break;
|
|
|
|
|
2010-09-05 17:01:48 +00:00
|
|
|
case DRAW_SHEET_STRUCT_TYPE:
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
|
|
|
SCH_SHEET* sheet = (SCH_SHEET*) item;
|
|
|
|
// Read the hierarchical pins list and teast for dangling pins:
|
|
|
|
BOOST_FOREACH( SCH_SHEET_PIN & pinsheet, sheet->GetSheetPins() )
|
|
|
|
{
|
|
|
|
TestLabelForDangling( itemList, &pinsheet, this, DC );
|
2010-09-05 17:01:48 +00:00
|
|
|
}
|
2010-09-11 16:33:43 +00:00
|
|
|
}
|
2010-09-05 17:01:48 +00:00
|
|
|
break;
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
case DRAW_SEGMENT_STRUCT_TYPE:
|
2008-04-22 16:38:23 +00:00
|
|
|
#undef STRUCT
|
2009-12-02 21:44:03 +00:00
|
|
|
#define STRUCT ( (SCH_LINE*) item )
|
2008-04-14 19:22:48 +00:00
|
|
|
if( STRUCT->GetLayer() == LAYER_WIRE )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2010-09-11 16:33:43 +00:00
|
|
|
TestWireForDangling( itemList, STRUCT, this, DC );
|
2007-08-24 15:10:46 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-04-14 19:22:48 +00:00
|
|
|
if( STRUCT->GetLayer() == LAYER_NOTES )
|
2007-08-24 15:10:46 +00:00
|
|
|
break;
|
2008-04-14 19:22:48 +00:00
|
|
|
if( STRUCT->GetLayer() == LAYER_BUS )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2010-07-17 11:14:57 +00:00
|
|
|
STRUCT->m_StartIsDangling = STRUCT->m_EndIsDangling = false;
|
2007-08-24 15:10:46 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2010-09-05 17:01:48 +00:00
|
|
|
break;
|
2007-08-24 15:10:46 +00:00
|
|
|
}
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-10-08 13:19:28 +00:00
|
|
|
/**
|
|
|
|
* Test if point pos is on a pin end.
|
|
|
|
*
|
|
|
|
* @param DrawList = List of SCH_ITEMs to check.
|
2010-02-01 08:19:31 +00:00
|
|
|
* @return a LIB_PIN pointer to the located pin or NULL if no pin was found.
|
2007-08-24 15:10:46 +00:00
|
|
|
*/
|
2009-11-03 13:26:31 +00:00
|
|
|
LIB_PIN* WinEDA_SchematicFrame::LocatePinEnd( SCH_ITEM* DrawList,
|
|
|
|
const wxPoint& pos )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
SCH_COMPONENT* DrawLibItem;
|
2009-10-08 13:19:28 +00:00
|
|
|
LIB_PIN* Pin;
|
2007-08-24 15:10:46 +00:00
|
|
|
wxPoint pinpos;
|
|
|
|
|
|
|
|
Pin = LocateAnyPin( DrawList, pos, &DrawLibItem );
|
|
|
|
if( !Pin )
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
pinpos = Pin->m_Pos;
|
|
|
|
|
|
|
|
if( DrawLibItem == NULL )
|
2010-02-01 08:19:31 +00:00
|
|
|
NEGATE( pinpos.y ); // In libraries Y axis is bottom to top
|
|
|
|
// and in schematic Y axis is top to bottom
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2010-07-17 11:14:57 +00:00
|
|
|
else // calculate the pin position in schematic
|
2010-02-01 08:19:31 +00:00
|
|
|
pinpos = TransformCoordinate( DrawLibItem->m_Transform, pinpos )
|
2010-07-17 11:14:57 +00:00
|
|
|
+ DrawLibItem->m_Pos;
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-01-02 13:19:34 +00:00
|
|
|
if( pos == pinpos )
|
2007-08-24 15:10:46 +00:00
|
|
|
return Pin;
|
|
|
|
return NULL;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
void TestWireForDangling( std::vector <DANGLING_END_ITEM>& aItemList,
|
|
|
|
SCH_LINE* DrawRef,
|
|
|
|
WinEDA_SchematicFrame* frame,
|
|
|
|
wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-07-17 11:14:57 +00:00
|
|
|
bool Sdangstate = true, Edangstate = true;
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
BOOST_FOREACH( DANGLING_END_ITEM terminal_item, aItemList )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2010-09-11 16:33:43 +00:00
|
|
|
if( terminal_item.m_Item == DrawRef )
|
2007-08-24 15:10:46 +00:00
|
|
|
continue;
|
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
if( DrawRef->m_Start == terminal_item.m_Pos )
|
2010-07-17 11:14:57 +00:00
|
|
|
Sdangstate = false;
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
if( DrawRef->m_End == terminal_item.m_Pos )
|
2010-07-17 11:14:57 +00:00
|
|
|
Edangstate = false;
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2010-07-17 11:14:57 +00:00
|
|
|
if( (Sdangstate == false) && (Edangstate == false) )
|
2007-08-24 15:10:46 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( (Sdangstate != DrawRef->m_StartIsDangling)
|
|
|
|
|| (Edangstate != DrawRef->m_EndIsDangling) )
|
|
|
|
{
|
|
|
|
if( DC )
|
|
|
|
RedrawOneStruct( frame->DrawPanel, DC, DrawRef, g_XorMode );
|
|
|
|
DrawRef->m_StartIsDangling = Sdangstate;
|
|
|
|
DrawRef->m_EndIsDangling = Edangstate;
|
|
|
|
if( DC )
|
2009-11-03 13:26:31 +00:00
|
|
|
RedrawOneStruct( frame->DrawPanel, DC, DrawRef,
|
|
|
|
GR_DEFAULT_DRAWMODE );
|
2007-08-24 15:10:46 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
void TestLabelForDangling( std::vector <DANGLING_END_ITEM>& aItemList,
|
|
|
|
SCH_TEXT* aLabel,
|
|
|
|
WinEDA_SchematicFrame* aFrame,
|
|
|
|
wxDC* aDC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-07-17 11:14:57 +00:00
|
|
|
bool dangstate = true;
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
for( unsigned ii = 0; ii < aItemList.size(); ii++ )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2010-09-11 16:33:43 +00:00
|
|
|
DANGLING_END_ITEM & terminal_item = aItemList[ii];
|
|
|
|
|
|
|
|
if( terminal_item.m_Item == aLabel )
|
2007-08-24 15:10:46 +00:00
|
|
|
continue;
|
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
switch( terminal_item.m_Type )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
|
|
|
case PIN_END:
|
|
|
|
case LABEL_END:
|
|
|
|
case SHEET_LABEL_END:
|
2010-09-11 16:33:43 +00:00
|
|
|
if( aLabel->m_Pos == terminal_item.m_Pos )
|
2010-07-17 11:14:57 +00:00
|
|
|
dangstate = false;
|
2007-08-24 15:10:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WIRE_START_END:
|
|
|
|
case BUS_START_END:
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
|
|
|
// these schematic items have created 2 DANGLING_END_ITEM
|
|
|
|
// one per end.
|
|
|
|
ii++;
|
|
|
|
DANGLING_END_ITEM & next_terminal = aItemList[ii];
|
|
|
|
dangstate = !SegmentIntersect( terminal_item.m_Pos,
|
|
|
|
next_terminal.m_Pos,
|
|
|
|
aLabel->m_Pos );
|
|
|
|
}
|
2007-08-24 15:10:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case UNKNOWN:
|
|
|
|
case JUNCTION_END:
|
|
|
|
case ENTRY_END:
|
|
|
|
case WIRE_END_END:
|
|
|
|
case BUS_END_END:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-07-17 11:14:57 +00:00
|
|
|
if( dangstate == false )
|
2007-08-24 15:10:46 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
if( dangstate != aLabel->m_IsDangling )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2010-09-11 16:33:43 +00:00
|
|
|
if( aDC )
|
|
|
|
RedrawOneStruct( aFrame->DrawPanel, aDC, aLabel, g_XorMode );
|
|
|
|
aLabel->m_IsDangling = dangstate;
|
|
|
|
if( aDC )
|
|
|
|
RedrawOneStruct( aFrame->DrawPanel, aDC, aLabel, GR_DEFAULT_DRAWMODE );
|
2007-08-24 15:10:46 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
/* Returns the physical position of the pin relative to the component
|
|
|
|
* orientation. */
|
2009-10-08 13:19:28 +00:00
|
|
|
wxPoint ReturnPinPhysicalPosition( LIB_PIN* Pin, SCH_COMPONENT* DrawLibItem )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-24 15:10:46 +00:00
|
|
|
wxPoint PinPos = Pin->m_Pos;
|
|
|
|
|
|
|
|
if( DrawLibItem == NULL )
|
2009-01-02 13:19:34 +00:00
|
|
|
NEGATE( PinPos.y );
|
2007-08-24 15:10:46 +00:00
|
|
|
|
|
|
|
else
|
2009-10-08 13:19:28 +00:00
|
|
|
PinPos = TransformCoordinate( DrawLibItem->m_Transform,
|
|
|
|
Pin->m_Pos ) + DrawLibItem->m_Pos;
|
2007-08-24 15:10:46 +00:00
|
|
|
|
|
|
|
return PinPos;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
void RebuildEndPointsList( std::vector <DANGLING_END_ITEM>& aItemList, SCH_ITEM* aDrawList )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-09-11 16:33:43 +00:00
|
|
|
SCH_ITEM* schItem;
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
aItemList.clear();
|
|
|
|
|
|
|
|
for( schItem = aDrawList; schItem != NULL; schItem = schItem->Next() )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2010-09-11 16:33:43 +00:00
|
|
|
switch( schItem->Type() )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
case TYPE_SCH_LABEL:
|
|
|
|
case TYPE_SCH_GLOBALLABEL:
|
|
|
|
case TYPE_SCH_HIERLABEL:
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
|
|
|
#undef STRUCT
|
|
|
|
#define STRUCT ( (SCH_LABEL*) schItem )
|
|
|
|
DANGLING_END_ITEM item( LABEL_END, schItem );
|
|
|
|
item.m_Pos = STRUCT->m_Pos;
|
|
|
|
aItemList.push_back( item );
|
|
|
|
}
|
|
|
|
break;
|
2007-08-24 15:10:46 +00:00
|
|
|
|
|
|
|
case DRAW_SEGMENT_STRUCT_TYPE:
|
2010-09-11 16:33:43 +00:00
|
|
|
#undef STRUCT
|
|
|
|
#define STRUCT ( (SCH_LINE*) schItem )
|
2008-04-14 19:22:48 +00:00
|
|
|
if( STRUCT->GetLayer() == LAYER_NOTES )
|
2007-08-24 15:10:46 +00:00
|
|
|
break;
|
2009-11-03 13:26:31 +00:00
|
|
|
if( ( STRUCT->GetLayer() == LAYER_BUS )
|
|
|
|
|| (STRUCT->GetLayer() == LAYER_WIRE ) )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2010-09-11 16:33:43 +00:00
|
|
|
DANGLING_END_ITEM item( (STRUCT->GetLayer() == LAYER_BUS) ?
|
|
|
|
BUS_START_END : WIRE_START_END, schItem );
|
|
|
|
item.m_Pos = STRUCT->m_Start;
|
|
|
|
DANGLING_END_ITEM item1( (STRUCT->GetLayer() == LAYER_BUS) ?
|
|
|
|
BUS_END_END : WIRE_END_END, schItem );
|
|
|
|
item1.m_Pos = STRUCT->m_End;
|
|
|
|
|
|
|
|
aItemList.push_back( item );
|
|
|
|
aItemList.push_back( item1 );
|
2007-08-24 15:10:46 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_JUNCTION_STRUCT_TYPE:
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
|
|
|
#undef STRUCT
|
|
|
|
#define STRUCT ( (SCH_JUNCTION*) schItem )
|
|
|
|
DANGLING_END_ITEM item( JUNCTION_END, schItem );
|
|
|
|
item.m_Pos = STRUCT->m_Pos;
|
|
|
|
aItemList.push_back( item );
|
|
|
|
}
|
|
|
|
break;
|
2007-08-24 15:10:46 +00:00
|
|
|
|
|
|
|
case DRAW_BUSENTRY_STRUCT_TYPE:
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
|
|
|
#undef STRUCT
|
|
|
|
#define STRUCT ( (SCH_BUS_ENTRY*) schItem )
|
|
|
|
DANGLING_END_ITEM item( ENTRY_END, schItem );
|
|
|
|
item.m_Pos = STRUCT->m_Pos;
|
|
|
|
|
|
|
|
DANGLING_END_ITEM item1( ENTRY_END, schItem );
|
|
|
|
item1.m_Pos = STRUCT->m_End();
|
|
|
|
aItemList.push_back( item );
|
|
|
|
aItemList.push_back( item1 );
|
|
|
|
}
|
|
|
|
break;
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
case TYPE_SCH_COMPONENT:
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
|
|
|
#undef STRUCT
|
2010-09-11 16:33:43 +00:00
|
|
|
#define STRUCT ( (SCH_COMPONENT*) schItem )
|
2009-09-18 14:56:05 +00:00
|
|
|
LIB_COMPONENT* Entry;
|
|
|
|
Entry = CMP_LIBRARY::FindLibraryComponent( STRUCT->m_ChipName );
|
2007-08-24 15:10:46 +00:00
|
|
|
if( Entry == NULL )
|
|
|
|
break;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2009-10-08 13:19:28 +00:00
|
|
|
for( LIB_PIN* Pin = Entry->GetNextPin(); Pin != NULL;
|
2010-07-17 11:14:57 +00:00
|
|
|
Pin = Entry->GetNextPin( Pin ) )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2009-09-29 18:38:21 +00:00
|
|
|
wxASSERT( Pin->Type() == COMPONENT_PIN_DRAW_TYPE );
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
if( Pin->m_Unit && STRUCT->m_Multi
|
|
|
|
&& ( STRUCT->m_Multi != Pin->m_Unit ) )
|
2007-08-24 15:10:46 +00:00
|
|
|
continue;
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
if( Pin->m_Convert && STRUCT->m_Convert
|
2009-11-03 13:26:31 +00:00
|
|
|
&& ( STRUCT->m_Convert != Pin->m_Convert ) )
|
2007-08-24 15:10:46 +00:00
|
|
|
continue;
|
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
DANGLING_END_ITEM item( PIN_END, Pin );
|
|
|
|
item.m_Pos = ReturnPinPhysicalPosition( Pin, STRUCT );
|
|
|
|
aItemList.push_back( item );
|
2007-08-24 15:10:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case DRAW_SHEET_STRUCT_TYPE:
|
2009-11-03 13:26:31 +00:00
|
|
|
{
|
2010-09-11 16:33:43 +00:00
|
|
|
SCH_SHEET* sheet = (SCH_SHEET*) schItem;
|
2010-06-24 18:31:43 +00:00
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
// Using BOOST_FOREACH here creates problems (bad pointer value to pinsheet).
|
|
|
|
// I do not know why.
|
|
|
|
for( unsigned ii = 0; ii < sheet->GetSheetPins().size(); ii++ )
|
|
|
|
{
|
|
|
|
SCH_SHEET_PIN &pinsheet = sheet->GetSheetPins()[ii];
|
2010-06-24 18:31:43 +00:00
|
|
|
wxASSERT( pinsheet.Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE );
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
DANGLING_END_ITEM item( SHEET_LABEL_END, &pinsheet );
|
|
|
|
item.m_Pos = pinsheet.m_Pos;
|
|
|
|
aItemList.push_back( item );
|
2008-04-22 16:38:23 +00:00
|
|
|
}
|
2009-11-03 13:26:31 +00:00
|
|
|
}
|
|
|
|
break;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
default:
|
|
|
|
;
|
|
|
|
}
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|