1 : /******************************************************************************
2 : * $Id: ogr_spatialref.h 25256 2012-11-26 20:19:03Z rouault $
3 : *
4 : * Project: OpenGIS Simple Features Reference Implementation
5 : * Purpose: Classes for manipulating spatial reference systems in a
6 : * platform non-specific manner.
7 : * Author: Frank Warmerdam, warmerdam@pobox.com
8 : *
9 : ******************************************************************************
10 : * Copyright (c) 1999, Les Technologies SoftMap Inc.
11 : *
12 : * Permission is hereby granted, free of charge, to any person obtaining a
13 : * copy of this software and associated documentation files (the "Software"),
14 : * to deal in the Software without restriction, including without limitation
15 : * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 : * and/or sell copies of the Software, and to permit persons to whom the
17 : * Software is furnished to do so, subject to the following conditions:
18 : *
19 : * The above copyright notice and this permission notice shall be included
20 : * in all copies or substantial portions of the Software.
21 : *
22 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28 : * DEALINGS IN THE SOFTWARE.
29 : ****************************************************************************/
30 :
31 : #ifndef _OGR_SPATIALREF_H_INCLUDED
32 : #define _OGR_SPATIALREF_H_INCLUDED
33 :
34 : #include "ogr_srs_api.h"
35 :
36 : /**
37 : * \file ogr_spatialref.h
38 : *
39 : * Coordinate systems services.
40 : */
41 :
42 : /************************************************************************/
43 : /* OGR_SRSNode */
44 : /************************************************************************/
45 :
46 : /**
47 : * Objects of this class are used to represent value nodes in the parsed
48 : * representation of the WKT SRS format. For instance UNIT["METER",1]
49 : * would be rendered into three OGR_SRSNodes. The root node would have a
50 : * value of UNIT, and two children, the first with a value of METER, and the
51 : * second with a value of 1.
52 : *
53 : * Normally application code just interacts with the OGRSpatialReference
54 : * object, which uses the OGR_SRSNode to implement it's data structure;
55 : * however, this class is user accessable for detailed access to components
56 : * of an SRS definition.
57 : */
58 :
59 : class CPL_DLL OGR_SRSNode
60 : {
61 : char *pszValue;
62 :
63 : OGR_SRSNode **papoChildNodes;
64 : OGR_SRSNode *poParent;
65 :
66 : int nChildren;
67 :
68 : int NeedsQuoting() const;
69 :
70 : public:
71 : OGR_SRSNode(const char * = NULL);
72 : ~OGR_SRSNode();
73 :
74 : int IsLeafNode() const { return nChildren == 0; }
75 :
76 40726598 : int GetChildCount() const { return nChildren; }
77 : OGR_SRSNode *GetChild( int );
78 : const OGR_SRSNode *GetChild( int ) const;
79 :
80 : OGR_SRSNode *GetNode( const char * );
81 : const OGR_SRSNode *GetNode( const char * ) const;
82 :
83 : void InsertChild( OGR_SRSNode *, int );
84 : void AddChild( OGR_SRSNode * );
85 : int FindChild( const char * ) const;
86 : void DestroyChild( int );
87 : void ClearChildren();
88 : void StripNodes( const char * );
89 :
90 10285780 : const char *GetValue() const { return pszValue; }
91 : void SetValue( const char * );
92 :
93 : void MakeValueSafe();
94 : OGRErr FixupOrdering();
95 :
96 : OGR_SRSNode *Clone() const;
97 :
98 : OGRErr importFromWkt( char ** );
99 : OGRErr exportToWkt( char ** ) const;
100 : OGRErr exportToPrettyWkt( char **, int = 1) const;
101 :
102 : OGRErr applyRemapper( const char *pszNode,
103 : char **papszSrcValues,
104 : char **papszDstValues,
105 : int nStepSize = 1,
106 : int bChildOfHit = FALSE );
107 : };
108 :
109 : /************************************************************************/
110 : /* OGRSpatialReference */
111 : /************************************************************************/
112 :
113 : /**
114 : * This class respresents a OpenGIS Spatial Reference System, and contains
115 : * methods for converting between this object organization and well known
116 : * text (WKT) format. This object is reference counted as one instance of
117 : * the object is normally shared between many OGRGeometry objects.
118 : *
119 : * Normally application code can fetch needed parameter values for this
120 : * SRS using GetAttrValue(), but in special cases the underlying parse tree
121 : * (or OGR_SRSNode objects) can be accessed more directly.
122 : *
123 : * See <a href="osr_tutorial.html">the tutorial</a> for more information on
124 : * how to use this class.
125 : */
126 :
127 : class CPL_DLL OGRSpatialReference
128 : {
129 : double dfFromGreenwich;
130 : double dfToMeter;
131 : double dfToDegrees;
132 :
133 : OGR_SRSNode *poRoot;
134 :
135 : int nRefCount;
136 : int bNormInfoSet;
137 :
138 : static OGRErr Validate(OGR_SRSNode *poRoot);
139 : static OGRErr ValidateAuthority(OGR_SRSNode *poRoot);
140 : static OGRErr ValidateAxis(OGR_SRSNode *poRoot);
141 : static OGRErr ValidateUnit(OGR_SRSNode *poRoot);
142 : static OGRErr ValidateVertDatum(OGR_SRSNode *poRoot);
143 : static OGRErr ValidateProjection( OGR_SRSNode* poRoot );
144 : static int IsAliasFor( const char *, const char * );
145 : void GetNormInfo() const;
146 :
147 : OGRErr importFromURNPart(const char* pszAuthority,
148 : const char* pszCode,
149 : const char* pszURN);
150 : public:
151 : OGRSpatialReference(const OGRSpatialReference&);
152 : OGRSpatialReference(const char * = NULL);
153 :
154 : virtual ~OGRSpatialReference();
155 :
156 : static void DestroySpatialReference(OGRSpatialReference* poSRS);
157 :
158 : OGRSpatialReference &operator=(const OGRSpatialReference&);
159 :
160 : int Reference();
161 : int Dereference();
162 : int GetReferenceCount() const { return nRefCount; }
163 : void Release();
164 :
165 : OGRSpatialReference *Clone() const;
166 : OGRSpatialReference *CloneGeogCS() const;
167 :
168 : void dumpReadable();
169 : OGRErr exportToWkt( char ** ) const;
170 : OGRErr exportToPrettyWkt( char **, int = FALSE) const;
171 : OGRErr exportToProj4( char ** ) const;
172 : OGRErr exportToPCI( char **, char **, double ** ) const;
173 : OGRErr exportToUSGS( long *, long *, double **, long * ) const;
174 : OGRErr exportToXML( char **, const char * = NULL ) const;
175 : OGRErr exportToPanorama( long *, long *, long *, long *,
176 : double * ) const;
177 : OGRErr exportToERM( char *pszProj, char *pszDatum, char *pszUnits );
178 : OGRErr exportToMICoordSys( char ** ) const;
179 :
180 : OGRErr importFromWkt( char ** );
181 : OGRErr importFromProj4( const char * );
182 : OGRErr importFromEPSG( int );
183 : OGRErr importFromEPSGA( int );
184 : OGRErr importFromESRI( char ** );
185 : OGRErr importFromPCI( const char *, const char * = NULL,
186 : double * = NULL );
187 : #define USGS_ANGLE_DECIMALDEGREES 0
188 : #define USGS_ANGLE_PACKEDDMS TRUE /* 1 */
189 : #define USGS_ANGLE_RADIANS 2
190 : OGRErr importFromUSGS( long iProjSys, long iZone,
191 : double *padfPrjParams, long iDatum,
192 : int nUSGSAngleFormat = USGS_ANGLE_PACKEDDMS );
193 : OGRErr importFromPanorama( long, long, long, double* );
194 : OGRErr importFromOzi( const char *, const char *, const char * );
195 : OGRErr importFromOzi( const char * const* papszLines );
196 : OGRErr importFromWMSAUTO( const char *pszAutoDef );
197 : OGRErr importFromXML( const char * );
198 : OGRErr importFromDict( const char *pszDict, const char *pszCode );
199 : OGRErr importFromURN( const char * );
200 : OGRErr importFromCRSURL( const char * );
201 : OGRErr importFromERM( const char *pszProj, const char *pszDatum,
202 : const char *pszUnits );
203 : OGRErr importFromUrl( const char * );
204 : OGRErr importFromMICoordSys( const char * );
205 :
206 : OGRErr morphToESRI();
207 : OGRErr morphFromESRI();
208 :
209 : OGRErr Validate();
210 : OGRErr StripCTParms( OGR_SRSNode * = NULL );
211 : OGRErr StripVertical();
212 : OGRErr FixupOrdering();
213 : OGRErr Fixup();
214 :
215 : int EPSGTreatsAsLatLong();
216 : const char *GetAxis( const char *pszTargetKey, int iAxis,
217 : OGRAxisOrientation *peOrientation ) const;
218 : OGRErr SetAxes( const char *pszTargetKey,
219 : const char *pszXAxisName,
220 : OGRAxisOrientation eXAxisOrientation,
221 : const char *pszYAxisName,
222 : OGRAxisOrientation eYAxisOrientation );
223 :
224 : // Machinary for accessing parse nodes
225 2147880 : OGR_SRSNode *GetRoot() { return poRoot; }
226 149057 : const OGR_SRSNode *GetRoot() const { return poRoot; }
227 : void SetRoot( OGR_SRSNode * );
228 :
229 : OGR_SRSNode *GetAttrNode(const char *);
230 : const OGR_SRSNode *GetAttrNode(const char *) const;
231 : const char *GetAttrValue(const char *, int = 0) const;
232 :
233 : OGRErr SetNode( const char *, const char * );
234 : OGRErr SetNode( const char *, double );
235 :
236 : OGRErr SetLinearUnitsAndUpdateParameters( const char *pszName,
237 : double dfInMeters );
238 : OGRErr SetLinearUnits( const char *pszName, double dfInMeters );
239 : OGRErr SetTargetLinearUnits( const char *pszTargetKey,
240 : const char *pszName, double dfInMeters );
241 : double GetLinearUnits( char ** = NULL ) const;
242 : double GetTargetLinearUnits( const char *pszTargetKey,
243 : char ** ppszRetName = NULL ) const;
244 :
245 : OGRErr SetAngularUnits( const char *pszName, double dfInRadians );
246 : double GetAngularUnits( char ** = NULL ) const;
247 :
248 : double GetPrimeMeridian( char ** = NULL ) const;
249 :
250 : int IsGeographic() const;
251 : int IsProjected() const;
252 : int IsGeocentric() const;
253 : int IsLocal() const;
254 : int IsVertical() const;
255 : int IsCompound() const;
256 : int IsSameGeogCS( const OGRSpatialReference * ) const;
257 : int IsSameVertCS( const OGRSpatialReference * ) const;
258 : int IsSame( const OGRSpatialReference * ) const;
259 :
260 : void Clear();
261 : OGRErr SetLocalCS( const char * );
262 : OGRErr SetProjCS( const char * );
263 : OGRErr SetProjection( const char * );
264 : OGRErr SetGeocCS( const char * pszGeocName );
265 : OGRErr SetGeogCS( const char * pszGeogName,
266 : const char * pszDatumName,
267 : const char * pszEllipsoidName,
268 : double dfSemiMajor, double dfInvFlattening,
269 : const char * pszPMName = NULL,
270 : double dfPMOffset = 0.0,
271 : const char * pszUnits = NULL,
272 : double dfConvertToRadians = 0.0 );
273 : OGRErr SetWellKnownGeogCS( const char * );
274 : OGRErr CopyGeogCSFrom( const OGRSpatialReference * poSrcSRS );
275 : OGRErr SetVertCS( const char *pszVertCSName,
276 : const char *pszVertDatumName,
277 : int nVertDatumClass = 2005 );
278 : OGRErr SetCompoundCS( const char *pszName,
279 : const OGRSpatialReference *poHorizSRS,
280 : const OGRSpatialReference *poVertSRS );
281 :
282 : OGRErr SetFromUserInput( const char * );
283 :
284 : OGRErr SetTOWGS84( double, double, double,
285 : double = 0.0, double = 0.0, double = 0.0,
286 : double = 0.0 );
287 : OGRErr GetTOWGS84( double *padfCoef, int nCoeff = 7 ) const;
288 :
289 : double GetSemiMajor( OGRErr * = NULL ) const;
290 : double GetSemiMinor( OGRErr * = NULL ) const;
291 : double GetInvFlattening( OGRErr * = NULL ) const;
292 :
293 : OGRErr SetAuthority( const char * pszTargetKey,
294 : const char * pszAuthority,
295 : int nCode );
296 :
297 : OGRErr AutoIdentifyEPSG();
298 : int GetEPSGGeogCS();
299 :
300 : const char *GetAuthorityCode( const char * pszTargetKey ) const;
301 : const char *GetAuthorityName( const char * pszTargetKey ) const;
302 :
303 : const char *GetExtension( const char *pszTargetKey,
304 : const char *pszName,
305 : const char *pszDefault = NULL ) const;
306 : OGRErr SetExtension( const char *pszTargetKey,
307 : const char *pszName,
308 : const char *pszValue );
309 :
310 : int FindProjParm( const char *pszParameter,
311 : const OGR_SRSNode *poPROJCS=NULL ) const;
312 : OGRErr SetProjParm( const char *, double );
313 : double GetProjParm( const char *, double =0.0, OGRErr* = NULL ) const;
314 :
315 : OGRErr SetNormProjParm( const char *, double );
316 : double GetNormProjParm( const char *, double=0.0, OGRErr* =NULL)const;
317 :
318 : static int IsAngularParameter( const char * );
319 : static int IsLongitudeParameter( const char * );
320 : static int IsLinearParameter( const char * );
321 :
322 : /** Albers Conic Equal Area */
323 : OGRErr SetACEA( double dfStdP1, double dfStdP2,
324 : double dfCenterLat, double dfCenterLong,
325 : double dfFalseEasting, double dfFalseNorthing );
326 :
327 : /** Azimuthal Equidistant */
328 : OGRErr SetAE( double dfCenterLat, double dfCenterLong,
329 : double dfFalseEasting, double dfFalseNorthing );
330 :
331 : /** Bonne */
332 : OGRErr SetBonne( double dfStdP1, double dfCentralMeridian,
333 : double dfFalseEasting, double dfFalseNorthing );
334 :
335 : /** Cylindrical Equal Area */
336 : OGRErr SetCEA( double dfStdP1, double dfCentralMeridian,
337 : double dfFalseEasting, double dfFalseNorthing );
338 :
339 : /** Cassini-Soldner */
340 : OGRErr SetCS( double dfCenterLat, double dfCenterLong,
341 : double dfFalseEasting, double dfFalseNorthing );
342 :
343 : /** Equidistant Conic */
344 : OGRErr SetEC( double dfStdP1, double dfStdP2,
345 : double dfCenterLat, double dfCenterLong,
346 : double dfFalseEasting, double dfFalseNorthing );
347 :
348 : /** Eckert I-VI */
349 : OGRErr SetEckert( int nVariation, double dfCentralMeridian,
350 : double dfFalseEasting, double dfFalseNorthing );
351 :
352 : OGRErr SetEckertIV( double dfCentralMeridian,
353 : double dfFalseEasting, double dfFalseNorthing );
354 :
355 : OGRErr SetEckertVI( double dfCentralMeridian,
356 : double dfFalseEasting, double dfFalseNorthing );
357 :
358 : /** Equirectangular */
359 : OGRErr SetEquirectangular(double dfCenterLat, double dfCenterLong,
360 : double dfFalseEasting, double dfFalseNorthing );
361 : /** Equirectangular generalized form : */
362 : OGRErr SetEquirectangular2( double dfCenterLat, double dfCenterLong,
363 : double dfPseudoStdParallel1,
364 : double dfFalseEasting, double dfFalseNorthing );
365 :
366 : /** Geostationary Satellite */
367 : OGRErr SetGEOS( double dfCentralMeridian, double dfSatelliteHeight,
368 : double dfFalseEasting, double dfFalseNorthing );
369 :
370 : /** Goode Homolosine */
371 : OGRErr SetGH( double dfCentralMeridian,
372 : double dfFalseEasting, double dfFalseNorthing );
373 :
374 : /** Interrupted Goode Homolosine */
375 : OGRErr SetIGH();
376 :
377 : /** Gall Stereograpic */
378 : OGRErr SetGS( double dfCentralMeridian,
379 : double dfFalseEasting, double dfFalseNorthing );
380 :
381 : /** Gauss Schreiber Transverse Mercator */
382 : OGRErr SetGaussSchreiberTMercator(double dfCenterLat, double dfCenterLong,
383 : double dfScale,
384 : double dfFalseEasting, double dfFalseNorthing );
385 :
386 : /** Gnomonic */
387 : OGRErr SetGnomonic(double dfCenterLat, double dfCenterLong,
388 : double dfFalseEasting, double dfFalseNorthing );
389 :
390 : /** Hotine Oblique Mercator */
391 : OGRErr SetHOM( double dfCenterLat, double dfCenterLong,
392 : double dfAzimuth, double dfRectToSkew,
393 : double dfScale,
394 : double dfFalseEasting, double dfFalseNorthing );
395 :
396 : OGRErr SetHOM2PNO( double dfCenterLat,
397 : double dfLat1, double dfLong1,
398 : double dfLat2, double dfLong2,
399 : double dfScale,
400 : double dfFalseEasting, double dfFalseNorthing );
401 :
402 : OGRErr SetOM( double dfCenterLat, double dfCenterLong,
403 : double dfAzimuth, double dfRectToSkew,
404 : double dfScale,
405 : double dfFalseEasting, double dfFalseNorthing );
406 :
407 : /** Hotine Oblique Mercator Azimuth Center / Variant B */
408 : OGRErr SetHOMAC( double dfCenterLat, double dfCenterLong,
409 : double dfAzimuth, double dfRectToSkew,
410 : double dfScale,
411 : double dfFalseEasting, double dfFalseNorthing );
412 :
413 : /** International Map of the World Polyconic */
414 : OGRErr SetIWMPolyconic( double dfLat1, double dfLat2,
415 : double dfCenterLong,
416 : double dfFalseEasting,
417 : double dfFalseNorthing );
418 :
419 : /** Krovak Oblique Conic Conformal */
420 : OGRErr SetKrovak( double dfCenterLat, double dfCenterLong,
421 : double dfAzimuth, double dfPseudoStdParallelLat,
422 : double dfScale,
423 : double dfFalseEasting, double dfFalseNorthing );
424 :
425 : /** Lambert Azimuthal Equal-Area */
426 : OGRErr SetLAEA( double dfCenterLat, double dfCenterLong,
427 : double dfFalseEasting, double dfFalseNorthing );
428 :
429 : /** Lambert Conformal Conic */
430 : OGRErr SetLCC( double dfStdP1, double dfStdP2,
431 : double dfCenterLat, double dfCenterLong,
432 : double dfFalseEasting, double dfFalseNorthing );
433 :
434 : /** Lambert Conformal Conic 1SP */
435 : OGRErr SetLCC1SP( double dfCenterLat, double dfCenterLong,
436 : double dfScale,
437 : double dfFalseEasting, double dfFalseNorthing );
438 :
439 : /** Lambert Conformal Conic (Belgium) */
440 : OGRErr SetLCCB( double dfStdP1, double dfStdP2,
441 : double dfCenterLat, double dfCenterLong,
442 : double dfFalseEasting, double dfFalseNorthing );
443 :
444 : /** Miller Cylindrical */
445 : OGRErr SetMC( double dfCenterLat, double dfCenterLong,
446 : double dfFalseEasting, double dfFalseNorthing );
447 :
448 : /** Mercator */
449 : OGRErr SetMercator( double dfCenterLat, double dfCenterLong,
450 : double dfScale,
451 : double dfFalseEasting, double dfFalseNorthing );
452 :
453 : OGRErr SetMercator2SP( double dfStdP1,
454 : double dfCenterLat, double dfCenterLong,
455 : double dfFalseEasting, double dfFalseNorthing );
456 :
457 : /** Mollweide */
458 : OGRErr SetMollweide( double dfCentralMeridian,
459 : double dfFalseEasting, double dfFalseNorthing );
460 :
461 : /** New Zealand Map Grid */
462 : OGRErr SetNZMG( double dfCenterLat, double dfCenterLong,
463 : double dfFalseEasting, double dfFalseNorthing );
464 :
465 : /** Oblique Stereographic */
466 : OGRErr SetOS( double dfOriginLat, double dfCMeridian,
467 : double dfScale,
468 : double dfFalseEasting,double dfFalseNorthing);
469 :
470 : /** Orthographic */
471 : OGRErr SetOrthographic( double dfCenterLat, double dfCenterLong,
472 : double dfFalseEasting,double dfFalseNorthing);
473 :
474 : /** Polyconic */
475 : OGRErr SetPolyconic( double dfCenterLat, double dfCenterLong,
476 : double dfFalseEasting, double dfFalseNorthing );
477 :
478 : /** Polar Stereographic */
479 : OGRErr SetPS( double dfCenterLat, double dfCenterLong,
480 : double dfScale,
481 : double dfFalseEasting, double dfFalseNorthing);
482 :
483 : /** Robinson */
484 : OGRErr SetRobinson( double dfCenterLong,
485 : double dfFalseEasting, double dfFalseNorthing );
486 :
487 : /** Sinusoidal */
488 : OGRErr SetSinusoidal( double dfCenterLong,
489 : double dfFalseEasting, double dfFalseNorthing );
490 :
491 : /** Stereographic */
492 : OGRErr SetStereographic( double dfCenterLat, double dfCenterLong,
493 : double dfScale,
494 : double dfFalseEasting,double dfFalseNorthing);
495 :
496 : /** Swiss Oblique Cylindrical */
497 : OGRErr SetSOC( double dfLatitudeOfOrigin, double dfCentralMeridian,
498 : double dfFalseEasting, double dfFalseNorthing );
499 :
500 : /** Transverse Mercator */
501 : OGRErr SetTM( double dfCenterLat, double dfCenterLong,
502 : double dfScale,
503 : double dfFalseEasting, double dfFalseNorthing );
504 :
505 : /** Transverse Mercator variants. */
506 : OGRErr SetTMVariant( const char *pszVariantName,
507 : double dfCenterLat, double dfCenterLong,
508 : double dfScale,
509 : double dfFalseEasting, double dfFalseNorthing );
510 :
511 : /** Tunesia Mining Grid */
512 : OGRErr SetTMG( double dfCenterLat, double dfCenterLong,
513 : double dfFalseEasting, double dfFalseNorthing );
514 :
515 : /** Transverse Mercator (South Oriented) */
516 : OGRErr SetTMSO( double dfCenterLat, double dfCenterLong,
517 : double dfScale,
518 : double dfFalseEasting, double dfFalseNorthing );
519 :
520 : /** Two Point Equidistant */
521 : OGRErr SetTPED( double dfLat1, double dfLong1,
522 : double dfLat2, double dfLong2,
523 : double dfFalseEasting, double dfFalseNorthing );
524 :
525 : /** VanDerGrinten */
526 : OGRErr SetVDG( double dfCenterLong,
527 : double dfFalseEasting, double dfFalseNorthing );
528 :
529 : /** Universal Transverse Mercator */
530 : OGRErr SetUTM( int nZone, int bNorth = TRUE );
531 : int GetUTMZone( int *pbNorth = NULL ) const;
532 :
533 : /** Wagner I -- VII */
534 : OGRErr SetWagner( int nVariation, double dfCenterLat,
535 : double dfFalseEasting, double dfFalseNorthing );
536 :
537 : /** State Plane */
538 : OGRErr SetStatePlane( int nZone, int bNAD83 = TRUE,
539 : const char *pszOverrideUnitName = NULL,
540 : double dfOverrideUnit = 0.0 );
541 :
542 : OGRErr ImportFromESRIStatePlaneWKT(
543 : int nCode, const char* pszDatumName, const char* pszUnitsName,
544 : int nPCSCode, const char* pszCSName = 0 );
545 : OGRErr ImportFromESRIWisconsinWKT(
546 : const char* pszPrjName, double dfCentralMeridian, double dfLatOfOrigin,
547 : const char* pszUnitsName, const char* pszCSName = 0 );
548 : };
549 :
550 : /************************************************************************/
551 : /* OGRCoordinateTransformation */
552 : /* */
553 : /* This is really just used as a base class for a private */
554 : /* implementation. */
555 : /************************************************************************/
556 :
557 : /**
558 : * Interface for transforming between coordinate systems.
559 : *
560 : * Currently, the only implementation within OGR is OGRProj4CT, which
561 : * requires the PROJ.4 library to be available at run-time.
562 : *
563 : * Also, see OGRCreateCoordinateTransformation() for creating transformations.
564 : */
565 :
566 : class CPL_DLL OGRCoordinateTransformation
567 498 : {
568 : public:
569 498 : virtual ~OGRCoordinateTransformation() {}
570 :
571 : static void DestroyCT(OGRCoordinateTransformation* poCT);
572 :
573 : // From CT_CoordinateTransformation
574 :
575 : /** Fetch internal source coordinate system. */
576 : virtual OGRSpatialReference *GetSourceCS() = 0;
577 :
578 : /** Fetch internal target coordinate system. */
579 : virtual OGRSpatialReference *GetTargetCS() = 0;
580 :
581 : // From CT_MathTransform
582 :
583 : /**
584 : * Transform points from source to destination space.
585 : *
586 : * This method is the same as the C function OCTTransform().
587 : *
588 : * The method TransformEx() allows extended success information to
589 : * be captured indicating which points failed to transform.
590 : *
591 : * @param nCount number of points to transform.
592 : * @param x array of nCount X vertices, modified in place.
593 : * @param y array of nCount Y vertices, modified in place.
594 : * @param z array of nCount Z vertices, modified in place.
595 : * @return TRUE on success, or FALSE if some or all points fail to
596 : * transform.
597 : */
598 : virtual int Transform( int nCount,
599 : double *x, double *y, double *z = NULL ) = 0;
600 :
601 : /**
602 : * Transform points from source to destination space.
603 : *
604 : * This method is the same as the C function OCTTransformEx().
605 : *
606 : * @param nCount number of points to transform.
607 : * @param x array of nCount X vertices, modified in place.
608 : * @param y array of nCount Y vertices, modified in place.
609 : * @param z array of nCount Z vertices, modified in place.
610 : * @param pabSuccess array of per-point flags set to TRUE if that point
611 : * transforms, or FALSE if it does not.
612 : *
613 : * @return TRUE if some or all points transform successfully, or FALSE if
614 : * if none transform.
615 : */
616 : virtual int TransformEx( int nCount,
617 : double *x, double *y, double *z = NULL,
618 : int *pabSuccess = NULL ) = 0;
619 :
620 : };
621 :
622 : OGRCoordinateTransformation CPL_DLL *
623 : OGRCreateCoordinateTransformation( OGRSpatialReference *poSource,
624 : OGRSpatialReference *poTarget );
625 :
626 : #endif /* ndef _OGR_SPATIALREF_H_INCLUDED */
|