KiCad PCB EDA Suite
Loading...
Searching...
No Matches
graphics_cleaner.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef KICAD_GRAPHICS_CLEANER_H
21#define KICAD_GRAPHICS_CLEANER_H
22
23#include <board.h>
24
25class FOOTPRINT;
26class BOARD_COMMIT;
27class CLEANUP_ITEM;
28class TOOL_MANAGER;
29
30
31// Helper class used to clean tracks and vias
33{
34public:
35 GRAPHICS_CLEANER( const DRAWINGS& aDrawings, FOOTPRINT* aParentFootprint, BOARD_COMMIT& aCommit,
36 TOOL_MANAGER* aToolManager );
37
45 void CleanupBoard( bool aDryRun, std::vector<std::shared_ptr<CLEANUP_ITEM>>* aItemsList,
46 bool aMergeRects, bool aDeleteRedundant, bool aMergePads,
47 bool aFixBoardOutlines, int aTolerance );
48
49private:
50 bool isNullShape( PCB_SHAPE* aShape );
51 bool areEquivalent( PCB_SHAPE* aShape1, PCB_SHAPE* aShape2 );
52
53 void cleanupShapes();
54 void fixBoardOutlines();
55 void mergeRects();
56 void mergePads();
57
58private:
60 FOOTPRINT* m_parentFootprint; // nullptr if not in Footprint Editor
67
68 std::vector<std::shared_ptr<CLEANUP_ITEM>>* m_itemsList;
69};
70
71
72#endif //KICAD_GRAPHICS_CLEANER_H
TOOL_MANAGER * m_toolMgr
GRAPHICS_CLEANER(const DRAWINGS &aDrawings, FOOTPRINT *aParentFootprint, BOARD_COMMIT &aCommit, TOOL_MANAGER *aToolManager)
BOARD_COMMIT & m_commit
std::vector< std::shared_ptr< CLEANUP_ITEM > > * m_itemsList
FOOTPRINT * m_parentFootprint
void CleanupBoard(bool aDryRun, std::vector< std::shared_ptr< CLEANUP_ITEM > > *aItemsList, bool aMergeRects, bool aDeleteRedundant, bool aMergePads, bool aFixBoardOutlines, int aTolerance)
the cleanup function.
const DRAWINGS & m_drawings
bool isNullShape(PCB_SHAPE *aShape)
bool areEquivalent(PCB_SHAPE *aShape1, PCB_SHAPE *aShape2)
Master controller class:
std::deque< BOARD_ITEM * > DRAWINGS