2011-12-12 14:02:37 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2018-02-04 13:34:17 +00:00
|
|
|
* Copyright (C) 2004-2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2017-06-22 14:24:07 +00:00
|
|
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
2018-02-04 13:34:17 +00:00
|
|
|
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-12-12 14:02:37 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2010-11-21 18:28:32 +00:00
|
|
|
/**
|
2018-01-30 19:40:52 +00:00
|
|
|
* @file tracks_cleaner.cpp
|
2014-05-10 12:48:17 +00:00
|
|
|
* @brief functions to clean tracks: remove null length and redundant segments
|
2010-11-21 18:28:32 +00:00
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <class_drawpanel.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <pcb_edit_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbnew.h>
|
|
|
|
#include <class_board.h>
|
|
|
|
#include <class_track.h>
|
2019-03-31 09:37:57 +00:00
|
|
|
#include <dialog_cleanup_tracks_and_vias.h>
|
|
|
|
#include <reporter.h>
|
2016-11-28 14:31:28 +00:00
|
|
|
#include <board_commit.h>
|
2018-10-12 06:17:15 +00:00
|
|
|
#include <connectivity/connectivity_algo.h>
|
|
|
|
#include <connectivity/connectivity_data.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2018-02-04 13:34:17 +00:00
|
|
|
#include <tool/tool_manager.h>
|
|
|
|
#include <tools/pcb_actions.h>
|
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
#include <tracks_cleaner.h>
|
2007-10-19 23:02:11 +00:00
|
|
|
|
2016-11-28 14:08:33 +00:00
|
|
|
|
2013-03-08 07:29:30 +00:00
|
|
|
/* Install the cleanup dialog frame to know what should be cleaned
|
2007-10-27 18:05:50 +00:00
|
|
|
*/
|
2013-03-08 07:29:30 +00:00
|
|
|
void PCB_EDIT_FRAME::Clean_Pcb()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2019-03-31 09:37:57 +00:00
|
|
|
DIALOG_CLEANUP_TRACKS_AND_VIAS dlg( this );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
dlg.ShowModal();
|
|
|
|
}
|
2016-09-30 16:33:46 +00:00
|
|
|
|
2015-09-22 15:55:10 +00:00
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
TRACKS_CLEANER::TRACKS_CLEANER( EDA_UNITS_T aUnits, BOARD* aPcb, BOARD_COMMIT& aCommit ) :
|
|
|
|
m_units( aUnits ),
|
|
|
|
m_brd( aPcb ),
|
|
|
|
m_commit( aCommit ),
|
|
|
|
m_dryRun( true ),
|
|
|
|
m_itemsList( nullptr )
|
|
|
|
{
|
2007-06-14 05:31:55 +00:00
|
|
|
}
|
|
|
|
|
2017-06-22 14:24:07 +00:00
|
|
|
|
2017-03-28 11:18:15 +00:00
|
|
|
void TRACKS_CLEANER::buildTrackConnectionInfo()
|
|
|
|
{
|
|
|
|
auto connectivity = m_brd->GetConnectivity();
|
|
|
|
|
2017-06-22 14:24:07 +00:00
|
|
|
connectivity->Build(m_brd);
|
|
|
|
|
2017-06-23 11:56:28 +00:00
|
|
|
// clear flags and variables used in cleanup
|
2017-05-04 22:43:43 +00:00
|
|
|
for( auto track : m_brd->Tracks() )
|
2017-03-28 11:18:15 +00:00
|
|
|
{
|
|
|
|
track->SetState( START_ON_PAD | END_ON_PAD | BUSY, false );
|
|
|
|
}
|
|
|
|
|
2017-05-04 22:43:43 +00:00
|
|
|
for( auto track : m_brd->Tracks() )
|
2017-03-28 11:18:15 +00:00
|
|
|
{
|
|
|
|
// Mark track if connected to pads
|
|
|
|
for( auto pad : connectivity->GetConnectedPads( track ) )
|
|
|
|
{
|
|
|
|
if( pad->HitTest( track->GetStart() ) )
|
|
|
|
track->SetState( START_ON_PAD, true );
|
|
|
|
|
|
|
|
if( pad->HitTest( track->GetEnd() ) )
|
|
|
|
track->SetState( END_ON_PAD, true );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2007-10-27 18:05:50 +00:00
|
|
|
/* Main cleaning function.
|
|
|
|
* Delete
|
|
|
|
* - Redundant points on tracks (merge aligned segments)
|
|
|
|
* - vias on pad
|
2014-04-25 06:00:04 +00:00
|
|
|
* - null length segments
|
2007-10-27 18:05:50 +00:00
|
|
|
*/
|
2019-03-31 09:37:57 +00:00
|
|
|
bool TRACKS_CLEANER::CleanupBoard( bool aDryRun, DRC_LIST* aItemsList,
|
|
|
|
bool aRemoveMisConnected,
|
2014-04-13 18:24:44 +00:00
|
|
|
bool aCleanVias,
|
|
|
|
bool aMergeSegments,
|
|
|
|
bool aDeleteUnconnected )
|
2007-06-14 05:31:55 +00:00
|
|
|
{
|
2019-03-31 09:37:57 +00:00
|
|
|
m_dryRun = aDryRun;
|
|
|
|
m_itemsList = aItemsList;
|
2012-09-07 19:29:44 +00:00
|
|
|
bool modified = false;
|
2010-11-21 18:28:32 +00:00
|
|
|
|
2012-09-07 19:29:44 +00:00
|
|
|
// delete redundant vias
|
2016-09-30 09:09:17 +00:00
|
|
|
if( aCleanVias )
|
2017-03-22 13:51:07 +00:00
|
|
|
modified |= cleanupVias();
|
2008-03-10 15:00:22 +00:00
|
|
|
|
2012-09-07 19:29:44 +00:00
|
|
|
// Remove null segments and intermediate points on aligned segments
|
2016-09-30 16:33:46 +00:00
|
|
|
// If not asked, remove null segments only if remove misconnected is asked
|
2016-09-30 09:09:17 +00:00
|
|
|
if( aMergeSegments )
|
2017-06-22 14:24:07 +00:00
|
|
|
modified |= cleanupSegments();
|
2016-09-30 16:33:46 +00:00
|
|
|
else if( aRemoveMisConnected )
|
2017-06-22 14:24:07 +00:00
|
|
|
modified |= deleteNullSegments();
|
2016-09-30 09:09:17 +00:00
|
|
|
|
2017-03-28 11:18:15 +00:00
|
|
|
buildTrackConnectionInfo();
|
|
|
|
|
2016-09-30 09:09:17 +00:00
|
|
|
if( aRemoveMisConnected )
|
2017-03-28 11:18:15 +00:00
|
|
|
modified |= removeBadTrackSegments();
|
2015-05-01 15:01:09 +00:00
|
|
|
|
2016-09-30 16:33:46 +00:00
|
|
|
// Delete dangling tracks
|
|
|
|
if( aDeleteUnconnected )
|
2014-04-13 18:24:44 +00:00
|
|
|
{
|
2016-09-30 16:33:46 +00:00
|
|
|
if( deleteDanglingTracks() )
|
|
|
|
{
|
2016-12-07 15:52:48 +00:00
|
|
|
modified = true;
|
2016-09-30 16:33:46 +00:00
|
|
|
|
|
|
|
// Removed tracks can leave aligned segments
|
|
|
|
// (when a T was formed by tracks and the "vertical" segment
|
|
|
|
// is removed)
|
|
|
|
if( aMergeSegments )
|
2017-06-22 14:24:07 +00:00
|
|
|
cleanupSegments();
|
2016-09-30 16:33:46 +00:00
|
|
|
}
|
2014-04-13 18:24:44 +00:00
|
|
|
}
|
2015-05-01 15:01:09 +00:00
|
|
|
|
2012-09-07 19:29:44 +00:00
|
|
|
return modified;
|
|
|
|
}
|
2007-06-14 05:31:55 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
|
2016-09-30 16:33:46 +00:00
|
|
|
bool TRACKS_CLEANER::removeBadTrackSegments()
|
|
|
|
{
|
2017-03-22 13:51:07 +00:00
|
|
|
auto connectivity = m_brd->GetConnectivity();
|
2016-09-30 16:33:46 +00:00
|
|
|
|
2017-06-22 14:24:07 +00:00
|
|
|
std::set<BOARD_ITEM *> toRemove;
|
|
|
|
|
2017-03-22 13:51:07 +00:00
|
|
|
for( auto segment : m_brd->Tracks() )
|
2016-09-30 16:33:46 +00:00
|
|
|
{
|
|
|
|
segment->SetState( FLAG0, false );
|
|
|
|
|
2017-03-22 13:51:07 +00:00
|
|
|
for( auto testedPad : connectivity->GetConnectedPads( segment ) )
|
2016-09-30 16:33:46 +00:00
|
|
|
{
|
2017-03-22 13:51:07 +00:00
|
|
|
if( segment->GetNetCode() != testedPad->GetNetCode() )
|
2019-03-31 09:37:57 +00:00
|
|
|
{
|
|
|
|
if( m_itemsList )
|
|
|
|
{
|
|
|
|
m_itemsList->emplace_back( new DRC_ITEM( m_units, DRCE_SHORT,
|
|
|
|
segment, segment->GetPosition(),
|
|
|
|
nullptr, wxPoint() ) );
|
|
|
|
}
|
|
|
|
|
2017-06-22 14:24:07 +00:00
|
|
|
toRemove.insert( segment );
|
2019-03-31 09:37:57 +00:00
|
|
|
}
|
2016-09-30 16:33:46 +00:00
|
|
|
}
|
|
|
|
|
2017-03-22 13:51:07 +00:00
|
|
|
for( auto testedTrack : connectivity->GetConnectedTracks( segment ) )
|
2016-09-30 16:33:46 +00:00
|
|
|
{
|
2017-03-22 13:51:07 +00:00
|
|
|
if( segment->GetNetCode() != testedTrack->GetNetCode() && !testedTrack->GetState( FLAG0 ) )
|
2019-03-31 09:37:57 +00:00
|
|
|
{
|
|
|
|
if( m_itemsList )
|
|
|
|
{
|
|
|
|
m_itemsList->emplace_back( new DRC_ITEM( m_units, DRCE_SHORT,
|
|
|
|
segment, segment->GetPosition(),
|
|
|
|
nullptr, wxPoint() ) );
|
|
|
|
}
|
|
|
|
|
2017-06-22 14:24:07 +00:00
|
|
|
toRemove.insert( segment );
|
2019-03-31 09:37:57 +00:00
|
|
|
}
|
2016-09-30 16:33:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-22 14:24:07 +00:00
|
|
|
return removeItems( toRemove );
|
2016-09-30 16:33:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-22 14:24:07 +00:00
|
|
|
void TRACKS_CLEANER::removeDuplicatesOfVia( const VIA *aVia, std::set<BOARD_ITEM *>& aToRemove )
|
2014-05-10 12:48:17 +00:00
|
|
|
{
|
2016-12-07 15:52:48 +00:00
|
|
|
VIA* next_via;
|
|
|
|
|
|
|
|
for( VIA* alt_via = GetFirstVia( aVia->Next() ); alt_via != NULL; alt_via = next_via )
|
2014-05-10 12:48:17 +00:00
|
|
|
{
|
2016-12-07 15:52:48 +00:00
|
|
|
next_via = GetFirstVia( alt_via->Next() );
|
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
if( ( alt_via->GetViaType() == VIA_THROUGH ) && alt_via->GetStart() == aVia->GetStart() )
|
|
|
|
{
|
|
|
|
if( m_itemsList )
|
|
|
|
{
|
|
|
|
m_itemsList->emplace_back( new DRC_ITEM( m_units, DRCE_REDUNDANT_VIA,
|
|
|
|
alt_via, alt_via->GetPosition(),
|
|
|
|
nullptr, wxPoint() ) );
|
|
|
|
}
|
|
|
|
|
2017-06-22 14:24:07 +00:00
|
|
|
aToRemove.insert ( alt_via );
|
2019-03-31 09:37:57 +00:00
|
|
|
}
|
2014-05-10 12:48:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-28 14:08:33 +00:00
|
|
|
|
2017-03-22 13:51:07 +00:00
|
|
|
bool TRACKS_CLEANER::cleanupVias()
|
2010-11-21 18:28:32 +00:00
|
|
|
{
|
2017-06-22 14:24:07 +00:00
|
|
|
std::set<BOARD_ITEM*> toRemove;
|
2010-11-21 18:28:32 +00:00
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
for( VIA* via = GetFirstVia( m_brd->m_Track ); via != NULL; via = GetFirstVia( via->Next() ) )
|
2010-11-21 18:28:32 +00:00
|
|
|
{
|
2017-05-04 22:43:43 +00:00
|
|
|
if( via->GetFlags() & TRACK_LOCKED )
|
|
|
|
continue;
|
|
|
|
|
2014-04-30 19:16:22 +00:00
|
|
|
// Correct via m_End defects (if any), should never happen
|
|
|
|
if( via->GetStart() != via->GetEnd() )
|
2012-09-07 19:29:44 +00:00
|
|
|
{
|
2016-09-30 09:09:17 +00:00
|
|
|
wxFAIL_MSG( "Malformed via with mismatching ends" );
|
2014-04-30 19:16:22 +00:00
|
|
|
via->SetEnd( via->GetStart() );
|
2012-09-07 19:29:44 +00:00
|
|
|
}
|
|
|
|
|
2014-04-30 19:16:22 +00:00
|
|
|
/* Important: these cleanups only do thru hole vias, they don't
|
|
|
|
* (yet) handle high density interconnects */
|
2016-12-07 16:14:41 +00:00
|
|
|
if( via->GetViaType() == VIA_THROUGH )
|
2010-11-21 18:28:32 +00:00
|
|
|
{
|
2017-06-22 14:24:07 +00:00
|
|
|
removeDuplicatesOfVia( via, toRemove );
|
2010-11-21 18:28:32 +00:00
|
|
|
|
2014-04-30 19:16:22 +00:00
|
|
|
/* To delete through Via on THT pads at same location
|
|
|
|
* Examine the list of connected pads:
|
|
|
|
* if one through pad is found, the via can be removed */
|
2017-03-22 13:51:07 +00:00
|
|
|
|
|
|
|
const auto pads = m_brd->GetConnectivity()->GetConnectedPads( via );
|
|
|
|
for( const auto pad : pads )
|
2014-04-30 19:16:22 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
const LSET all_cu = LSET::AllCuMask();
|
|
|
|
|
2016-11-28 14:08:33 +00:00
|
|
|
if( ( pad->GetLayerSet() & all_cu ) == all_cu )
|
2014-04-30 19:16:22 +00:00
|
|
|
{
|
2019-03-31 09:37:57 +00:00
|
|
|
if( m_itemsList )
|
|
|
|
{
|
|
|
|
m_itemsList->emplace_back( new DRC_ITEM( m_units, DRCE_REDUNDANT_VIA,
|
|
|
|
via, via->GetPosition(),
|
|
|
|
nullptr, wxPoint() ) );
|
|
|
|
}
|
|
|
|
|
2014-04-30 19:16:22 +00:00
|
|
|
// redundant: delete the via
|
2017-06-22 14:24:07 +00:00
|
|
|
toRemove.insert( via );
|
2014-04-30 19:16:22 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-04-25 06:00:04 +00:00
|
|
|
}
|
2010-11-21 18:28:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-22 14:24:07 +00:00
|
|
|
return removeItems( toRemove );
|
2014-04-30 19:16:22 +00:00
|
|
|
}
|
|
|
|
|
2016-11-28 14:08:33 +00:00
|
|
|
|
2014-04-30 19:16:22 +00:00
|
|
|
/** Utility: does the endpoint unconnected processed for one endpoint of one track
|
|
|
|
* Returns true if the track must be deleted, false if not necessarily */
|
2016-11-28 14:08:33 +00:00
|
|
|
bool TRACKS_CLEANER::testTrackEndpointDangling( TRACK* aTrack, ENDPOINT_T aEndPoint )
|
2014-04-30 19:16:22 +00:00
|
|
|
{
|
2017-05-04 22:43:43 +00:00
|
|
|
auto connectivity = m_brd->GetConnectivity();
|
|
|
|
VECTOR2I endpoint ;
|
2012-09-07 19:29:44 +00:00
|
|
|
|
2017-06-23 11:56:28 +00:00
|
|
|
if( aTrack->Type() == PCB_TRACE_T )
|
2017-05-04 22:43:43 +00:00
|
|
|
endpoint = aTrack->GetEndPoint( aEndPoint );
|
|
|
|
else
|
|
|
|
endpoint = aTrack->GetStart( );
|
2014-04-30 19:16:22 +00:00
|
|
|
|
2017-06-22 14:24:07 +00:00
|
|
|
//wxASSERT ( connectivity->GetConnectivityAlgo()->ItemEntry( aTrack ) != nullptr );
|
|
|
|
wxASSERT ( connectivity->GetConnectivityAlgo()->ItemEntry( aTrack ).GetItems().size() != 0 );
|
|
|
|
auto citem = connectivity->GetConnectivityAlgo()->ItemEntry( aTrack ).GetItems().front();
|
|
|
|
|
|
|
|
if( !citem->Valid() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
auto anchors = citem->Anchors();
|
2014-04-30 19:16:22 +00:00
|
|
|
|
2017-09-24 18:11:58 +00:00
|
|
|
for( const auto& anchor : anchors )
|
2017-05-04 22:43:43 +00:00
|
|
|
{
|
2017-06-23 11:56:28 +00:00
|
|
|
if( anchor->Pos() == endpoint && anchor->IsDangling() )
|
2017-05-04 22:43:43 +00:00
|
|
|
return true;
|
2010-11-21 18:28:32 +00:00
|
|
|
}
|
2015-02-06 10:54:55 +00:00
|
|
|
|
2017-05-04 22:43:43 +00:00
|
|
|
return false;
|
2010-11-21 18:28:32 +00:00
|
|
|
}
|
|
|
|
|
2016-11-28 14:08:33 +00:00
|
|
|
|
2016-09-30 09:09:17 +00:00
|
|
|
/* Delete dangling tracks
|
2007-10-27 12:24:09 +00:00
|
|
|
* Vias:
|
|
|
|
* If a via is only connected to a dangling track, it also will be removed
|
2007-08-10 19:14:51 +00:00
|
|
|
*/
|
2016-09-30 09:09:17 +00:00
|
|
|
bool TRACKS_CLEANER::deleteDanglingTracks()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2017-06-22 14:24:07 +00:00
|
|
|
bool item_erased = false;
|
2012-09-07 19:29:44 +00:00
|
|
|
bool modified = false;
|
2016-09-30 09:09:17 +00:00
|
|
|
|
2014-04-30 19:16:22 +00:00
|
|
|
do // Iterate when at least one track is deleted
|
2007-08-10 19:14:51 +00:00
|
|
|
{
|
2019-02-16 15:05:29 +00:00
|
|
|
buildTrackConnectionInfo();
|
2012-09-07 19:29:44 +00:00
|
|
|
item_erased = false;
|
2017-06-22 14:24:07 +00:00
|
|
|
|
2016-12-07 15:52:48 +00:00
|
|
|
TRACK* next_track;
|
2016-09-30 09:09:17 +00:00
|
|
|
|
2016-12-07 15:52:48 +00:00
|
|
|
for( TRACK *track = m_brd->m_Track; track != NULL; track = next_track )
|
2007-08-10 19:14:51 +00:00
|
|
|
{
|
2016-12-07 15:52:48 +00:00
|
|
|
next_track = track->Next();
|
2014-04-30 19:16:22 +00:00
|
|
|
bool flag_erase = false; // Start without a good reason to erase it
|
2008-03-10 15:00:22 +00:00
|
|
|
|
2014-04-30 19:16:22 +00:00
|
|
|
/* if a track endpoint is not connected to a pad, test if
|
|
|
|
* the endpoint is connected to another track or to a zone.
|
|
|
|
* For via test, an enhancement could be to test if
|
|
|
|
* connected to 2 items on different layers. Currently
|
|
|
|
* a via must be connected to 2 items, that can be on the
|
|
|
|
* same layer */
|
2008-03-10 15:00:22 +00:00
|
|
|
|
2014-04-30 19:16:22 +00:00
|
|
|
// Check if there is nothing attached on the start
|
2016-11-28 14:08:33 +00:00
|
|
|
if( !( track->GetState( START_ON_PAD ) ) )
|
2014-04-30 19:16:22 +00:00
|
|
|
flag_erase |= testTrackEndpointDangling( track, ENDPOINT_START );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2016-12-07 15:52:48 +00:00
|
|
|
// If not sure about removal, then check if there is nothing attached on the end
|
|
|
|
if( !flag_erase && !track->GetState( END_ON_PAD ) )
|
2014-04-30 19:16:22 +00:00
|
|
|
flag_erase |= testTrackEndpointDangling( track, ENDPOINT_END );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2012-09-07 19:29:44 +00:00
|
|
|
if( flag_erase )
|
2011-09-07 19:41:04 +00:00
|
|
|
{
|
2019-03-31 09:37:57 +00:00
|
|
|
if( m_itemsList )
|
|
|
|
{
|
|
|
|
int code = track->IsTrack() ? DRCE_DANGLING_TRACK : DRCE_DANGLING_VIA;
|
|
|
|
m_itemsList->emplace_back( new DRC_ITEM( m_units, code,
|
|
|
|
track, track->GetPosition(),
|
|
|
|
nullptr, wxPoint() ) );
|
|
|
|
}
|
2016-12-07 15:52:48 +00:00
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
if( !m_dryRun )
|
|
|
|
{
|
|
|
|
m_brd->Remove( track );
|
|
|
|
m_commit.Removed( track );
|
|
|
|
|
|
|
|
/* keep iterating, because a track connected to the deleted track
|
|
|
|
* now perhaps is not connected and should be deleted */
|
|
|
|
item_erased = true;
|
|
|
|
modified = true;
|
|
|
|
}
|
2011-09-07 19:41:04 +00:00
|
|
|
}
|
2007-08-10 19:14:51 +00:00
|
|
|
}
|
2014-04-30 19:16:22 +00:00
|
|
|
} while( item_erased );
|
2012-09-07 19:29:44 +00:00
|
|
|
|
2017-06-22 14:24:07 +00:00
|
|
|
|
2012-09-07 19:29:44 +00:00
|
|
|
return modified;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2016-11-28 14:08:33 +00:00
|
|
|
|
2014-05-10 12:48:17 +00:00
|
|
|
// Delete null length track segments
|
2017-06-22 14:24:07 +00:00
|
|
|
bool TRACKS_CLEANER::deleteNullSegments()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2017-06-22 14:24:07 +00:00
|
|
|
std::set<BOARD_ITEM *> toRemove;
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2017-06-22 14:24:07 +00:00
|
|
|
for( auto segment : m_brd->Tracks() )
|
2007-08-10 19:14:51 +00:00
|
|
|
{
|
2017-06-23 11:56:28 +00:00
|
|
|
if( segment->IsNull() ) // Length segment = 0; delete it
|
2019-03-31 09:37:57 +00:00
|
|
|
{
|
|
|
|
if( m_itemsList )
|
|
|
|
{
|
|
|
|
m_itemsList->emplace_back( new DRC_ITEM( m_units, DRCE_ZERO_LENGTH_TRACK,
|
|
|
|
segment, segment->GetPosition(),
|
|
|
|
nullptr, wxPoint() ) );
|
|
|
|
}
|
|
|
|
|
2017-06-22 14:24:07 +00:00
|
|
|
toRemove.insert( segment );
|
2019-03-31 09:37:57 +00:00
|
|
|
}
|
2007-08-10 19:14:51 +00:00
|
|
|
}
|
2016-11-28 14:08:33 +00:00
|
|
|
|
2017-06-22 14:24:07 +00:00
|
|
|
return removeItems( toRemove );
|
2014-05-10 12:48:17 +00:00
|
|
|
}
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
void TRACKS_CLEANER::removeDuplicatesOfTrack( const TRACK *aSeg, std::set<BOARD_ITEM*>& aToRemove )
|
2014-05-10 12:48:17 +00:00
|
|
|
{
|
2019-04-22 08:58:06 +00:00
|
|
|
if( aSeg->GetEditFlags() & STRUCT_DELETED )
|
2017-10-19 21:09:58 +00:00
|
|
|
return;
|
2014-05-10 12:48:17 +00:00
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
for( auto seg2 : m_brd->Tracks() )
|
2007-08-10 19:14:51 +00:00
|
|
|
{
|
2019-03-31 09:37:57 +00:00
|
|
|
// New netcode, break out (can't be there any seg2)
|
|
|
|
if( aSeg->GetNetCode() != seg2->GetNetCode() )
|
2017-06-22 14:24:07 +00:00
|
|
|
continue;
|
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
if( aSeg == seg2 )
|
2017-06-22 14:24:07 +00:00
|
|
|
continue;
|
2014-05-10 12:48:17 +00:00
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
if( seg2->GetFlags() & STRUCT_DELETED )
|
2017-10-19 21:09:58 +00:00
|
|
|
continue;
|
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
// Must be of the same type, on the same layer and with the same endpoints (although
|
|
|
|
// they might be swapped)
|
|
|
|
if( aSeg->Type() == seg2->Type() && aSeg->GetLayer() == seg2->GetLayer() )
|
2007-08-10 19:14:51 +00:00
|
|
|
{
|
2019-03-31 09:37:57 +00:00
|
|
|
if( ( aSeg->GetStart() == seg2->GetStart() && aSeg->GetEnd() == seg2->GetEnd() ) ||
|
|
|
|
( aSeg->GetStart() == seg2->GetEnd() && aSeg->GetEnd() == seg2->GetStart() ) )
|
2014-05-10 12:48:17 +00:00
|
|
|
{
|
2019-03-31 09:37:57 +00:00
|
|
|
if( m_itemsList )
|
|
|
|
{
|
|
|
|
m_itemsList->emplace_back( new DRC_ITEM( m_units, DRCE_DUPLICATE_TRACK,
|
|
|
|
seg2, seg2->GetPosition(),
|
|
|
|
nullptr, wxPoint() ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
seg2->SetFlags( STRUCT_DELETED );
|
|
|
|
aToRemove.insert( seg2 );
|
2014-05-10 12:48:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2016-11-28 14:08:33 +00:00
|
|
|
|
2017-06-22 14:24:07 +00:00
|
|
|
bool TRACKS_CLEANER::MergeCollinearTracks( TRACK* aSegment )
|
2014-05-10 12:48:17 +00:00
|
|
|
{
|
|
|
|
bool merged_this = false;
|
2008-03-10 15:00:22 +00:00
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
if( !aSegment->Next() )
|
|
|
|
return merged_this;
|
2017-06-22 14:24:07 +00:00
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
for( ENDPOINT_T endpoint : { ENDPOINT_START, ENDPOINT_END } )
|
2014-05-10 12:48:17 +00:00
|
|
|
{
|
2014-05-17 17:36:02 +00:00
|
|
|
// search for a possible segment connected to the current endpoint of the current one
|
2019-03-31 09:37:57 +00:00
|
|
|
TRACK* seg2 = aSegment->GetTrack( aSegment->Next(), NULL, endpoint, true, false );
|
2016-11-28 14:08:33 +00:00
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
if( seg2 )
|
2007-08-10 19:14:51 +00:00
|
|
|
{
|
2019-03-31 09:37:57 +00:00
|
|
|
// the two segments must have the same width and seg2 cannot be a via
|
|
|
|
if( aSegment->GetWidth() == seg2->GetWidth() && seg2->Type() == PCB_TRACE_T )
|
2014-05-17 17:36:02 +00:00
|
|
|
{
|
2019-03-31 09:37:57 +00:00
|
|
|
// There can be only one segment connected
|
|
|
|
seg2->SetState( BUSY, true );
|
|
|
|
TRACK* seg3 = aSegment->GetTrack( m_brd->m_Track, NULL, endpoint, true, false );
|
|
|
|
seg2->SetState( BUSY, false );
|
2014-05-17 17:36:02 +00:00
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
if( seg3 )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// Try to merge them
|
|
|
|
TRACK* segDelete = mergeCollinearSegments( aSegment, seg2, endpoint );
|
|
|
|
|
|
|
|
// Merge succesful, seg2 has to go away
|
|
|
|
if( !m_dryRun && segDelete )
|
|
|
|
{
|
|
|
|
m_brd->Remove( segDelete );
|
|
|
|
m_commit.Removed( segDelete );
|
|
|
|
merged_this = true;
|
2014-05-17 17:36:02 +00:00
|
|
|
}
|
|
|
|
}
|
2007-08-10 19:14:51 +00:00
|
|
|
}
|
2014-05-10 12:48:17 +00:00
|
|
|
}
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2014-05-10 12:48:17 +00:00
|
|
|
return merged_this;
|
|
|
|
}
|
2008-03-10 15:00:22 +00:00
|
|
|
|
2016-11-28 14:08:33 +00:00
|
|
|
|
2014-05-10 12:48:17 +00:00
|
|
|
// Delete null length segments, and intermediate points ..
|
2017-06-22 14:24:07 +00:00
|
|
|
bool TRACKS_CLEANER::cleanupSegments()
|
2014-05-10 12:48:17 +00:00
|
|
|
{
|
|
|
|
bool modified = false;
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2014-05-10 12:48:17 +00:00
|
|
|
// Easy things first
|
2017-06-22 14:24:07 +00:00
|
|
|
modified |= deleteNullSegments();
|
|
|
|
|
|
|
|
buildTrackConnectionInfo();
|
|
|
|
|
|
|
|
std::set<BOARD_ITEM*> toRemove;
|
2008-03-10 15:00:22 +00:00
|
|
|
|
2014-05-17 17:36:02 +00:00
|
|
|
// Delete redundant segments, i.e. segments having the same end points and layers
|
2016-09-30 09:09:17 +00:00
|
|
|
// (can happens when blocks are copied on themselve)
|
2017-06-23 11:56:28 +00:00
|
|
|
for( auto segment : m_brd->Tracks() )
|
2017-06-22 14:24:07 +00:00
|
|
|
removeDuplicatesOfTrack( segment, toRemove );
|
|
|
|
|
|
|
|
modified |= removeItems( toRemove );
|
|
|
|
|
|
|
|
if( modified )
|
|
|
|
buildTrackConnectionInfo();
|
2008-03-10 15:00:22 +00:00
|
|
|
|
2014-05-10 12:48:17 +00:00
|
|
|
// merge collinear segments:
|
2016-11-28 14:08:33 +00:00
|
|
|
TRACK* nextsegment;
|
2015-05-01 15:01:09 +00:00
|
|
|
|
2017-06-22 14:24:07 +00:00
|
|
|
for( TRACK* segment = m_brd->m_Track; segment; segment = nextsegment )
|
2014-05-10 12:48:17 +00:00
|
|
|
{
|
|
|
|
nextsegment = segment->Next();
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2014-05-10 12:48:17 +00:00
|
|
|
if( segment->Type() == PCB_TRACE_T )
|
2007-08-10 19:14:51 +00:00
|
|
|
{
|
2017-06-22 14:24:07 +00:00
|
|
|
bool merged_this = MergeCollinearTracks( segment );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2014-05-17 17:36:02 +00:00
|
|
|
if( merged_this ) // The current segment was modified, retry to merge it again
|
2015-05-01 15:01:09 +00:00
|
|
|
{
|
2014-05-10 12:48:17 +00:00
|
|
|
nextsegment = segment->Next();
|
2015-05-01 15:01:09 +00:00
|
|
|
modified = true;
|
|
|
|
}
|
2007-08-10 19:14:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-07 19:29:44 +00:00
|
|
|
return modified;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2016-11-28 14:08:33 +00:00
|
|
|
|
2014-05-10 12:48:17 +00:00
|
|
|
/* Utility: check for parallelism between two segments */
|
2017-06-22 14:24:07 +00:00
|
|
|
static bool parallelismTest( int dx1, int dy1, int dx2, int dy2 )
|
2014-05-10 12:48:17 +00:00
|
|
|
{
|
2014-05-17 17:36:02 +00:00
|
|
|
/* The following condition list is ugly and repetitive, but I have
|
|
|
|
* not a better way to express clearly the trivial cases. Hope the
|
|
|
|
* compiler optimize it better than always doing the product
|
|
|
|
* below... */
|
2014-05-10 12:48:17 +00:00
|
|
|
|
|
|
|
// test for vertical alignment (easy to handle)
|
|
|
|
if( dx1 == 0 )
|
2014-05-17 17:36:02 +00:00
|
|
|
return dx2 == 0;
|
2014-05-10 12:48:17 +00:00
|
|
|
|
|
|
|
if( dx2 == 0 )
|
2014-05-17 17:36:02 +00:00
|
|
|
return dx1 == 0;
|
2014-05-10 12:48:17 +00:00
|
|
|
|
|
|
|
// test for horizontal alignment (easy to handle)
|
|
|
|
if( dy1 == 0 )
|
2014-05-17 17:36:02 +00:00
|
|
|
return dy2 == 0;
|
2014-05-10 12:48:17 +00:00
|
|
|
|
|
|
|
if( dy2 == 0 )
|
2014-05-17 17:36:02 +00:00
|
|
|
return dy1 == 0;
|
2014-05-10 12:48:17 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
/* test for alignment in other cases: Do the usual cross product test
|
2014-05-10 12:48:17 +00:00
|
|
|
* (the same as testing the slope, but without a division) */
|
|
|
|
return ((double)dy1 * dx2 == (double)dx1 * dy2);
|
|
|
|
}
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2016-11-28 14:08:33 +00:00
|
|
|
|
2017-06-22 14:24:07 +00:00
|
|
|
/** Function used by cleanupSegments.
|
2012-09-11 07:33:17 +00:00
|
|
|
* Test if aTrackRef and aCandidate (which must have a common end) are collinear.
|
2007-10-27 18:05:50 +00:00
|
|
|
* and see if the common point is not on a pad (i.e. if this common point can be removed).
|
2012-09-11 07:33:17 +00:00
|
|
|
* the ending point of aTrackRef is the start point (aEndType == START)
|
2011-11-15 19:21:16 +00:00
|
|
|
* or the end point (aEndType != START)
|
2012-09-07 19:29:44 +00:00
|
|
|
* flags START_ON_PAD and END_ON_PAD must be set before calling this function
|
2011-11-15 19:21:16 +00:00
|
|
|
* if the common point can be deleted, this function
|
|
|
|
* change the common point coordinate of the aTrackRef segm
|
2007-10-27 18:05:50 +00:00
|
|
|
* (and therefore connect the 2 other ending points)
|
2011-11-15 19:21:16 +00:00
|
|
|
* and return aCandidate (which can be deleted).
|
2007-10-27 18:05:50 +00:00
|
|
|
* else return NULL
|
2007-08-10 19:14:51 +00:00
|
|
|
*/
|
2017-09-23 09:20:10 +00:00
|
|
|
static void updateConn( TRACK *track, const std::shared_ptr<CONNECTIVITY_DATA>& connectivity )
|
2017-06-22 14:24:07 +00:00
|
|
|
{
|
|
|
|
for( auto pad : connectivity->GetConnectedPads( track ) )
|
|
|
|
{
|
|
|
|
if( pad->HitTest( track->GetStart() ) )
|
|
|
|
track->SetState( START_ON_PAD, true );
|
|
|
|
|
|
|
|
if( pad->HitTest( track->GetEnd() ) )
|
|
|
|
track->SetState( END_ON_PAD, true );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
TRACK* TRACKS_CLEANER::mergeCollinearSegments( TRACK* aSeg1, TRACK* aSeg2,
|
|
|
|
ENDPOINT_T aEndType )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2014-05-10 12:48:17 +00:00
|
|
|
// First of all, they must be of the same width and must be both actual tracks
|
2019-03-31 09:37:57 +00:00
|
|
|
if( aSeg1->GetWidth() != aSeg2->GetWidth() ||
|
|
|
|
aSeg1->Type() != PCB_TRACE_T || aSeg2->Type() != PCB_TRACE_T )
|
|
|
|
{
|
2011-11-15 19:21:16 +00:00
|
|
|
return NULL;
|
2019-03-31 09:37:57 +00:00
|
|
|
}
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2014-05-10 12:48:17 +00:00
|
|
|
// Trivial case: exactly the same track
|
2019-03-31 09:37:57 +00:00
|
|
|
if( ( aSeg1->GetStart() == aSeg2->GetStart() && aSeg1->GetEnd() == aSeg2->GetEnd() ) ||
|
|
|
|
( aSeg1->GetStart() == aSeg2->GetEnd() && aSeg1->GetEnd() == aSeg2->GetStart() ))
|
|
|
|
{
|
|
|
|
if( m_itemsList )
|
|
|
|
{
|
|
|
|
m_itemsList->emplace_back( new DRC_ITEM( m_units, DRCE_DUPLICATE_TRACK,
|
|
|
|
aSeg2, aSeg2->GetPosition(),
|
|
|
|
nullptr, wxPoint() ) );
|
|
|
|
}
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
return aSeg2;
|
|
|
|
}
|
2008-03-10 15:00:22 +00:00
|
|
|
|
2014-05-10 12:48:17 +00:00
|
|
|
// Weed out non-parallel tracks
|
2019-03-31 09:37:57 +00:00
|
|
|
if( !parallelismTest( aSeg1->GetEnd().x - aSeg1->GetStart().x,
|
|
|
|
aSeg1->GetEnd().y - aSeg1->GetStart().y,
|
|
|
|
aSeg2->GetEnd().x - aSeg2->GetStart().x,
|
|
|
|
aSeg2->GetEnd().y - aSeg2->GetStart().y ) )
|
|
|
|
{
|
2014-05-10 12:48:17 +00:00
|
|
|
return NULL;
|
2019-03-31 09:37:57 +00:00
|
|
|
}
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2017-06-23 11:56:28 +00:00
|
|
|
auto connectivity = m_brd->GetConnectivity();
|
2017-06-22 14:24:07 +00:00
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
updateConn( aSeg1, connectivity );
|
|
|
|
updateConn( aSeg2, connectivity );
|
2017-06-22 14:24:07 +00:00
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
if( ( aEndType == ENDPOINT_START && aSeg1->GetState( START_ON_PAD ) ) ||
|
|
|
|
( aEndType == ENDPOINT_END && aSeg1->GetState( END_ON_PAD ) ) )
|
2007-08-10 19:14:51 +00:00
|
|
|
{
|
2017-06-23 11:56:28 +00:00
|
|
|
// We do not have a pad, which is a always terminal point for a track
|
2019-03-31 09:37:57 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
if( m_itemsList )
|
|
|
|
{
|
|
|
|
m_itemsList->emplace_back( new DRC_ITEM( m_units, DRCE_MERGE_TRACKS,
|
|
|
|
aSeg1, aSeg1->GetPosition(),
|
|
|
|
aSeg2, aSeg2->GetPosition() ) );
|
2007-08-10 19:14:51 +00:00
|
|
|
}
|
2019-03-31 09:37:57 +00:00
|
|
|
|
|
|
|
if( !m_dryRun )
|
2007-08-10 19:14:51 +00:00
|
|
|
{
|
2019-03-31 09:37:57 +00:00
|
|
|
m_commit.Modify( aSeg1 );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
if( aEndType == ENDPOINT_START )
|
2007-08-10 19:14:51 +00:00
|
|
|
{
|
2019-03-31 09:37:57 +00:00
|
|
|
/* change the common point coordinate of pt_segm to use the other point
|
|
|
|
* of pt_segm (pt_segm will be removed later) */
|
|
|
|
if( aSeg1->GetStart() == aSeg2->GetStart() )
|
|
|
|
{
|
|
|
|
aSeg1->SetStart( aSeg2->GetEnd() );
|
|
|
|
aSeg1->SetState( START_ON_PAD, aSeg2->GetState( END_ON_PAD ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aSeg1->SetStart( aSeg2->GetStart() );
|
|
|
|
aSeg1->SetState( START_ON_PAD, aSeg2->GetState( START_ON_PAD ) );
|
|
|
|
}
|
2007-08-10 19:14:51 +00:00
|
|
|
}
|
2019-03-31 09:37:57 +00:00
|
|
|
else // aEndType == END
|
2007-08-10 19:14:51 +00:00
|
|
|
{
|
2019-03-31 09:37:57 +00:00
|
|
|
/* change the common point coordinate of pt_segm to use the other point
|
|
|
|
* of pt_segm (pt_segm will be removed later) */
|
|
|
|
if( aSeg1->GetEnd() == aSeg2->GetStart() )
|
|
|
|
{
|
|
|
|
aSeg1->SetEnd( aSeg2->GetEnd() );
|
|
|
|
aSeg1->SetState( END_ON_PAD, aSeg2->GetState( END_ON_PAD ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aSeg1->SetEnd( aSeg2->GetStart() );
|
|
|
|
aSeg1->SetState( END_ON_PAD, aSeg2->GetState( START_ON_PAD ) );
|
|
|
|
}
|
2007-08-10 19:14:51 +00:00
|
|
|
}
|
2019-03-31 09:37:57 +00:00
|
|
|
|
|
|
|
connectivity->Update( aSeg1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
return aSeg2;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool TRACKS_CLEANER::removeItems( std::set<BOARD_ITEM*>& aItems )
|
|
|
|
{
|
|
|
|
if( m_dryRun )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
bool isModified = false;
|
|
|
|
|
|
|
|
for( auto item : aItems )
|
|
|
|
{
|
|
|
|
isModified = true;
|
|
|
|
m_brd->Remove( item );
|
|
|
|
m_commit.Removed( item );
|
2007-08-10 19:14:51 +00:00
|
|
|
}
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
return isModified;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-01-26 09:37:36 +00:00
|
|
|
bool PCB_EDIT_FRAME::RemoveMisConnectedTracks()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2016-09-30 16:33:46 +00:00
|
|
|
// Old model has to be refreshed, GAL normally does not keep updating it
|
2016-09-30 09:09:17 +00:00
|
|
|
Compile_Ratsnest( NULL, false );
|
2016-11-28 14:31:28 +00:00
|
|
|
BOARD_COMMIT commit( this );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2019-03-31 09:37:57 +00:00
|
|
|
TRACKS_CLEANER cleaner( m_UserUnits, GetBoard(), commit );
|
|
|
|
bool isModified = cleaner.CleanupBoard( true, nullptr, true, false, false, false );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2016-09-30 16:33:46 +00:00
|
|
|
if( isModified )
|
2016-09-30 09:09:17 +00:00
|
|
|
{
|
2016-09-30 16:33:46 +00:00
|
|
|
// Clear undo and redo lists to avoid inconsistencies between lists
|
2016-11-28 14:31:28 +00:00
|
|
|
commit.Push( _( "Board cleanup" ) );
|
2016-09-30 16:33:46 +00:00
|
|
|
Compile_Ratsnest( NULL, true );
|
2007-08-10 19:14:51 +00:00
|
|
|
}
|
|
|
|
|
2016-09-30 16:33:46 +00:00
|
|
|
m_canvas->Refresh( true );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
2010-11-21 18:28:32 +00:00
|
|
|
return isModified;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|