Loading common/trigo.cpp +8 −4 Original line number Original line Diff line number Diff line Loading @@ -249,8 +249,10 @@ void RotatePoint( int* pX, int* pY, int angle ) else else { { double fangle = DEG2RAD( (double) angle / 10.0 ); double fangle = DEG2RAD( (double) angle / 10.0 ); double fpx = (*pY * sin( fangle ) ) + (*pX * cos( fangle ) ); double sinus = sin( fangle ); double fpy = (*pY * cos( fangle ) ) - (*pX * sin( fangle ) ); double cosinus = cos( fangle ); double fpx = (*pY * sinus ) + (*pX * cosinus ); double fpy = (*pY * cosinus ) - (*pX * sinus ); *pX = wxRound( fpx ); *pX = wxRound( fpx ); *pY = wxRound( fpy ); *pY = wxRound( fpy ); } } Loading Loading @@ -345,9 +347,11 @@ void RotatePoint( double* pX, double* pY, int angle ) else else { { double fangle = DEG2RAD( (double) angle / 10.0 ); double fangle = DEG2RAD( (double) angle / 10.0 ); double sinus = sin( fangle ); double cosinus = cos( fangle ); double fpx = (*pY * sin( fangle ) ) + (*pX * cos( fangle ) ); double fpx = (*pY * sinus ) + (*pX * cosinus ); double fpy = (*pY * cos( fangle ) ) - (*pX * sin( fangle ) ); double fpy = (*pY * cosinus ) - (*pX * sinus ); *pX = fpx; *pX = fpx; *pY = fpy; *pY = fpy; } } Loading include/wxBasePcbFrame.h +2 −7 Original line number Original line Diff line number Diff line Loading @@ -441,15 +441,14 @@ public: * according to its net code. and when nets are changed (when a new netlist is read) * according to its net code. and when nets are changed (when a new netlist is read) * tracks are sorted before using this function. * tracks are sorted before using this function. * </p> * </p> * @param aDC = current Device Context */ */ void TestConnections( wxDC* aDC ); void TestConnections(); /** /** * Function TestNetConnection * Function TestNetConnection * tests the connections relative to \a aNetCode. Track segments are assumed to be * tests the connections relative to \a aNetCode. Track segments are assumed to be * sorted by net codes. * sorted by net codes. * @param aDC Cyrrent Device Context * @param aDC Current Device Context * @param aNetCode The net code to test * @param aNetCode The net code to test */ */ void TestNetConnection( wxDC* aDC, int aNetCode ); void TestNetConnection( wxDC* aDC, int aNetCode ); Loading @@ -458,10 +457,6 @@ public: * Function RecalculateAllTracksNetcode * Function RecalculateAllTracksNetcode * search connections between tracks and pads and propagate pad net codes to the track * search connections between tracks and pads and propagate pad net codes to the track * segments. * segments. * <p> * This is a 2 pass computation. First we search a connection between a track segment * and a pad. If the connection is found, the segment netcode is set to the pad netcode. * </p> */ */ void RecalculateAllTracksNetcode(); void RecalculateAllTracksNetcode(); Loading include/wxPcbStruct.h +6 −6 Original line number Original line Diff line number Diff line Loading @@ -1138,20 +1138,20 @@ public: * The zone outline is a frontier, and can be complex (with holes) * The zone outline is a frontier, and can be complex (with holes) * The filling starts from starting points like pads, tracks. * The filling starts from starting points like pads, tracks. * If exists the old filling is removed * If exists the old filling is removed * @param zone_container = zone to fill * @param aZone = zone to fill * @param verbose = true to show error messages * @return error level (0 = no error) * @return error level (0 = no error) */ */ int Fill_Zone( ZONE_CONTAINER* zone_container, bool verbose = true ); int Fill_Zone( ZONE_CONTAINER* aZone ); /** /** * Function Fill_All_Zones * Function Fill_All_Zones * Fill all zones on the board * Fill all zones on the board * The old fillings are removed * The old fillings are removed * @param verbose = true to show error messages * @param aActiveWindow = the current active window, if a progress bar is shown * @return error level (0 = no error) * = NULL to do not display a progress bar * @param aVerbose = true to show error messages */ */ int Fill_All_Zones( bool verbose = true ); int Fill_All_Zones( wxWindow * aActiveWindow, bool aVerbose = true ); /** /** Loading pcbnew/connect.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -511,7 +511,7 @@ void CONNECTIONS::Propagate_SubNets() } } } } void PCB_BASE_FRAME::TestConnections( wxDC* aDC ) void PCB_BASE_FRAME::TestConnections() { { // Clear the cluster identifier for all pads // Clear the cluster identifier for all pads for( unsigned i = 0; i< m_Pcb->GetPadsCount(); ++i ) for( unsigned i = 0; i< m_Pcb->GetPadsCount(); ++i ) Loading pcbnew/drc.cpp +48 −42 Original line number Original line Diff line number Diff line Loading @@ -230,7 +230,7 @@ void DRC::RunTests( wxTextCtrl* aMessages ) aMessages->AppendText( _( "Track clearances...\n" ) ); aMessages->AppendText( _( "Track clearances...\n" ) ); wxSafeYield(); wxSafeYield(); } } testTracks(); testTracks( true ); // Before testing segments and unconnected, refill all zones: // Before testing segments and unconnected, refill all zones: // this is a good caution, because filled areas can be outdated. // this is a good caution, because filled areas can be outdated. Loading @@ -240,17 +240,16 @@ void DRC::RunTests( wxTextCtrl* aMessages ) wxSafeYield(); wxSafeYield(); } } m_mainWindow->Fill_All_Zones( false ); m_mainWindow->Fill_All_Zones( aMessages->GetParent(), false ); wxSafeYield(); // test zone clearances to other zones, pads, tracks, and vias // test zone clearances to other zones if( aMessages && m_doZonesTest ) if( aMessages ) { { aMessages->AppendText( _( "Test zones...\n" ) ); aMessages->AppendText( _( "Test zones...\n" ) ); wxSafeYield(); wxSafeYield(); } } testZones( m_doZonesTest ); testZones(); // find and gather unconnected pads. // find and gather unconnected pads. if( m_doUnconnectedTest ) if( m_doUnconnectedTest ) Loading Loading @@ -457,10 +456,44 @@ void DRC::testPad2Pad() } } void DRC::testTracks() #include <wx/progdlg.h> /* Function testTracks * performs the DRC on all tracks. * because this test can take a while, a progrsse bar can be displayed * (Note: it is shown only if there are many tracks */ void DRC::testTracks( bool aShowProgressBar ) { wxProgressDialog * progressDialog = NULL; const int delta = 500; // This is the number of tests between 2 calls to the // progress bar int count = 0; for( TRACK* segm = m_pcb->m_Track; segm && segm->Next(); segm = segm->Next() ) count++; int deltamax = count/delta; if( aShowProgressBar && deltamax > 3 ) { { progressDialog = new wxProgressDialog( _( "Track clearances" ), wxEmptyString, deltamax, m_mainWindow, wxPD_AUTO_HIDE | wxPD_CAN_ABORT ); progressDialog->Update( 0, wxEmptyString ); } int ii = 0; count = 0; for( TRACK* segm = m_pcb->m_Track; segm && segm->Next(); segm = segm->Next() ) for( TRACK* segm = m_pcb->m_Track; segm && segm->Next(); segm = segm->Next() ) { { if ( ii++ > delta ) { ii = 0; count++; if( progressDialog ) { if( !progressDialog->Update( count, wxEmptyString ) ) break; // Aborted by user } } if( !doTrackDrc( segm, segm->Next(), true ) ) if( !doTrackDrc( segm, segm->Next(), true ) ) { { wxASSERT( m_currentMarker ); wxASSERT( m_currentMarker ); Loading @@ -468,6 +501,8 @@ void DRC::testTracks() m_currentMarker = 0; m_currentMarker = 0; } } } } if( progressDialog ) progressDialog->Destroy(); } } Loading @@ -484,13 +519,13 @@ void DRC::testUnconnected() for( unsigned ii = 0; ii < m_pcb->GetRatsnestsCount(); ++ii ) for( unsigned ii = 0; ii < m_pcb->GetRatsnestsCount(); ++ii ) { { RATSNEST_ITEM* rat = &m_pcb->m_FullRatsnest[ii]; RATSNEST_ITEM& rat = m_pcb->m_FullRatsnest[ii]; if( (rat->m_Status & CH_ACTIF) == 0 ) if( (rat.m_Status & CH_ACTIF) == 0 ) continue; continue; D_PAD* padStart = rat->m_PadStart; D_PAD* padStart = rat.m_PadStart; D_PAD* padEnd = rat->m_PadEnd; D_PAD* padEnd = rat.m_PadEnd; DRC_ITEM* uncItem = new DRC_ITEM( DRCE_UNCONNECTED_PADS, DRC_ITEM* uncItem = new DRC_ITEM( DRCE_UNCONNECTED_PADS, padStart->GetSelectMenuText(), padStart->GetSelectMenuText(), Loading @@ -502,7 +537,7 @@ void DRC::testUnconnected() } } void DRC::testZones( bool adoTestFillSegments ) void DRC::testZones() { { // Test copper areas for valid netcodes // Test copper areas for valid netcodes // if a netcode is < 0 the netname was not found when reading a netlist // if a netcode is < 0 the netname was not found when reading a netlist Loading @@ -526,35 +561,6 @@ void DRC::testZones( bool adoTestFillSegments ) // Test copper areas outlines, and create markers when needed // Test copper areas outlines, and create markers when needed m_pcb->Test_Drc_Areas_Outlines_To_Areas_Outlines( NULL, true ); m_pcb->Test_Drc_Areas_Outlines_To_Areas_Outlines( NULL, true ); TRACK* zoneSeg; if( !adoTestFillSegments ) return; // m_pcb->m_Zone is fully obsolete. Keep this test for compatibility // with old designs. Will be removed on day for( zoneSeg = m_pcb->m_Zone; zoneSeg && zoneSeg->Next(); zoneSeg = zoneSeg->Next() ) { // Test zoneSeg with other zone segments and with all pads if( !doTrackDrc( zoneSeg, zoneSeg->Next(), true ) ) { wxASSERT( m_currentMarker ); m_pcb->Add( m_currentMarker ); m_currentMarker = 0; } // Pads already tested: disable pad test bool rc = doTrackDrc( zoneSeg, m_pcb->m_Track, false ); if( !rc ) { wxASSERT( m_currentMarker ); m_pcb->Add( m_currentMarker ); m_currentMarker = 0; } } } } Loading Loading
common/trigo.cpp +8 −4 Original line number Original line Diff line number Diff line Loading @@ -249,8 +249,10 @@ void RotatePoint( int* pX, int* pY, int angle ) else else { { double fangle = DEG2RAD( (double) angle / 10.0 ); double fangle = DEG2RAD( (double) angle / 10.0 ); double fpx = (*pY * sin( fangle ) ) + (*pX * cos( fangle ) ); double sinus = sin( fangle ); double fpy = (*pY * cos( fangle ) ) - (*pX * sin( fangle ) ); double cosinus = cos( fangle ); double fpx = (*pY * sinus ) + (*pX * cosinus ); double fpy = (*pY * cosinus ) - (*pX * sinus ); *pX = wxRound( fpx ); *pX = wxRound( fpx ); *pY = wxRound( fpy ); *pY = wxRound( fpy ); } } Loading Loading @@ -345,9 +347,11 @@ void RotatePoint( double* pX, double* pY, int angle ) else else { { double fangle = DEG2RAD( (double) angle / 10.0 ); double fangle = DEG2RAD( (double) angle / 10.0 ); double sinus = sin( fangle ); double cosinus = cos( fangle ); double fpx = (*pY * sin( fangle ) ) + (*pX * cos( fangle ) ); double fpx = (*pY * sinus ) + (*pX * cosinus ); double fpy = (*pY * cos( fangle ) ) - (*pX * sin( fangle ) ); double fpy = (*pY * cosinus ) - (*pX * sinus ); *pX = fpx; *pX = fpx; *pY = fpy; *pY = fpy; } } Loading
include/wxBasePcbFrame.h +2 −7 Original line number Original line Diff line number Diff line Loading @@ -441,15 +441,14 @@ public: * according to its net code. and when nets are changed (when a new netlist is read) * according to its net code. and when nets are changed (when a new netlist is read) * tracks are sorted before using this function. * tracks are sorted before using this function. * </p> * </p> * @param aDC = current Device Context */ */ void TestConnections( wxDC* aDC ); void TestConnections(); /** /** * Function TestNetConnection * Function TestNetConnection * tests the connections relative to \a aNetCode. Track segments are assumed to be * tests the connections relative to \a aNetCode. Track segments are assumed to be * sorted by net codes. * sorted by net codes. * @param aDC Cyrrent Device Context * @param aDC Current Device Context * @param aNetCode The net code to test * @param aNetCode The net code to test */ */ void TestNetConnection( wxDC* aDC, int aNetCode ); void TestNetConnection( wxDC* aDC, int aNetCode ); Loading @@ -458,10 +457,6 @@ public: * Function RecalculateAllTracksNetcode * Function RecalculateAllTracksNetcode * search connections between tracks and pads and propagate pad net codes to the track * search connections between tracks and pads and propagate pad net codes to the track * segments. * segments. * <p> * This is a 2 pass computation. First we search a connection between a track segment * and a pad. If the connection is found, the segment netcode is set to the pad netcode. * </p> */ */ void RecalculateAllTracksNetcode(); void RecalculateAllTracksNetcode(); Loading
include/wxPcbStruct.h +6 −6 Original line number Original line Diff line number Diff line Loading @@ -1138,20 +1138,20 @@ public: * The zone outline is a frontier, and can be complex (with holes) * The zone outline is a frontier, and can be complex (with holes) * The filling starts from starting points like pads, tracks. * The filling starts from starting points like pads, tracks. * If exists the old filling is removed * If exists the old filling is removed * @param zone_container = zone to fill * @param aZone = zone to fill * @param verbose = true to show error messages * @return error level (0 = no error) * @return error level (0 = no error) */ */ int Fill_Zone( ZONE_CONTAINER* zone_container, bool verbose = true ); int Fill_Zone( ZONE_CONTAINER* aZone ); /** /** * Function Fill_All_Zones * Function Fill_All_Zones * Fill all zones on the board * Fill all zones on the board * The old fillings are removed * The old fillings are removed * @param verbose = true to show error messages * @param aActiveWindow = the current active window, if a progress bar is shown * @return error level (0 = no error) * = NULL to do not display a progress bar * @param aVerbose = true to show error messages */ */ int Fill_All_Zones( bool verbose = true ); int Fill_All_Zones( wxWindow * aActiveWindow, bool aVerbose = true ); /** /** Loading
pcbnew/connect.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -511,7 +511,7 @@ void CONNECTIONS::Propagate_SubNets() } } } } void PCB_BASE_FRAME::TestConnections( wxDC* aDC ) void PCB_BASE_FRAME::TestConnections() { { // Clear the cluster identifier for all pads // Clear the cluster identifier for all pads for( unsigned i = 0; i< m_Pcb->GetPadsCount(); ++i ) for( unsigned i = 0; i< m_Pcb->GetPadsCount(); ++i ) Loading
pcbnew/drc.cpp +48 −42 Original line number Original line Diff line number Diff line Loading @@ -230,7 +230,7 @@ void DRC::RunTests( wxTextCtrl* aMessages ) aMessages->AppendText( _( "Track clearances...\n" ) ); aMessages->AppendText( _( "Track clearances...\n" ) ); wxSafeYield(); wxSafeYield(); } } testTracks(); testTracks( true ); // Before testing segments and unconnected, refill all zones: // Before testing segments and unconnected, refill all zones: // this is a good caution, because filled areas can be outdated. // this is a good caution, because filled areas can be outdated. Loading @@ -240,17 +240,16 @@ void DRC::RunTests( wxTextCtrl* aMessages ) wxSafeYield(); wxSafeYield(); } } m_mainWindow->Fill_All_Zones( false ); m_mainWindow->Fill_All_Zones( aMessages->GetParent(), false ); wxSafeYield(); // test zone clearances to other zones, pads, tracks, and vias // test zone clearances to other zones if( aMessages && m_doZonesTest ) if( aMessages ) { { aMessages->AppendText( _( "Test zones...\n" ) ); aMessages->AppendText( _( "Test zones...\n" ) ); wxSafeYield(); wxSafeYield(); } } testZones( m_doZonesTest ); testZones(); // find and gather unconnected pads. // find and gather unconnected pads. if( m_doUnconnectedTest ) if( m_doUnconnectedTest ) Loading Loading @@ -457,10 +456,44 @@ void DRC::testPad2Pad() } } void DRC::testTracks() #include <wx/progdlg.h> /* Function testTracks * performs the DRC on all tracks. * because this test can take a while, a progrsse bar can be displayed * (Note: it is shown only if there are many tracks */ void DRC::testTracks( bool aShowProgressBar ) { wxProgressDialog * progressDialog = NULL; const int delta = 500; // This is the number of tests between 2 calls to the // progress bar int count = 0; for( TRACK* segm = m_pcb->m_Track; segm && segm->Next(); segm = segm->Next() ) count++; int deltamax = count/delta; if( aShowProgressBar && deltamax > 3 ) { { progressDialog = new wxProgressDialog( _( "Track clearances" ), wxEmptyString, deltamax, m_mainWindow, wxPD_AUTO_HIDE | wxPD_CAN_ABORT ); progressDialog->Update( 0, wxEmptyString ); } int ii = 0; count = 0; for( TRACK* segm = m_pcb->m_Track; segm && segm->Next(); segm = segm->Next() ) for( TRACK* segm = m_pcb->m_Track; segm && segm->Next(); segm = segm->Next() ) { { if ( ii++ > delta ) { ii = 0; count++; if( progressDialog ) { if( !progressDialog->Update( count, wxEmptyString ) ) break; // Aborted by user } } if( !doTrackDrc( segm, segm->Next(), true ) ) if( !doTrackDrc( segm, segm->Next(), true ) ) { { wxASSERT( m_currentMarker ); wxASSERT( m_currentMarker ); Loading @@ -468,6 +501,8 @@ void DRC::testTracks() m_currentMarker = 0; m_currentMarker = 0; } } } } if( progressDialog ) progressDialog->Destroy(); } } Loading @@ -484,13 +519,13 @@ void DRC::testUnconnected() for( unsigned ii = 0; ii < m_pcb->GetRatsnestsCount(); ++ii ) for( unsigned ii = 0; ii < m_pcb->GetRatsnestsCount(); ++ii ) { { RATSNEST_ITEM* rat = &m_pcb->m_FullRatsnest[ii]; RATSNEST_ITEM& rat = m_pcb->m_FullRatsnest[ii]; if( (rat->m_Status & CH_ACTIF) == 0 ) if( (rat.m_Status & CH_ACTIF) == 0 ) continue; continue; D_PAD* padStart = rat->m_PadStart; D_PAD* padStart = rat.m_PadStart; D_PAD* padEnd = rat->m_PadEnd; D_PAD* padEnd = rat.m_PadEnd; DRC_ITEM* uncItem = new DRC_ITEM( DRCE_UNCONNECTED_PADS, DRC_ITEM* uncItem = new DRC_ITEM( DRCE_UNCONNECTED_PADS, padStart->GetSelectMenuText(), padStart->GetSelectMenuText(), Loading @@ -502,7 +537,7 @@ void DRC::testUnconnected() } } void DRC::testZones( bool adoTestFillSegments ) void DRC::testZones() { { // Test copper areas for valid netcodes // Test copper areas for valid netcodes // if a netcode is < 0 the netname was not found when reading a netlist // if a netcode is < 0 the netname was not found when reading a netlist Loading @@ -526,35 +561,6 @@ void DRC::testZones( bool adoTestFillSegments ) // Test copper areas outlines, and create markers when needed // Test copper areas outlines, and create markers when needed m_pcb->Test_Drc_Areas_Outlines_To_Areas_Outlines( NULL, true ); m_pcb->Test_Drc_Areas_Outlines_To_Areas_Outlines( NULL, true ); TRACK* zoneSeg; if( !adoTestFillSegments ) return; // m_pcb->m_Zone is fully obsolete. Keep this test for compatibility // with old designs. Will be removed on day for( zoneSeg = m_pcb->m_Zone; zoneSeg && zoneSeg->Next(); zoneSeg = zoneSeg->Next() ) { // Test zoneSeg with other zone segments and with all pads if( !doTrackDrc( zoneSeg, zoneSeg->Next(), true ) ) { wxASSERT( m_currentMarker ); m_pcb->Add( m_currentMarker ); m_currentMarker = 0; } // Pads already tested: disable pad test bool rc = doTrackDrc( zoneSeg, m_pcb->m_Track, false ); if( !rc ) { wxASSERT( m_currentMarker ); m_pcb->Add( m_currentMarker ); m_currentMarker = 0; } } } } Loading