OTB  7.4.0
Orfeo Toolbox
otbGenericMapProjection.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2020 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, class TScalarType = double, unsigned int NInputDimensions = 2,
59  unsigned int NOutputDimensions = 2>
60 class ITK_EXPORT GenericMapProjection : public Transform<TScalarType, // Data type for scalars
61  NInputDimensions, // Number of dimensions in the input space
62  NOutputDimensions> // Number of dimensions in the output space
63 {
64 public:
68  typedef itk::SmartPointer<Self> Pointer;
69  typedef itk::SmartPointer<const Self> ConstPointer;
70 
72  typedef itk::Point<ScalarType, NInputDimensions> InputPointType;
73  typedef itk::Point<ScalarType, NOutputDimensions> OutputPointType;
74 
76  itkNewMacro(Self);
77 
79  itkTypeMacro(GenericMapProjection, Transform);
80 
81  static const TransformDirection::TransformationDirection DirectionOfMapping = TDirectionOfMapping;
82 
83  itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions);
84  itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions);
85  itkStaticConstMacro(SpaceDimension, unsigned int, NInputDimensions);
86  itkStaticConstMacro(ParametersDimension, unsigned int, NInputDimensions*(NInputDimensions + 1));
87 
89  virtual std::string GetWkt();
90 
92  virtual void SetWkt(const std::string& projectionRefWkt);
93 
94  OutputPointType TransformPoint(const InputPointType& point) const override;
95 
96  bool IsProjectionDefined() const;
97 
98 protected:
100  ~GenericMapProjection() override;
101 
102  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
103 
104  std::unique_ptr<CoordinateTransformation> m_MapProjection;
105 
106 private:
107  GenericMapProjection(const Self&) = delete;
108  void operator=(const Self&) = delete;
109 };
110 
111 } // namespace otb
112 
113 #ifndef OTB_MANUAL_INSTANTIATION
115 #endif
116 
117 #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
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Superclass::ScalarType ScalarType
std::unique_ptr< CoordinateTransformation > m_MapProjection
This is the base class for generic map projection transformation.
TScalarType ScalarType
Definition: otbTransform.h:71
Class to overload method passed to virtual pure in ITK V4.
Definition: otbTransform.h:39