OTB  10.0.0
Orfeo Toolbox
otbVectorDataProjectionFilter.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 otbVectorDataProjectionFilter_h
22 #define otbVectorDataProjectionFilter_h
23 
25 #include "otbGenericRSTransform.h"
26 #include <string>
27 
28 namespace otb
29 {
30 
66 template <class TInputVectorData, class TOutputVectorData>
67 class ITK_EXPORT VectorDataProjectionFilter : public otb::VectorDataToVectorDataFilter<TInputVectorData, TOutputVectorData>
68 {
69 
70 public:
74  typedef itk::SmartPointer<Self> Pointer;
75  typedef itk::SmartPointer<const Self> ConstPointer;
76 
77  typedef TInputVectorData InputVectorDataType;
78  typedef TOutputVectorData OutputVectorDataType;
79  typedef typename TInputVectorData::ConstPointer InputVectorDataPointer;
80  typedef typename TOutputVectorData::Pointer OutputVectorDataPointer;
81 
83  typedef itk::Transform<double, 2, 2> GenericTransformType;
84  typedef typename GenericTransformType::Pointer GenericTransformPointerType;
85  // typedef otb::CompositeTransform<GenericTransformType, GenericTransformType, double, 2, 2> InternalTransformType;
88 
89  typedef itk::Vector<double, 2> SpacingType;
90  typedef itk::Point<double, 2> OriginType;
91 
92  typedef typename OutputVectorDataType::DataNodeType OutputDataNodeType;
93  typedef typename InputVectorDataType::DataNodeType InputDataNodeType;
94 
95  typedef typename InputVectorDataType::TreeNodeType InputInternalTreeNodeType;
96  typedef typename OutputVectorDataType::TreeNodeType OutputInternalTreeNodeType;
97 
98  typedef typename InputDataNodeType::PointType InputPointType;
99  typedef typename InputDataNodeType::LineType InputLineType;
100  typedef typename InputDataNodeType::PolygonType InputPolygonType;
101  typedef typename InputDataNodeType::PolygonListType InputPolygonListType;
102 
103  typedef typename InputLineType::Pointer InputLinePointerType;
104  typedef typename InputPolygonType::Pointer InputPolygonPointerType;
105  typedef typename InputPolygonListType::Pointer InputPolygonListPointerType;
106 
107  typedef typename OutputDataNodeType::PointType OutputPointType;
108  typedef typename OutputDataNodeType::LineType OutputLineType;
109  typedef typename OutputDataNodeType::PolygonType OutputPolygonType;
110  typedef typename OutputDataNodeType::PolygonListType OutputPolygonListType;
111 
112  typedef typename OutputLineType::Pointer OutputLinePointerType;
113  typedef typename OutputPolygonType::Pointer OutputPolygonPointerType;
114  typedef typename OutputPolygonListType::Pointer OutputPolygonListPointerType;
115 
117  itkNewMacro(Self);
118 
121 
123  itkSetStringMacro(InputProjectionRef);
124  itkGetStringMacro(InputProjectionRef);
126 
127  itkSetStringMacro(OutputProjectionRef);
128  itkGetStringMacro(OutputProjectionRef);
129 
132  itkSetMacro(InputOrigin, OriginType);
133  virtual void SetInputOrigin(const double origin[2]);
134  virtual void SetInputOrigin(const float origin[2]);
136 
137  itkGetConstReferenceMacro(InputOrigin, OriginType);
138 
141  virtual void SetInputSpacing(const SpacingType& spacing);
142  virtual void SetInputSpacing(const double spacing[2]);
143  virtual void SetInputSpacing(const float spacing[2]);
145 
146  itkGetConstReferenceMacro(InputSpacing, SpacingType);
147 
150  itkSetMacro(OutputOrigin, OriginType);
151  virtual void SetOutputOrigin(const double origin[2]);
152  virtual void SetOutputOrigin(const float origin[2]);
154 
155  itkGetConstReferenceMacro(OutputOrigin, OriginType);
156 
159  virtual void SetOutputSpacing(const SpacingType& spacing);
160  virtual void SetOutputSpacing(const double spacing[2]);
161  virtual void SetOutputSpacing(const float spacing[2]);
163 
164  itkGetConstReferenceMacro(OutputSpacing, SpacingType);
165 
169  {
170  return m_InputImageMetadata;
171  }
173  {
174  m_InputImageMetadata = imd;
175  this->Modified();
176  }
178 
180  {
181  return m_OutputImageMetadata;
182  }
184  {
185  m_OutputImageMetadata = imd;
186  this->Modified();
187  }
189 
190 protected:
193  {
194  }
195 
196  OutputPointType ProcessPoint(InputPointType point) const override;
197  OutputLinePointerType ProcessLine(InputLinePointerType line) const override;
198  OutputPolygonPointerType ProcessPolygon(InputPolygonPointerType polygon) const override;
199  OutputPolygonListPointerType ProcessPolygonList(InputPolygonListPointerType polygonList) const override;
200 
201  virtual void InstantiateTransform(void);
202 
203  void GenerateOutputInformation(void) override;
204  void GenerateData(void) override;
205 
206 private:
208  void operator=(const Self&) = delete;
209 
211  std::string m_InputProjectionRef;
213  const ImageMetadata* m_InputImageMetadata = nullptr;
214  const ImageMetadata* m_OutputImageMetadata = nullptr;
215 
220 };
221 
222 } // end namespace otb
223 
224 #ifndef OTB_MANUAL_INSTANTIATION
226 #endif
227 
228 #endif
This is the class to handle generic remote sensing transform.
itk::SmartPointer< Self > Pointer
Generic class containing image metadata used in OTB.
Reproject vector data in a different coordinate system.
OutputDataNodeType::PolygonType OutputPolygonType
OutputVectorDataType::TreeNodeType OutputInternalTreeNodeType
otb::GenericRSTransform< double, 2, 2 > InternalTransformType
InputDataNodeType::PointType InputPointType
GenericTransformType::Pointer GenericTransformPointerType
OutputDataNodeType::LineType OutputLineType
TOutputVectorData::Pointer OutputVectorDataPointer
VectorDataProjectionFilter(const Self &)=delete
void SetInputImageMetadata(const ImageMetadata *imd)
TInputVectorData::ConstPointer InputVectorDataPointer
InputDataNodeType::PolygonType InputPolygonType
InputVectorDataType::TreeNodeType InputInternalTreeNodeType
const ImageMetadata * GetOutputImageMetadata() const
OutputDataNodeType::PolygonListType OutputPolygonListType
InputVectorDataType::DataNodeType InputDataNodeType
InternalTransformType::Pointer InternalTransformPointerType
const ImageMetadata * GetInputImageMetadata() const
itk::SmartPointer< const Self > ConstPointer
OutputPolygonListType::Pointer OutputPolygonListPointerType
void SetOutputImageMetadata(const ImageMetadata *imd)
OutputPolygonType::Pointer OutputPolygonPointerType
InputPolygonListType::Pointer InputPolygonListPointerType
itk::Transform< double, 2, 2 > GenericTransformType
InputPolygonType::Pointer InputPolygonPointerType
OutputDataNodeType::PointType OutputPointType
InputDataNodeType::PolygonListType InputPolygonListType
OutputVectorDataType::DataNodeType OutputDataNodeType
void operator=(const Self &)=delete
otb::VectorDataToVectorDataFilter< TInputVectorData, TOutputVectorData > Superclass
Filter hierarchy for generating VectorData.
Base class for filters that take an VectorData as input and produce an VectorData as output.
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.