Commit 3d004a7f authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

ENH: better decoupling with ossim

parent 92fcdeea
......@@ -18,6 +18,7 @@
#include "otbImageKeywordlist.h"
#include "base/ossimKeywordlist.h"
#include "base/ossimString.h"
namespace otb
{
......@@ -48,12 +49,20 @@ void
ImageKeywordlist::
SetKeywordlist(const ossimKeywordlist& kwl)
{
m_Keywordlist = kwl.getMap();
m_Keywordlist.clear();
for (ossimKeywordlist::KeywordMap::const_iterator it = kwl.getMap().begin();
it != kwl.getMap().end();
++it)
{
std::string first(it->first.stringDup());
std::string second(it->second.stringDup());
m_Keywordlist[first] = second;
}
}
const ossimString&
const std::string&
ImageKeywordlist::
GetMetadataByKey(const ossimString& key) const
GetMetadataByKey(const std::string& key) const
{
// Search for the key in the output map
KeywordlistMap::const_iterator it = m_Keywordlist.find(key);
......@@ -71,7 +80,16 @@ void
ImageKeywordlist::
convertToOSSIMKeywordlist(ossimKeywordlist& kwl) const
{
kwl.getMap() = m_Keywordlist;
ossimKeywordlist::KeywordMap ossimMap;
for(KeywordlistMap::const_iterator it = m_Keywordlist.begin();
it != m_Keywordlist.end();
++it)
{
ossimString first(it->first);
ossimString second(it->second);
ossimMap[first] = second;
}
kwl.getMap() = ossimMap;
}
void
......
......@@ -24,8 +24,6 @@
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "base/ossimString.h"
//forward declaration
class ossimKeywordlist;
......@@ -50,7 +48,7 @@ public:
//virtual const char *GetNameOfClass() const
//{return "ImageKeywordlist"; }
typedef std::map<ossimString, ossimString> KeywordlistMap;
typedef std::map<std::string, std::string> KeywordlistMap;
/** Run-time type information (and related methods). */
itkTypeMacro(ImageKeywordlist, ImageKeywordlist);
......@@ -74,7 +72,7 @@ public:
}
/** Get the Data object descriptor corresponding to the given key */
const ossimString& GetMetadataByKey(const ossimString& key) const;
const std::string& GetMetadataByKey(const std::string& key) const;
virtual void convertToOSSIMKeywordlist(ossimKeywordlist& kwl) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment