KiCad PCB EDA Suite
Loading...
Searching...
No Matches
selection_area.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) 2013 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Tomasz Wlostowski <[email protected]>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef PREVIEW_ITEMS_SELECTION_AREA_H
24#define PREVIEW_ITEMS_SELECTION_AREA_H
25
28#include <tool/selection_tool.h>
29
30namespace KIGFX
31{
32class GAL;
33
34namespace PREVIEW
35{
36
44{
45public:
46 static const int SelectionLayer = LAYER_GP_OVERLAY;
47
49
50 const BOX2I ViewBBox() const override;
51
53 void SetOrigin( const VECTOR2I& aOrigin )
54 {
55 m_origin = aOrigin;
56 }
57
61 void SetEnd( const VECTOR2I& aEnd )
62 {
63 m_end = aEnd;
64 }
65
69 wxString GetClass() const override
70 {
71 return wxT( "SELECTION_AREA" );
72 }
73
74 VECTOR2I GetOrigin() const { return m_origin; }
75
76 VECTOR2I GetEnd() const { return m_end; }
77
78 void SetAdditive( bool aAdditive ) { m_additive = aAdditive; }
79 void SetSubtractive( bool aSubtractive ) { m_subtractive = aSubtractive; }
80 void SetExclusiveOr( bool aExclusiveOr ) { m_exclusiveOr = aExclusiveOr; }
81
82 void SetMode( SELECTION_MODE aMode ) { m_mode = aMode; }
83 SELECTION_MODE GetMode() const { return m_mode; }
84
85 void SetPoly( SHAPE_LINE_CHAIN& aPoly ) { m_shape_poly = aPoly; }
87
88 void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override final;
89
90private:
91
95
97
98 VECTOR2I m_origin, m_end; // Used for box selection
99 SHAPE_LINE_CHAIN m_shape_poly; // Used for lasso selection
100};
101
102} // PREVIEW
103} // KIGFX
104
105#endif // PREVIEW_ITEMS_SELECTION_AREA_H
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
Abstract interface for drawing on a 2D-surface.
void SetMode(SELECTION_MODE aMode)
void SetSubtractive(bool aSubtractive)
SELECTION_MODE GetMode() const
void SetAdditive(bool aAdditive)
void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override final
Draw the parts of the object belonging to layer aLayer.
void SetPoly(SHAPE_LINE_CHAIN &aPoly)
void SetOrigin(const VECTOR2I &aOrigin)
const BOX2I ViewBBox() const override
Set the origin of the rectangle (the fixed corner)
SHAPE_LINE_CHAIN & GetPoly()
void SetExclusiveOr(bool aExclusiveOr)
wxString GetClass() const override
void SetEnd(const VECTOR2I &aEnd)
Set the current end of the rectangle (the corner that moves with the cursor.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:63
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
@ LAYER_GP_OVERLAY
General purpose overlay.
Definition layer_ids.h:275
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:29
SELECTION_MODE
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683