| 
    KiCad PCB EDA Suite
    
   | 
 
#include <tracks_cleaner.h>
Public Member Functions | |
| TRACKS_CLEANER (BOARD *aPcb, BOARD_COMMIT &aCommit) | |
| void | CleanupBoard (bool aDryRun, std::vector< std::shared_ptr< CLEANUP_ITEM > > *aItemsList, bool aCleanVias, bool aRemoveMisConnected, bool aMergeSegments, bool aDeleteUnconnected, bool aDeleteTracksinPad, bool aDeleteDanglingVias, REPORTER *aReporter=nullptr) | 
| the cleanup function.   | |
| void | SetFilter (const std::function< bool(BOARD_CONNECTED_ITEM *aItem)> &aFilter) | 
Private Member Functions | |
| bool | filterItem (BOARD_CONNECTED_ITEM *aItem) | 
| void | removeShortingTrackSegments () | 
| bool | deleteDanglingTracks (bool aTrack, bool aVia) | 
| Removes tracks or vias only connected on one end.   | |
| void | deleteTracksInPads () | 
| void | cleanup (bool aDeleteDuplicateVias, bool aDeleteNullSegments, bool aDeleteDuplicateSegments, bool aMergeSegments) | 
| Geometry-based cleanup: duplicate items, null items, colinear items.   | |
| bool | mergeCollinearSegments (PCB_TRACK *aSeg1, PCB_TRACK *aSeg2) | 
| helper function merge aTrackRef and aCandidate, when possible, i.e.   | |
| bool | testMergeCollinearSegments (PCB_TRACK *aSeg1, PCB_TRACK *aSeg2, PCB_TRACK *aDummySeg=nullptr) | 
| helper function test if 2 segments are colinear.   | |
| bool | testTrackEndpointIsNode (PCB_TRACK *aTrack, bool aTstStart, bool aTstEnd) | 
| void | removeItems (std::set< BOARD_ITEM * > &aItems) | 
| const std::vector< BOARD_CONNECTED_ITEM * > & | getConnectedItems (PCB_TRACK *aTrack) | 
Private Attributes | |
| BOARD * | m_brd | 
| BOARD_COMMIT & | m_commit | 
| bool | m_dryRun | 
| std::vector< std::shared_ptr< CLEANUP_ITEM > > * | m_itemsList | 
| REPORTER * | m_reporter | 
| std::map< PCB_TRACK *, std::vector< BOARD_CONNECTED_ITEM * > > | m_connectedItemsCache | 
| std::function< bool(BOARD_CONNECTED_ITEM *aItem)> | m_filter | 
| std::mutex | m_mutex | 
Definition at line 37 of file tracks_cleaner.h.
| TRACKS_CLEANER::TRACKS_CLEANER | ( | BOARD * | aPcb, | 
| BOARD_COMMIT & | aCommit ) | 
Definition at line 42 of file tracks_cleaner.cpp.
References m_brd, m_commit, m_dryRun, m_filter, m_itemsList, and m_reporter.
      
  | 
  private | 
Geometry-based cleanup: duplicate items, null items, colinear items.
Definition at line 378 of file tracks_cleaner.cpp.
References LSET::AllCuMask(), CLEANUP_REDUNDANT_VIA, CLEANUP_ZERO_LENGTH_TRACK, filterItem(), DRC_RTREE::Insert(), IS_DELETED, m_brd, m_itemsList, pad, PCB_TRACE_T, PCB_VIA_T, DRC_RTREE::QueryColliding(), SKIP_STRUCT, and via.
Referenced by CleanupBoard().
| void TRACKS_CLEANER::CleanupBoard | ( | bool | aDryRun, | 
| std::vector< std::shared_ptr< CLEANUP_ITEM > > * | aItemsList, | ||
| bool | aCleanVias, | ||
| bool | aRemoveMisConnected, | ||
| bool | aMergeSegments, | ||
| bool | aDeleteUnconnected, | ||
| bool | aDeleteTracksinPad, | ||
| bool | aDeleteDanglingVias, | ||
| REPORTER * | aReporter = nullptr ) | 
the cleanup function.
| aDryRun | = true to build changes list, false to modify the board | 
| aItemsList | = list of modified items | 
| aCleanVias | = true to remove superimposed vias | 
| aRemoveMisConnected | = true to remove segments connecting 2 different nets (short circuits) | 
| aMergeSegments | = true to merge collinear segmenst and remove 0 len segm | 
| aDeleteUnconnected | = true to remove dangling tracks | 
| aDeleteTracksinPad | = true to remove tracks fully inside pads | 
| aDeleteDanglingVias | = true to remove a via that is only connected to a single layer | 
| aReporter | is a REPORTER to print activity and info | 
Definition at line 59 of file tracks_cleaner.cpp.
References _, cleanup(), deleteDanglingTracks(), deleteTracksInPads(), m_dryRun, m_itemsList, m_reporter, and removeShortingTrackSegments().
Referenced by BOOST_DATA_TEST_CASE_F(), BOOST_DATA_TEST_CASE_F(), and DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup().
      
  | 
  private | 
