KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 <[email protected]>
9 * Copyright (C) 2007-2021 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 <geometry/eda_angle.h>
34#include <math/box2.h>
35
36
46{
47public:
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
71 VECTOR2I TransformCoordinate( const VECTOR2I& aPoint ) const;
72
80 BOX2I TransformCoordinate( const BOX2I& aRect ) const;
81
89
97 bool MapAngles( EDA_ANGLE* aAngle1, EDA_ANGLE* aAngle2 ) const;
98};
99
100namespace std
101{
102 template <> struct hash<TRANSFORM>
103 {
104 size_t operator() ( const TRANSFORM& k ) const;
105 };
106}
107
108#endif // _TRANSFORM_H_
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:46
TRANSFORM(int ax1, int ay1, int ax2, int ay2)
Definition: transform.h:58
int x2
Definition: transform.h:50
int y1
Definition: transform.h:49
bool MapAngles(EDA_ANGLE *aAngle1, EDA_ANGLE *aAngle2) const
Calculate new angles according to the transform.
Definition: transform.cpp:81
TRANSFORM InverseTransform() const
Calculate the Inverse mirror/rotation transform.
Definition: transform.cpp:59
bool operator==(const TRANSFORM &aTransform) const
Definition: transform.cpp:35
VECTOR2I TransformCoordinate(const VECTOR2I &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:44
TRANSFORM()
The default construct creates a transform that draws object is the normal orientation.
Definition: transform.h:56
bool operator!=(const TRANSFORM &aTransform) const
Definition: transform.h:62
int y2
Definition: transform.h:51
int x1
Definition: transform.h:48
STL namespace.