KiCad PCB EDA Suite
Loading...
Searching...
No Matches
anchor_debug.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 (C) 2024 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, 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 <cstddef>
27#include <map>
28#include <span>
29#include <vector>
30
31#include <origin_viewitem.h>
32
33#include <math/vector2d.h>
34#include <geometry/seg.h> // OPT_VECTOR2I
35
36namespace KIGFX
37{
38
44class ANCHOR_DEBUG : public EDA_ITEM
45{
46public:
48
49 ANCHOR_DEBUG* Clone() const override;
50
51 std::vector<int> ViewGetLayers() const override;
52
53 const BOX2I ViewBBox() const override;
54
55 void ViewDraw( int aLayer, VIEW* aView ) const override;
56
62 wxString GetClass() const override { return wxT( "ANCHOR_DEBUG" ); }
63
64 void ClearAnchors();
65
69 void AddAnchor( const VECTOR2I& aAnchor );
70
76 void SetNearest( const OPT_VECTOR2I& aNearest );
77
78private:
79 // Store the anchors by location and count
80 std::map<VECTOR2I, size_t> m_anchors;
82};
83
84} // namespace KIGFX
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:89
View item to draw debug items for anchors.
Definition: anchor_debug.h:45
wxString GetClass() const override
Get class name.
Definition: anchor_debug.h:62
std::map< VECTOR2I, size_t > m_anchors
Definition: anchor_debug.h:80
ANCHOR_DEBUG * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
OPT_VECTOR2I m_nearest
Definition: anchor_debug.h:81
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
void SetNearest(const OPT_VECTOR2I &aNearest)
Set the nearest anchor to the given position.
void AddAnchor(const VECTOR2I &aAnchor)
Add an anchor at the given position.
void ViewDraw(int aLayer, VIEW *aView) const override
Draw the parts of the object belonging to layer aLayer.
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:247
std::optional< VECTOR2I > OPT_VECTOR2I
Definition: seg.h:39