OTB  7.2.0
Orfeo Toolbox
otbVectorDataProjectionFilter.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 otbVectorDataProjectionFilter_h
22 #define otbVectorDataProjectionFilter_h
23 
25 #include "otbGenericRSTransform.h"
26 #include "otbImageKeywordlist.h"
27 #include <string>
28 
29 namespace otb
30 {
31 
67 template <class TInputVectorData, class TOutputVectorData>
68 class ITK_EXPORT VectorDataProjectionFilter : public otb::VectorDataToVectorDataFilter<TInputVectorData, TOutputVectorData>
69 {
70 
71 public:
75  typedef itk::SmartPointer<Self> Pointer;
76  typedef itk::SmartPointer<const Self> ConstPointer;
77 
78  typedef TInputVectorData InputVectorDataType;
79  typedef TOutputVectorData OutputVectorDataType;
80  typedef typename TInputVectorData::ConstPointer InputVectorDataPointer;
81  typedef typename TOutputVectorData::Pointer OutputVectorDataPointer;
82 
84  typedef itk::Transform<double, 2, 2> GenericTransformType;
85  typedef typename GenericTransformType::Pointer GenericTransformPointerType;
86  // typedef otb::CompositeTransform<GenericTransformType, GenericTransformType, double, 2, 2> InternalTransformType;
89 
90  typedef itk::Vector<double, 2> SpacingType;
91  typedef itk::Point<double, 2> OriginType;
92 
93  typedef typename OutputVectorDataType::DataNodeType OutputDataNodeType;
94  typedef typename InputVectorDataType::DataNodeType InputDataNodeType;
95 
96  typedef typename InputVectorDataType::DataTreeType::TreeNodeType InputInternalTreeNodeType;
97  typedef typename OutputVectorDataType::DataTreeType::TreeNodeType OutputInternalTreeNodeType;
98 
100  typedef typename InputDataNodeType::LineType InputLineType;
101  typedef typename InputDataNodeType::PolygonType InputPolygonType;
102  typedef typename InputDataNodeType::PolygonListType InputPolygonListType;
103 
104  typedef typename InputLineType::Pointer InputLinePointerType;
105  typedef typename InputPolygonType::Pointer InputPolygonPointerType;
106  typedef typename InputPolygonListType::Pointer InputPolygonListPointerType;
107 
109  typedef typename OutputDataNodeType::LineType OutputLineType;
110  typedef typename OutputDataNodeType::PolygonType OutputPolygonType;
111  typedef typename OutputDataNodeType::PolygonListType OutputPolygonListType;
112 
113  typedef typename OutputLineType::Pointer OutputLinePointerType;
114  typedef typename OutputPolygonType::Pointer OutputPolygonPointerType;
115  typedef typename OutputPolygonListType::Pointer OutputPolygonListPointerType;
116 
118  itkNewMacro(Self);
119 
122 
124  itkSetStringMacro(InputProjectionRef);
125  itkGetStringMacro(InputProjectionRef);
127 
128  itkSetStringMacro(OutputProjectionRef);
129  itkGetStringMacro(OutputProjectionRef);
130 
131  itkGetMacro(InputKeywordList, ImageKeywordlist);
133  {
134  this->m_InputKeywordList = kwl;
135  this->Modified();
136  }
137 
138  itkGetMacro(OutputKeywordList, ImageKeywordlist);
140  {
141  this->m_OutputKeywordList = kwl;
142  this->Modified();
143  }
144 
147  itkSetMacro(InputOrigin, OriginType);
148  virtual void SetInputOrigin(const double origin[2]);
149  virtual void SetInputOrigin(const float origin[2]);
151 
152  itkGetConstReferenceMacro(InputOrigin, OriginType);
153 
156  virtual void SetInputSpacing(const SpacingType& spacing);
157  virtual void SetInputSpacing(const double spacing[2]);
158  virtual void SetInputSpacing(const float spacing[2]);
160 
161  itkGetConstReferenceMacro(InputSpacing, SpacingType);
162 
165  itkSetMacro(OutputOrigin, OriginType);
166  virtual void SetOutputOrigin(const double origin[2]);
167  virtual void SetOutputOrigin(const float origin[2]);
169 
170  itkGetConstReferenceMacro(OutputOrigin, OriginType);
171 
174  virtual void SetOutputSpacing(const SpacingType& spacing);
175  virtual void SetOutputSpacing(const double spacing[2]);
176  virtual void SetOutputSpacing(const float spacing[2]);
178 
179  itkGetConstReferenceMacro(OutputSpacing, SpacingType);
180 
181 protected:
184  {
185  }
186 
187  OutputPointType ProcessPoint(InputPointType point) const override;
188  OutputLinePointerType ProcessLine(InputLinePointerType line) const override;
189  OutputPolygonPointerType ProcessPolygon(InputPolygonPointerType polygon) const override;
190  OutputPolygonListPointerType ProcessPolygonList(InputPolygonListPointerType polygonList) const override;
191 
192  virtual void InstantiateTransform(void);
193 
194  void GenerateOutputInformation(void) override;
195  void GenerateData(void) override;
196 
197 private:
198  VectorDataProjectionFilter(const Self&) = delete;
199  void operator=(const Self&) = delete;
200 
201  InternalTransformPointerType m_Transform;
202  std::string m_InputProjectionRef;
206 
207  SpacingType m_InputSpacing;
208  OriginType m_InputOrigin;
209  SpacingType m_OutputSpacing;
210  OriginType m_OutputOrigin;
211 };
212 
213 } // end namespace otb
214 
215 #ifndef OTB_MANUAL_INSTANTIATION
217 #endif
218 
219 #endif
InputPolygonListType::Pointer InputPolygonListPointerType
InputVectorDataType::DataTreeType::TreeNodeType InputInternalTreeNodeType
InputDataNodeType::PolygonType InputPolygonType
InputPolygonType::Pointer InputPolygonPointerType
InternalTransformType::Pointer InternalTransformPointerType
Storage and conversion for OSSIM metadata.
itk::SmartPointer< Self > Pointer
OutputDataNodeType::LineType OutputLineType
otb::VectorDataToVectorDataFilter< TInputVectorData, TOutputVectorData > Superclass
OutputVectorDataType::DataTreeType::TreeNodeType OutputInternalTreeNodeType
itk::SmartPointer< const Self > ConstPointer
GenericTransformType::Pointer GenericTransformPointerType
TOutputVectorData::Pointer OutputVectorDataPointer
OutputDataNodeType::PolygonListType OutputPolygonListType
Reproject vector data in a different coordinate system.
itk::Transform< double, 2, 2 > GenericTransformType
OutputVectorDataType::DataNodeType OutputDataNodeType
OutputPolygonListType::Pointer OutputPolygonListPointerType
InputVectorDataType::DataNodeType InputDataNodeType
otb::GenericRSTransform< double, 2, 2 > InternalTransformType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
This is the class to handle generic remote sensing transform.
InputDataNodeType::PolygonListType InputPolygonListType
Base class for filters that take an VectorData as input and produce an VectorData as output...
OutputDataNodeType::PolygonType OutputPolygonType
void SetOutputKeywordList(const ImageKeywordlist &kwl)
TInputVectorData::ConstPointer InputVectorDataPointer
OutputPolygonType::Pointer OutputPolygonPointerType
VectorImageType::PointType PointType
Definition: mvdTypes.h:183
InputDataNodeType::PointType InputPointType
void SetInputKeywordList(const ImageKeywordlist &kwl)
OutputDataNodeType::PointType OutputPointType