KiCad PCB EDA Suite
selection_area.cpp
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  * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
26 
28 #include <view/view.h>
29 
30 using namespace KIGFX::PREVIEW;
31 
32 
34 {
35  SetStrokeColor( COLOR4D( 1.0, 1.0, 0.4, 1.0 ) );
36  SetFillColor( COLOR4D( 0.3, 0.3, 0.5, 0.3 ) );
37 }
38 
39 
41 {
42  BOX2I tmp;
43 
44  tmp.SetOrigin( m_origin );
45  tmp.SetEnd( m_end );
46  tmp.Normalize();
47  return tmp;
48 }
49 
50 
52 {
53  aGal.DrawRectangle( m_origin, m_end );
54 }
55 
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
void SetStrokeColor(const COLOR4D &aNewColor)
Set the stroke colour to set before drawing preview
BOX2< Vec > & Normalize()
Function Normalize ensures that the height ant width are positive.
Definition: box2.h:117
const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers. ...
void drawPreviewShape(KIGFX::GAL &aGal) const override
Draw the selection rectangle onto the GAL.
void SetFillColor(const COLOR4D &aNewColor)
Set the fill colour to set before drawing preview
void SetEnd(coord_type x, coord_type y)
Definition: box2.h:213
void SetOrigin(const Vec &pos)
Definition: box2.h:198
Class GAL is the abstract interface for drawing on a 2D-surface.
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39