27 #include <ossim/base/ossimTrace.h> 28 static ossimTrace traceDebug (
"ossimSrtmElevSource:debug");
36 m_srtmRecordSizeInBytes(0),
104 int x0 =
static_cast<int>(xi);
105 int y0 =
static_cast<int>(yi);
121 if ( xi < 0.0 || yi < 0.0 ||
181 double xt0 = xi - x0;
182 double yt0 = yi - y0;
186 double w00 = xt1*yt1;
187 double w01 = xt0*yt1;
188 double w10 = xt1*yt0;
189 double w11 = xt0*yt0;
204 cout <<
"\np00: " << p00
215 double sum_weights = w00 + w01 + w10 + w11;
219 return (p00*w00 + p01*w01 + p10*w10 + p11*w11) / sum_weights;
234 int x0 =
static_cast<int>(xi);
235 int y0 =
static_cast<int>(yi);
262 if ( xi < 0.0 || yi < 0.0 ||
273 T v00 = *(
reinterpret_cast<T*
> (&
m_memoryMap[offset]));
274 T v01 = *(
reinterpret_cast<T*
> (&
m_memoryMap[offset +
sizeof(T)]));
275 T v10 = *(
reinterpret_cast<T*
> (&
m_memoryMap[offset2]));
276 T v11 = *(
reinterpret_cast<T*
> (&
m_memoryMap[offset2 +
sizeof(T)]));
289 double xt0 = xi - x0;
290 double yt0 = yi - y0;
294 double w00 = xt1*yt1;
295 double w01 = xt0*yt1;
296 double w10 = xt1*yt0;
297 double w11 = xt0*yt0;
312 cout <<
"\np00: " << p00
323 double sum_weights = w00 + w01 + w10 + w11;
327 return (p00*w00 + p01*w01 + p10*w10 + p11*w11) / sum_weights;
336 <<
"ossimSrtmHandler::getPostValue(const ossimIpt& gridPt): NEED TO IMPLEMENT TO NEW INTERFACE\n";
340 static const char MODULE[] =
"ossimSrtmHandler::getPostValue";
345 if ( gridPt.x < 0.0 || gridPt.y < 0.0 ||
346 gridPt.x > (theNumberOfSamples - 1) ||
347 gridPt.y > (theNumberOfLines - 1) )
352 <<
"WARNING " << MODULE <<
": No intersection..." << std::endl;
362 std::streampos offset = gridPt.y * theSrtmRecordSizeInBytes + gridPt.x * 2;
386 m_supportData(src.m_supportData),
387 m_streamOpen(src.m_streamOpen),
388 m_numberOfLines(src.m_numberOfLines),
389 m_numberOfSamples(src.m_numberOfSamples),
390 m_srtmRecordSizeInBytes(src.m_srtmRecordSizeInBytes),
391 m_latSpacing(src.m_latSpacing),
392 m_lonSpacing(src.m_lonSpacing),
393 m_nwCornerPost(src.m_nwCornerPost),
395 m_scalarType(src.m_scalarType),
396 m_memoryMap(src.m_memoryMap)
401 std::ios::binary|std::ios::in);
471 if(theFileStr.valid())
481 theFileStr = ossimStreamFactoryRegistry::instance()->createNewIFStream(
theFilename,
482 std::ios::in | std::ios::binary);
484 if(theFileStr.valid())
ossimSrtmSupportData m_supportData
double getHeightAboveMSLFileTemplate(T dummy, const ossimGpt &gpt)
ossim_int32 m_numberOfLines
std::vector< ossim_int8 > m_memoryMap
double getHeightAboveMSLMemoryTemplate(T dummy, const ossimGpt &gpt)
virtual const ossimFilename & getFilename() const
ossim_float64 getSouthwestLatitude() const
double theNullHeightValue
ossim_float64 getSouthwestLongitude() const
ossim_int64 fileSize() const
bool almostEqual(T x, T y, T tolerance=FLT_EPSILON)
double nan()
Method to return ieee floating point double precision NAN.
ossimScalarType m_scalarType
ossim_uint32 getNumberOfSamples() const
OSSIM_DLL ossimByteOrder byteOrder()
static const ossimErrorCode OSSIM_ERROR
bool m_streamOpen
true if stream is open.
virtual bool open(const ossimFilename &file, bool memoryMapFlag=false)
Opens a stream to the srtm cell.
ossimSrtmHandler()
Constructor that takes a file name.
virtual ~ossimSrtmHandler()
destructor
virtual ossimIpt getSizeOfElevCell() const
METHOD: getSizeOfElevCell Returns the number of post in the cell.
virtual void close()
Closes the stream to the file.
virtual void clearErrorStatus() const
signed short ossim_sint16
ossim_int32 m_srtmRecordSizeInBytes
unsigned long long ossim_uint64
ossimFilename theFilename
Virtual method for reading.
OSSIM_DLL ossim_uint32 scalarSizeInBytes(ossimScalarType scalarType)
std::mutex m_fileStrMutex
ossimErrorCode theErrorStatus
ossim_int32 m_numberOfSamples
ossim_uint32 getNumberOfLines() const
virtual double getPostValue(const ossimIpt &gridPt) const
METHOD: getPostValue Returns the value at a given grid point as a double.
ossim_float64 getLatitudeSpacing() const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
ossimScalarType getScalarType() const
ossimDpt metersPerDegree() const
#define RTTI_DEF1(cls, name, b1)
const ossimGpt & lr() const
virtual bool isOpen() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_float64 getLongitudeSpacing() const
virtual double getHeightAboveMSL(const ossimGpt &)
METHOD: getHeightAboveMSL Height access methods.
bool setFilename(const ossimFilename &srtmFile, bool scanForMinMax=false)
Initializes object from file.