OTB  6.7.0
Orfeo Toolbox
otbGenericMapProjection.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 otbGenericMapProjection_h
22 #define otbGenericMapProjection_h
23 
24 #include <sstream>
25 
26 #include "otbTransform.h"
27 #include "itkMacro.h"
29 #include <string>
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;
78 
80  itkNewMacro(Self);
81 
83  itkTypeMacro(GenericMapProjection, Transform);
84 
85  static const TransformDirection::TransformationDirection DirectionOfMapping = TDirectionOfMapping;
86 
87  itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions);
88  itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions);
89  itkStaticConstMacro(SpaceDimension, unsigned int, NInputDimensions);
90  itkStaticConstMacro(ParametersDimension, unsigned int, NInputDimensions * (NInputDimensions + 1));
91 
93  virtual std::string GetWkt();
94 
96  virtual void SetWkt(const std::string& projectionRefWkt);
97 
98  OutputPointType TransformPoint(const InputPointType& point) const override;
99 
100  bool IsProjectionDefined() const;
101 
102 protected:
104  ~GenericMapProjection() override;
105 
106  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
107 
108  std::unique_ptr<CoordinateTransformation> m_MapProjection;
109 
110 private:
111  GenericMapProjection(const Self &) = delete;
112  void operator =(const Self&) = delete;
113 
114 };
115 
116 } // namespace otb
117 
118 #ifndef OTB_MANUAL_INSTANTIATION
120 #endif
121 
122 #endif
itk::Point< ScalarType, NOutputDimensions > OutputPointType
itk::Point< ScalarType, NInputDimensions > InputPointType
itk::SmartPointer< Self > Pointer
Transform< TScalarType, NInputDimensions, NOutputDimensions > Superclass
itk::SmartPointer< const Self > ConstPointer
Superclass::ScalarType ScalarType
std::unique_ptr< CoordinateTransformation > 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