KiCad PCB EDA Suite
Loading...
Searching...
No Matches
creepage_overlay.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.
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, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#pragma once
25
26#include <map>
27#include <memory>
28#include <vector>
29
30#include <layer_ids.h>
31
33
34class BOARD;
35class BOARD_ITEM;
36class DRC_ENGINE;
37
38namespace KIGFX
39{
40class VIEW;
41class VIEW_OVERLAY;
42}
43
44
56{
57public:
58 CREEPAGE_OVERLAY( BOARD* aBoard, std::shared_ptr<DRC_ENGINE> aDrcEngine, KIGFX::VIEW* aView );
60
62 bool IsEnabled() const { return m_enabled; }
63
66 void Start( const std::vector<BOARD_ITEM*>& aMovingItems );
67
69 void Update();
70
72 void Stop();
73
74private:
75 void clearOverlay();
76
78 std::shared_ptr<DRC_ENGINE> m_drcEngine;
81
82 // One interactive engine per dragged copper layer, each with its own near-violation band
83 // (a layer's band must not exceed the search radius that layer's engine actually built).
85 {
86 std::unique_ptr<CREEPAGE_ENGINE> m_engine;
87 int m_nearMargin = 0;
88 };
89
90 std::shared_ptr<KIGFX::VIEW_OVERLAY> m_overlay;
91 std::map<PCB_LAYER_ID, LAYER_ENGINE> m_engines;
92
95
96 // Frame-drop throttle: a heavy Update defers the next m_skipFrames motion frames so the drag
97 // stays responsive rather than blocking. The overlay keeps showing the last result meanwhile.
99};
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:81
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:372
std::shared_ptr< DRC_ENGINE > m_drcEngine
bool IsEnabled() const
True when the board has creepage constraints and the feature flag is on.
std::shared_ptr< KIGFX::VIEW_OVERLAY > m_overlay
std::map< PCB_LAYER_ID, LAYER_ENGINE > m_engines
KIGFX::VIEW * m_view
CREEPAGE_OVERLAY(BOARD *aBoard, std::shared_ptr< DRC_ENGINE > aDrcEngine, KIGFX::VIEW *aView)
void Update()
Recompute and redraw at the items' current board positions.
void Start(const std::vector< BOARD_ITEM * > &aMovingItems)
Begin a drag session for the given items, on every copper layer they occupy.
void Stop()
End the session and clear the overlay.
Design Rule Checker object that performs all the DRC tests.
Definition drc_engine.h:129
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:63
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:29
std::unique_ptr< CREEPAGE_ENGINE > m_engine