OTB  10.0.0
Orfeo Toolbox
otbGeomMetadataSupplier.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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 otbGeomMetadataSupplier_h
22 #define otbGeomMetadataSupplier_h
23 
24 #include <boost/any.hpp>
25 #include <unordered_map>
26 
27 #include "OTBMetadataExport.h"
29 #include "otbImageMetadata.h"
30 
31 
32 namespace otb
33 {
34 
41 class OTBMetadata_EXPORT GeomMetadataSupplier
43 {
44 public:
45  using DictType = std::unordered_map<std::string, std::string>;
46 
47  GeomMetadataSupplier(const std::string & geomFile);
48  GeomMetadataSupplier(const std::string & geomFile, const std::string & imageFile);
51  ~GeomMetadataSupplier() = default;
52 
61  std::string GetMetadataValue(std::string const& path, bool& hasValue, int band=1) const override;
62 
63  std::string GetResourceFile(std::string const& s="") const override;
64  std::vector<std::string> GetResourceFiles() const override;
65 
66  int GetNbBands() const override;
67 
73  bool FetchRPC(ImageMetadata & imd, const double lineOffset=0, const double sampleOffset=0);
74 
80  bool FetchGCP(ImageMetadata & imd);
81 
83  unsigned int GetNumberOf(std::string const&) const override;
84 
86  unsigned int GetAttributeId(std::string const&, std::string const&) const override
87  {
88  otbLogMacro(Error, << "GetAttributeId() not yet implemented in otbGeomMetadataSupplier");
89  return 0;
90  }
92 
98  std::string PrintSelf() const;
99 
100 protected:
104  void ReadGeomFile();
105 
106 private:
108  std::unordered_map<std::string, std::string> m_FileNames;
109 
112 
113 };
114 
115 } // end namespace otb
116 
117 #endif
Class to access metadata information in a Geom file.
unsigned int GetAttributeId(std::string const &, std::string const &) const override
int GetNbBands() const override
GeomMetadataSupplier & operator=(const GeomMetadataSupplier &)=delete
GeomMetadataSupplier(const GeomMetadataSupplier &)=delete
GeomMetadataSupplier(const std::string &geomFile, const std::string &imageFile)
std::vector< std::string > GetResourceFiles() const override
void ReadGeomFile()
Parse a Geom file and fill the internal map.
std::unordered_map< std::string, std::string > m_FileNames
std::string GetMetadataValue(std::string const &path, bool &hasValue, int band=1) const override
Get the metadata value corresponding to a given path.
unsigned int GetNumberOf(std::string const &) const override
std::string PrintSelf() const
Writes the content of the Geom file into a string.
std::unordered_map< std::string, std::string > DictType
GeomMetadataSupplier(const std::string &geomFile)
bool FetchRPC(ImageMetadata &imd, const double lineOffset=0, const double sampleOffset=0)
Fill the ImageMetadata with the RPC model from the geom file.
std::string GetResourceFile(std::string const &s="") const override
bool FetchGCP(ImageMetadata &imd)
Fill the ImageMetadata with the GCP from the geom file.
Generic class containing image metadata used in OTB.
Base class to access metadata information in files/images.
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
#define otbLogMacro(level, msg)
Definition: otbMacro.h:104