@@ -32,30 +32,43 @@ extern "C"
32
32
// if defined shows all information about transform to stdout
33
33
// #define COORDINATE_TRANSFORM_VERBOSE
34
34
35
- QgsCoordinateTransform::QgsCoordinateTransform ( ) : QObject(), mSourceCRS(), mDestCRS()
35
+ QgsCoordinateTransform::QgsCoordinateTransform ()
36
+ : QObject()
37
+ , mInitialisedFlag( false )
38
+ , mSourceProjection( 0 )
39
+ , mDestinationProjection( 0 )
36
40
{
37
41
setFinder ();
38
42
}
39
43
40
- QgsCoordinateTransform::QgsCoordinateTransform ( const QgsCoordinateReferenceSystem& source,
41
- const QgsCoordinateReferenceSystem& dest )
44
+ QgsCoordinateTransform::QgsCoordinateTransform ( const QgsCoordinateReferenceSystem& source, const QgsCoordinateReferenceSystem& dest )
45
+ : QObject()
46
+ , mInitialisedFlag( false )
47
+ , mSourceProjection( 0 )
48
+ , mDestinationProjection( 0 )
42
49
{
43
50
setFinder ();
44
-
45
51
mSourceCRS = source;
46
52
mDestCRS = dest;
47
53
initialise ();
48
54
}
49
55
50
56
QgsCoordinateTransform::QgsCoordinateTransform ( long theSourceSrsId, long theDestSrsId )
51
- : mSourceCRS( theSourceSrsId, QgsCoordinateReferenceSystem::InternalCrsId ),
52
- mDestCRS( theDestSrsId, QgsCoordinateReferenceSystem::InternalCrsId )
57
+ : QObject()
58
+ , mInitialisedFlag( false )
59
+ , mSourceCRS( theSourceSrsId, QgsCoordinateReferenceSystem::InternalCrsId )
60
+ , mDestCRS( theDestSrsId, QgsCoordinateReferenceSystem::InternalCrsId )
61
+ , mSourceProjection( 0 )
62
+ , mDestinationProjection( 0 )
53
63
{
54
64
initialise ();
55
65
}
56
66
57
- QgsCoordinateTransform::QgsCoordinateTransform ( QString theSourceCRS, QString theDestCRS ) : QObject()
58
-
67
+ QgsCoordinateTransform::QgsCoordinateTransform ( QString theSourceCRS, QString theDestCRS )
68
+ : QObject()
69
+ , mInitialisedFlag( false )
70
+ , mSourceProjection( 0 )
71
+ , mDestinationProjection( 0 )
59
72
{
60
73
setFinder ();
61
74
mSourceCRS .createFromWkt ( theSourceCRS );
@@ -69,7 +82,11 @@ QgsCoordinateTransform::QgsCoordinateTransform( QString theSourceCRS, QString th
69
82
70
83
QgsCoordinateTransform::QgsCoordinateTransform ( long theSourceSrid,
71
84
QString theDestWkt,
72
- QgsCoordinateReferenceSystem::CrsType theSourceCRSType ): QObject()
85
+ QgsCoordinateReferenceSystem::CrsType theSourceCRSType )
86
+ : QObject()
87
+ , mInitialisedFlag( false )
88
+ , mSourceProjection( 0 )
89
+ , mDestinationProjection( 0 )
73
90
{
74
91
setFinder ();
75
92
@@ -85,11 +102,11 @@ QgsCoordinateTransform::QgsCoordinateTransform( long theSourceSrid,
85
102
QgsCoordinateTransform::~QgsCoordinateTransform ()
86
103
{
87
104
// free the proj objects
88
- if ( mSourceProjection != 0 )
105
+ if ( mSourceProjection )
89
106
{
90
107
pj_free ( mSourceProjection );
91
108
}
92
- if ( mDestinationProjection != 0 )
109
+ if ( mDestinationProjection )
93
110
{
94
111
pj_free ( mDestinationProjection );
95
112
}
@@ -106,7 +123,6 @@ void QgsCoordinateTransform::setDestCRS( const QgsCoordinateReferenceSystem& the
106
123
initialise ();
107
124
}
108
125
109
-
110
126
void QgsCoordinateTransform::setDestCRSID ( long theCRSID )
111
127
{
112
128
// !todo Add some logic here to determine if the srsid is a system or user one
@@ -118,11 +134,6 @@ void QgsCoordinateTransform::setDestCRSID( long theCRSID )
118
134
// And probably shouldn't be a void
119
135
void QgsCoordinateTransform::initialise ()
120
136
{
121
-
122
- mInitialisedFlag = false ; // guilty until proven innocent...
123
- mSourceProjection = NULL ;
124
- mDestinationProjection = NULL ;
125
-
126
137
// XXX Warning - multiple return paths in this block!!
127
138
if ( !mSourceCRS .isValid () )
128
139
{
@@ -152,11 +163,11 @@ void QgsCoordinateTransform::initialise()
152
163
#endif
153
164
154
165
mInitialisedFlag = true ;
155
- if ( mDestinationProjection == NULL )
166
+ if ( ! mDestinationProjection )
156
167
{
157
168
mInitialisedFlag = false ;
158
169
}
159
- if ( mSourceProjection == NULL )
170
+ if ( ! mSourceProjection )
160
171
{
161
172
mInitialisedFlag = false ;
162
173
}
0 commit comments