georefer.h

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

Generated on Tue Dec 14 13:18:51 2004 for TNTsdk by  doxygen 1.3.8-20040913