OTB  9.0.0
Orfeo Toolbox
otbVectorDataProjectionFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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::DataTreeType::TreeNodeType InputInternalTreeNodeType;
96  typedef typename OutputVectorDataType::DataTreeType::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:
207  VectorDataProjectionFilter(const Self&) = delete;
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
otb::VectorDataProjectionFilter::OutputLineType
OutputDataNodeType::LineType OutputLineType
Definition: otbVectorDataProjectionFilter.h:108
otb::VectorDataProjectionFilter::InternalTransformType
otb::GenericRSTransform< double, 2, 2 > InternalTransformType
Definition: otbVectorDataProjectionFilter.h:86
otb::GenericRSTransform::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbGenericRSTransform.h:66
otb::VectorDataProjectionFilter::OutputPointType
OutputDataNodeType::PointType OutputPointType
Definition: otbVectorDataProjectionFilter.h:107
otb::VectorDataProjectionFilter::OutputLinePointerType
OutputLineType::Pointer OutputLinePointerType
Definition: otbVectorDataProjectionFilter.h:112
otb::VectorDataProjectionFilter::GenericTransformType
itk::Transform< double, 2, 2 > GenericTransformType
Definition: otbVectorDataProjectionFilter.h:83
otb::VectorDataProjectionFilter::InputPolygonListPointerType
InputPolygonListType::Pointer InputPolygonListPointerType
Definition: otbVectorDataProjectionFilter.h:105
otb::VectorDataProjectionFilter::OutputDataNodeType
OutputVectorDataType::DataNodeType OutputDataNodeType
Definition: otbVectorDataProjectionFilter.h:92
otbVectorDataProjectionFilter.hxx
otb::VectorDataProjectionFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbVectorDataProjectionFilter.h:74
otb::VectorDataProjectionFilter::InputVectorDataPointer
TInputVectorData::ConstPointer InputVectorDataPointer
Definition: otbVectorDataProjectionFilter.h:79
otb::VectorDataProjectionFilter
Reproject vector data in a different coordinate system.
Definition: otbVectorDataProjectionFilter.h:67
otbVectorDataToVectorDataFilter.h
otb::VectorDataProjectionFilter::OutputVectorDataPointer
TOutputVectorData::Pointer OutputVectorDataPointer
Definition: otbVectorDataProjectionFilter.h:80
otb::VectorDataProjectionFilter::OriginType
itk::Point< double, 2 > OriginType
Definition: otbVectorDataProjectionFilter.h:90
otb::VectorDataProjectionFilter::m_Transform
InternalTransformPointerType m_Transform
Definition: otbVectorDataProjectionFilter.h:210
otb::VectorDataProjectionFilter::OutputPolygonType
OutputDataNodeType::PolygonType OutputPolygonType
Definition: otbVectorDataProjectionFilter.h:109
otb::VectorDataProjectionFilter::SetInputImageMetadata
void SetInputImageMetadata(const ImageMetadata *imd)
Definition: otbVectorDataProjectionFilter.h:172
otb::VectorDataProjectionFilter::GetOutputImageMetadata
const ImageMetadata * GetOutputImageMetadata() const
Definition: otbVectorDataProjectionFilter.h:179
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::VectorDataProjectionFilter::m_InputProjectionRef
std::string m_InputProjectionRef
Definition: otbVectorDataProjectionFilter.h:211
otb::VectorDataProjectionFilter::InputInternalTreeNodeType
InputVectorDataType::DataTreeType::TreeNodeType InputInternalTreeNodeType
Definition: otbVectorDataProjectionFilter.h:95
otb::VectorDataProjectionFilter::Superclass
otb::VectorDataToVectorDataFilter< TInputVectorData, TOutputVectorData > Superclass
Definition: otbVectorDataProjectionFilter.h:73
otb::VectorDataProjectionFilter::InternalTransformPointerType
InternalTransformType::Pointer InternalTransformPointerType
Definition: otbVectorDataProjectionFilter.h:87
otb::VectorDataProjectionFilter::InputVectorDataType
TInputVectorData InputVectorDataType
Definition: otbVectorDataProjectionFilter.h:77
otb::VectorDataProjectionFilter::InputPointType
InputDataNodeType::PointType InputPointType
Definition: otbVectorDataProjectionFilter.h:98
otb::VectorDataProjectionFilter::SpacingType
itk::Vector< double, 2 > SpacingType
Definition: otbVectorDataProjectionFilter.h:89
otb::VectorDataToVectorDataFilter
Base class for filters that take an VectorData as input and produce an VectorData as output.
Definition: otbVectorDataToVectorDataFilter.h:43
otb::GenericRSTransform
This is the class to handle generic remote sensing transform.
Definition: otbGenericRSTransform.h:57
otb::VectorDataProjectionFilter::OutputPolygonListPointerType
OutputPolygonListType::Pointer OutputPolygonListPointerType
Definition: otbVectorDataProjectionFilter.h:114
otb::VectorDataProjectionFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbVectorDataProjectionFilter.h:75
otb::VectorDataProjectionFilter::m_OutputProjectionRef
std::string m_OutputProjectionRef
Definition: otbVectorDataProjectionFilter.h:212
otb::VectorDataProjectionFilter::OutputVectorDataType
TOutputVectorData OutputVectorDataType
Definition: otbVectorDataProjectionFilter.h:78
otb::VectorDataProjectionFilter::InputPolygonPointerType
InputPolygonType::Pointer InputPolygonPointerType
Definition: otbVectorDataProjectionFilter.h:104
otb::VectorDataProjectionFilter::GetInputImageMetadata
const ImageMetadata * GetInputImageMetadata() const
Definition: otbVectorDataProjectionFilter.h:168
otb::VectorDataProjectionFilter::OutputInternalTreeNodeType
OutputVectorDataType::DataTreeType::TreeNodeType OutputInternalTreeNodeType
Definition: otbVectorDataProjectionFilter.h:96
otb::VectorDataProjectionFilter::InputLineType
InputDataNodeType::LineType InputLineType
Definition: otbVectorDataProjectionFilter.h:99
otb::VectorDataProjectionFilter::m_InputOrigin
OriginType m_InputOrigin
Definition: otbVectorDataProjectionFilter.h:217
otbGenericRSTransform.h
otb::VectorDataProjectionFilter::GenericTransformPointerType
GenericTransformType::Pointer GenericTransformPointerType
Definition: otbVectorDataProjectionFilter.h:84
otb::VectorDataProjectionFilter::~VectorDataProjectionFilter
~VectorDataProjectionFilter() override
Definition: otbVectorDataProjectionFilter.h:192
otb::VectorDataProjectionFilter::m_OutputSpacing
SpacingType m_OutputSpacing
Definition: otbVectorDataProjectionFilter.h:218
otb::VectorDataProjectionFilter::OutputPolygonPointerType
OutputPolygonType::Pointer OutputPolygonPointerType
Definition: otbVectorDataProjectionFilter.h:113
otb::VectorDataProjectionFilter::InputPolygonListType
InputDataNodeType::PolygonListType InputPolygonListType
Definition: otbVectorDataProjectionFilter.h:101
otb::VectorDataProjectionFilter::InputDataNodeType
InputVectorDataType::DataNodeType InputDataNodeType
Definition: otbVectorDataProjectionFilter.h:93
otb::VectorDataProjectionFilter::Self
VectorDataProjectionFilter Self
Definition: otbVectorDataProjectionFilter.h:72
otb::VectorDataSource
Filter hierarchy for generating VectorData.
Definition: otbVectorDataSource.h:42
otb::ImageMetadata
Generic class containing image metadata used in OTB.
Definition: otbImageMetadata.h:270
otb::VectorDataProjectionFilter::OutputPolygonListType
OutputDataNodeType::PolygonListType OutputPolygonListType
Definition: otbVectorDataProjectionFilter.h:110
otb::VectorDataProjectionFilter::m_InputSpacing
SpacingType m_InputSpacing
Definition: otbVectorDataProjectionFilter.h:216
otb::VectorDataProjectionFilter::InputPolygonType
InputDataNodeType::PolygonType InputPolygonType
Definition: otbVectorDataProjectionFilter.h:100
otb::VectorDataProjectionFilter::m_OutputOrigin
OriginType m_OutputOrigin
Definition: otbVectorDataProjectionFilter.h:219
otb::VectorDataProjectionFilter::InputLinePointerType
InputLineType::Pointer InputLinePointerType
Definition: otbVectorDataProjectionFilter.h:103
otb::VectorDataProjectionFilter::SetOutputImageMetadata
void SetOutputImageMetadata(const ImageMetadata *imd)
Definition: otbVectorDataProjectionFilter.h:183