OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimGeoTiff.h
Go to the documentation of this file.
1 //***************************************************************************
2 // FILE: ossimGeoTiff.h
3 //
4 // License: See top level LICENSE.txt file.
5 //
6 // Description:
7 //
8 // Class declaration for ossimGeoTiff which is designed to read and hold tag
9 // information.
10 //
11 //***************************************************************************
12 // $Id: ossimGeoTiff.h 21023 2012-05-29 20:32:22Z dburken $
13 
14 #ifndef ossimGeoTiff_HEADER
15 #define ossimGeoTiff_HEADER 1
18 #include <ossim/base/ossimEndian.h>
19 #include <ossim/base/ossimString.h>
22 #include <ossim/base/ossimRefPtr.h>
24 #include <vector>
25 
26 #include <tiffio.h>
27 #include <mutex>
28 
29 class ossimFilename;
30 class ossimKeywordlist;
32 class ossimProjection;
33 class ossimTieGptSet;
34 
36 {
37 public:
39  ossimGeoTiff();
40 
41  ossimGeoTiff(const ossimFilename& file, ossim_uint32 entryIdx=0);
42 
43  ~ossimGeoTiff();
44 
45  enum
46  {
47  UNDEFINED = 0,
48  PIXEL_IS_AREA = 1,
49  PIXEL_IS_POINT = 2,
50  GT_MODEL_TYPE_GEO_KEY = 1024,
51  GT_RASTER_TYPE_GEO_KEY = 1025,
52  GEOGRAPHIC_TYPE_GEO_KEY = 2048,
53  GEOG_GEODETIC_DATUM_GEO_KEY = 2050,
54  GEOG_ANGULAR_UNITS_GEO_KEY = 2054,
55  PROJECTED_CS_TYPE_GEO_KEY = 3072,
56  PCS_CITATION_GEO_KEY = 3073,
57  PROJECTION_GEO_KEY = 3074,
58  PROJ_COORD_TRANS_GEO_KEY = 3075,
59  LINEAR_UNITS_GEO_KEY = 3076,
60  PROJ_STD_PARALLEL1_GEO_KEY = 3078,
61  PROJ_STD_PARALLEL2_GEO_KEY = 3079,
62  PROJ_NAT_ORIGIN_LONG_GEO_KEY = 3080,
63  PROJ_NAT_ORIGIN_LAT_GEO_KEY = 3081,
64  PROJ_FALSE_EASTING_GEO_KEY = 3082,
65  PROJ_FALSE_NORTHING_GEO_KEY = 3083,
66  PROJ_CENTER_LONG_GEO_KEY = 3088,
67  PROJ_CENTER_LAT_GEO_KEY = 3089,
68  PROJ_SCALE_AT_NAT_ORIGIN_GEO_KEY = 3092,
69  LINEAR_METER = 9001,
70  LINEAR_FOOT = 9002,
71  LINEAR_FOOT_US_SURVEY = 9003,
72  ANGULAR_DEGREE = 9102,
73  ANGULAR_ARC_MINUTE = 9103,
74  ANGULAR_ARC_SECOND = 9104,
75  ANGULAR_GRAD = 9105,
76  ANGULAR_GON = 9106,
77  ANGULAR_DMS = 9107,
78  ANGULAR_DMS_HEMISPHERE = 9108,
79  PCS_BRITISH_NATIONAL_GRID = 27700,
80  USER_DEFINED = 32767
81  };
82 
83 /* enum CompressType */
84 /* { */
85 /* NOT_COMPRESSED = 0, */
86 /* COMPRESSED = 1 */
87 /* }; */
88 
89 /* enum PhotoInterpretation */
90 /* { */
91 /* PHOTO_MINISWHITE = 0, // min value is white */
92 /* PHOTO_MINISBLACK = 1, // min value is black */
93 /* PHOTO_RGB = 2, // RGB color model */
94 /* PHOTO_PALETTE = 3, // color map indexed */
95 /* PHOTO_MASK = 4, // $holdout mask */
96 /* PHOTO_SEPARATED = 5, // !color separations */
97 /* PHOTO_YCBCR = 6, // !CCIR 601 */
98 /* PHOTO_CIELAB = 8 // !1976 CIE L*a*b* */
99 /* }; */
101  {
102  UNKNOWN = 0,
103  MODEL_TYPE_PROJECTED = 1, // Projection Coordinate System
104  MODEL_TYPE_GEOGRAPHIC = 2, // Geographic latitude-longitude System
105  MODEL_TYPE_GEOCENTRIC = 3
106  };
107 
108  static int getPcsUnitType(ossim_int32 pcsCode);
109 
110  static bool writeTags(TIFF* tiffOut,
111  const ossimRefPtr<ossimMapProjectionInfo> projectionInfo,
112  bool imagineNad27Flag=false);
113 
127  static bool writeJp2GeotiffBox(const ossimFilename& tmpFile,
128  const ossimIrect& rect,
129  const ossimProjection* proj,
130  std::vector<ossim_uint8>& buf,
131  ossimPixelType pixelType);
132 
137  bool readTags(const ossimFilename& file, ossim_uint32 entryIdx=0);
138 
157  bool readTags(TIFF* tiff, ossim_uint32 entryIdx, bool ownTiffPtrFlag);
158 
159  bool readTags(std::shared_ptr<ossim::TiffHandlerState> state,
160  ossim_uint32 entryIdx);
164  int mapZone() const;
165 
170  bool addImageGeometry(ossimKeywordlist& kwl,
171  const char* prefix=0) const;
172 
177  ossimString getOssimProjectionName() const;
178 
182  void setOssimProjectionName();
183 
187  void setOssimProjectionName(std::shared_ptr<ossim::TiffHandlerState> state, ossim_int32 entryIdx=0);
188 
193  ossimString getOssimDatumName() const;
194 
198  void setOssimDatumName();
199 
200  void setOssimDatumName(std::shared_ptr<ossim::TiffHandlerState> state, ossim_int32 entryIdx=0);
201 
202  void getScale(std::vector<double>& scale) const;
203  void getTiePoint(std::vector<double>& tie_point) const;
204  void getModelTransformation(std::vector<double>& transform) const;
205 
206  const std::vector<double>& getTiePoint() const;
207  const std::vector<double>& getModelTransformation() const;
208  const std::vector<double>& getScale() const;
209  ossimPixelType getRasterType() const;
210 
211  int getWidth() const;
212  int getLength() const;
213 /* int getSamplesPerPixel() const; */
214 
216  virtual std::ostream& print(std::ostream& out) const;
217 
218 private:
219 
220  // Disallow ...
221  ossimGeoTiff& operator=(const ossimGeoTiff& /*rhs*/) { return *this; }
222 
225  bool parsePcsCode();
226 
228  bool parseProjection(ossimMapProjection* map_proj);
229 
234  double convert2meters(double d) const;
235 
240  bool usingModelTransform() const;
241 
246  void getTieSet(ossimTieGptSet& tieSet) const;
247 
252  bool hasOneBasedTiePoints() const;
253 
258  int theZone;
264 
265  std::vector<double> theScale; // tag 33550
266  std::vector<double> theTiePoint; // tag 33922
267  std::vector<double> theModelTransformation; // tag 34264
268  std::vector<double> theDoubleParam; // tag 34736
270 
271  ossim_uint32 theWidth; // tag 256
274 
276  ossim_uint16 theRasterType; // key 1025 undefined=0, area=1, point=2
284  double theStdPar1; // key 3078
285  double theStdPar2; // key 3079
286  mutable double theOriginLon; // key 3080
287  mutable double theOriginLat; // key 3081
288  double theFalseEasting; // key 3082
289  double theFalseNorthing; // key 3083
290  double theScaleFactor; // key 3092
291 
293 
294  static std::mutex theMutex;
295 };
296 
297 #endif
double theScaleFactor
Definition: ossimGeoTiff.h:290
double theOriginLat
Definition: ossimGeoTiff.h:287
ossim_uint32 theWidth
Definition: ossimGeoTiff.h:271
std::vector< double > theScale
Definition: ossimGeoTiff.h:265
Represents serializable keyword/value map.
ossim_uint16 theAngularUnits
Definition: ossimGeoTiff.h:279
std::vector< double > theModelTransformation
Definition: ossimGeoTiff.h:267
virtual std::ostream & print(std::ostream &out) const
Outputs theErrorStatus as an ossimErrorCode and an ossimString.
ossim_uint16 theGcsCode
Definition: ossimGeoTiff.h:277
ossimGeoTiff & operator=(const ossimGeoTiff &)
Definition: ossimGeoTiff.h:221
std::vector< double > theTiePoint
Definition: ossimGeoTiff.h:266
ossim_uint16 theDatumCode
Definition: ossimGeoTiff.h:278
static std::mutex theMutex
Definition: ossimGeoTiff.h:294
ossim_uint16 theBitsPerSample
Definition: ossimGeoTiff.h:273
TIFF * theTiffPtr
Definition: ossimGeoTiff.h:254
unsigned short ossim_uint16
double theStdPar2
Definition: ossimGeoTiff.h:285
ossim_uint16 theLinearUnitsCode
Definition: ossimGeoTiff.h:283
double theFalseEasting
Definition: ossimGeoTiff.h:288
double theStdPar1
Definition: ossimGeoTiff.h:284
ossim_uint16 theModelType
Definition: ossimGeoTiff.h:275
ossim_uint16 theCoorTransGeoCode
Definition: ossimGeoTiff.h:282
ossim_uint32 theGeoKeyOffset
Definition: ossimGeoTiff.h:255
ossim_uint16 theRasterType
Definition: ossimGeoTiff.h:276
unsigned int ossim_uint32
ossimString theAsciiParam
Definition: ossimGeoTiff.h:269
struct tiff TIFF
#define USER_DEFINED
ossim_uint32 theLength
Definition: ossimGeoTiff.h:272
int theAsciiParamLength
Definition: ossimGeoTiff.h:261
ossimString thePcsCitation
Definition: ossimGeoTiff.h:281
ossimString theHemisphere
Definition: ossimGeoTiff.h:259
ossimPixelType
double theFalseNorthing
Definition: ossimGeoTiff.h:289
storage class for a set of geographic tie points, between master and slave images ...
#define OSSIM_DLL
std::vector< double > theDoubleParam
Definition: ossimGeoTiff.h:268
int theDoubleParamLength
Definition: ossimGeoTiff.h:260
bool theGeoKeysPresentFlag
Definition: ossimGeoTiff.h:257
ossimString theDatumName
Definition: ossimGeoTiff.h:263
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
ossim_uint32 thePcsCode
Definition: ossimGeoTiff.h:280
ossimString theProjectionName
Definition: ossimGeoTiff.h:262
int ossim_int32
ossimPrivateGtifDef * thePrivateDefinitions
Definition: ossimGeoTiff.h:292
double theOriginLon
Definition: ossimGeoTiff.h:286