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
00097 class SbProj4Projection : public SbProjection
00098 {
00099
00100 public:
00101
00105 enum CoordinateSystem
00106 {
00107 GEOCENTRIC = 0,
00108 GEODETIC,
00109 NUM_COORDINATE_SYSTEMS
00110 };
00111
00115 enum PredefinedEllipsoid
00116 {
00117 SPHERE = 0,
00118 AIRY ,
00119 AIRYM ,
00120 ANDRAE ,
00121 APL ,
00122 AUST_SA ,
00123 BESSEL ,
00124 BESS_NAM ,
00125 CLRK66 ,
00126 CLRK80 ,
00127 CPM ,
00128 DELMBR ,
00129 ENGELIS ,
00130 EVRST30 ,
00131 EVRST48 ,
00132 EVRST56 ,
00133 EVRST69 ,
00134 EVRSTSS ,
00135 FSCHR60 ,
00136 FSCHR60M ,
00137 FSCHR68 ,
00138 GRS67 ,
00139 GRS80 ,
00140 HELMERT ,
00141 HOUGH ,
00142 IAU76 ,
00143 INTL ,
00144 KAULA ,
00145 KRASS ,
00146 LERCH ,
00147 MERIT ,
00148 MPRTS ,
00149 NEW_INTL ,
00150 NWL9D ,
00151 PLESSIS ,
00152 SE_ASIA ,
00153 SGS85 ,
00154 WALBECK ,
00155 WGS60 ,
00156 WGS66 ,
00157 WGS72 ,
00158 WGS84 ,
00159 NUM_ELLIPSOIDS
00160 };
00161
00165 enum Projection
00166 {
00167 CASSINI,
00168 EQUAL_AREA_CYLINDRICAL,
00169 COLLIGNON,
00170 CRASTER_PARABOLIC,
00171 ECKERT_I,
00172 ECKERT_II,
00173 ECKERT_III,
00174 ECKERT_IV,
00175 ECKERT_V,
00176 ECKERT_VI,
00177 EQUIDISTANT_CYLINDRICAL,
00178 FAHEY,
00179 FOUCAUT_SINUSOIDAL,
00180 GALL,
00181 GEOCENTRIC_PROJ,
00182 HATANO_ASYMMETRICAL_EQUAL_AREA,
00183 KAVRAISKY_VII,
00184 KROVAK,
00185 LAMBERT_AZIMUTHAL_EQUAL_AREA,
00186 LAT_LONG ,
00187 LONG_LAT ,
00188 LAMBERT_EQUAL_AREA_CONIC,
00189 LOXIMUTHAL,
00190 MCBRYDE_THOMAS_FLAT_POLE_SINE,
00191 MCBRYDE_THOMAS_FLAT_POLAR_PARABOLIC,
00192 MCBRYDE_THOMAS_FLAT_POLAR_QUARTIC,
00193 MCBRYDE_THOMAS_FLAT_POLAR_SINUSOIDAL,
00194 MERCATOR,
00195 MILLER_CYLINDRICAL,
00196 MOLLWEIDE,
00197 NELL,
00198 NELL_HAMMER,
00199 OBLIQUE_CYLINDRICAL_EQUAL_AREA,
00200 POLYCONIC,
00201 PUTNINS_P1,
00202 PUTNINS_P2,
00203 PUTNINS_P3_2,
00204 PUTNINS_P4_2,
00205 PUTNINS_P5,
00206 PUTNINS_P5_2,
00207 PUTNINS_P6,
00208 PUTNINS_P6_2,
00209 ROBINSON,
00210 SINUSOIDAL,
00211 SWISS_OBL_MERCATOR,
00212 OBLIQUE_STEREOGRAPHIC_ALTERNATIVE,
00213 TRANSVERSE_CYLINDRICAL_EQUAL_AREA,
00214 TRANSVERSE_MERCATOR,
00215 UNIVERSAL_POLAR_STEREOGRAPHIC,
00216 UNIVERSAL_TRANSVERSE_MERCATOR,
00217 VAN_DER_GRINTEN_I,
00218 WAGNER_I,
00219 WAGNER_II,
00220 WAGNER_III,
00221 WAGNER_IV,
00222 WAGNER_V,
00223 WAGNER_VI,
00224 WERENSKIOLD_I,
00225 WINKEL_I,
00226 WINKEL_TRIPEL,
00227 NUM_PROJ4_PROJECTIONS
00228 };
00229
00233 SbProj4Projection();
00234
00238 SbProj4Projection( SoProjection *node );
00239
00243 SbProj4Projection( const SbProj4Projection &proj );
00244
00248 virtual ~SbProj4Projection();
00249
00253 void setEllipsoid( SbProj4Projection::PredefinedEllipsoid ellipsoid );
00254
00258 SbProj4Projection::PredefinedEllipsoid getEllipsoid();
00259
00263 void setEllipsoidIn( SbProj4Projection::PredefinedEllipsoid ellipsoid );
00264
00268 SbProj4Projection::PredefinedEllipsoid getEllipsoidIn();
00269
00273 static SbString getEllipsoidString( SbProj4Projection::PredefinedEllipsoid ellipsoid );
00274
00278 void setCoordinateSystem( SbProj4Projection::CoordinateSystem coordinateSystem );
00279
00283 SbProj4Projection::CoordinateSystem getCoordinateSystem();
00284
00288 void setProjection( SbProj4Projection::Projection proj );
00289
00293 SbProj4Projection::Projection getProjection( );
00294
00298 void setProjectionIn( SbProj4Projection::Projection proj );
00299
00303 SbProj4Projection::Projection getProjectionIn();
00304
00308 void setUTMZone( int zone );
00309
00313 int getUTMZone();
00314
00318 void setUTMSouth( bool south );
00319
00323 bool isUTMSouth();
00324
00328 void setRevertCoord( bool revertCoordNeeded ) { m_revertCoordNeeded = revertCoordNeeded; };
00329
00333 bool isRevertCoordNeeded() { return m_revertCoordNeeded; };
00334
00338 static SbString getProjectionString( SbProj4Projection::Projection proj );
00339
00343 static SbString getProjectionName( SbProj4Projection::Projection proj );
00344
00348 virtual void init();
00349
00353 virtual void exit();
00354
00358 virtual void inverse( SbVec3f &point );
00359
00363 void toGeodetic( SbVec3f &point );
00364
00368 void toGeocentric( SbVec3f &point );
00369
00370 SoEXTENDER_Documented private:
00374 virtual void apply( SbVec3f &point );
00375
00376 private:
00377
00378
00379 virtual void internalSetParameter( int parameterId, const SbString ¶meterString, SbBool notifyNode = TRUE, SbBool callInit = TRUE);
00380
00381
00382 virtual void internalSetParameter( int parameterId, const float ¶meterString, SbBool notifyNode = TRUE, SbBool callInit = TRUE)
00383 { SbProjection::internalSetParameter( parameterId, parameterString, notifyNode , callInit ); }
00384
00385 private:
00386
00387 void internalInit();
00388
00392 void initProj4Params();
00393
00394
00395 SbProj4Projection::PredefinedEllipsoid m_ellipsoid;
00396
00397
00398 SbProj4Projection::PredefinedEllipsoid m_ellipsoidIn;
00399
00400
00401 SbProj4Projection::CoordinateSystem m_coordinateSystem;
00402
00403
00404 bool m_firstInit;
00405
00406
00407
00408 double m_lon0;
00409
00410
00411 int m_zone;
00412
00413
00414 bool m_south;
00415
00416 bool m_revertCoordNeeded;
00417
00418
00419 int m_numProjections;
00420
00421
00422 int m_projID;
00423
00424
00425 int m_projInID;
00426
00427
00428 void *m_projType;
00429
00430
00431 void *m_projTypeIn;
00432 };
00433
00434 #endif
00435
00436