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-2014 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 00087 class SoGeoProjection : public SoProjection 00088 { 00089 00090 SO_NODE_HEADER(SoGeoProjection); 00091 00092 public: 00093 00097 SoGeoProjection(); 00098 00103 SoSFEnum ellipsoid; 00104 00109 SoSFEnum coordinateSystem; 00110 00115 SoSFEnum projection; 00116 00117 private: 00118 00119 static void initClass(); 00120 static void exitClass(); 00121 00126 static bool changeCoordSys( SbProj4Projection::CoordinateSystem originCoordSys, SbProj4Projection::CoordinateSystem destCoordSys, SbVec3f &coord ); 00127 00128 // return static instance 00129 static SoGeoProjection* getInstance(); 00130 00131 void setProj( SbProj4Projection::Projection proj ); 00132 00133 void setEllipsoidIn( SbProj4Projection::PredefinedEllipsoid ellipsoid ); 00134 00135 void setProjIn( SbProj4Projection::Projection proj ); 00136 00137 void setUTMZone( int zone ); 00138 00139 void setUTMSouth( bool south ); 00140 00141 SbProj4Projection::PredefinedEllipsoid getEllipsoidIn(); 00142 00143 SbProj4Projection::Projection getProjIn(); 00144 00145 int getUTMZone(); 00146 00147 bool isUTMSouth(); 00148 00149 void setRevertCoord( bool revertCoordNeeded ) { m_proj4Projection->setRevertCoord( revertCoordNeeded ); }; 00150 00151 bool isRevertCoordNeeded() { return m_proj4Projection->isRevertCoordNeeded(); }; 00152 00156 static void ellipsoidChangedCB( void *data, SoSensor* ); 00157 00158 static void coordinateChangedCB( void *data, SoSensor* ); 00159 00160 static void projIdChangedCB( void *data, SoSensor* ); 00161 00162 static void projectionChangedCB( void *data, SoSensor* ); 00163 00164 private: 00165 00166 //static instance for system coordinate change 00167 static SoGeoProjection* m_geoProjection; 00168 00169 //Internal proj4 projection 00170 SbProj4Projection* m_proj4Projection; 00171 00175 virtual ~SoGeoProjection(); 00176 00177 //Called if projection type id has changed 00178 SoFieldSensor* m_typeIdSensor; 00179 00180 // Field sensors 00181 SoFieldSensor* m_projectionSensor; 00182 SoFieldSensor* m_ellipsoidSensor; 00183 SoFieldSensor* m_coordinateSensor; 00184 }; 00185 00186 #endif /* _SO_GEO_PROJECTION_ */ 00187 00188