00001 /** 00002 * \file rvc/geospatl.h 00003 * \brief interface for the RVCGEOSPATIAL class. 00004 * 00005 * \if NODOC 00006 * $Id: geospatl.h_v 1.34 2004/12/03 17:15:05 scowan Exp $ 00007 * 00008 * $Log: geospatl.h_v $ 00009 * Revision 1.34 2004/12/03 17:15:05 scowan 00010 * Updated docs on has capability.. 00011 * 00012 * Revision 1.33 2004/10/01 20:32:15 mju 00013 * Remove unused computeObjectScale variants previously deprecated. 00014 * 00015 * Revision 1.32 2004/09/09 15:49:52 mju 00016 * Add convertToMeters parm for computeObjectScale and computeScaleFromGeoref. 00017 * Deprecate other variants of aforementioned methods. 00018 * 00019 * Revision 1.31 2004/07/19 23:23:13 scowan 00020 * Removed legacy method. 00021 * 00022 * Revision 1.30 2004/07/13 15:37:35 mju 00023 * Add getobjfilter_hasgeoreference. 00024 * 00025 * Revision 1.29 2004/06/24 16:25:59 scowan 00026 * Better support for region2d. 00027 * 00028 * Revision 1.28 2004/03/12 14:53:05 mju 00029 * Add getobjfilter_hasgeoreference. 00030 * 00031 * Revision 1.27 2004/03/04 18:42:42 scowan 00032 * Added dtor for filter. 00033 * 00034 * Revision 1.26 2004/02/09 20:33:19 scowan 00035 * Added new get object region method. 00036 * 00037 * Revision 1.25 2003/11/21 22:17:05 scowan 00038 * Support new Capabilities system. 00039 * 00040 * Revision 1.24 2003/10/22 16:17:05 scowan 00041 * Added get objtype set static method. 00042 * 00043 * Revision 1.23 2003/09/30 16:52:06 dwilliss 00044 * Doxygen 00045 * 00046 * Revision 1.22 2003/09/25 21:56:37 dwilliss 00047 * doxygen 00048 * 00049 * Revision 1.21 2003/09/15 13:49:45 fileserver!dwilliss 00050 * Doxygen 00051 * 00052 * Revision 1.20 2003/09/11 17:55:34 scowan 00053 * Added is geospatial method. 00054 * 00055 * Revision 1.19 2003/08/13 16:31:18 scowan 00056 * Added another copy georef to method. 00057 * 00058 * Revision 1.18 2003/08/12 21:07:41 scowan 00059 * Added copy georef to methods. 00060 * 00061 * Revision 1.17 2003/08/04 16:45:47 scowan 00062 * Added method to compute translation betrween two geospatial objects. 00063 * 00064 * Revision 1.16 2003/08/01 19:52:46 scowan 00065 * Fixed ignore and end ignore items. 00066 * 00067 * Revision 1.15 2003/08/01 19:09:25 scowan 00068 * Added is overlapping filter. 00069 * 00070 * Revision 1.14 2003/07/23 17:20:15 mju 00071 * Remove 'allow arbitrary' parm from ChkGeoref and GetDftGeoref methods. 00072 * 00073 * Revision 1.13 2003/07/23 17:00:32 scowan 00074 * Added enum. 00075 * 00076 * Revision 1.12 2003/05/30 21:33:29 scowan 00077 * Added is selectable filter. 00078 * 00079 * Revision 1.11 2003/05/07 22:19:23 scowan 00080 * Changed virutal method format. 00081 * 00082 * Revision 1.10 2002/04/26 22:44:32 scowan 00083 * Added more virtual methods. 00084 * 00085 * Revision 1.9 2002/04/24 19:30:44 scowan 00086 * Added check name method. 00087 * 00088 * Revision 1.8 2002/04/24 16:02:18 scowan 00089 * Added get object region method. 00090 * 00091 * Revision 1.7 2002/03/01 15:31:46 scowan 00092 * Added another get geospatial method. 00093 * 00094 * Revision 1.6 2001/10/25 21:54:28 scowan 00095 * Changed check to get. 00096 * 00097 * Revision 1.5 2001/06/14 15:14:46 scowan 00098 * Added to RVC namespace. 00099 * 00100 * Revision 1.4 2001/05/31 21:43:21 scowan 00101 * More const. 00102 * 00103 * Revision 1.3 2000/11/24 22:47:48 scowan 00104 * oops. 00105 * 00106 * Revision 1.2 2000/10/19 17:56:00 scowan 00107 * Checked in for vacation. 00108 * 00109 * Revision 1.1 2000/09/29 15:26:32 scowan 00110 * Initial revision 00111 * \endif 00112 **/ 00113 00114 //! \class RVC::GEOSPATIAL rvc/geospatl.h 00115 //! \brief Interface for RVC objects that support a georeferences paradigm. 00116 //! 00117 //! This includes methods to get the scale, offset, and retrieving the correct georeference. 00118 //! 00119 //! RVC Object Types that this class supports: Derived class 00120 //! 00121 //! Default RVC Object Type for this class: Derived class 00122 //! 00123 //! Valid parents for this class: Derived class 00124 00125 #ifndef INC_RVC_GEOSPATL_H 00126 #define INC_RVC_GEOSPATL_H 00127 00128 #ifndef INC_RVC_OBJECT_H 00129 #include <rvc/object.h> 00130 #endif 00131 00132 #ifndef INC_RVC_GETOBJF_H 00133 #include <rvc/getobjf.h> 00134 #endif 00135 00136 #ifndef INC_MI32_TRANS2DC_H 00137 #include <mi32/trans2dc.h> 00138 #endif 00139 00140 #ifndef GENERATING_DOXYGEN_OUTPUT 00141 class REGION2D; // Forward declarations 00142 #endif // GENERATING_DOXYGEN_OUTPUT 00143 00144 namespace RVC { 00145 00146 #ifndef GENERATING_DOXYGEN_OUTPUT 00147 class GEOREFERENCE; // Forward declarations 00148 #endif // GENERATING_DOXYGEN_OUTPUT 00149 00150 class GEOSPATIAL : public RVC::OBJECT { 00151 public: 00152 00153 //Ignore 00154 class GETOBJFILTER_ISSELECTABLE; 00155 class GETOBJFILTER_ISOVERLAPPING; 00156 class GETOBJFILTER_HASGEOREFERENCE; 00157 class GETOBJFILTER_HASNOGEOREFERENCE; 00158 //End Ignore 00159 00160 enum CAPABILITY { 00161 CAPABILITY_None = 0, 00162 CAPABILITY_RandomAccess = 256, //!< Object is capable of random access to elements 00163 CAPABILITY_CanBeModified, //!< Object can be modified 00164 CAPABILITY_LoginRequired //!< A login ( username and password ) is required to access this object 00165 }; 00166 00167 enum MAKELINKFLAGS { 00168 MAKELINKFLAG_None = 0x0000, 00169 MAKELINKFLAG_NoGeoreference = 0x0001, //!< Don't create georeference subobjects 00170 MAKELINKFLAG_NoPyramidLinks = 0x0002, //!< Don't create raster pyramid tier links 00171 MAKELINKFLAG_BuildHistograms = 0x0004, //!< Build raster histogram subobjects when make link 00172 MAKELINKFLAG_BuildPyramids = 0x0008, //!< Build raster pyramid tiers when make link 00173 MAKELINKFLAG_NoContrastTables = 0x0010, //!< Don't create raster contrast tables 00174 MAKELINKFLAG_ColorComposite = 0x0020, //!< Create raster links as color-composite (RGB) where appropriate 00175 MAKELINKFLAG_ColorSeparate = 0x0040 //!< Create raster links as color separates where appropriate 00176 }; 00177 00178 enum OBJECTREGIONFLAGS { 00179 OBJECTREGION_Default = 0x0000, 00180 OBJECTREGION_UseGeorefModel = 0x0001, //!< Use warping model specified by georeference 00181 OBJECTREGION_ForceArbitrary = 0x0002 //!< Force region to use arbitrary 00182 }; 00183 00184 //! Default constructor 00185 GEOSPATIAL ( 00186 ); 00187 00188 //! Copy constructor 00189 GEOSPATIAL ( 00190 const RVC::GEOSPATIAL& rhs 00191 ); 00192 00193 //! Destructor 00194 virtual ~GEOSPATIAL ( 00195 ) = 0; 00196 00197 //! Check if the georeference object name exists under this object 00198 //! Will get the default georeference if the named object does not exist 00199 ERRVALUE CheckGeorefName ( 00200 RVC::OBJECTNAME& GeorefName //!< Changed if default georef is searched for 00201 ); 00202 00203 //! Compute object scale from specified or default georeference. 00204 //! If ObjGeoref is not attached the default georeference will be used and returned. 00205 //! @returns -1 if no scale available, 0 if no georeference, 1 if georeference, < -1 if error 00206 INT32 ComputeObjectScale ( 00207 RVC::GEOREFERENCE& ObjGeoref, //!< Georeference object used passed/returned 00208 double& xscale, //!< X scale or cellsize returned 00209 double& yscale, //!< Y scale or cellsize returned 00210 bool ConvertToMeters //!< Return scale in meters per object unit 00211 ) const; 00212 00213 #ifndef NO_DEPRECATED 00214 //! Compute object scale from default georeference in meters per object unit. 00215 //! \deprecated Use variant specifying GEOREFERENCE and whether to convert to meters or not 00216 //! @returns 0 if used value in obj hdr, 1 if used georef, -1 if no scale, < -1 if error 00217 DEPRECATED INT32 ComputeObjectScale ( 00218 double& xscale, //!< X scale or cellsize returned in meters per object unit 00219 double& yscale //!< Y scale or cellsize returned in meters per object unit 00220 ) const; 00221 #endif 00222 00223 //! Compute a translation between the source (this) and the target (ObjTarget) 00224 //! This function will return an EBadFuncParm error if either object has an arbitrary 00225 //! georeference and the other does not. 00226 ERRVALUE ComputeObjectTranslation ( 00227 const RVC::GEOSPATIAL& ObjTarget, 00228 TRANS2D_MAPGEN& SrcToDest 00229 ); 00230 00231 //! Compute object scale from georeference 00232 //! Specified georeference object must be attached or an error will be returned. 00233 ERRVALUE ComputeScaleFromGeoref ( 00234 const RVC::GEOREFERENCE& DftGeoref, //!< Attached georeference object to use 00235 double& xscale, //!< X scale or cellsize returned 00236 double& yscale, //!< Y scale or cellsize returned 00237 bool ConvertToMeters //!< Return scale in meters per object unit 00238 ) const; 00239 00240 #ifndef NO_DEPRECATED 00241 //! Compute object scale from georeference 00242 //! \deprecated Use variant specifying whether to convert to meters or not 00243 //! Specified georeference object must be attached or an error will be returned. 00244 DEPRECATED ERRVALUE ComputeScaleFromGeoref ( 00245 const RVC::GEOREFERENCE& DftGeoref, //!< Attached georeference object to use 00246 double& xscale, //!< X scale or cellsize returned in meters per object unit 00247 double& yscale //!< Y scale or cellsize returned in meters per object unit 00248 ) const; 00249 #endif 00250 00251 //! Copy the "default" georeference from the source to the destination 00252 //! using the extents of the two objects to compute a translation for the georeference. 00253 //! If the Source or Dest is an RVC::IMAGE instance, the center of the cells will be used. 00254 //! This method assumes that the Source and Dest objects extents are valid. 00255 //! If no georeference exists under the Source object, an arbitrary georeference will be 00256 //! created under both the Source and Dest so that they match. 00257 ERRVALUE CopyGeorefTo ( 00258 const RVC::GEOSPATIAL& DestObj 00259 ); 00260 00261 //! Copy the "default" georeference from the source to the destination 00262 //! using the supplied translation for the georeference. 00263 //! If no georeference exists under the Source object, an arbitrary georeference will be 00264 //! created under both the Source and Dest so that they match. 00265 ERRVALUE CopyGeorefTo ( 00266 const RVC::GEOSPATIAL& DestObj, 00267 const TRANS2D_AFFINE& SrcToDest 00268 ); 00269 00270 //! Copy the "default" georeference from the source to the destination 00271 //! using the supplied translation for the georeference. 00272 //! If no georeference exists under the Source object, an arbitrary georeference will be 00273 //! created under both the Source and Dest so that they match. 00274 ERRVALUE CopyGeorefTo ( 00275 const RVC::GEOSPATIAL& DestObj, 00276 const TRANS2D_MAPGEN& SrcToDest 00277 ); 00278 00279 //! Determine if the capability requested is supported by the object. The object could be a RVC object or a link to another file 00280 //! Only one capability at a time can be queried using the method. 00281 //! @return 'True' if the object supports the capability, 'false' if not 00282 bool HasCapability ( 00283 int Capability //!< CAPABILITY enums from this and derived classes 00284 ) const; 00285 00286 //! Determine if georeference is valid, if not, get default georeference. 00287 //! If a georeference is found, it will be read into 'GeorefObj' and method will return TRUE. 00288 //! If not found, 'GeorefObj' will be set up with an arbitrary georeference and will return FALSE. 00289 //! @return TRUE if found existing object, FALSE if not, < 0 if error. 00290 int GetDefaultGeoref ( 00291 RVC::GEOREFERENCE& GeorefObj //!< Georeference object to check 00292 ) const; 00293 00294 //! Obtain extents of derived class in rvc object coordinates 00295 void GetExtents ( 00296 DRECT3D& extents //!< Extents of rvc object RETURNED 00297 ) const { v_GetExtents(extents); } 00298 00299 //! Obtain a geospatial type beased on the rvc object type. 00300 //! @returns Pointer to created RVCGEOSPATIAL type (Vector, CAD, Raster, ...) that "obj" refers to, 0 if invalid rvc object 00301 static RVC::GEOSPATIAL* GetGeospatial ( 00302 const RVC::OBJECT& obj //!< Base rvc object instance to create derived rvc class object from 00303 ); 00304 00305 //! Obtain a geospatial type beased on the rvc object type. 00306 //! @returns Pointer to created RVCGEOSPATIAL type (Vector, CAD, Raster, ...) that "obj" refers to, 0 if invalid rvc object 00307 static RVC::GEOSPATIAL* GetGeospatial ( 00308 const RVC::OBJITEM& ObjItem //!< Base RVC::OBJITEM instance to create derived rvc class object from 00309 ); 00310 00311 //! Get the region defined by the georeference parameter 00312 ERRVALUE GetObjectMapRegion ( 00313 RVC::GEOREFERENCE& GeorefObj, //!< If not attached, it will look for the default georeference 00314 REGION2D& region, //!< The region to fill in, its Coordinate Reference System will be set 00315 OBJECTREGIONFLAGS flags = OBJECTREGION_Default 00316 ) const; 00317 00318 //! Get the region defined by this object 00319 ERRVALUE GetObjectRegion ( 00320 RVC::GEOREFERENCE& GeorefObj, //!< If not attached, it will look for the default georeference 00321 REGION2D& region, //!< The region to fill in, its Coordinate Reference System will be set if the georeference is IMPLIED 00322 TRANS2D_MAPGEN& ObjectToMap, //!< Setup input side as object to map transformation 00323 OBJECTREGIONFLAGS flags = OBJECTREGION_Default 00324 ) const; 00325 00326 //! Get correct OBJTYPESET for all geospatial OBJTYPE's 00327 //! @return OBJTYPESET for all geospatial OBJTYPE's 00328 static RVC::OBJTYPESET GetObjTypeSet ( 00329 ); 00330 00331 //! Determine derived rvc class object x and y scale values 00332 void GetScale ( 00333 double& xscale, //!< X scale of object RETURNED 00334 double& yscale //!< Y scale of object RETURNED 00335 ) const { v_GetScale(xscale, yscale); } 00336 00337 //! Determine derived rvc class object z offset value 00338 //! @return Object Z offset value 00339 double GetZOffset ( 00340 ) const { return (v_GetZOffset()); } 00341 00342 //! Determine derived rvc class object z scale value 00343 //! @return Object Z scale value 00344 double GetZScale ( 00345 ) const { return (v_GetZScale()); } 00346 00347 //! Determine if the object type is a geospatial object 00348 static bool IsGeospatial ( 00349 RVC::OBJTYPE ObjType 00350 ); 00351 00352 //! Set object scale 00353 ERRVALUE SetObjectScale ( 00354 double xscale, //!< X scale to set in object 00355 double yscale, //!< Y scale to set in object 00356 bool onlyifzero //!< Set if only zero? 00357 ); 00358 00359 //! Set object scale from georeference 00360 ERRVALUE SetScaleFromGeoref ( 00361 RVC::GEOREFERENCE& GeorefObj, 00362 bool onlyifzero 00363 ); 00364 00365 //! Set object Z offset 00366 void SetZOffset ( 00367 double zoffset 00368 ) { v_SetZOffset(zoffset); } 00369 00370 //! Set object Z value 00371 void SetZScale ( 00372 double zscale 00373 ) { v_SetZScale(zscale); } 00374 00375 private: 00376 #ifndef GENERATING_DOXYGEN_OUTPUT 00377 virtual void v_GetExtents (DRECT3D& extents) const = 0; 00378 virtual void v_GetScale (double& xscale, double& yscale) const = 0; 00379 virtual double v_GetZScale () const = 0; 00380 virtual double v_GetZOffset () const = 0; 00381 virtual bool v_HasCapability (int Capability) const = 0; 00382 virtual void v_SetZScale (double zscale) = 0; 00383 virtual void v_SetZOffset (double zoffset) = 0; 00384 virtual void v_SetScale (double xscale, double yscale) = 0; 00385 #endif // GENERATING_DOXYGEN_OUTPUT 00386 00387 }; 00388 00389 DEFINE_ENUM_OP_BITWISE(GEOSPATIAL::MAKELINKFLAGS); 00390 DEFINE_ENUM_OP_BITWISE(GEOSPATIAL::OBJECTREGIONFLAGS); 00391 00392 //! Geospatial object selection filter to disallow selection of non geospatial objects 00393 class GEOSPATIAL::GETOBJFILTER_ISSELECTABLE : public GETOBJFILTER { 00394 public: 00395 GETOBJFILTER_ISSELECTABLE () {} 00396 private: 00397 #ifndef GENERATING_DOXYGEN_OUTPUT 00398 virtual bool v_IsSelectable (const RVC::OBJITEM& ObjItem, int position); 00399 #endif // GENERATING_DOXYGEN_OUTPUT 00400 }; 00401 00402 //! Geospatial object selection filter to allow selection of objects that overlap by extents the initial object 00403 class GEOSPATIAL::GETOBJFILTER_ISOVERLAPPING : public GETOBJFILTER { 00404 public: 00405 GETOBJFILTER_ISOVERLAPPING ( 00406 const RVC::OBJITEM& SrcObjItem 00407 ) : m_SrcObjItem(SrcObjItem) {} 00408 00409 virtual ~GETOBJFILTER_ISOVERLAPPING () {} 00410 private: 00411 #ifndef GENERATING_DOXYGEN_OUTPUT 00412 const OBJITEM& m_SrcObjItem; 00413 TRANS2D_MAPGEN m_SrcToSelect; 00414 DRECT3D m_SrcExtents; 00415 bool m_SrcArb; 00416 00417 virtual bool v_IsSelectable (const RVC::OBJITEM& ObjItem, int position); 00418 #endif // GENERATING_DOXYGEN_OUTPUT 00419 }; 00420 00421 //! Geospatial object selection filter to disallow selection of non-georeferenced geospatial objects 00422 class GEOSPATIAL::GETOBJFILTER_HASGEOREFERENCE : public GETOBJFILTER { 00423 public: 00424 GETOBJFILTER_HASGEOREFERENCE () {} 00425 private: 00426 #ifndef GENERATING_DOXYGEN_OUTPUT 00427 virtual bool v_IsSelectable (const RVC::OBJITEM& ObjItem, int position); 00428 #endif // GENERATING_DOXYGEN_OUTPUT 00429 }; 00430 00431 //! Geospatial object selection filter to disallow selection of already georeferenced geospatial objects 00432 class GEOSPATIAL::GETOBJFILTER_HASNOGEOREFERENCE : public GETOBJFILTER { 00433 public: 00434 GETOBJFILTER_HASNOGEOREFERENCE () {} 00435 private: 00436 #ifndef GENERATING_DOXYGEN_OUTPUT 00437 virtual bool v_IsSelectable (const RVC::OBJITEM& ObjItem, int position); 00438 #endif // GENERATING_DOXYGEN_OUTPUT 00439 }; 00440 00441 } //! End of RVC namespace 00442 00443 #endif //!< INC_RVC_GEOSPATL_H
1.3.8-20040913