PDS_JP2
|
00001 /* PDS_Projection_Data 00002 00003 HiROC CVS ID: PDS_Projection_Data.hh,v 1.13 2020/05/22 20:59:29 guym 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 #include <gdal.h> 00035 00036 00037 namespace UA 00038 { 00039 namespace HiRISE 00040 { 00041 00096 class PDS_Projection_Data 00097 : public PDS_Data 00098 { 00099 public: 00100 /*============================================================================== 00101 Constants: 00102 */ 00104 static const char* const 00105 ID; 00106 00108 static const char 00109 *PLANET_PARAMETER_NAME; 00111 static const char 00112 *IMAGE_MAP_PROJECTION_GROUP_NAME; 00114 static const char 00115 *PROJECTION_TYPE_PARAMETER_NAME; 00117 static const char 00118 *COORDINATE_SYSTEM_PARAMETER_NAME; 00120 static const char 00121 *LATITUDE_TYPE_PARAMETER_NAME; 00125 static const char 00126 *HORIZONATAL_OFFSET_PARAMETER_NAME; 00130 static const char 00131 *VERTICAL_OFFSET_PARAMETER_NAME; 00133 static const char 00134 *IMAGE_HEIGHT_PARAMETER_NAME; 00136 static const char 00137 *IMAGE_WIDTH_PARAMETER_NAME; 00139 static const char 00140 *PIXELS_PER_DEGREE_PARAMETER_NAME; 00142 static const char 00143 *PIXEL_SIZE_PARAMETER_NAME; 00145 static const char 00146 *SEMI_MAJOR_RADIUS_PARAMETER_NAME; 00148 static const char 00149 *SEMI_MINOR_RADIUS_PARAMETER_NAME; 00151 static const char 00152 *FIRST_STANDARD_PARALLEL_PARAMETER_NAME; 00154 static const char 00155 *SECOND_STANDARD_PARALLEL_PARAMETER_NAME; 00157 static const char 00158 *CENTER_LONGITUDE_PARAMETER_NAME; 00160 static const char 00161 *CENTER_LATITUDE_PARAMETER_NAME; 00163 static const char 00164 *MINIMUM_LATITUDE_PARAMETER_NAME; 00166 static const char 00167 *MAXIMUM_LATITUDE_PARAMETER_NAME; 00169 static const char 00170 *MINIMUM_LONGITUDE_PARAMETER_NAME; 00172 static const char 00173 *MAXIMUM_LONGITUDE_PARAMETER_NAME; 00175 static const char 00176 *PROJECTION_ROTATION_PARAMETER_NAME; 00177 static const char 00178 *MISSING_CONSTANT_PARAMETER_NAME; 00179 static const char 00180 *GDAL_NODATA_PARAMETER_NAME; 00181 00183 enum Projection_Type 00184 { 00185 UNKNOWN_PROJECTION = -1, 00186 /* 00187 Well known projections are placed first in the list. 00188 */ 00189 EQUIRECTANGULAR = 0, 00190 POLAR_STEREOGRAPHIC, 00191 /* 00192 The remaining projections are listed alphabetically. 00193 */ 00194 ALBERS, 00195 BONNE, 00196 CYLINDRICAL_EQUAL_AREA, 00197 GNOMONIC, 00198 LAMBERT_AZIMUTHAL_EQUAL_AREA, 00199 LAMBERT_CONFORMAL_CONIC, 00200 MERCATOR, 00201 MOLLWEIDE, 00202 OBLIQUE_CYLINDRICAL, 00203 ORTHOGRAPHIC, 00204 SINUSOIDAL, 00205 STEREOGRAPHIC, 00206 TRANSVERSE_MERCATOR, 00207 VANDERGRINTEN, 00208 00209 TOTAL_PROJECTION_TYPES 00210 }; 00211 00215 struct Projection_Definition 00216 { 00218 Projection_Type 00219 Code; 00220 00227 static const int 00228 MAX_ARRAY_ENTRIES = 8; 00229 00240 const char* 00241 Aliases[MAX_ARRAY_ENTRIES]; 00242 00249 struct Required_Projection_Parameter 00250 { 00252 const char* 00253 SRS_Parameter_Name; 00255 const char* 00256 PDS_Parameter_Name; 00257 } 00258 Required_Parameters[MAX_ARRAY_ENTRIES]; 00259 00265 struct Default_Projection_Parameter 00266 { 00268 const char* 00269 SRS_Parameter_Name; 00271 double 00272 Value; 00273 } 00274 Default_Parameters[MAX_ARRAY_ENTRIES]; 00275 }; 00277 static const Projection_Definition 00278 Projection_Definitions[TOTAL_PROJECTION_TYPES]; 00279 00284 static const double 00285 DEFAULT_GEO_TIFF_TRANSFORM[6]; 00286 00288 static const unsigned char 00289 GEO_TIFF_UUID[16]; 00290 00291 /*============================================================================== 00292 Constructors: 00293 */ 00299 PDS_Projection_Data (); 00300 00311 PDS_Projection_Data (const PDS_Data& PDS_data); 00312 00323 PDS_Projection_Data (const std::string& pathname); 00324 00329 virtual ~PDS_Projection_Data (); 00330 00331 /*============================================================================== 00332 Accessors 00333 */ 00355 virtual PDS_Data& parameters (const std::string& pathname); 00356 00371 virtual PDS_Data& parameters (const idaeim::PVL::Aggregate& parameters); 00372 00489 const double* geo_transform () const 00490 {return Geo_Transform;} 00491 00497 OGRSpatialReference* spatial_reference () const 00498 {return Spatial_Reference ? Spatial_Reference->Clone () : NULL;} 00499 00511 Projection_Type projection_type () const 00512 {return Projection_Type_Code;} 00513 00538 std::string projection_name () const 00539 {return Projection_Name;} 00540 00541 /*============================================================================== 00542 Manipulators 00543 */ 00609 PDS_Projection_Data& initialize_geo_transform (); 00610 00720 PDS_Projection_Data& initialize_spatial_reference (); 00721 00722 /*============================================================================== 00723 JP2 Boxes 00724 */ 00743 JP2_Box* JP2_GeoTIFF () const; 00744 00805 JP2_Box* JP2_GML 00806 (unsigned int image_width = 0, unsigned int image_height = 0) const; 00807 00808 /*============================================================================== 00809 Helpers 00810 */ 00825 static bool named_in_list (std::string name, const char* const* aliases); 00826 00839 static Projection_Type projection_type (const std::string& projection_name); 00840 00841 /*============================================================================== 00842 Data Members: 00843 */ 00844 protected: 00845 00850 std::string 00851 Projection_Name; 00852 00857 Projection_Type 00858 Projection_Type_Code; 00859 00864 OGRSpatialReference 00865 *Spatial_Reference; 00866 00871 double 00872 Geo_Transform[6]; 00873 00874 }; // End class PDS_Projection_Data 00875 00876 } // namespace HiRISE 00877 } // namespace UA 00878 #endif