OTB  6.7.0
Orfeo Toolbox
otbGenericMapProjection.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2017 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 otbGenericMapProjection_h
22 #define otbGenericMapProjection_h
23 
24 #include <iostream>
25 #include <sstream>
26 
27 #include "otbTransform.h"
28 #include "itkMacro.h"
30 
31 namespace otb
32 {
33 
34 namespace TransformDirection
35 {
37  {
38  FORWARD = 0,
39  INVERSE = 1
40  };
41 }
42 
58 template <TransformDirection::TransformationDirection TDirectionOfMapping,
59  class TScalarType = double,
60  unsigned int NInputDimensions = 2,
61  unsigned int NOutputDimensions = 2>
62 class ITK_EXPORT GenericMapProjection : public Transform<TScalarType, // Data type for scalars
63  NInputDimensions, // Number of dimensions in the input space
64  NOutputDimensions> // Number of dimensions in the output space
65 {
66 public:
68  typedef Transform<TScalarType,
69  NInputDimensions,
70  NOutputDimensions> Superclass;
74 
75  typedef typename Superclass::ScalarType ScalarType;
79 
81  itkNewMacro(Self);
82 
84  itkTypeMacro(GenericMapProjection, Transform);
85 
86  static const TransformDirection::TransformationDirection DirectionOfMapping = TDirectionOfMapping;
87 
88  itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions);
89  itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions);
90  itkStaticConstMacro(SpaceDimension, unsigned int, NInputDimensions);
91  itkStaticConstMacro(ParametersDimension, unsigned int, NInputDimensions * (NInputDimensions + 1));
92 
94  virtual std::string GetWkt();
95 
97  virtual void SetWkt(const std::string& projectionRefWkt);
98 
99  virtual void PrintMap() const;
100 
101  OutputPointType TransformPoint(const InputPointType& point) const override;
102 
103  virtual bool InstantiateProjection();
104 
105  const MapProjectionAdapter* GetMapProjection() const;
106 
107  virtual bool IsProjectionDefined() const;
108 
109  void SetParameter(const std::string& key, const std::string& value);
110  std::string GetParameter(const std::string& key) const;
111 
112 protected:
114  ~GenericMapProjection() override;
115 
116  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
117 
119 
120 private:
121  GenericMapProjection(const Self &); //purposely not implemented
122  void operator =(const Self&); //purposely not implemented
123 
124 };
125 
126 } // namespace otb
127 
128 #ifndef OTB_MANUAL_INSTANTIATION
130 #endif
131 
132 #endif
itk::Point< ScalarType, NOutputDimensions > OutputPointType
itk::Point< ScalarType, NInputDimensions > InputPointType
itk::SmartPointer< Self > Pointer
Wrapper class to group all dependencies to ossim for map projection.
Transform< TScalarType, NInputDimensions, NOutputDimensions > Superclass
MapProjectionAdapter MapProjectionType
itk::SmartPointer< const Self > ConstPointer
Superclass::ScalarType ScalarType
MapProjectionAdapter::Pointer m_MapProjection
This is the base class for generic map projection transformation.
Class to overload method passed to virtual pure in ITK V4.
Definition: otbTransform.h:40