00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _SB_PROJ4PROJECTION_
00025 #define _SB_PROJ4PROJECTION_
00026
00027 #include <Inventor/projection/SbProjection.h>
00028 #include <Inventor/SbLinear.h>
00029
00030
00031 #define PVALUE PROJ_PVALUE
00032
00033 #define PROJECTION_PARAM_ID 0
00034 #define ELLIPSOID_PARAM_ID 1
00035 #define UTM_ZONE 2
00036 #define UTM_SOUTH 3
00037
00038 class SoProjection;
00039
00098 class SbProj4Projection : public SbProjection
00099 {
00100
00101 public:
00102
00106 enum CoordinateSystem
00107 {
00108 GEOCENTRIC = 0,
00109 GEODETIC,
00110 NUM_COORDINATE_SYSTEMS
00111 };
00112
00116 enum PredefinedEllipsoid
00117 {
00118 SPHERE = 0,
00119 AIRY ,
00120 AIRYM ,
00121 ANDRAE ,
00122 APL ,
00123 AUST_SA ,
00124 BESSEL ,
00125 BESS_NAM ,
00126 CLRK66 ,
00127 CLRK80 ,
00128 CPM ,
00129 DELMBR ,
00130 ENGELIS ,
00131 EVRST30 ,
00132 EVRST48 ,
00133 EVRST56 ,
00134 EVRST69 ,
00135 EVRSTSS ,
00136 FSCHR60 ,
00137 FSCHR60M ,
00138 FSCHR68 ,
00139 GRS67 ,
00140 GRS80 ,
00141 HELMERT ,
00142 HOUGH ,
00143 IAU76 ,
00144 INTL ,
00145 KAULA ,
00146 KRASS ,
00147 LERCH ,
00148 MERIT ,
00149 MPRTS ,
00150 NEW_INTL ,
00151 NWL9D ,
00152 PLESSIS ,
00153 SE_ASIA ,
00154 SGS85 ,
00155 WALBECK ,
00156 WGS60 ,
00157 WGS66 ,
00158 WGS72 ,
00159 WGS84 ,
00160 NUM_ELLIPSOIDS
00161 };
00162
00166 enum Projection
00167 {
00168 CASSINI,
00169 EQUAL_AREA_CYLINDRICAL,
00170 COLLIGNON,
00171 CRASTER_PARABOLIC,
00172 ECKERT_I,
00173 ECKERT_II,
00174 ECKERT_III,
00175 ECKERT_IV,
00176 ECKERT_V,
00177 ECKERT_VI,
00178 EQUIDISTANT_CYLINDRICAL,
00179 FAHEY,
00180 FOUCAUT_SINUSOIDAL,
00181 GALL,
00182 GEOCENTRIC_PROJ,
00183 HATANO_ASYMMETRICAL_EQUAL_AREA,
00184 KAVRAISKY_VII,
00185 KROVAK,
00186 LAMBERT_AZIMUTHAL_EQUAL_AREA,
00187 LAT_LONG ,
00188 LONG_LAT ,
00189 LAMBERT_EQUAL_AREA_CONIC,
00190 LOXIMUTHAL,
00191 MCBRYDE_THOMAS_FLAT_POLE_SINE,
00192 MCBRYDE_THOMAS_FLAT_POLAR_PARABOLIC,
00193 MCBRYDE_THOMAS_FLAT_POLAR_QUARTIC,
00194 MCBRYDE_THOMAS_FLAT_POLAR_SINUSOIDAL,
00195 MERCATOR,
00196 MILLER_CYLINDRICAL,
00197 MOLLWEIDE,
00198 NELL,
00199 NELL_HAMMER,
00200 OBLIQUE_CYLINDRICAL_EQUAL_AREA,
00201 POLYCONIC,
00202 PUTNINS_P1,
00203 PUTNINS_P2,
00204 PUTNINS_P3_2,
00205 PUTNINS_P4_2,
00206 PUTNINS_P5,
00207 PUTNINS_P5_2,
00208 PUTNINS_P6,
00209 PUTNINS_P6_2,
00210 ROBINSON,
00211 SINUSOIDAL,
00212 SWISS_OBL_MERCATOR,
00213 OBLIQUE_STEREOGRAPHIC_ALTERNATIVE,
00214 TRANSVERSE_CYLINDRICAL_EQUAL_AREA,
00215 TRANSVERSE_MERCATOR,
00216 UNIVERSAL_POLAR_STEREOGRAPHIC,
00217 UNIVERSAL_TRANSVERSE_MERCATOR,
00218 VAN_DER_GRINTEN_I,
00219 WAGNER_I,
00220 WAGNER_II,
00221 WAGNER_III,
00222 WAGNER_IV,
00223 WAGNER_V,
00224 WAGNER_VI,
00225 WERENSKIOLD_I,
00226 WINKEL_I,
00227 WINKEL_TRIPEL,
00228 NUM_PROJ4_PROJECTIONS
00229 };
00230
00234 SbProj4Projection();
00235
00239 SbProj4Projection( SoProjection *node );
00240
00244 SbProj4Projection( const SbProj4Projection &proj );
00245
00249 virtual ~SbProj4Projection();
00250
00254 void setEllipsoid( SbProj4Projection::PredefinedEllipsoid ellipsoid );
00255
00259 SbProj4Projection::PredefinedEllipsoid getEllipsoid();
00260
00264 void setEllipsoidIn( SbProj4Projection::PredefinedEllipsoid ellipsoid );
00265
00269 SbProj4Projection::PredefinedEllipsoid getEllipsoidIn();
00270
00274 static SbString getEllipsoidString( SbProj4Projection::PredefinedEllipsoid ellipsoid );
00275
00279 void setCoordinateSystem( SbProj4Projection::CoordinateSystem coordinateSystem );
00280
00284 SbProj4Projection::CoordinateSystem getCoordinateSystem();
00285
00289 void setProjection( SbProj4Projection::Projection proj );
00290
00294 SbProj4Projection::Projection getProjection( );
00295
00299 void setProjectionIn( SbProj4Projection::Projection proj );
00300
00304 SbProj4Projection::Projection getProjectionIn();
00305
00309 void setUTMZone( int zone );
00310
00314 int getUTMZone();
00315
00319 void setUTMSouth( bool south );
00320
00324 bool isUTMSouth();
00325
00329 void setRevertCoord( bool revertCoordNeeded ) { m_revertCoordNeeded = revertCoordNeeded; };
00330
00334 bool isRevertCoordNeeded() { return m_revertCoordNeeded; };
00335
00339 static SbString getProjectionString( SbProj4Projection::Projection proj );
00340
00344 static SbString getProjectionName( SbProj4Projection::Projection proj );
00345
00349 virtual void init();
00350
00354 virtual void exit();
00355
00359 virtual void inverse( SbVec3f &point );
00360
00364 void toGeodetic( SbVec3f &point );
00365
00369 void toGeocentric( SbVec3f &point );
00370
00371 SoEXTENDER_Documented private:
00375 virtual void apply( SbVec3f &point );
00376
00377 private:
00378
00379
00380 virtual void internalSetParameter( int parameterId, const SbString ¶meterString, SbBool notifyNode = TRUE, SbBool callInit = TRUE);
00381
00382
00383 virtual void internalSetParameter( int parameterId, const float ¶meterString, SbBool notifyNode = TRUE, SbBool callInit = TRUE)
00384 { SbProjection::internalSetParameter( parameterId, parameterString, notifyNode , callInit ); }
00385
00386 private:
00387
00388 void internalInit();
00389
00393 void initProj4Params();
00394
00395
00396 SbProj4Projection::PredefinedEllipsoid m_ellipsoid;
00397
00398
00399 SbProj4Projection::PredefinedEllipsoid m_ellipsoidIn;
00400
00401
00402 SbProj4Projection::CoordinateSystem m_coordinateSystem;
00403
00404
00405 bool m_firstInit;
00406
00407
00408
00409 double m_lon0;
00410
00411
00412 int m_zone;
00413
00414
00415 bool m_south;
00416
00417 bool m_revertCoordNeeded;
00418
00419
00420 int m_numProjections;
00421
00422
00423 int m_projID;
00424
00425
00426 int m_projInID;
00427
00428
00429 void *m_projType;
00430
00431
00432 void *m_projTypeIn;
00433 };
00434
00435 #endif
00436
00437