00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : G.TALLEC (Sep 2007) 00022 **=======================================================================*/ 00023 00024 00025 #ifndef _SO_GEO_PROJECTION_ 00026 #define _SO_GEO_PROJECTION_ 00027 00028 #include <Inventor/nodes/SoProjection.h> 00029 #include <Inventor/projection/SbProj4Projection.h> 00030 00031 class SbProj4Projection; 00032 00088 class SoGeoProjection : public SoProjection 00089 { 00090 00091 SO_NODE_HEADER(SoGeoProjection); 00092 00093 public: 00094 00098 SoGeoProjection(); 00099 00104 SoSFEnum ellipsoid; 00105 00110 SoSFEnum coordinateSystem; 00111 00116 SoSFEnum projection; 00117 00118 private: 00119 00120 static void initClass(); 00121 static void exitClass(); 00122 00127 static bool changeCoordSys( SbProj4Projection::CoordinateSystem originCoordSys, SbProj4Projection::CoordinateSystem destCoordSys, SbVec3f &coord ); 00128 00129 // return static instance 00130 static SoGeoProjection* getInstance(); 00131 00132 void setProj( SbProj4Projection::Projection proj ); 00133 00134 void setEllipsoidIn( SbProj4Projection::PredefinedEllipsoid ellipsoid ); 00135 00136 void setProjIn( SbProj4Projection::Projection proj ); 00137 00138 void setUTMZone( int zone ); 00139 00140 void setUTMSouth( bool south ); 00141 00142 SbProj4Projection::PredefinedEllipsoid getEllipsoidIn(); 00143 00144 SbProj4Projection::Projection getProjIn(); 00145 00146 int getUTMZone(); 00147 00148 bool isUTMSouth(); 00149 00150 void setRevertCoord( bool revertCoordNeeded ) { m_proj4Projection->setRevertCoord( revertCoordNeeded ); }; 00151 00152 bool isRevertCoordNeeded() { return m_proj4Projection->isRevertCoordNeeded(); }; 00153 00157 static void ellipsoidChangedCB( void *data, SoSensor* ); 00158 00159 static void coordinateChangedCB( void *data, SoSensor* ); 00160 00161 static void projIdChangedCB( void *data, SoSensor* ); 00162 00163 static void projectionChangedCB( void *data, SoSensor* ); 00164 00165 private: 00166 00167 //static instance for system coordinate change 00168 static SoGeoProjection* m_geoProjection; 00169 00170 //Internal proj4 projection 00171 SbProj4Projection* m_proj4Projection; 00172 00176 virtual ~SoGeoProjection(); 00177 00178 //Called if projection type id has changed 00179 SoFieldSensor* m_typeIdSensor; 00180 00181 // Field sensors 00182 SoFieldSensor* m_projectionSensor; 00183 SoFieldSensor* m_ellipsoidSensor; 00184 SoFieldSensor* m_coordinateSensor; 00185 }; 00186 00187 #endif /* _SO_GEO_PROJECTION_ */ 00188 00189