OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimIgenGenerator.h
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 // Author: Garrett Potts (gpotts@imagelinks.com)
6 //
7 //*************************************************************************
8 // $Id: ossimIgenGenerator.h 15833 2009-10-29 01:41:53Z eshirschorn $
9 #ifndef ossimIgenGenerator_HEADER
10 #define ossimIgenGenerator_HEADER
11 #include <stack>
12 
16 #include <ossim/base/ossimGrect.h>
21 
23 {
24 public:
26  ossimConnectableObject* output=NULL,
27  ossimObject* view=NULL)
28  :thePixelType(OSSIM_PIXEL_IS_POINT),
29  theTilingFlag(false),
30  theTileSpacing(7.5, 7.5),
31  theTileSpacingUnits(OSSIM_MINUTES),
32  theTilePadding(0,0),
33  theTilePaddingUnits(OSSIM_PIXEL),
34  theNamingConvention("DEFAULT"),
35  theSpecFileLocation(""),
36  theIgenExecutable("igen"),
37  theSpecFileIndex(0),
38  theSpecListIndex(0),
39  theTileNamingConvention("id")
40  {
41  theUpperLeftTileStart.makeNan();
42  setInput(input);
43  setOutput(output);
44  setView(view);
45  theInputBoundingRect.makeNan();
46  }
47 
49  {
50  }
52  {
53  theSpecList.clear();
54  generateOutputKwl(output);
55  }
56 
57  void setOutput(const ossimKeywordlist& kwl);
58 
59  void setInput(ossimConnectableObject* input);
60 
61  void setView(ossimObject* view)
62  {
63  generateViewKwl(view);
64  }
65 
66  void generateSpecList(bool outputToFileFlag = false);
67  void getImageFilenamesFromSpecList(std::vector<ossimFilename>& filenameList);
68  ossimGrect getBoundingGround()const;
69 
70  void executeSpecList();
71 
73  {
74  theSpecFileIndex = 0;
75  theSpecListIndex = 0;
76  }
77  bool nextSpecFile(ossimFilename& specFile)
78  {
79  if(theSpecFileIndex >= theSpecFileList.size())
80  {
81  return false;
82  }
83  specFile = theSpecFileList[theSpecFileIndex];
84  ++theSpecFileIndex;
85  return true;
86  }
87  void getSpecs(vector<ossimKeywordlist>& specList)const
88  {
89  specList = theSpecList;
90  }
91 
93  {
94  return (ossim_uint32)theSpecFileList.size();
95  }
96 
97  ossimFilename getSpecFilename(ossim_uint32 specFileIndex = 0)const
98  {
99  if(specFileIndex < theSpecFileList.size())
100  {
101  return theSpecFileList[specFileIndex];
102  }
103 
104  return ossimFilename("");
105  }
107  {
108  ossimFilename igenExe = getIgenExecutable();
109  ossimFilename specFile = getSpecFilename(i);
110 
111  return ossimFilename( igenExe + " " + specFile);
112  }
113 
115  ossim_uint32 specIndex=0)
116  {
117  kwl.clear();
118 
119  if(specIndex < theSpecList.size())
120  {
121  kwl = theSpecList[specIndex];
122  }
123  }
125  const char* prefix=NULL)const
126  {
127  kwl.add(prefix,
128  theInputKwl,
129  true);
130  }
132  const char* prefix=NULL)const
133  {
134  kwl.add(prefix,
135  theOutputKwl,
136  true);
137  }
138 
140  const char* prefix=NULL)const
141  {
142  kwl.add(prefix,
143  theViewKwl,
144  true);
145  }
146 
148  const char* prefix = NULL)
149  {
150  theViewKwl.clear();
151  theViewKwl.add(prefix,
152  kwl,
153  true);
154  }
156  const char* prefix = NULL)
157  {
158  theOutputKwl.clear();
159  theOutputKwl.add(prefix,
160  kwl,
161  true);
162  }
163  void setSpecFileLocation(const ossimFilename& filename)
164  {
165  theSpecFileLocation = filename;
166  }
168  {
169  return theSpecFileLocation;
170  }
171  void setIgenExecutable(const ossimFilename& igenExecutable)
172  {
173  theIgenExecutable = igenExecutable;
174  }
176  {
177  return theIgenExecutable;
178  }
180  {
181  theOutputGeoPolygon = poly;
182  }
183  void setPixelType(ossimPixelType pixelType)
184  {
185  thePixelType = pixelType;
186  }
188  {
189  poly = theOutputGeoPolygon;
190  }
192  {
193  return theOutputGeoPolygon;
194  }
195  void setTilingFlag(bool flag)
196  {
197  theTilingFlag = flag;
198  }
199  void setTileSpacing(const ossimDpt& spacing)
200  {
201  theTileSpacing = spacing;
202  }
203  void setTilePadding(const ossimDpt& padding)
204  {
205  theTilePadding = padding;
206  }
208  {
209  theTileSpacingUnits = unitType;
210  }
212  {
213  theTilePaddingUnits = unitType;
214  }
215  bool getTilingFlag()const
216  {
217  return theTilingFlag;
218  }
219  const ossimDpt& getTileSpacing()const
220  {
221  return theTileSpacing;
222  }
223  const ossimDpt& getTilePadding()const
224  {
225  return theTilePadding;
226  }
228  {
229  return theTileSpacingUnits;
230  }
232  {
233  return theTilePaddingUnits;
234  }
236  {
237  return thePixelType;
238  }
245  void setTileNamingConvention(const ossimString& namingConvention)
246  {
247  theTileNamingConvention = namingConvention;
248  theTileNamingConvention = theTileNamingConvention.downcase();
249 
250  }
252  {
253  return theTileNamingConvention;
254  }
255  ossimIrect getInputBoundingRect()const;
256 
257  ossimProjection* createProductProjection()const;
258  ossimObject* createOutput()const;
259  ossimObject* createInput()const;
260 
261 protected:
280 
281  vector<ossimKeywordlist> theSpecList;
282  vector<ossimFilename> theSpecFileList;
283 
284  void generateInputKwl(ossimConnectableObject* connectable);
285  void generateOutputKwl(ossimConnectableObject* connectable);
286  void generateViewKwl(ossimObject* view);
287  void setDefaultOutput();
288  void generateTiledSpecList(bool outputToFileFlag);
289  void generateGeoTiledSpecList(const ossimDpt& spacing, bool outputToFileFlag);
290  void generatePixelTiledSpecList(bool outputToFileFlag);
291  void generateNoTiledSpecList(bool outputToFileFlag);
292 
293  void generateChainForMultiInput(ossimConnectableObject* connectable);
294  void generateChainForMultiInputRecurse(std::stack<ossimConnectableObject*>& aStack,
295  ossimConnectableObject* connectable);
296 
297  int getTileId(const ossimDrect& rect,
298  const ossimDpt& currentPt,
299  const ossimDpt& spacing)const;
300  void addPadding(ossimGeoPolygon& output,
301  const ossimGeoPolygon& input)const;
302  void addPixelType(ossimKeywordlist& kwl, const char* prefix="product.");
303 };
304 
305 #endif
ossim_uint32 theSpecFileIndex
void getSpecs(vector< ossimKeywordlist > &specList) const
ossimKeywordlist theOutputKwl
ossim_uint32 getNumberOfSpecFiles() const
#define OSSIMDLLEXPORT
ossimIrect theInputBoundingRect
bool getTilingFlag() const
ossimFilename buildExe(ossim_uint32 i=0) const
const ossimGeoPolygon & getOutputGeoPolygon() const
ossimUnitType getTilePaddingUnits() const
ossimUnitType
Represents serializable keyword/value map.
void setTilingFlag(bool flag)
void setTilePadding(const ossimDpt &padding)
vector< ossimKeywordlist > theSpecList
ossimString theTileNamingConvention
ossimIgenGenerator(ossimConnectableObject *input=NULL, ossimConnectableObject *output=NULL, ossimObject *view=NULL)
ossimString theNamingConvention
ossimGeoPolygon theOutputGeoPolygon
bool nextSpecFile(ossimFilename &specFile)
const ossimFilename & getSpecFileLocation() const
void setTileNamingConvention(const ossimString &namingConvention)
void setOutputPolygon(const ossimGeoPolygon &poly)
ossimFilename getSpecFilename(ossim_uint32 specFileIndex=0) const
void getView(ossimKeywordlist &kwl, const char *prefix=NULL) const
vector< ossimFilename > theSpecFileList
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
void setTilePaddingUnits(ossimUnitType unitType)
ossimKeywordlist theInputKwl
ossimFilename theIgenExecutable
void getOutput(ossimKeywordlist &kwl, const char *prefix=NULL) const
const ossimString & getTileNamingConvention() const
void setView(ossimKeywordlist &kwl, const char *prefix=NULL)
unsigned int ossim_uint32
void setView(ossimObject *view)
ossimUnitType getTileSpacingUnits() const
const ossimFilename & getIgenExecutable() const
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
void setPixelType(ossimPixelType pixelType)
void setSpecFileLocation(const ossimFilename &filename)
ossimFilename theSpecFileLocation
ossimPixelType thePixelType
ossim_uint32 theSpecListIndex
ossimPixelType
ossimKeywordlist theViewKwl
void setOutput(ossimKeywordlist &kwl, const char *prefix=NULL)
void getSpec(ossimKeywordlist &kwl, ossim_uint32 specIndex=0)
ossimUnitType theTilePaddingUnits
void getOutputGeoPolygon(ossimGeoPolygon &poly) const
const ossimDpt & getTileSpacing() const
ossimPixelType getPixelType() const
ossimUnitType theTileSpacingUnits
void setTileSpacingUnits(ossimUnitType unitType)
void getInput(ossimKeywordlist &kwl, const char *prefix=NULL) const
void setTileSpacing(const ossimDpt &spacing)
void setIgenExecutable(const ossimFilename &igenExecutable)
void setOutput(ossimConnectableObject *output)
const ossimDpt & getTilePadding() const