KiCad PCB EDA Suite
transform.h
Go to the documentation of this file.
1 
5 /*
6  * This program source code file is part of KiCad, a free EDA CAD application.
7  *
8  * Copyright (C) 2007-2010 Wayne Stambaugh <stambaughw@verizon.net>
9  * Copyright (C) 2007-2017 KiCad Developers, see AUTHORS.txt for contributors.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, you may find one here:
23  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
24  * or you may search the http://www.gnu.org website for the version 2 license,
25  * or you may write to the Free Software Foundation, Inc.,
26  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
27  */
28 
29 
30 #ifndef _TRANSFORM_H_
31 #define _TRANSFORM_H_
32 
33 #include <wx/gdicmn.h>
34 
35 class EDA_RECT;
36 
45 class TRANSFORM
46 {
47 public:
48  int x1;
49  int y1;
50  int x2;
51  int y2;
52 
56  TRANSFORM() : x1( 1 ), y1( 0 ), x2( 0 ), y2( -1 ) {}
57 
58  TRANSFORM( int ax1, int ay1, int ax2, int ay2 ) : x1( ax1 ), y1( ay1 ), x2( ax2 ), y2( ay2 ) {}
59 
60  bool operator==( const TRANSFORM& aTransform ) const;
61 
62  bool operator!=( const TRANSFORM& aTransform ) const { return !( *this == aTransform ); }
63 
72  wxPoint TransformCoordinate( const wxPoint& aPoint ) const;
73 
82  EDA_RECT TransformCoordinate( const EDA_RECT& aRect ) const;
83 
91  TRANSFORM InverseTransform( ) const;
92 
100  bool MapAngles( int* aAngle1, int* aAngle2 ) const;
101 };
102 
103 
104 #endif // _TRANSFORM_H_
int y2
Definition: transform.h:51
int x2
Definition: transform.h:50
int x1
Definition: transform.h:48
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
int y1
Definition: transform.h:49
Class for tranforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
TRANSFORM()
The default construct creates a tranform that draws object is the normal orientation.
Definition: transform.h:56
bool MapAngles(int *aAngle1, int *aAngle2) const
Calculate new angles according to the transform.
Definition: transform.cpp:80
TRANSFORM(int ax1, int ay1, int ax2, int ay2)
Definition: transform.h:58
Class EDA_RECT handles the component boundary box.
bool operator==(const TRANSFORM &aTransform) const
Definition: transform.cpp:32
bool operator!=(const TRANSFORM &aTransform) const
Definition: transform.h:62
TRANSFORM InverseTransform() const
Calculate the Inverse mirror/rotation transform.
Definition: transform.cpp:58