/
qgsgeometrycoordinatetransform.cpp
executable file
·54 lines (40 loc) · 2.34 KB
/
qgsgeometrycoordinatetransform.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/***************************************************************************
qgsgeometrycoordinatetransform.cpp
-------------------
begin : Dec 29, 2009
copyright : (C) 2009 by Diego Moreira And Luiz Motta
email : moreira.geo at gmail.com And motta.luiz at gmail.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/* $Id$ */
#include "qgsgeometrycoordinatetransform.h"
#include "qgscoordinatereferencesystem.h"
QgsGeometryCoordinateTransform::~QgsGeometryCoordinateTransform()
{
delete mCoordTransform;
} // QgsGeometryCoordinateTransform::~QgsGeometryCoordinateTransform()
void QgsGeometryCoordinateTransform::setCoordinateTransform( QgsVectorLayer* lyrTarget, QgsVectorLayer* lyrReference )
{
// Transform Forward: Target to Reference
QgsCoordinateReferenceSystem srsTarget = lyrTarget->crs();
QgsCoordinateReferenceSystem srsReference = lyrReference->crs();
mCoordTransform = new QgsCoordinateTransform( srsTarget, srsReference );
mFuncTransform = ( srsTarget != srsReference )
? &QgsGeometryCoordinateTransform::setGeomTransform
: &QgsGeometryCoordinateTransform::setNoneGeomTransform;
} // void QgsGeometryCoordinateTransform::setCoordinateTransform(QgsVectorLayer* lyrTarget, QgsVectorLayer* lyrReference)
void QgsGeometryCoordinateTransform::transform( QgsGeometry *geom )
{
( this->*mFuncTransform )( geom );
} // void QgsGeometryCoordinateTransform::transformCoordenate()
void QgsGeometryCoordinateTransform::setGeomTransform( QgsGeometry *geom )
{
geom->transform( *mCoordTransform );
} // void QgsGeometryCoordinateTransform::setGeomTransform(QgsGeometry *geom)