KiCad PCB EDA Suite
Loading...
Searching...
No Matches
transform.h
Go to the documentation of this file.
1
4
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 The 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, see <https://www.gnu.org/licenses/>.
23 */
24
25
26#ifndef _TRANSFORM_H_
27#define _TRANSFORM_H_
28
29#include <geometry/eda_angle.h>
30#include <math/box2.h>
31
32
42{
43public:
44 int x1;
45 int y1;
46 int x2;
47 int y2;
48
53 x1( 1 ),
54 y1( 0 ),
55 x2( 0 ),
56 y2( 1 )
57 {}
58
59 TRANSFORM( int ax1, int ay1, int ax2, int ay2 ) :
60 x1( ax1 ),
61 y1( ay1 ),
62 x2( ax2 ),
63 y2( ay2 )
64 {}
65
66 bool operator==( const TRANSFORM& aTransform ) const;
67
68 bool operator!=( const TRANSFORM& aTransform ) const { return !( *this == aTransform ); }
69
77 VECTOR2I TransformCoordinate( const VECTOR2I& aPoint ) const;
78
86 BOX2I TransformCoordinate( const BOX2I& aRect ) const;
87
95
103 bool MapAngles( EDA_ANGLE* aAngle1, EDA_ANGLE* aAngle2 ) const;
104};
105
106namespace std
107{
108 template <> struct hash<TRANSFORM>
109 {
110 size_t operator() ( const TRANSFORM& k ) const;
111 };
112}
113
114#endif // _TRANSFORM_H_
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
for transforming drawing coordinates for a wxDC device context.
Definition transform.h:42
TRANSFORM(int ax1, int ay1, int ax2, int ay2)
Definition transform.h:59
bool MapAngles(EDA_ANGLE *aAngle1, EDA_ANGLE *aAngle2) const
Calculate new angles according to the transform.
Definition transform.cpp:77
TRANSFORM InverseTransform() const
Calculate the Inverse mirror/rotation transform.
Definition transform.cpp:55
bool operator==(const TRANSFORM &aTransform) const
Definition transform.cpp:31
VECTOR2I TransformCoordinate(const VECTOR2I &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition transform.cpp:40
TRANSFORM()
The default construct creates a transform that draws object is the normal orientation.
Definition transform.h:52
bool operator!=(const TRANSFORM &aTransform) const
Definition transform.h:68
STL namespace.
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683