Removes tracks or vias only connected on one end.
| aTrack | if true, clean dangling tracks | 
| aVia | if true, clean dangling vias | 
Definition at line 271 of file tracks_cleaner.cpp.
References CLEANUP_DANGLING_TRACK, CLEANUP_DANGLING_VIA, filterItem(), IS_DELETED, m_brd, m_commit, m_dryRun, m_itemsList, PCB_ARC_T, PCB_TRACE_T, and PCB_VIA_T.
Referenced by CleanupBoard().
      
  | 
  private | 
Definition at line 331 of file tracks_cleaner.cpp.
References SHAPE_POLY_SET::BooleanSubtract(), CLEANUP_TRACK_IN_PAD, ERROR_INSIDE, filterItem(), IS_DELETED, SHAPE_POLY_SET::IsEmpty(), m_brd, m_dryRun, m_itemsList, pad, PCB_VIA_T, and removeItems().
Referenced by CleanupBoard().
      
  | 
  private | 
Definition at line 168 of file tracks_cleaner.cpp.
References m_filter.
Referenced by cleanup(), deleteDanglingTracks(), deleteTracksInPads(), and removeShortingTrackSegments().
      
  | 
  private | 
Definition at line 625 of file tracks_cleaner.cpp.
References m_brd, m_connectedItemsCache, and m_mutex.
Referenced by testMergeCollinearSegments().
helper function merge aTrackRef and aCandidate, when possible, i.e.
when they are colinear, same width, and obviously same layer
| aSeg1 | is the reference | 
| aSeg2 | is the candidate, and after merging, the removed segment | 
Definition at line 769 of file tracks_cleaner.cpp.
References CLEANUP_MERGE_TRACKS, IS_DELETED, m_brd, m_commit, m_dryRun, m_itemsList, EDA_ITEM::SetFlags(), and testMergeCollinearSegments().
      
  | 
  private | 
Definition at line 799 of file tracks_cleaner.cpp.
References m_brd, and m_commit.
Referenced by deleteTracksInPads(), and removeShortingTrackSegments().
      
  | 
  private | 
Definition at line 177 of file tracks_cleaner.cpp.
References CLEANUP_SHORTING_TRACK, CLEANUP_SHORTING_VIA, filterItem(), m_brd, m_dryRun, m_itemsList, PCB_VIA_T, and removeItems().
Referenced by CleanupBoard().
      
  | 
  inline | 
Definition at line 60 of file tracks_cleaner.h.
References m_filter.
Referenced by DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup().
      
  | 
  private | 
helper function test if 2 segments are colinear.
Does not modify the connectivity
| aSeg1 | is the reference | 
| aSeg2 | is the candidate | 
Definition at line 637 of file tracks_cleaner.cpp.
References getConnectedItems(), PCB_TRACK::GetEnd(), PCB_TRACK::GetStart(), PCB_TRACK::GetWidth(), IS_DELETED, BOARD_ITEM::IsLocked(), PCB_TRACK::IsPointOnEnds(), PCB_ARC_T, PCB_TRACE_T, PCB_VIA_T, PCB_TRACK::SetEnd(), PCB_TRACK::SetStart(), testTrackEndpointIsNode(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by mergeCollinearSegments().
      
  | 
  private | 
| aTrack | is the track to test. | 
| aTstStart | = true ot test the start point of the track or false for end point | 
Definition at line 230 of file tracks_cleaner.cpp.
References anchor, PCB_TRACK::ApproxCollinear(), PCB_TRACK::GetEnd(), PCB_TRACK::GetStart(), EDA_ITEM::HasFlag(), IS_DELETED, m_brd, and PCB_TRACE_T.
Referenced by testMergeCollinearSegments().
      
  | 
  private | 
Definition at line 121 of file tracks_cleaner.h.
Referenced by cleanup(), deleteDanglingTracks(), deleteTracksInPads(), getConnectedItems(), mergeCollinearSegments(), removeItems(), removeShortingTrackSegments(), testTrackEndpointIsNode(), and TRACKS_CLEANER().
      
  | 
  private | 
Definition at line 122 of file tracks_cleaner.h.
Referenced by deleteDanglingTracks(), mergeCollinearSegments(), removeItems(), and TRACKS_CLEANER().
      
  | 
  private | 
Definition at line 128 of file tracks_cleaner.h.
Referenced by getConnectedItems().
      
  | 
  private | 
Definition at line 123 of file tracks_cleaner.h.
Referenced by CleanupBoard(), deleteDanglingTracks(), deleteTracksInPads(), mergeCollinearSegments(), removeShortingTrackSegments(), and TRACKS_CLEANER().
      
  | 
  private | 
Definition at line 130 of file tracks_cleaner.h.
Referenced by filterItem(), SetFilter(), and TRACKS_CLEANER().
      
  | 
  private | 
Definition at line 124 of file tracks_cleaner.h.
Referenced by cleanup(), CleanupBoard(), deleteDanglingTracks(), deleteTracksInPads(), mergeCollinearSegments(), removeShortingTrackSegments(), and TRACKS_CLEANER().
      
  | 
  private | 
Definition at line 131 of file tracks_cleaner.h.
Referenced by getConnectedItems().
      
  | 
  private | 
Definition at line 125 of file tracks_cleaner.h.
Referenced by CleanupBoard(), and TRACKS_CLEANER().