KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_handle_key.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 PCB_HANDLE_KEY_H
21#define PCB_HANDLE_KEY_H
22
23#include <optional>
24
25#include <kiid.h>
26
27class EDIT_POINT;
28class EDIT_POINTS;
29
43{
44public:
53 static std::optional<PCB_HANDLE_KEY> Make( const EDIT_POINTS& aPoints, const EDIT_POINT* aPoint );
54
61 EDIT_POINT* Resolve( EDIT_POINTS& aPoints ) const;
62
63 const KIID& Parent() const { return m_parent; }
64 bool IsLine() const { return m_isLine; }
65 int Index() const { return m_index; }
66
67 bool operator==( const PCB_HANDLE_KEY& aOther ) const;
68 bool operator<( const PCB_HANDLE_KEY& aOther ) const;
69
70private:
71 PCB_HANDLE_KEY( const KIID& aParent, bool aIsLine, int aIndex, unsigned aPointCount, unsigned aLineCount );
72
76 unsigned m_pointCount;
77 unsigned m_lineCount;
78};
79
80#endif // PCB_HANDLE_KEY_H
EDIT_POINTS is a VIEW_ITEM that manages EDIT_POINTs and EDIT_LINEs and draws them.
Represent a single point that can be used for modifying items.
Definition edit_points.h:44
Definition kiid.h:46
Lasting name for one handle in an EDIT_POINTS collection.
bool operator<(const PCB_HANDLE_KEY &aOther) const
bool IsLine() const
unsigned m_lineCount
bool operator==(const PCB_HANDLE_KEY &aOther) const
EDIT_POINT * Resolve(EDIT_POINTS &aPoints) const
Find this key's handle in a collection, usually after it was rebuilt.
const KIID & Parent() const
int Index() const
static std::optional< PCB_HANDLE_KEY > Make(const EDIT_POINTS &aPoints, const EDIT_POINT *aPoint)
Build the key for a handle in a collection.
PCB_HANDLE_KEY(const KIID &aParent, bool aIsLine, int aIndex, unsigned aPointCount, unsigned aLineCount)
unsigned m_pointCount