OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimQuickbirdNitfTileSource.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 // Copyright (C) 2000 ImageLinks Inc.
3 //
4 // License: LGPL
5 //
6 // See LICENSE.txt file in the top level directory for more details.
7 //
8 // Author: Garrett Potts
9 //
10 // Description:
11 //
12 //*******************************************************************
13 // $Id: ossimQuickbirdNitfTileSource.cpp 22836 2014-07-25 15:13:47Z dburken $
16 #include <ossim/base/ossimDrect.h>
17 #include <ossim/base/ossimTrace.h>
21 
22 RTTI_DEF1(ossimQuickbirdNitfTileSource, "ossimQuickbirdNitfTileSource", ossimNitfTileSource);
23 
24 static const ossimTrace traceDebug("ossimQuickbirdNitfTileSource:debug");
25 
27 {
28  if(traceDebug())
29  {
31  << "ossimQuickbirdNitfTileSource::open(file) DEBUG: entered ..."
32  << std::endl;
33  }
34 
36  file = file.replaceAllThatMatch("_R[0-9]+C[0-9]+");
37  ossimQuickbirdTile tileFile;
38  bool openedTileFile = false;
39  file.setExtension("TIL");
40 
41  if(!tileFile.open(file))
42  {
43  file.setExtension("TIL");
44  if(tileFile.open(file))
45  {
46  openedTileFile = true;
47  }
48  else
49  {
50  file.setExtension("til");
51  if(tileFile.open(file))
52  {
53  openedTileFile = true;
54  }
55  }
56  }
57  else
58  {
59  openedTileFile = true;
60  }
61 
62  if(openedTileFile)
63  {
64  if(traceDebug())
65  {
67  << "ossimQuickbirdNitfTileSource::open(file) DEBUG:"
68  << "\nOpened tile file" << std::endl;
69  }
70 
71  // Call the base class open...
73  {
74  return false;
75  }
76 
79 
80 
81  tempBounds = ossimIrect(0,
82  0,
83  tempBounds.width() - 1,
84  tempBounds.height() - 1);
85 
86  if(traceDebug())
87  {
89  << "ossimQuickbirdNitfTileSource::open(file) DEBUG:"
90  << "\nheader rectangle = " << tempBounds << std::endl;
91  }
92 
93  ossimIpt ulPt;
94  ossimIpt urPt;
95  ossimIpt lrPt;
96  ossimIpt llPt;
97  ossimDpt shift;
98  if(tileFile.getInfo(info, theImageFile.file().upcase()))
99  {
100  ulPt.makeNan();
101  urPt.makeNan();
102  lrPt.makeNan();
103  llPt.makeNan();
104 
105  if((info.theUlXOffset != OSSIM_INT_NAN) &&
106  (info.theUlYOffset != OSSIM_INT_NAN))
107  {
108  shift = ossimIpt(info.theUlXOffset, info.theUlYOffset);
109  }
110  else
111  {
112  shift = ossimIpt(0,0);
113  }
115  }
116  if(traceDebug())
117  {
119  << "ossimQuickbirdNitfTileSource::open(file) DEBUG:"
120  << "\nUl = " << ulPt
121  << "\nUr = " << urPt
122  << "\nLr = " << lrPt
123  << "\nLl = " << llPt
124  << "\ntheImageRect: " << getImageRectangle(0)
125  << "\nExiting..."
126  << std::endl;
127  }
128  }
129  else
130  {
131  if(traceDebug())
132  {
134  << "ossimQuickbirdNitfTileSource::open(file) DEBUG"
135  << "Not opened..."
136  << std::endl;
137  }
138  }
139 
140  return openedTileFile;
141 }
142 
144 {
146  if( result.valid() )
147  {
148  if(!result->getTransform())
149  {
150  result->setTransform(m_transform.get());
151  }
152  }
153  return result;
154 }
155 
157  const char* prefix)const
158 {
159  return ossimNitfTileSource::saveState( kwl, prefix );
160 }
161 
163  const char* prefix)
164 
165 {
166  return ossimNitfTileSource::loadState( kwl, prefix );
167 }
void makeNan()
Definition: ossimIpt.h:56
static ossimString upcase(const ossimString &aString)
Definition: ossimString.cpp:34
ossimFilename theImageFile
bool open(const ossimFilename tileFile)
Represents serializable keyword/value map.
bool valid() const
Definition: ossimRefPtr.h:75
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
ossim_uint32 height() const
Definition: ossimIrect.h:487
#define OSSIM_INT_NAN
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
ossimString replaceAllThatMatch(const char *regularExpressionPattern, const char *value="") const
bool getInfo(ossimQuickbirdTileInfo &result, const ossimFilename &filename) const
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if non defined...
virtual ossimIrect getImageRect() const =0
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if non defined...
virtual ossimIrect getImageRectangle(ossim_uint32 resLevel=0) const
Returns zero-based bounding rectangle of the image.
const ossimNitfImageHeader * getCurrentImageHeader() const
ossim_uint32 width() const
Definition: ossimIrect.h:500
virtual bool open()
Returns true if the image_file can be opened and is a valid nitf file.
void setTransform(ossim2dTo2dTransform *transform)
Sets the transform to be used for local-to-full-image coordinate transformation.
const ossim2dTo2dTransform * getTransform() const
Access methods for transform (may be NULL pointer).
ossimFilename file() const
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
ossimRefPtr< ossim2dTo2dTransform > m_transform
ossimFilename & setExtension(const ossimString &e)
Sets the extension of a file name.
virtual bool open()
Returns true if the image_file can be opened and is a valid nitf file.
RTTI_DEF1(ossimQuickbirdNitfTileSource, "ossimQuickbirdNitfTileSource", ossimNitfTileSource)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)