OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimDtedTileSource.h
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: MIT
4 //
5 // See LICENSE.txt file in the top level directory for more details.
6 //
7 // Author: David Burken
8 //
9 // Description:
10 //
11 // Contains class declaration of ossimDtedTileSource. The ossimDtedTileSource
12 // class is derived from ossimImageHandler and is intended to be an image
13 // handler for DTED files.
14 //
15 //********************************************************************
16 // $Id: ossimDtedTileSource.h 17932 2010-08-19 20:34:35Z dburken $
17 
18 #ifndef ossimDtedTileSource_HEADER
19 #define ossimDtedTileSource_HEADER
20 
21 #include <fstream>
22 
31 
32 class ossimImageData;
33 
35 {
36 public:
37 
39 
40  enum
41  {
42  DATA_RECORD_OFFSET_TO_POST = 8, // bytes
43  DATA_RECORD_CHECKSUM_SIZE = 4, // bytes
44  POST_SIZE = 2, // bytes
45  NULL_PIXEL = -32767
46  };
47 
48  virtual ossimString getShortName()const;
49  virtual ossimString getLongName()const;
50 
54  virtual bool open();
55  virtual void close();
56 
57  virtual ossimRefPtr<ossimImageData> getTile(const ossimIrect& tile_rect,
58  ossim_uint32 resLevel=0);
59 
72  virtual bool getTile(ossimImageData* result, ossim_uint32 resLevel=0);
73 
78  virtual ossim_uint32 getNumberOfInputBands() const;
79 
80  virtual ossim_uint32 getNumberOfOutputBands()const;
81 
87  ossim_uint32 reduced_res_level = 0) const;
88 
94  ossim_uint32 reduced_res_level = 0) const;
95 
96  virtual double getNullPixelValue(ossim_uint32 band=0)const;
97  virtual double getMinPixelValue(ossim_uint32 band=0)const;
98  virtual double getMaxPixelValue(ossim_uint32 band=0)const;
99 
105  ossim_uint32 reduced_res_level = 0) const;
106 
111  virtual bool saveState(ossimKeywordlist& kwl,
112  const char* prefix=0)const;
113 
118  virtual bool loadState(const ossimKeywordlist& kwl,
119  const char* prefix=0);
120 
124 
128  virtual ossimScalarType getOutputScalarType() const;
129 
133  virtual ossim_uint32 getTileWidth() const;
134 
138  virtual ossim_uint32 getTileHeight() const;
139 
146  virtual ossim_uint32 getImageTileWidth() const;
147 
154  virtual ossim_uint32 getImageTileHeight() const;
155 
156  virtual bool isOpen()const;
157 
164  void getPostSpacing(ossimDpt& postSpacing) const;
165 
172  virtual ossimRefPtr<ossimProperty> getProperty(const ossimString& name)const;
177  virtual void getPropertyNames(
178  std::vector<ossimString>& propertyNames)const;
179 
187  virtual void loadMetaData();
188 
189 protected:
190  virtual ~ossimDtedTileSource();
191 
192  // Disallow operator= and copy constrution...
195 
199  void allocate();
200 
204  bool fillBuffer(const ossimIrect& tile_rect,
205  const ossimIrect& clip_rect,
206  ossimImageData* tile);
207 
208 
214  void gatherStatistics(bool writeStatsFile);
215 
216  ossim_sint16 convertSignedMagnitude(ossim_uint16& s) const;
217 
219  mutable std::shared_ptr<ossim::istream> m_fileStr;
220  mutable std::shared_ptr<ossimDtedInfo> m_dtedInfo;
221 
231 
242 
243 TYPE_DATA
244 };
245 
247 {
248  // DATA_VALUE_MASK 0x7fff = 0111 1111 1111 1111
249  // DATA_SIGN_MASK 0x8000 = 1000 0000 0000 0000
250 
251  // First check to see if the bytes need swapped.
252  s = (theSwapBytesFlag ? ( ((s&0x00ff) << 8) | ((s&0xff00) >> 8) ) : s);
253 
254  // If the sign bit is set, mask it out then multiply by negative one.
255  if (s & 0x8000)
256  {
257  return (static_cast<ossim_sint16>(s & 0x7fff) * -1);
258  }
259 
260  return static_cast<ossim_sint16>(s);
261 }
262 
263 #endif
virtual bool open()=0
Pure virtual open.
Represents serializable keyword/value map.
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
virtual ossim_uint32 getNumberOfLines(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
const ossimImageSource & operator=(const ossimImageSource &)
virtual ossim_uint32 getTileHeight() const
Returns the default processing tile height.
bool theSwapBytesFlag
DTED data is always stored as BIG_ENDIAN.
unsigned short ossim_uint16
ossim_uint32 theDataRecordSize
virtual ossimString getShortName() const
Definition: ossimObject.cpp:48
virtual ossim_uint32 getTileWidth() const
Returns the default processing tile width.
virtual bool isOpen() const =0
Derived classes must implement this method to be concrete.
virtual double getMinPixelValue(ossim_uint32 band=0) const
Retuns the min pixel value.
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if non defined...
signed short ossim_sint16
#define TYPE_DATA
Definition: ossimRtti.h:339
virtual ossim_uint32 getImageTileHeight() const =0
Returns the tile width of the image or 0 if the image is not tiled.
unsigned int ossim_uint32
virtual ossimString getLongName() const
Definition: ossimObject.cpp:53
virtual void close()
Deletes the overview and clears the valid image vertices.
virtual ossimIrect getImageRectangle(ossim_uint32 resLevel=0) const
Returns zero-based bounding rectangle of the image.
ossimScalarType
ossimRefPtr< ossimImageData > theTile
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
virtual ossim_uint32 getImageTileWidth() const =0
Returns the tile width of the image or 0 if the image is not tiled.
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
This class defines an abstract Handler which all image handlers(loaders) should derive from...
virtual void loadMetaData()
There is an external file with an omd extension.
#define OSSIM_DLL
ossim_uint32 theOffsetToFirstDataRecord
std::shared_ptr< ossimDtedInfo > m_dtedInfo
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
virtual ossim_uint32 getNumberOfInputBands() const =0
std::shared_ptr< ossim::istream > m_fileStr
virtual double getNullPixelValue(ossim_uint32 band=0) const
Each band has a null pixel associated with it.
ossim_sint16 convertSignedMagnitude(ossim_uint16 &s) const
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)