OTB  6.7.0
Orfeo Toolbox
otbImageKeywordlist.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbImageKeywordlist_h
22 #define otbImageKeywordlist_h
23 
24 #include <map>
25 
26 #include "gdal.h"
27 
28 #include "itkObject.h"
29 #include "itkObjectFactory.h"
30 
31 #include "OTBOSSIMAdaptersExport.h"
32 
33 //forward declaration
34 class ossimKeywordlist;
35 
36 namespace otb
37 {
38 
39 namespace internal
40 {
48  inline double ConvertToOSSIMFrame(double val)
49  {
50  return (val - 0.5);
51  }
52 
60  inline double ConvertFromOSSIMFrame(double val)
61  {
62  return (val + 0.5);
63  }
64 
65 } // namespace internal
66 
78 class OTBOSSIMAdapters_EXPORT ImageKeywordlist
79 {
80 public:
83 
84  //virtual const char *GetNameOfClass() const
85  //{return "ImageKeywordlist"; }
86 
87  typedef std::map<std::string, std::string> KeywordlistMap;
88  typedef KeywordlistMap::size_type KeywordlistMapSizeType;
89 
92  {
93  return m_Keywordlist;
94  }
95 
96  void SetKeywordlist(const ossimKeywordlist& kwl);
97 
98  void Clear(void)
99  {
100  m_Keywordlist.clear();
101  }
102 
104  {
105  return m_Keywordlist.empty();
106  }
107 
109  {
110  return m_Keywordlist.size();
111  }
112 
114  const std::string& GetMetadataByKey(const std::string& key) const;
115 
117  bool HasKey(const std::string& key) const;
118 
120  virtual void ClearMetadataByKey(const std::string& key);
121 
122  virtual void AddKey(const std::string& key, const std::string& value);
123 
124  virtual void convertToOSSIMKeywordlist(ossimKeywordlist& kwl) const;
125 
128  virtual bool convertToGDALRPC(GDALRPCInfo &rpc) const;
129 
130  virtual void Print(std::ostream& os, itk::Indent indent = 0) const;
131 
133  virtual ~ImageKeywordlist();
134 
135  ImageKeywordlist(const Self &);
136  void operator =(const Self&);
137 
138  bool operator ==(const Self&) const;
139  inline bool operator != ( const Self & ) const;
140 
141 protected:
146  virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
147 
148 private:
151 
152 // char m_Delimiter;
153 
154 // void operator=(const Self&) = delete;
155 
156 };
157 
158 OTBOSSIMAdapters_EXPORT
159 std::ostream & operator <<(std::ostream& os, const ImageKeywordlist& kwl);
160 
161 // Free function to handle the keywordlist <-> files
162 OTBOSSIMAdapters_EXPORT
163 ImageKeywordlist ReadGeometryFromImage(const std::string& filename, bool checkRpcTag=true);
164 
165 OTBOSSIMAdapters_EXPORT
166 ImageKeywordlist ReadGeometryFromGEOMFile(const std::string& filename);
167 
168 OTBOSSIMAdapters_EXPORT
169 ImageKeywordlist ReadGeometryFromRPCTag(const std::string& filename);
170 
171 OTBOSSIMAdapters_EXPORT
172 void WriteGeometry(const ImageKeywordlist& otb_kwl, const std::string& filename);
173 
174 inline
175 bool
177 ::operator !=( const Self & p ) const
178 {
179  return !this->operator == ( p );
180 }
181 
182 } //namespace otb
183 
184 #endif // otbImageKeywordlist_h
OTBCommon_EXPORT std::ostream & operator<<(std::ostream &os, const otb::StringToHTML &str)
KeywordlistMapSizeType Empty() const
Storage and conversion for OSSIM metadata.
OTBGdalAdapters_EXPORT bool operator==(const CoordinateTransformation &ct1, const CoordinateTransformation &ct2) noexcept
equal operator
double ConvertFromOSSIMFrame(double val)
OTBOSSIMAdapters_EXPORT ImageKeywordlist ReadGeometryFromImage(const std::string &filename, bool checkRpcTag=true)
OTBOSSIMAdapters_EXPORT ImageKeywordlist ReadGeometryFromRPCTag(const std::string &filename)
double ConvertToOSSIMFrame(double val)
KeywordlistMap::size_type KeywordlistMapSizeType
KeywordlistMapSizeType GetSize(void) const
OTBGdalAdapters_EXPORT bool operator!=(const CoordinateTransformation &ct1, const CoordinateTransformation &ct2) noexcept
different operator
std::map< std::string, std::string > KeywordlistMap
const KeywordlistMap & GetKeywordlist() const
OTBOSSIMAdapters_EXPORT ImageKeywordlist ReadGeometryFromGEOMFile(const std::string &filename)
OTBOSSIMAdapters_EXPORT void WriteGeometry(const ImageKeywordlist &otb_kwl, const std::string &filename)
bool operator!=(const Self &) const