KiCad PCB EDA Suite
Loading...
Searching...
No Matches
snap_indicator.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 <origin_viewitem.h>
28
29
30namespace KIGFX
31{
32
38{
39public:
40 SNAP_INDICATOR( const COLOR4D& aColor = COLOR4D::WHITE, int aSize = 16,
41 const VECTOR2D& aPosition = VECTOR2D( 0, 0 ) );
42
43 SNAP_INDICATOR( const VECTOR2D& aPosition, EDA_ITEM_FLAGS flags );
44
45 SNAP_INDICATOR* Clone() const override;
46
47 const BOX2I ViewBBox() const override;
48
49 void ViewDraw( int aLayer, VIEW* aView ) const override;
50
51#if defined( DEBUG )
52 void Show( int x, std::ostream& st ) const override {}
53#endif
54
60 wxString GetClass() const override { return wxT( "SNAP_INDICATOR" ); }
61
67 void SetSnapTypes( int aSnapTypes ) { m_snapTypes = aSnapTypes; }
68
69private:
70 int m_snapTypes = POINT_TYPE::PT_NONE;
71};
72
73} // namespace KIGFX
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
static const COLOR4D WHITE
Definition: color4d.h:401
View item to draw an origin marker with an optional snap type indicator.
void ViewDraw(int aLayer, VIEW *aView) const override
Draw the parts of the object belonging to layer aLayer.
wxString GetClass() const override
Get class name.
SNAP_INDICATOR * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
void SetSnapTypes(int aSnapTypes)
Set a mask of point types that this snap item represents.
SNAP_INDICATOR(const VECTOR2D &aPosition, EDA_ITEM_FLAGS flags)
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
std::uint32_t EDA_ITEM_FLAGS
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:247
VECTOR2< double > VECTOR2D
Definition: vector2d.h:690