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, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#ifndef PREVIEW_ITEMS_SELECTION_AREA_H
28#define PREVIEW_ITEMS_SELECTION_AREA_H
29
32#include <tool/selection_tool.h>
33
34namespace KIGFX
35{
36class GAL;
37
38namespace PREVIEW
39{
40
48{
49public:
50 static const int SelectionLayer = LAYER_GP_OVERLAY;
51
53
54 const BOX2I ViewBBox() const override;
55
57 void SetOrigin( const VECTOR2I& aOrigin )
58 {
59 m_origin = aOrigin;
60 }
61
65 void SetEnd( const VECTOR2I& aEnd )
66 {
67 m_end = aEnd;
68 }
69
73 wxString GetClass() const override
74 {
75 return wxT( "SELECTION_AREA" );
76 }
77
78 VECTOR2I GetOrigin() const { return m_origin; }
79
80 VECTOR2I GetEnd() const { return m_end; }
81
82 void SetAdditive( bool aAdditive ) { m_additive = aAdditive; }
83 void SetSubtractive( bool aSubtractive ) { m_subtractive = aSubtractive; }
84 void SetExclusiveOr( bool aExclusiveOr ) { m_exclusiveOr = aExclusiveOr; }
85
86 void SetMode( SELECTION_MODE aMode ) { m_mode = aMode; }
87 SELECTION_MODE GetMode() const { return m_mode; }
88
89 void SetPoly( SHAPE_LINE_CHAIN& aPoly ) { m_shape_poly = aPoly; }
91
92 void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override final;
93
94private:
95
99
101
102 VECTOR2I m_origin, m_end; // Used for box selection
103 SHAPE_LINE_CHAIN m_shape_poly; // Used for lasso selection
104};
105
106} // PREVIEW
107} // KIGFX
108
109#endif // PREVIEW_ITEMS_SELECTION_AREA_H
Represent a selection area (currently a rectangle) in a VIEW, drawn corner-to-corner between two poin...
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.
SIMPLE_OVERLAY_ITEM is class that represents a visual area drawn on a canvas, used to temporarily dem...
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:66
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:278
The Cairo implementation of the graphics abstraction layer.
Definition: eda_group.h:33
SELECTION_MODE