OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimRpfTocEntry.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: LGPL
4 //
5 // See LICENSE.txt file in the top level directory for more details.
6 //
7 // Author: Garrett Potts
8 //
9 //*************************************************************************
10 // $Id: ossimRpfTocEntry.cpp 19900 2011-08-04 14:19:57Z dburken $
11 
12 #include <istream>
13 #include <ostream>
14 #include <iterator>
15 
17 #include <ossim/base/ossimCommon.h>
19 #include <ossim/base/ossimIrect.h>
24 
26  const ossimRpfTocEntry& data)
27 {
28  data.print(out);
29  return out;
30 }
31 
33 {
34 
35 }
36 
39 {
41 
43  if(result == ossimErrorCodes::OSSIM_OK)
44  {
46  }
47 
48  // Fetch the number of samples as data member since it may need to be adjusted due to
49  // wrap (OLK 10/10):
51  ossimDpt ddpp;
53  ossim_float64 width_in_deg = theNumSamples*ddpp.x;
54  if (width_in_deg >= 360.0)
55  theNumSamples -= (width_in_deg - 360.0)/ddpp.x;
56 
57  return result;
58 }
59 
61  const std::string& prefix) const
62 {
63  theBoundaryInformation.print(out, prefix);
64 
65  std::vector< std::vector<ossimRpfFrameEntry> >::const_iterator frameEntry =
66  theFrameEntryArray.begin();
67 
68  while( frameEntry != theFrameEntryArray.end() )
69  {
70  std::vector<ossimRpfFrameEntry>::const_iterator i =
71  (*frameEntry).begin();
72  while ( i != (*frameEntry).end() )
73  {
74  (*i).print(out, prefix);
75  ++i;
76  }
77  ++frameEntry;
78  }
79  return out;
80 }
81 
83 {
85 }
86 
88 {
90 }
91 
93 {
95 }
96 
98 {
99  return theNumSamples;
100 }
101 
103 {
104  ossim_uint32 result = 0;
105  ossimString productType = getProductType().trim().upcase();
106  if( productType == "CIB" )
107  {
108  result = 1;
109  }
110  else if ( productType == "CADRG" )
111  {
112  result = 3;
113  }
114  return result;
115 }
116 
118 {
119  rect = ossimIrect(0, 0, getNumberOfSamples()-1, getNumberOfLines()-1);
120 }
121 
123 {
124  return theBoundaryInformation;
125 }
126 
128  long row,
129  long col)
130 {
131  if(row < (long)theFrameEntryArray.size() && row >= 0)
132  {
133  if(col < (long)theFrameEntryArray[row].size() && col >= 0)
134  {
135  theFrameEntryArray[row][col] = entry;
136  }
137  }
138 }
139 
141  long col,
142  ossimRpfFrameEntry& result)const
143 {
144  if(row < (long)theFrameEntryArray.size() && row >= 0)
145  {
146  if(col < (long)theFrameEntryArray[row].size() && col >= 0)
147  {
148  result = theFrameEntryArray[row][col];
149  }
150  else
151  {
152  return false;
153  }
154  }
155  else
156  {
157  return false;
158  }
159 
160  return true;
161 }
162 
164 {
166 }
167 
173 {
174  long rows = (long)theFrameEntryArray.size();
175  long cols = 0;
176  if(rows > 0)
177  {
178  cols = (long)theFrameEntryArray[0].size();
179  for(long rowIndex = 0; rowIndex < rows; ++ rowIndex)
180  {
181  for(long colIndex = 0; colIndex < cols; ++colIndex)
182  {
183  if(theFrameEntryArray[rowIndex][colIndex].exists())
184  {
185  return false;
186  }
187  }
188  }
189  }
190 
191  return true;
192 }
193 
195 {
196 
199 
200  // Decimal degrees per pixel:
201  ossimDpt ddpp;
203 
204  // Tie point - Shifted to pixel-is-point:
205  ossimGpt tie( (ul.latd() - (ddpp.y/2.0)), (ul.lond() + (ddpp.x/2.0)), 0.0 );
206 
207  // Origin - Use the center latitude for horizontal scale, and the left edge as origin longitude
208  // (OLK 10/10)
209  ossimGpt origin ((ul.lat + theBoundaryInformation.getCoverage().getLlLat())/2.0, tie.lon);
210 
211 #if 0 /* Please leave for debug. (drb) */
212  std::cout << "boundaryInfo:\n" << boundaryInfo << std::endl;
213 #endif
214 
216 
217  if (z == 74) z--; // Fix J to a zone.
218  if (z > 64) z -= 64; // Below the equator
219  else z -= 48; // Above the equator
220 
222  if ( z != 9 )
223  {
224  mapProj = new ossimEquDistCylProjection;
225  }
226  else
227  {
228  mapProj = new ossimAzimEquDistProjection;
229  }
230 
231  // Set the origin:
232  mapProj->setOrigin(origin);
233 
234  // Set the scale:
235  mapProj->setDecimalDegreesPerPixel(ddpp);
236 
237  // Set the tie:
238  mapProj->setUlTiePoints(tie);
239 
240  // Give projection to the geometry object.
242  geom->setProjection( mapProj.get() );
243 
244  return geom;
245 }
246 
248 {
249 #if 1
252 #else
259  scale.x = (urLon - ulLon) / samps;
260  scale.y = (ulLat - llLat) / lines;
261 #endif
262 }
263 
265 {
268 }
269 
271 {
274 
275  for(ossim_uint32 index = 0; index < theFrameEntryArray.size(); index++)
276  {
277  theFrameEntryArray[index].resize(horizontalSize);
278  }
279 }
ossim_int32 ossimErrorCode
ossim_float64 getLlLat() const
void setProjection(ossimProjection *projection)
Sets the projection to be used for local-to-world coordinate transformation.
static ossimString upcase(const ossimString &aString)
Definition: ossimString.cpp:34
ossimErrorCode parseStream(std::istream &in, ossimByteOrder byteOrder)
std::ostream & print(std::ostream &out, const std::string &prefix=std::string()) const
print method that outputs a key/value type format adding prefix to keys.
static const ossimErrorCode OSSIM_OK
ossim_uint32 getNumberOfFramesVertical() const
ossimString getProductType() const
ossim_float64 getVerticalInterval() const
ossim_uint32 getNumberOfFramesVertical() const
double y
Definition: ossimDpt.h:165
virtual void setOrigin(const ossimGpt &origin)
Sets theOrigin to origin.
ossim_uint32 getNumberOfSamples() const
ossimRefPtr< ossimImageGeometry > getImageGeometry() const
Returns the image geometry object associated with this tile source or NULL if non defined...
ossim_uint32 theNumSamples
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
virtual void setDecimalDegreesPerPixel(const ossimDpt &gsd)
ossim_float64 getVerticalResolution() const
const ossimRpfCoverageSection & getCoverage() const
const ossimRpfBoundaryRectRecord & getBoundaryInformation() const
void setEntry(const ossimRpfFrameEntry &entry, long row, long col)
std::ostream & operator<<(std::ostream &out, const ossimRpfTocEntry &data)
double ossim_float64
ossim_float64 getUlLat() const
yy_size_t size
ossim_float64 lon
Definition: ossimGpt.h:266
std::vector< std::vector< ossimRpfFrameEntry > > theFrameEntryArray
May be less than actual image width in case of > 360 deg wrap condition. (OLK 10/10) ...
unsigned int ossim_uint32
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
ossim_float64 getUrLon() const
ossimByteOrder
void getBoundingRect(ossimIrect &rect) const
Get the bounding rect of entry.
ossimRpfBoundaryRectRecord theBoundaryInformation
ossim_float64 getHorizontalInterval() const
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
ossim_uint32 getNumberOfFramesHorizontal() const
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
ossim_uint32 getNumberOfLines() const
ossim_float64 getUlLon() const
ossim_uint32 getNumberOfFramesHorizontal() const
void getMetersPerPixel(ossimDpt &scale) const
Get the scale in meters per pixel.
double x
Definition: ossimDpt.h:164
ossim_uint32 getNumberOfBands() const
virtual void setUlTiePoints(const ossimGpt &gpt)
bool getEntry(long row, long col, ossimRpfFrameEntry &result) const
void getDecimalDegreesPerPixel(ossimDpt &scale) const
Get the scale in decimal degrees per pixel.
ossim_float64 getLrLat() const
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
ossimErrorCode parseStream(std::istream &in, ossimByteOrder byteOrder)
ossim_float64 getHorizontalResolution() const
std::ostream & print(std::ostream &out, ossimString prefix) const
prints to out.