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 <[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 <wx/gdicmn.h>
34#include <geometry/eda_angle.h>
35#include <math/box2.h>
36
37
47{
48public:
49 int x1;
50 int y1;
51 int x2;
52 int y2;
53
57 TRANSFORM() : x1( 1 ), y1( 0 ), x2( 0 ), y2( -1 ) {}
58
59 TRANSFORM( int ax1, int ay1, int ax2, int ay2 ) : x1( ax1 ), y1( ay1 ), x2( ax2 ), y2( ay2 ) {}
60
61 bool operator==( const TRANSFORM& aTransform ) const;
62
63 bool operator!=( const TRANSFORM& aTransform ) const { return !( *this == aTransform ); }
64
72 VECTOR2I TransformCoordinate( const VECTOR2I& aPoint ) const;
73
81 BOX2I TransformCoordinate( const BOX2I& aRect ) const;
82
90
98 bool MapAngles( EDA_ANGLE* aAngle1, EDA_ANGLE* aAngle2 ) const;
99};
100
101
102#endif // _TRANSFORM_H_
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:47
TRANSFORM(int ax1, int ay1, int ax2, int ay2)
Definition: transform.h:59
int x2
Definition: transform.h:51
int y1
Definition: transform.h:50
bool MapAngles(EDA_ANGLE *aAngle1, EDA_ANGLE *aAngle2) const
Calculate new angles according to the transform.
Definition: transform.cpp:78
TRANSFORM InverseTransform() const
Calculate the Inverse mirror/rotation transform.
Definition: transform.cpp:56
bool operator==(const TRANSFORM &aTransform) const
Definition: transform.cpp:32
VECTOR2I TransformCoordinate(const VECTOR2I &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
TRANSFORM()
The default construct creates a transform that draws object is the normal orientation.
Definition: transform.h:57
bool operator!=(const TRANSFORM &aTransform) const
Definition: transform.h:63
int y2
Definition: transform.h:52
int x1
Definition: transform.h:49