00001 /** 00002 * \file rvc/georefer.h 00003 * \brief interface for the RVC::GEOREFERENCE class. 00004 * 00005 * \if NODOC 00006 * $Id: georefer.h_v 1.30 2005/04/05 22:11:36 scowan Exp $ 00007 * 00008 * $Log: georefer.h_v $ 00009 * Revision 1.30 2005/04/05 22:11:36 scowan 00010 * Chagne set CRS method to validatre CRS and return error if needed. 00011 * 00012 * Revision 1.29 2005/03/15 17:32:31 scowan 00013 * Removed deprecated method. 00014 * 00015 * Revision 1.28 2005/03/15 00:35:09 scowan 00016 * Removed unused member. 00017 * 00018 * Revision 1.27 2005/03/14 16:39:30 scowan 00019 * Removed getProjParm. 00020 * 00021 * Revision 1.26 2005/03/03 23:57:34 scowan 00022 * Allow method to get affine matrix. 00023 * 00024 * Revision 1.25 2005/01/19 23:39:01 scowan 00025 * Support of descriptor class. 00026 * 00027 * Revision 1.24 2005/01/11 21:52:59 scowan 00028 * Deprecated map proj parm methods. 00029 * 00030 * Revision 1.23 2004/06/21 17:19:21 scowan 00031 * Added coord ref sys methods. 00032 * 00033 * Revision 1.22 2004/05/12 21:45:09 scowan 00034 * Fixed docs for added methods. 00035 * 00036 * Revision 1.21 2004/05/12 17:08:46 scowan 00037 * Added method. 00038 * 00039 * Revision 1.20 2004/05/11 23:07:40 scowan 00040 * Added boundary methods. 00041 * 00042 * Revision 1.19 2004/01/28 23:02:36 scowan 00043 * Change 3d sheet to mani fold. 00044 * 00045 * Revision 1.18 2004/01/20 23:22:02 scowan 00046 * Updated 3dsheet. 00047 * 00048 * Revision 1.17 2003/12/19 21:07:45 scowan 00049 * Finialized (for now) the new georefernce interface. 00050 * 00051 * Revision 1.16 2003/12/12 22:34:23 scowan 00052 * Added more methods. 00053 * 00054 * Revision 1.15 2003/12/12 18:05:06 scowan 00055 * Updated some items. 00056 * 00057 * Revision 1.14 2003/12/12 17:13:23 scowan 00058 * Added new set of API's. 00059 * 00060 * Revision 1.13 2003/10/07 17:32:49 scowan 00061 * Object virtual method changes. 00062 * 00063 * Revision 1.12 2003/09/30 16:52:06 dwilliss 00064 * Doxygen 00065 * 00066 * Revision 1.11 2003/09/25 21:20:04 dwilliss 00067 * Fixed doxygen comment 00068 * 00069 * Revision 1.10 2003/09/15 13:49:45 fileserver!dwilliss 00070 * Doxygen 00071 * 00072 * Revision 1.9 2003/07/23 20:11:48 mju 00073 * Add GEOREFTYPE_AffineMatrix so meaning clearer. 00074 * 00075 * Revision 1.8 2002/04/26 22:44:27 scowan 00076 * Added more methods. 00077 * 00078 * Revision 1.7 2001/09/05 21:05:33 scowan 00079 * Added conversion methods on the source coordinates. 00080 * 00081 * Revision 1.6 2001/06/13 21:45:32 scowan 00082 * Added to RVC namespace. 00083 * 00084 * Revision 1.5 2001/06/13 14:55:09 scowan 00085 * Changed objtype enum. 00086 * 00087 * Revision 1.3 2001/05/25 14:55:33 scowan 00088 * Fixed const errors. 00089 * 00090 * Revision 1.2 2000/10/19 17:55:52 scowan 00091 * Checked in for vacation. 00092 * 00093 * Revision 1.1 2000/09/29 16:25:29 scowan 00094 * Initial revision 00095 * 00096 * \endif 00097 **/ 00098 00099 //! \class RVC::GEOREFERENCE rvc/georefer.h 00100 //! \brief Manages RVC::OBJTYPE_Georeference RVC objects. 00101 //! 00102 //! The interface currently wraps the MfGeoref functions. 00103 //! 00104 //! RVC Object Types that this class supports: RVC::OBJTYPE_Georeference. 00105 //! 00106 //! Default RVC Object Type for this class: RVC::OBJTYPE_Georeference. 00107 //! 00108 //! Valid parents for this class: 00109 //! - RVC::OBJTYPE_Vector 00110 //! - RVC::OBJTYPE_TIN 00111 //! - RVC::OBJTYPE_CAD 00112 //! - RVC::OBJTYPE_Raster 00113 //! - RVC::OBJTYPE_RasterSet 00114 //! - RVC::OBJTYPE_Hyperspectral 00115 //! 00116 //! Read() and Write() methods inherited from RVC::SIMPLE class. View RVC::SIMPLE docs for inherited methods 00117 00118 #ifndef INC_RVC_GEOREFER_H 00119 #define INC_RVC_GEOREFER_H 00120 00121 #ifndef INC_RVC_SIMPLE_H 00122 #include <rvc/simple.h> 00123 #endif 00124 00125 #ifndef INC_MI32_TRANS2DC_H 00126 #include <mi32/trans2dc.h> 00127 #endif 00128 00129 #ifndef INC_MI32_TRANSMOD_H 00130 #include <mi32/transmod.h> 00131 #endif 00132 00133 #ifndef INC_MI32_SIMPLEAR_H 00134 #include <mi32/simplear.h> 00135 #endif 00136 00137 #ifndef INC_MI32_SPATREF_H 00138 #include <mi32/spatref.h> 00139 #endif 00140 00141 namespace RVC { 00142 00143 #ifndef GENERATING_DOXYGEN_OUTPUT 00144 class GEOREFHANDLE; 00145 #endif 00146 00147 class GEOREFERENCE : public SIMPLE { 00148 public: 00149 00150 //! Type of georeference 00151 enum GEOREFTYPE { 00152 GEOREFTYPE_Implied = 5, //!< Georeference information is implied in the data 00153 GEOREFTYPE_AffineMatrix = 6, //!< Affine transformation matrix 00154 GEOREFTYPE_Matrix = GEOREFTYPE_AffineMatrix, 00155 GEOREFTYPE_CtrlPoint = 7, //!< List of CTRLPOINT3's 00156 GEOREFTYPE_Manifold = 8 //!< Set of CTRLPOINT3's to create a Manifold on 00157 }; 00158 00159 struct CTRLPTEDGE { 00160 INT32 m_StartCtrlPtID; 00161 INT32 m_EndCtrlPtID; 00162 }; 00163 00164 //! Default Constructor 00165 GEOREFERENCE ( 00166 ); 00167 00168 //! Copy Constructor 00169 GEOREFERENCE ( 00170 const RVC::GEOREFERENCE& rhs 00171 ); 00172 00173 //! Destructor 00174 virtual ~GEOREFERENCE ( 00175 ); 00176 00177 //! Assignment 00178 RVC::GEOREFERENCE& operator= ( 00179 const RVC::GEOREFERENCE& rhs 00180 ); 00181 00182 //! Add a georeference boundary control point array to the list of boundary control point arrays 00183 //! Only works for extented georeference objects 00184 //! @return Number of the added boundary control point array 00185 INT32 AddBoundary ( 00186 const SIMPLE_ARRAY<INT32>& Boundary 00187 ); 00188 00189 //! Add a georeference control point to the list of control points 00190 //! Works for either basic or extented georeference objects 00191 //! @return Number of the added control point 00192 INT32 AddCtrlPoint ( 00193 const CTRLPOINT3& CtrlPoint 00194 ); 00195 00196 //! Add a georeference control point edge entry to the list of control points edge entries 00197 //! Only works for extented georeference objects 00198 //! @return Number of the added control point edge entry 00199 INT32 AddCtrlPointEdge ( 00200 const CTRLPTEDGE& CtrlPtEdge 00201 ); 00202 00203 //! Clear out all georeference control point array entries 00204 //! Only works for extented georeference objects 00205 ERRVALUE ClearBoundaries ( 00206 ); 00207 00208 //! Clear out all georeference control point entries 00209 //! Works for either basic or extented georeference objects. 00210 ERRVALUE ClearCtrlPoints ( 00211 ); 00212 00213 //! Clear out all georeference control point edge entries 00214 //! Only works for extented georeference objects 00215 ERRVALUE ClearCtrlPointEdges ( 00216 ); 00217 00218 //! Convert control point list 'source' coordinates using an affine transformation 00219 //! Only works for internally stored ctrl point lists, does not affect disabled ctrl points 00220 ERRVALUE ConvertForward ( 00221 const TRANS2D_AFFINE& Affine 00222 ); 00223 00224 //! Convert control point list 'source' coordinates using an affine transformation 00225 //! Only works for internally stored ctrl point lists, does not affect disabled ctrl points 00226 ERRVALUE ConvertInverse ( 00227 const TRANS2D_AFFINE& Affine 00228 ); 00229 00230 //! Convert control point list 'source' coordinates using an TRANS2D_MAPGEN transformation 00231 //! Only works for internally stored ctrl point lists, does not affect disabled ctrl points 00232 ERRVALUE ConvertForward ( 00233 const TRANS2D_MAPGEN& tmg 00234 ); 00235 00236 //! Convert control point list 'source' coordinates using an TRANS2D_MAPGEN transformation 00237 //! Only works for internally stored ctrl point lists, does not affect disabled ctrl points 00238 ERRVALUE ConvertInverse ( 00239 const TRANS2D_MAPGEN& tmg 00240 ); 00241 00242 //! Convert a basic georeference object to an extented georeference object 00243 //! Only works for basic georeference objects 00244 ERRVALUE ConvertToExtended ( 00245 ); 00246 00247 //! Delete a control point at the location specified 00248 //! Maintains the order of the control point list 00249 //! Works for either basic or extented georeference objects. 00250 ERRVALUE DeleteCtrlPoint ( 00251 INT32 CtrlPointNum 00252 ); 00253 00254 //! Delete a control point edge entry at the location specified 00255 //! Maintains the order of the control point edge list 00256 //! Only works for extented georeference objects 00257 ERRVALUE DeleteCtrlPointEdge ( 00258 INT32 CtrlPointEdgeNum 00259 ); 00260 00261 //! Get georeference affine matrix. Only value if GetGeorefType() == GEOREFTYPE_AffineMatrix 00262 //! @return Affine matrix 00263 const TRANS2D_AFFINE& GetAffineMatrix ( 00264 ) const; 00265 00266 //! Obtain the calibration / translation model from the rvc georeference object 00267 //! @return calibration / translation model class instance 00268 TRANSMODEL GetCalibModel ( 00269 ) const; 00270 00271 //! Get georeference Coordinate reference system parameters 00272 //! @return Coordinate reference system parameters to use 00273 const SPATREF::COORDREFSYS& GetCoordRefSys ( 00274 ) const; 00275 00276 //! Obtain the georeference type 00277 //! @return Georeference Type 00278 GEOREFTYPE GetGeorefType ( 00279 ) const; 00280 00281 //! Generate a TRANS2D_MAPGEN from the georeference instance 00282 ERRVALUE GetMapTrans ( 00283 TRANS2D_MAPGEN& tmg, //!< Generic transformation generated and RETURNED 00284 bool DoOutput = false, //!< Place transformation on output side if true 00285 TRANSMODEL model = 0 //!< Translation model, zero sets up the default model 00286 ) const; 00287 00288 //! Get the number of boundary control point array items 00289 //! Only works for extented georeference objects 00290 //! @return Number of boundary control point array entries 00291 INT32 GetNumBoundaries ( 00292 ); 00293 00294 //! Get the number of control points 00295 //! Works for either basic or extented georeference objects 00296 //! @return Number of control points 00297 INT32 GetNumCtrlPoints ( 00298 ); 00299 00300 //! Get the number of control points edge entries 00301 //! Only works for extented georeference objects 00302 //! @return Number of control point edge entries 00303 INT32 GetNumCtrlPointEdges ( 00304 ); 00305 00306 //! Generate a control point list from the georeference 00307 //! This method will generate control points if the georeference is not a control point georeference 00308 ERRVALUE GetPointList ( 00309 SIMPLE_ARRAY<CTRLPOINT3>& CtrlList //!< Control point list allocated and returned 00310 ) const; 00311 00312 //! Insert a control point at the location specified 00313 //! Maintains the order of the control point list 00314 //! Works for either basic or extented georeference objects. 00315 ERRVALUE InsertCtrlPoint ( 00316 INT32 CtrlPointNum, 00317 const CTRLPOINT3& CtrlPoint 00318 ); 00319 00320 //! Insert a control point edge entry at the location specified 00321 //! Maintains the order of the control point edge list 00322 //! Works for extented georeference objects only. 00323 ERRVALUE InsertCtrlPointEdge ( 00324 INT32 CtrlPointEdgeNum, 00325 const CTRLPTEDGE& CtrlPtEdge 00326 ); 00327 00328 //! Determine if the georeference object is basic or extented 00329 //! @return 'True' if the georeference object is basic, 'false' if extented 00330 bool IsBasicFormat ( 00331 ); 00332 00333 //! Determine if the referenced control point is enabled 00334 //! Works for either basic or extented georeference objects. Standard georeference objects always return 'true' 00335 //! @return 'True' if the control point is enabled, 'false' if not 00336 bool IsCtrlPointEnabled ( 00337 INT32 CtrlPointIndex 00338 ); 00339 00340 //! Determine if the two georeference objects are equivalent 00341 //! @return 'True' if the georeference information is equivalent, 'false' if not 00342 bool IsEquivalentTo ( 00343 const RVC::GEOREFERENCE& GeorefObj 00344 ) const; 00345 00346 //! Read a specific georeference boundary control point array entry 00347 //! Only works for extented georeference objects 00348 ERRVALUE ReadBoundary ( 00349 INT32 BoundaryIndex, 00350 SIMPLE_ARRAY<INT32>& Boundary 00351 ); 00352 00353 //! Read a specific georeference control point 00354 //! Works for either basic or extented georeference objects. 00355 ERRVALUE ReadCtrlPoint ( 00356 INT32 CtrlPointIndex, 00357 CTRLPOINT3& CtrlPoint 00358 ); 00359 00360 //! Read a specific georeference control point edge entry 00361 //! Only works for extented georeference objects 00362 ERRVALUE ReadCtrlPointEdge ( 00363 INT32 CtrlPointEdgeIndex, 00364 CTRLPTEDGE& CtrlPtEdge 00365 ); 00366 00367 //! Read a specific georeference control point ID entry 00368 //! Enhanced georeference objects can store an ID value associated with the control point 00369 //! Only works for extented georeference objects 00370 INT32 ReadCtrlPointID ( 00371 INT32 CtrlPointIndex 00372 ); 00373 00374 //! Read a specific georeference control point name entry 00375 //! Enhanced georeference objects can store a name value associated with the control point 00376 //! Only works for extented georeference objects 00377 ERRVALUE ReadCtrlPointName ( 00378 INT32 CtrlPointIndex, 00379 MISTRING& CtrlPointName 00380 ); 00381 00382 //! Set the number of control point edge entries 00383 //! Only works for extented georeference objects 00384 ERRVALUE ResizeCtrlPointEdges ( 00385 INT32 NumCtrlPointEdges 00386 ); 00387 00388 //! Set the number of control points 00389 //! Works for either basic or extented georeference objects. 00390 ERRVALUE ResizeCtrlPoints ( 00391 INT32 NumCtrlPoints 00392 ); 00393 00394 //! Set georeference to be a Manifold georeference 00395 void SetManifold ( 00396 ); 00397 00398 //! Set georeference to be an affine transformation 00399 void SetAffine ( 00400 const TRANS2D_AFFINE& taf //!< Affine transformation to set in georeference 00401 ); 00402 00403 //! Set calibration model 00404 void SetCalibModel ( 00405 const TRANSMODEL& model //!< Calibration / translation model to use 00406 ); 00407 00408 //! Set georeference Coordinate reference system parameters 00409 ERRVALUE SetCoordRefSys ( 00410 const SPATREF::COORDREFSYS& CoordRefSys //!< Coordinate reference system parameters to use 00411 ); 00412 00413 //! Set the specified control point to be enabled or disabled 00414 //! Only works for extented georeference objects 00415 ERRVALUE SetCtrlPointEnabled ( 00416 INT32 CtrlPointIndex, 00417 bool IsEnabled 00418 ); 00419 00420 //! Set georeference to be an implied transformation 00421 void SetImplied ( 00422 ); 00423 00424 //! Set georeference to be an control point transformation 00425 ERRVALUE SetPointList ( 00426 const SIMPLE_ARRAY<CTRLPOINT3>& CtrlList //!< Control point list to use 00427 ); 00428 00429 //! Write a specific georeference boundary control point array entry 00430 //! Only works for extented georeference objects 00431 ERRVALUE WriteBoundary ( 00432 INT32 BoundaryIndex, 00433 const SIMPLE_ARRAY<INT32>& Boundary 00434 ); 00435 00436 //! Write a specific georeference control point. Use AddCtrlPoint() to add control points to the list 00437 //! Works for either basic or extented georeference objects. 00438 ERRVALUE WriteCtrlPoint ( 00439 INT32 CtrlPointIndex, 00440 const CTRLPOINT3& CtrlPoint 00441 ); 00442 00443 //! Write a specific georeference control point edge entry 00444 //! Only works for extented georeference objects 00445 ERRVALUE WriteCtrlPointEdge ( 00446 INT32 CtrlPointEdgeIndex, 00447 const CTRLPTEDGE& CtrlPtEdge 00448 ); 00449 00450 //! Write a specific georeference control point name entry 00451 //! Enhanced georeference objects can store an ID value associated with the control point 00452 //! Only works for extented georeference objects 00453 ERRVALUE WriteCtrlPointID ( 00454 INT32 CtrlPointIndex, 00455 INT32 CtrlPointID 00456 ); 00457 00458 //! Write a specific georeference control point name entry 00459 //! Enhanced georeference objects can store a name value associated with the control point 00460 //! Only works for extented georeference objects 00461 ERRVALUE WriteCtrlPointName ( 00462 INT32 CtrlPointIndex, 00463 const MISTRING& CtrlPointName 00464 ); 00465 00466 private: 00467 #ifndef GENERATING_DOXYGEN_OUTPUT 00468 00469 //! Implementation of RVC::OBJECT virtual methods 00470 virtual ERRVALUE v_CloseObject (); 00471 virtual RVC::OBJTYPE v_GetDftObjectType () const; 00472 virtual bool v_IsObjectOpen () const; 00473 virtual ERRVALUE v_OpenObject (OPENMODE OpenMode, MDLGPARENT parent); 00474 00475 //! Implementation of RVC::SIMPLE virtual methods 00476 virtual ERRVALUE v_GetDftNameDesc (const OBJECT& parent, DESCRIPTOR& Descriptor); 00477 virtual ERRVALUE v_ReadData (); 00478 virtual ERRVALUE v_WriteData (const RVCGENINFO& ginfo); 00479 00480 ERRVALUE ReadStandardGeorefData (); 00481 ERRVALUE UpdateHeader (); 00482 00483 GEOREFTYPE m_GeorefType; //!< Type of georeference used 00484 TRANSMODEL m_CalibModel; //!< Calibration model using TRANS2DMODEL values defined in <mi32/transmod.h> 00485 SPATREF::COORDREFSYS m_CoordRefSys; //!< Coordinate reference system of the georeference 00486 SIMPLE_ARRAY<CTRLPOINT3> m_CtrlList; //!< Control point list if georeference has one 00487 TRANS2D_AFFINE m_Affine; //!< Affine transformation if georeference has one 00488 bool m_ChangedType; //!< Type of projection (Affine, Implied, Ctrl Point) and or projection name has changed 00489 GEOREFHANDLE* m_GeorefHandle; 00490 00491 #endif // GENERATING_DOXYGEN_OUTPUT 00492 }; 00493 00494 } //! End of RVC namespace 00495 00496 #endif //!< INC_RVC_GEOREFER_H
1.3.8-20040913