35 static ossimTrace traceDebug(
"ossimSrtmSupportData:debug");
54 m_minPixelValue(DEFAULT_MIN),
55 m_maxPixelValue(DEFAULT_MAX),
73 <<
"ossimSrtmSupportData::setFilename: entered:" 74 <<
"\nsrtmFile: " << srtmFile
75 <<
"\nscanForMinMax flag: " << scanForMinMax
88 <<
m_file <<
" does not exist: leaving ..." << std::endl;
104 bool outputOmd =
false;
105 bool loadedFromOmd =
false;
149 <<
"Unable to compute min max: leaving ..." << std::endl;
207 "ossimEquDistCylProjection",
285 const char* prefix)
const 297 bandPrefix +=
"band1.";
389 bandPrefix +=
"band1.";
422 std::string bandPrefix;
429 bandPrefix +=
"band1.";
555 <<
"ossimSrtmSupportData::setCornerPoints(): entered..." << std::endl;
559 ossimString regularExp1 =
"[N|S][0-9][0-9][E|W][0-9][0-9][0-9]";
560 ossimString regularExp2 =
"[E|W][0-9][0-9][0-9][N|S][0-9][0-9]";
562 bool latLonOrderFlag =
true;
563 bool foundFlag =
false;
574 latLonOrderFlag =
false;
596 f.
begin()+3).toDouble();
598 if (f[static_cast<std::string::size_type>(0)] ==
'S')
602 else if (f[static_cast<std::string::size_type>(0)] !=
'N')
612 f.
begin()+7).toDouble();
613 if (f[static_cast<std::string::size_type>(3)] ==
'W')
617 else if (f[static_cast<std::string::size_type>(3)] !=
'E')
630 f.
begin()+4).toDouble();
631 if (f[static_cast<std::string::size_type>(0)] ==
'W')
635 else if (f[static_cast<std::string::size_type>(0)] !=
'E')
644 f.
begin()+7).toDouble();
646 if (f[static_cast<std::string::size_type>(4)] ==
'S')
650 else if (f[static_cast<std::string::size_type>(4)] !=
'N')
660 <<
"ossimSrtmSupportData::setCornerPoints(): leaving with true..." 671 <<
"ossimSrtmSupportData::setSize(): entered..." << std::endl;
690 m_str->seekg(0, std::ios::beg);
693 if(
m_str->isCompressed())
700 std::ios::out|std::ios::binary);
706 while(!done&&!
m_str->fail())
708 m_str->read(buf, 1024);
709 if(
m_str->gcount() < 1024)
713 if(
m_str->gcount() > 0)
715 out.write(buf,
m_str->gcount());
736 <<
"ossimSrtmSupportData::setSize(): leaving with false at line " 737 << __LINE__ << std::endl;
747 if (
size == 25934402)
753 else if(
size == 51868804)
759 else if (
size == 2884802)
765 else if (
size == 5769604)
776 if(lines*samples*2 ==
size)
788 if(lines*samples*4 ==
size)
799 <<
"ossimSrtmSupportData::setSize(): leaving with false at line " << __LINE__ << std::endl;
811 <<
"ossimSrtmSupportData::setSize(): leaving with true..." 859 char* char_buf = (
char*)line_buf;
865 m_str->read(char_buf, (std::streamsize)BYTES_IN_LINE);
872 if (line_buf[sample] == NULL_PIX)
continue;
873 if (line_buf[sample] > maxValue) maxValue = line_buf[sample];
874 if (line_buf[sample] < minValue) minValue = line_buf[sample];
902 out << std::setprecision(15) <<
"ossimSrtmSupportData data members:" static const char * BYTE_ORDER_KW
ossim_float64 m_maxPixelValue
static const char * MIN_VALUE_KW
bool setCornerPoints()
Sets corner points from "theFile".
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of the object to a keyword list.
static const char * DECIMAL_DEGREES_PER_PIXEL_LAT
static bool remove(const ossimFilename &pathname)
Removes pathname from filesystem if supported by platform.
static ossimString upcase(const ossimString &aString)
static const char * DATUM_KW
static const ossimFilename NIL
This was taken from Wx widgets for performing touch and access date stamps.
static const char * CENTRAL_MERIDIAN_KW
ossim_float64 getSouthwestLatitude() const
Represents serializable keyword/value map.
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
ossim_float64 getSouthwestLongitude() const
const char * find(const char *key) const
ossim_int64 fileSize() const
bool setSize()
Sets lines and samples from "theFile" size.
virtual std::ostream & print(std::ostream &out) const
Prints data members for debug.
double nan()
Method to return ieee floating point double precision NAN.
This code was derived from https://gist.github.com/mshockwave.
static const char * MAX_VALUE_KW
static const char * NULL_VALUE_KW
static const char * NUMBER_LINES_KW
static const char * TIE_POINT_LON_KW
ossim_uint32 getNumberOfSamples() const
ossim_float64 m_minPixelValue
OSSIM_DLL ossimByteOrder byteOrder()
virtual void setDecimalDegreesPerPixel(const ossimDpt &gsd)
ossim_uint32 toUInt32() const
static StreamFactoryRegistry * instance()
ossim_float64 m_lonSpacing
ossimRefPtr< ossimProjection > getProjection() const
Gets the projection for srtm cell.
virtual bool write(const char *file, const char *comment=0) const
Methods to dump the ossimKeywordlist to a file on disk.
static const char * TYPE_KW
virtual bool getImageGeometry(ossimKeywordlist &kwl, const char *prefix=0)
Populates the keyword list with image geometry information.
virtual ossim_int32 getEntryNumber(const char *entry_string, bool case_insensitive=true) const
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
ossim_float64 getMinPixelValue() const
static ossimScalarTypeLut * instance()
Returns the static instance of an ossimScalarTypeLut object.
ossimSrtmSupportData()
default constructor
virtual ~ossimSrtmSupportData()
destructor
bool computeMinMaxTemplate(T dummy, double defaultNull)
signed short ossim_sint16
std::string::size_type size() const
std::string::iterator begin()
OSSIM_DLL double defaultNull(ossimScalarType scalarType)
unsigned long long ossim_uint64
unsigned int ossim_uint32
virtual const ossimEllipsoid * ellipsoid() const
ossim_float64 toFloat64() const
static ossimDatumFactory * instance()
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of the object from a keyword list.
static const char * DECIMAL_DEGREES_PER_PIXEL_LON
void clear()
Sets all data members to an unitialized state.
static const char * NUMBER_BANDS_KW
bool computeMinMax()
Scans file for min and max pixels.
void compile(const char *)
ossim_uint32 start() const
ossimScalarType m_scalarType
ossim_uint32 m_numberOfLines
static const char * ORIGIN_LATITUDE_KW
ossim_float64 m_southwestLatitude
ossim_uint32 m_numberOfSamples
ossim_uint32 getNumberOfLines() const
ossim_float64 getLatitudeSpacing() const
ossim_float64 m_southwestLongitude
ossimFilename fileNoExtension() const
bool loadOmd(const ossimKeywordlist &kwl, const char *prefix=0)
This is a loadState called by setFilename that does not reset "theFile".
ossimFilename getFilename() const
std::shared_ptr< ossim::istream > m_str
ossim_float64 m_latSpacing
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
static const char * SCALAR_TYPE_KW
ossimScalarType getScalarType() const
virtual void setUlTiePoints(const ossimGpt &gpt)
static const char * TIE_POINT_LAT_KW
virtual std::shared_ptr< ossim::istream > createIstream(const std::string &connectionString, const ossimKeywordlist &options=ossimKeywordlist(), std::ios_base::openmode mode=std::ios_base::in|std::ios_base::binary) const
Will try to creates an istream interface to the connectionString passed in.
const ossimDatum * wgs84() const
static const char * IMAGE_FILE_KW
ossimFilename & setExtension(const ossimString &e)
Sets the extension of a file name.
static const char * FILENAME_KW
ossim_float64 getMaxPixelValue() const
static const char * NUMBER_SAMPLES_KW
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
std::basic_ostream< char > ostream
Base class for char output streams.
ossim_float64 getLongitudeSpacing() const
const std::string & string() const
bool setFilename(const ossimFilename &srtmFile, bool scanForMinMax=false)
Initializes object from file.