Orfeo Toolbox  4.0
otbTileMapImageIO.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ORFEO Toolbox
4  Language: C++
5  Date: $Date$
6  Version: $Revision$
7 
8 
9  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10  See OTBCopyright.txt for details.
11 
12 
13  This software is distributed WITHOUT ANY WARRANTY; without even
14  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  PURPOSE. See the above copyright notices for more information.
16 
17 =========================================================================*/
18 #ifndef __otbTileMapImageIO_h
19 #define __otbTileMapImageIO_h
20 
21 
22 /* C++ Libraries */
23 #include <string>
24 #include <vector>
25 //#include "stdlib.h"
26 
27 /* ITK Libraries */
28 #include "otbMacro.h"
29 #include "otbImageIOBase.h"
31 
32 #include "otbCurlHelperInterface.h"
33 
34 namespace otb
35 {
36 
38 {
39 enum TileMapAdressingStyle {GM = 0, OSM = 1, NEARMAP = 2, LOCAL = 3};
40 }
41 
48 class ITK_EXPORT TileMapImageIO : public otb::ImageIOBase
49 {
50 public:
51 
52  typedef unsigned char InputPixelType;
53 
58 
60  itkNewMacro(Self);
61 
64 
66 
69  itkSetMacro(CompressionLevel, int);
70  itkGetMacro(CompressionLevel, int);
71 
73  itkSetMacro(MaxConnect, int);
74  itkGetMacro(MaxConnect, int);
75 
76  virtual void SetCacheDirectory(const char* _arg);
77  virtual void SetCacheDirectory(const std::string& _arg);
78 
79  itkGetStringMacro(CacheDirectory);
80 
81  itkSetMacro(Depth, int);
82  itkGetMacro(Depth, int);
83 
84  itkGetStringMacro(FileSuffix);
85  itkSetStringMacro(FileSuffix);
86 
89  virtual bool CanReadFile(const char*);
90 
92  virtual bool CanStreamRead()
93  {
94  return true;
95  }
96 
98  virtual void ReadImageInformation();
99 
101  virtual void Read(void* buffer);
102 
105  virtual bool CanWriteFile(const char*);
106 
108  virtual bool CanStreamWrite()
109  {
110  return true;
111  }
112 
115  virtual void WriteImageInformation();
116 
119  virtual void Write(const void* buffer);
120 
121 protected:
123  TileMapImageIO();
125  virtual ~TileMapImageIO();
126 
127  void PrintSelf(std::ostream& os, itk::Indent indent) const;
129  void InternalReadImageInformation();
131  void InternalWriteImageInformation();
132 
133  virtual unsigned int GetActualNumberOfSplitsForWritingCanStreamWrite(unsigned int numberOfRequestedSplits,
134  const ImageIORegion& pasteRegion) const;
135 
136  virtual ImageIORegion GetSplitRegionForWritingCanStreamWrite(unsigned int ithPiece,
137  unsigned int numberOfActualSplits,
138  const ImageIORegion& pasteRegion) const;
139 
142 
146 
147 private:
149  typedef struct
150  {
151  int numTileX;
152  int numTileY;
153  double x;
154  double y;
155  std::string filename;
157 
158  TileMapImageIO(const Self &); //purposely not implemented
159  void operator =(const Self&); //purposely not implemented
160 
161  void InternalWrite(double x, double y, const void* buffer);
162  void BuildFileName(const std::ostringstream& quad, std::ostringstream& filename, bool inCache = true) const;
163  void FillCacheFaults(void* buffer) const;
164  int XYToQuadTree(double x, double y, std::ostringstream& quad) const;
165  int XYToQuadTree2(double x, double y, std::ostringstream& quad) const;
166 
168  void GenerateTileInfo(double x, double y, int numTileX, int numTileY);
169  bool CanReadFromCache(const std::string& filename);
170  void GenerateURL(double x, double y);
171  void GenerateBuffer(unsigned char * p);
172  void ReadTile(const std::string& filename, void * buffer);
173 
174  std::vector<std::string> m_ListFilename;
175  std::vector<std::string> m_ListURLs;
176  std::vector<TileNameAndCoordType> m_ListTiles;
178 
180 
183 
186 
188  int m_Depth;
190  std::string m_CacheDirectory;
191  std::string m_ServerName;
192  std::string m_FileSuffix;
194 
196 
198 
201 };
202 
203 } // end namespace otb
204 
205 #endif // __otbTileMapImageIO_h

Generated at Sat Mar 8 2014 16:22:35 for Orfeo Toolbox with doxygen 1.8.3.1