otbOGRExtendedFilenameToOptions.h 3.39 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/*
 * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
 *
 * This file is part of Orfeo Toolbox
 *
 *     https://www.orfeo-toolbox.org/
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

21 22
#ifndef otbOGRExtendedFilenameToOptions_h
#define otbOGRExtendedFilenameToOptions_h
23

24
#include <unordered_map>
25 26 27 28 29
#include "otbExtendedFilenameHelper.h"

namespace otb
{

30
/** \class OGRExtendedFilenameToOptions
31 32 33
 *  \brief This class aim at processing GDAL option that can be pass through
 * extended filename.
 * \ingroup OTBExtendedFilename
34 35
 * \ingroup OTBGdalAdapters
 *
36
 */
37
#include "OTBGdalAdaptersExport.h"
38

39
class OTBGdalAdapters_EXPORT OGRExtendedFilenameToOptions : public ExtendedFilenameHelper
40 41 42
{
public:
  /** Standard class typedefs. */
43
  typedef OGRExtendedFilenameToOptions Self;
44 45 46 47 48
  typedef itk::SmartPointer<Self> Pointer;
  typedef itk::SmartPointer<const Self> ConstPointer;
  typedef ExtendedFilenameHelper Superclass;

  typedef Superclass::OptionMapType OptionMapType;
49
  typedef OptionMapType::const_iterator ConstMapIteratorType;
50
  typedef std::vector<std::string> GDALOptionType;
51

52
  itkTypeMacro(OGRExtendedFilenameToOptions, otb::ExtendedFilenameHelper);
53 54
  itkNewMacro(Self);

55

56
  /** The creation option structure. */
57 58
  struct OpenOptionType
  {
59 60
    GDALOptionType gdalOptions;
    // std::unordered_map< std::string , bool > availableOptions;
61 62 63 64
  };

  struct CreationOptionType
  {
65 66
    GDALOptionType gdalOptions;
    // std::unordered_map< std::string , bool > availableOptions;
67 68 69
  };

  struct LayerOptionType
70
  {
71
    std::unordered_map< std::string , std::string > gdalOptions;
72 73
  };

74
  /** Set extended filename */
75 76
  void SetExtendedFileName(const char * extFname) override;

77
  /** Get the GDAL option for type operation */
78 79
  GDALOptionType GetGDALOptions( const std::string & type ) const ;

80
  /** Get the deffierent GDAL options*/
81 82 83 84
  GDALOptionType GetGDALOpenOptions() const ;
  GDALOptionType GetGDALCreationOptions() const ;
  GDALOptionType GetGDALLayerOptions() const ;

85 86 87
  bool SimpleFileNameIsSet() const;
  bool HasGDALLayerOption() const;

88
  /** Set GDAL layer option through a vector of string */
89
  void SetGDALLayerOptions( const GDALOptionType & options );
90 91

  /** Add GDAL layer option to existing one */
92 93
  void AddGDALLayerOptions( const GDALOptionType & options );

94 95 96
  /** Constructor that return a pointer to an OGRExtendedFilename with 
   * GDAL layer option as options
   */
97
  static Pointer GetGDALLayerOptionsHelper( const GDALOptionType & options );
98

99
protected:
100
  OGRExtendedFilenameToOptions();
101
  OGRExtendedFilenameToOptions( const GDALOptionType & options );
102
  ~OGRExtendedFilenameToOptions() override {};
103 104

private:
105
  OGRExtendedFilenameToOptions(const Self &) = delete ;
106 107
  void operator =(const Self&) = delete ;

108 109 110
  OpenOptionType m_OpenOptions;
  CreationOptionType m_CreationOptions;
  LayerOptionType m_LayerOptions;
111
  bool m_HasFileName;
112 113 114 115
};

} //end namespace otb

116
#endif // otbOGRExtendedFilenameToOptions_h