61 std::string xmlString;
87 str.read( (
char*)&c, 1);
90 str.read( (
char*)&c, 1);
98 str.read( (
char*)&c, 1);
101 str.read( (
char*)&c, 1);
111 str.read( (
char*)&xpacketLength, 2 );
117 swapper.
swap( xpacketLength );
120 if ( xpacketLength > 31 )
129 std::vector<char> v( XMP_ID_SIZE );
132 str.read( &v.front(), XMP_ID_SIZE );
136 std::string s = &v.front();
138 if ( s ==
"http://ns.adobe.com/xap/1.0/" )
150 v.resize( HEADER_SIZE );
151 str.read( &v.front(), HEADER_SIZE );
156 if ( s ==
"<?xpacket begin=" )
159 str.seekg( 1, std::ios_base::cur );
163 str.read( (
char*)encode_bytes, 3 );
165 if ( ( encode_bytes[0] == 0xef ) &&
166 ( encode_bytes[1] == 0xbb ) &&
167 ( encode_bytes[2] == 0xbf ) )
170 str.seekg( 6, std::ios_base::cur );
174 v.resize( XPACKET_ID_SIZE );
175 str.read ( &v.front(), XPACKET_ID_SIZE );
180 if ( s ==
"W5M0MpCehiHzreSzNTczkc9d" )
191 if ( xmpApp1XmlBlock.size() )
224 std::string prefix =
"";
226 if ( ( ext ==
"jpg" ) || ( ext ==
"jpeg" ) )
237 out << prefix <<
"acquisitionDate: " << s << std::endl;
244 out << prefix <<
"missionId: " << s << std::endl;
251 out << prefix <<
"sensorId: " << s << std::endl;
279 if ( xmlDoc.
read( is ) )
288 bool foundAll =
false;
293 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/dc:UL_Latitude";
294 if (
getPath( path, xmlDoc, s ) )
302 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/dc:UL_Longitude";
303 if (
getPath( path, xmlDoc, s ) )
313 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/dc:UR_Latitude";
314 if (
getPath( path, xmlDoc, s ) )
322 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/dc:UR_Longitude";
323 if (
getPath( path, xmlDoc, s ) )
333 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/dc:LR_Latitude";
334 if (
getPath( path, xmlDoc, s ) )
342 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/dc:LR_Longitude";
343 if (
getPath( path, xmlDoc, s ) )
353 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/dc:LL_Latitude";
354 if (
getPath( path, xmlDoc, s ) )
362 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/dc:LL_Longitude";
363 if (
getPath( path, xmlDoc, s ) )
415 if ( xmlDoc.
read( is ) )
425 std::string dayOfMonth;
429 std::string milliSecond;
431 bool foundAll =
false;
436 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/dc:IRIG_Year";
437 if (
getPath( path, xmlDoc, s ) )
446 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/dc:IRIG_Month";
447 if (
getPath( path, xmlDoc, s ) )
457 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/dc:IRIG_Day_of_Month";
458 if (
getPath( path, xmlDoc, s ) )
468 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/dc:IRIG_Hour";
469 if (
getPath( path, xmlDoc, s ) )
479 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/dc:IRIG_Min";
480 if (
getPath( path, xmlDoc, s ) )
490 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/dc:IRIG_Sec";
491 if (
getPath( path, xmlDoc, s ) )
501 path =
"/x:xmpmeta/rdf:RDF/rdf:Description/dc:IRIG_Msec";
502 if (
getPath( path, xmlDoc, s ) )
528 os1 << std::setiosflags(std::ios_base::fixed|std::ios_base::right)
532 date += os1.str() +
"-";
536 os2 << std::setiosflags(std::ios_base::fixed|std::ios_base::right)
540 date +=
os2.str() +
"T";
544 os3 << std::setiosflags(std::ios_base::fixed|std::ios_base::right)
548 date += os3.str() +
":";
552 os4 << std::setiosflags(std::ios_base::fixed|std::ios_base::right)
556 date += os4.str() +
":";
560 os5 << std::setiosflags(std::ios_base::fixed|std::ios_base::right)
564 date += os5.str() +
".";
568 os6 << std::setiosflags(std::ios_base::fixed|std::ios_base::right)
572 date += os6.str() +
"Z";
599 std::vector<ossimRefPtr<ossimXmlNode> > xnodes;
601 if ( xnodes.size() == 1 )
603 if ( xnodes[0].valid() )
605 s = xnodes[0]->getText();
608 else if(traceDebug())
611 <<
"ossimXmpInfo::getPath ERROR:\n" 612 <<
"Node not found: " << path
616 else if ( xnodes.size() == 0 )
621 <<
"ossimXmpInfo::getPath ERROR:\n" 622 <<
"Node not found: " << path
631 <<
"ossimXmpInfo::getPath ERROR:\n" 632 <<
"Multiple nodes found: " << path
void clear()
Erases the entire container.
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
void getMissionId(std::string &mission) const
Gets the mission ID if available.
std::basic_ifstream< char > ifstream
Class for char input file streams.
const ossimDpt & ul() const
virtual std::ostream & print(std::ostream &out) const
Print method.
OSSIM_DLL ossimByteOrder byteOrder()
std::istream & getline(std::istream &is, ossimString &str, char delim)
unsigned short ossim_uint16
virtual bool open(const ossimFilename &file)
open method.
ossimXmpInfo()
default constructor
const std::string & getXmpApp1XmlBlock() const
bool getPath(const ossimString &path, const ossimXmlDocument &xdoc, ossimString &s) const
Gets path from doc and initializes string.
unsigned int ossim_uint32
ossim_float64 toFloat64() const
static ossimString downcase(const ossimString &aString)
const ossimDpt & ur() const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
bool read(std::istream &in)
const ossimDpt & ll() const
void getSensorId(std::string &sensor) const
Gets the sensor ID if available.
void findNodes(const ossimString &xpath, std::vector< ossimRefPtr< ossimXmlNode > > &nodelist) const
Appends any matching nodes to the list supplied (should be empty):
std::basic_istringstream< char > istringstream
Class for char input memory streams.
const ossimDpt & lr() const
ossimRefPtr< ossimProjection > getProjection(const ossimDrect &imageRect) const
Method to get a projection if possible.
std::string m_xmpApp1XmlBlock
unsigned char ossim_uint8
void getDate(std::string &date) const
Gets the date if available in ISO8601 format: YYYY-MM-DDThh:mm:ss.sssZ.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
std::basic_ostream< char > ostream
Base class for char output streams.
virtual ~ossimXmpInfo()
virtual destructor
const std::string & string() const