47 return (rhs.first.downcase().contains(
m_key));
53 static const char HEADER_OFFSET_KW[] =
"header_offset";
54 static const char FILE_TYPE_KW[] =
"file_type";
55 static const char DATA_TYPE_KW[] =
"data_type";
56 static const char SENSOR_TYPE_KW[] =
"sensor_type";
57 static const char X_START_KW[] =
"x_start";
58 static const char Y_START_KW[] =
"y_start";
59 static const char MAP_INFO_KW[] =
"map_info";
60 static const char WAVELENGTH_UNITS_KW[] =
"wavelength_units";
61 static const char BAND_NAME_KW[] =
"band_name";
62 static const char WAVELENGTH_KW[] =
"wavelength";
127 in.open(file.
c_str(), std::ios::in | std::ios::binary);
148 while(!in.eof()&&in.good())
154 int c =
static_cast<char>(in.get());
155 while((c !=
'=')&&(in.good())&&!in.eof())
157 name +=
static_cast<char>(c);
163 if(in.good()&&!in.eof())
168 while((c !=
'}')&&(in.good())&&!in.eof())
170 value +=
static_cast<char>(c);
176 while(((c !=
'\n')&&(c!=
'\r'))&&(in.good())&&!in.eof())
178 value +=
static_cast<char>(c);
220 out <<
"ENVI" <<
"\n" <<
m_keywords << std::endl;
226 return obj.
print( out );
304 std::vector<ossimString> strLst;
308 std::vector<ossimString>::const_iterator i = strLst.begin();
310 while ( i != strLst.end() )
312 band = (*i).toUInt32();
317 bands.push_back(band);
322 <<
"ossimEnviHeader::getDefaultBands WARN!" 323 <<
"\nDetected zero based bands in \"default bands\" from header!" 337 return (bands.size() ?
true :
false);
377 switch( dataTypeInt )
419 dataTypeString =
"1";
422 dataTypeString =
"2";
425 dataTypeString =
"3";
428 dataTypeString =
"4";
431 dataTypeString =
"5";
434 dataTypeString =
"6";
437 dataTypeString =
"9";
440 dataTypeString =
"12";
443 dataTypeString =
"13";
449 if(!dataTypeString.
empty())
461 if (interleave ==
"bsq")
465 else if (interleave ==
"bil")
469 else if (interleave ==
"bip")
481 std::string interleaveString =
"";
485 interleaveString =
"bil";
488 interleaveString =
"bsq";
491 interleaveString =
"bip";
494 interleaveString =
"Unknown";
592 <<
"ossimEnviHeader::setMapInfo DEBUG:" 610 <<
"ossimEnviHeader::setMapInfo WARNING:" 611 <<
"\nNo projection type found!\nReturning..." 630 <<
"ossimEnviHeader::setMapInfo WARNING:" 631 <<
"\nUnhandled ossim -> envi datum: " << datum
632 <<
"\nAssuming WGS-84!" 637 if ( (projection ==
"ossimEquDistCylProjection") ||
638 (projection ==
"ossimLlxyProjection") )
640 const char* tieLat = NULL;
641 const char* tieLon = NULL;
642 const char* degLat = NULL;
643 const char* degLon = NULL;
646 degLat = kwl.
find(prefix,
648 degLon = kwl.
find(prefix,
651 if (!tieLat || !tieLon || !degLat || !degLon)
656 mapInfoString =
"{Geographic Lat/Lon, 1.0000, 1.0000, ";
657 mapInfoString += tieLon;
658 mapInfoString +=
", ";
659 mapInfoString += tieLat;
660 mapInfoString +=
", ";
661 mapInfoString += degLon;
662 mapInfoString +=
", ";
663 mapInfoString += degLat;
664 mapInfoString +=
", ";
665 mapInfoString += datum;
666 mapInfoString +=
", units=degrees}";
673 <<
"ossimEnviHeader::setMapInfo DEBUG:" 674 <<
"\ntheMapInfo: " << mapInfoString
694 bandNamesString.
split(bandNames,
",");
700 value.
join(bandNames,
",");
709 bandNamesString.
split(waveLengths,
",");
713 const std::vector<ossimString>& wavelengths)
716 value.
join(wavelengths,
",");
724 std::string pfx = (prefix ? prefix:
"" );
759 lookup = kwl.
findKey(pfx, std::string(HEADER_OFFSET_KW));
765 lookup = kwl.
findKey(pfx, std::string(FILE_TYPE_KW));
771 lookup = kwl.
findKey(pfx, DATA_TYPE_KW);
783 lookup = kwl.
findKey(pfx, std::string(SENSOR_TYPE_KW));
794 if (s ==
"little_endian")
798 else if (s ==
"big_endian")
808 lookup = kwl.
findKey(pfx, std::string(X_START_KW));
813 lookup = kwl.
findKey(pfx, std::string(Y_START_KW));
819 lookup = kwl.
findKey(pfx, std::string(MAP_INFO_KW));
825 lookup = kwl.
findKey(pfx, std::string(WAVELENGTH_UNITS_KW));
841 while ( (count <
n) || (count > MAX_TRIES) )
870 while ( (count <
n) || (count > MAX_TRIES) )
893 <<
"ossimEnviHeader::loadState DEUG\n";
904 in.open(file.
c_str(), std::ios::in | std::ios::binary);
940 std::vector<ossim_uint32>::const_iterator i = bands.begin();
941 while ( i != bands.end() )
943 if ( (*i) >= INPUT_BANDS )
static const char * BYTE_ORDER_KW
static const char * DECIMAL_DEGREES_PER_PIXEL_LAT
ossim_uint32 numberOf(const char *str) const
32 bit complex floating point
static const char * DATUM_KW
const ossimString & join(const std::vector< ossimString > &stringList, const ossimString &separator)
Represents serializable keyword/value map.
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
std::basic_ifstream< char > ifstream
Class for char input file streams.
const char * find(const char *key) const
bool hasKey(const std::string &key) const
Checks for key in map.
static ossimString toString(bool aValue)
Numeric to string methods.
static const char * NUMBER_LINES_KW
static const char * TIE_POINT_LON_KW
void split(std::vector< ossimString > &result, const ossimString &separatorList, bool skipBlankFields=false) const
Splits this string into a vector of strings (fields) using the delimiter list specified.
OSSIM_DLL ossimByteOrder byteOrder()
ossim_uint32 toUInt32() const
static const char * TYPE_KW
ossim_int32 toInt32() const
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual bool operator()(const KwlComparePairType &rhs) const
OSSIM_DLL std::istream & skipws(std::istream &in)
std::string::size_type size() const
os2<< "> n<< " > nendobj n
bool findValue(ossimString &value, const CompareType &compare) const
This is a generic find method that takes a comparator type and iterates through the map executing t...
unsigned int ossim_uint32
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
static const char * DECIMAL_DEGREES_PER_PIXEL_LON
static const char * NUMBER_BANDS_KW
static ossimString downcase(const ossimString &aString)
std::basic_istream< char > istream
Base class for char input streams.
static const char * INTERLEAVE_TYPE_KW
static const char * DESCRIPTION_KW
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
KwlKeyCaseInsensitiveEquals(const ossimString &key)
KwlKeySubStringCaseInsensitive(const ossimString &key)
static const char * TIE_POINT_LAT_KW
64 bit complex floating point
std::basic_ofstream< char > ofstream
Class for char output file streams.
virtual bool operator()(const KwlComparePairType &rhs) const
static const char * FILENAME_KW
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.
const std::string & string() const