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 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#pragma once
21
22#include <cstddef>
23#include <map>
24#include <span>
25#include <vector>
26
27#include <origin_viewitem.h>
28
29#include <math/vector2d.h>
30#include <geometry/seg.h> // OPT_VECTOR2I
31
32namespace KIGFX
33{
34
40class ANCHOR_DEBUG : public EDA_ITEM
41{
42public:
44
45 ANCHOR_DEBUG* Clone() const override;
46
47 std::vector<int> ViewGetLayers() const override;
48
49 const BOX2I ViewBBox() const override;
50
51 void ViewDraw( int aLayer, VIEW* aView ) const override;
52
58 wxString GetClass() const override { return wxT( "ANCHOR_DEBUG" ); }
59
60 void ClearAnchors();
61
65 void AddAnchor( const VECTOR2I& aAnchor );
66
72 void SetNearest( const OPT_VECTOR2I& aNearest );
73
74private:
75 // Store the anchors by location and count
76 std::map<VECTOR2I, size_t> m_anchors;
78};
79
80} // namespace KIGFX
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:37
wxString GetClass() const override
Get class name.
std::map< VECTOR2I, size_t > m_anchors
ANCHOR_DEBUG * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
OPT_VECTOR2I m_nearest
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:63
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:29
std::optional< VECTOR2I > OPT_VECTOR2I
Definition seg.h:35
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683