|
|
PDS_JP2
|
00001 /* PDS_Projection_Data 00002 00003 HiROC CVS ID: PDS_Projection_Data.hh,v 1.10 2007/10/22 18:27:52 castalia Exp 00004 00005 Copyright (C) 2007 Arizona Board of Regents on behalf of the 00006 Planetary Image Research Laboratory, Lunar and Planetary Laboratory at 00007 the University of Arizona. 00008 00009 This library is free software; you can redistribute it and/or modify it 00010 under the terms of the GNU Lesser General Public License, version 2.1, 00011 as published by the Free Software Foundation. 00012 00013 This library is distributed in the hope that it will be useful, but 00014 WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Lesser General Public License for more details. 00017 00018 You should have received a copy of the GNU Lesser General Public License 00019 along with this library; if not, write to the Free Software Foundation, 00020 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00021 00022 *******************************************************************************/ 00023 00024 #ifndef _PDS_Projection_Data_ 00025 #define _PDS_Projection_Data_ 00026 00027 #include "PDS_Data.hh" 00028 00029 #include "JP2_Box.hh" 00030 #include "Dimensions.hh" 00031 00032 // GDAL/OGR 00033 #include "ogr_spatialref.h" 00034 00035 00036 namespace UA 00037 { 00038 namespace HiRISE 00039 { 00040 00095 class PDS_Projection_Data 00096 : public PDS_Data 00097 { 00098 public: 00099 /*============================================================================== 00100 Constants: 00101 */ 00103 static const char* const 00104 ID; 00105 00107 static const char 00108 *PLANET_PARAMETER_NAME; 00110 static const char 00111 *IMAGE_MAP_PROJECTION_GROUP_NAME; 00113 static const char 00114 *PROJECTION_TYPE_PARAMETER_NAME; 00116 static const char 00117 *COORDINATE_SYSTEM_PARAMETER_NAME; 00119 static const char 00120 *LATITUDE_TYPE_PARAMETER_NAME; 00124 static const char 00125 *HORIZONATAL_OFFSET_PARAMETER_NAME; 00129 static const char 00130 *VERTICAL_OFFSET_PARAMETER_NAME; 00132 static const char 00133 *IMAGE_HEIGHT_PARAMETER_NAME; 00135 static const char 00136 *IMAGE_WIDTH_PARAMETER_NAME; 00138 static const char 00139 *PIXELS_PER_DEGREE_PARAMETER_NAME; 00141 static const char 00142 *PIXEL_SIZE_PARAMETER_NAME; 00144 static const char 00145 *SEMI_MAJOR_RADIUS_PARAMETER_NAME; 00147 static const char 00148 *SEMI_MINOR_RADIUS_PARAMETER_NAME; 00150 static const char 00151 *FIRST_STANDARD_PARALLEL_PARAMETER_NAME; 00153 static const char 00154 *SECOND_STANDARD_PARALLEL_PARAMETER_NAME; 00156 static const char 00157 *CENTER_LONGITUDE_PARAMETER_NAME; 00159 static const char 00160 *CENTER_LATITUDE_PARAMETER_NAME; 00162 static const char 00163 *MINIMUM_LATITUDE_PARAMETER_NAME; 00165 static const char 00166 *MAXIMUM_LATITUDE_PARAMETER_NAME; 00168 static const char 00169 *MINIMUM_LONGITUDE_PARAMETER_NAME; 00171 static const char 00172 *MAXIMUM_LONGITUDE_PARAMETER_NAME; 00174 static const char 00175 *PROJECTION_ROTATION_PARAMETER_NAME; 00176 00178 enum Projection_Type 00179 { 00180 UNKNOWN_PROJECTION = -1, 00181 /* 00182 Well known projections are placed first in the list. 00183 */ 00184 EQUIRECTANGULAR = 0, 00185 POLAR_STEREOGRAPHIC, 00186 /* 00187 The remaining projections are listed alphabetically. 00188 */ 00189 ALBERS, 00190 BONNE, 00191 CYLINDRICAL_EQUAL_AREA, 00192 GNOMONIC, 00193 LAMBERT_AZIMUTHAL_EQUAL_AREA, 00194 LAMBERT_CONFORMAL_CONIC, 00195 MERCATOR, 00196 MOLLWEIDE, 00197 OBLIQUE_CYLINDRICAL, 00198 ORTHOGRAPHIC, 00199 SINUSOIDAL, 00200 STEREOGRAPHIC, 00201 TRANSVERSE_MERCATOR, 00202 VANDERGRINTEN, 00203 00204 TOTAL_PROJECTION_TYPES 00205 }; 00206 00210 struct Projection_Definition 00211 { 00213 Projection_Type 00214 Code; 00215 00222 static const int 00223 MAX_ARRAY_ENTRIES = 8; 00224 00235 const char* 00236 Aliases[MAX_ARRAY_ENTRIES]; 00237 00244 struct Required_Projection_Parameter 00245 { 00247 const char* 00248 SRS_Parameter_Name; 00250 const char* 00251 PDS_Parameter_Name; 00252 } 00253 Required_Parameters[MAX_ARRAY_ENTRIES]; 00254 00260 struct Default_Projection_Parameter 00261 { 00263 const char* 00264 SRS_Parameter_Name; 00266 double 00267 Value; 00268 } 00269 Default_Parameters[MAX_ARRAY_ENTRIES]; 00270 }; 00272 static const Projection_Definition 00273 Projection_Definitions[TOTAL_PROJECTION_TYPES]; 00274 00279 static const double 00280 DEFAULT_GEO_TIFF_TRANSFORM[6]; 00281 00283 static const unsigned char 00284 GEO_TIFF_UUID[16]; 00285 00286 /*============================================================================== 00287 Constructors: 00288 */ 00294 PDS_Projection_Data (); 00295 00306 PDS_Projection_Data (const PDS_Data& PDS_data); 00307 00318 PDS_Projection_Data (const std::string& pathname); 00319 00324 virtual ~PDS_Projection_Data (); 00325 00326 /*============================================================================== 00327 Accessors 00328 */ 00350 virtual PDS_Data& parameters (const std::string& pathname); 00351 00366 virtual PDS_Data& parameters (const idaeim::PVL::Aggregate& parameters); 00367 00484 const double* geo_transform () const 00485 {return Geo_Transform;} 00486 00492 OGRSpatialReference* spatial_reference () const 00493 {return Spatial_Reference ? Spatial_Reference->Clone () : NULL;} 00494 00506 Projection_Type projection_type () const 00507 {return Projection_Type_Code;} 00508 00533 std::string projection_name () const 00534 {return Projection_Name;} 00535 00536 /*============================================================================== 00537 Manipulators 00538 */ 00604 PDS_Projection_Data& initialize_geo_transform (); 00605 00715 PDS_Projection_Data& initialize_spatial_reference (); 00716 00717 /*============================================================================== 00718 JP2 Boxes 00719 */ 00738 JP2_Box* JP2_GeoTIFF () const; 00739 00800 JP2_Box* JP2_GML 00801 (unsigned int image_width = 0, unsigned int image_height = 0) const; 00802 00803 /*============================================================================== 00804 Helpers 00805 */ 00820 static bool named_in_list (std::string name, const char* const* aliases); 00821 00834 static Projection_Type projection_type (const std::string& projection_name); 00835 00836 /*============================================================================== 00837 Data Members: 00838 */ 00839 protected: 00840 00845 std::string 00846 Projection_Name; 00847 00852 Projection_Type 00853 Projection_Type_Code; 00854 00859 OGRSpatialReference 00860 *Spatial_Reference; 00861 00866 double 00867 Geo_Transform[6]; 00868 00869 }; // End class PDS_Projection_Data 00870 00871 } // namespace HiRISE 00872 } // namespace UA 00873 #endif
1.5.3