static void SegmentToPointConnect(ObjetNetListStruct *Jonction, int IsBus, int start) /***************************************************************/ /* Routine qui recherche si un point (jonction) est connecte a des segments, et regroupe les NetCodes des objets connectes a la jonction. Le point de jonction doit avoir un netcode valide La liste des objets est supposee classe par NumSheet Croissants, et la recherche se fait a partir de l'element start, 1er element de la feuille de schema ( il ne peut y avoir connexion physique entre elements de differentes sheets) */ { int i; ObjetNetListStruct *Segment = g_TabObjNet; for (i = start; i < g_NbrObjNet; i++) { if( Segment[i].m_SheetNumber > Jonction->m_SheetNumber ) break; if( IsBus == 0) { if ( Segment[i].m_Type != NET_SEGMENT ) continue; } else { if ( Segment[i].m_Type != NET_BUS ) continue; } if ( SegmentIntersect(Segment[i].m_Start.x, Segment[i].m_Start.y, Segment[i].m_End.x, Segment[i].m_End.y, Jonction->m_Start.x, Jonction->m_Start.y) ) { /* Propagation du Netcode a tous les Objets de meme NetCode */ if( IsBus == 0 ) { if( Segment[i].m_NetCode ) PropageNetCode(Segment[i].m_NetCode, Jonction->m_NetCode, IsBus); else Segment[i].m_NetCode = Jonction->m_NetCode; } else { if( Segment[i].m_BusNetCode ) PropageNetCode(Segment[i].m_BusNetCode, Jonction->m_BusNetCode, IsBus); else Segment[i].m_BusNetCode = Jonction->m_BusNetCode; } } } }
void TestLabelForDangling(DrawTextStruct * label, WinEDA_SchematicFrame * frame, wxDC * DC) /********************************************************/ { DanglingEndHandle * terminal_item; bool dangstate = TRUE; for ( terminal_item = ItemList; terminal_item != NULL; terminal_item = terminal_item->m_Pnext) { if ( terminal_item->m_Item == label ) continue; switch( terminal_item->m_Type ) { case PIN_END: case LABEL_END: case SHEET_LABEL_END: if ( (label->m_Pos.x == terminal_item->m_Pos.x) && (label->m_Pos.y == terminal_item->m_Pos.y) ) dangstate = FALSE; break; case WIRE_START_END: case BUS_START_END: dangstate = ! SegmentIntersect(terminal_item->m_Pos.x, terminal_item->m_Pos.y, terminal_item->m_Pnext->m_Pos.x, terminal_item->m_Pnext->m_Pos.y, label->m_Pos.x, label->m_Pos.y); terminal_item = terminal_item->m_Pnext; break; case UNKNOWN: case JUNCTION_END: case ENTRY_END: case WIRE_END_END: case BUS_END_END: break; } if (dangstate == FALSE) break; } if ( dangstate != label->m_IsDangling ) { if ( DC ) RedrawOneStruct(frame->DrawPanel,DC, label, g_XorMode); label->m_IsDangling = dangstate; if ( DC ) RedrawOneStruct(frame->DrawPanel,DC, label, GR_DEFAULT_DRAWMODE); } }
bool SCH_TEXT::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList ) { // Normal text labels cannot be tested for dangling ends. if( Type() == SCH_TEXT_T ) return false; bool previousState = m_isDangling; m_isDangling = true; for( unsigned ii = 0; ii < aItemList.size(); ii++ ) { DANGLING_END_ITEM& item = aItemList[ii]; if( item.GetItem() == this ) continue; switch( item.GetType() ) { case PIN_END: case LABEL_END: case SHEET_LABEL_END: if( m_Pos == item.GetPosition() ) m_isDangling = false; break; case WIRE_START_END: case BUS_START_END: { // These schematic items have created 2 DANGLING_END_ITEM one per end. But being // a paranoid programmer, I'll check just in case. ii++; wxCHECK_MSG( ii < aItemList.size(), previousState != m_isDangling, wxT( "Dangling end type list overflow. Bad programmer!" ) ); DANGLING_END_ITEM & nextItem = aItemList[ii]; m_isDangling = !SegmentIntersect( item.GetPosition(), nextItem.GetPosition(), m_Pos ); } break; default: break; } if( m_isDangling == false ) break; } return previousState != m_isDangling; }