21 #ifndef otbVectorDataTransformFilter_hxx
22 #define otbVectorDataTransformFilter_hxx
25 #include "itkProgressReporter.h"
26 #include <itkContinuousIndex.h>
35 template <
class TInputVectorData,
class TOutputVectorData>
43 m_Transform =
nullptr;
50 template <
class TInputVectorData,
class TOutputVectorData>
54 itk::Point<double, 2> point;
55 point = m_Transform->TransformPoint(pointCoord);
64 template <
class TInputVectorData,
class TOutputVectorData>
68 typedef typename LineType::VertexListType::ConstPointer VertexListConstPointerType;
69 typedef typename LineType::VertexListConstIteratorType VertexListConstIteratorType;
70 VertexListConstPointerType vertexList = line->GetVertexList();
71 VertexListConstIteratorType it = vertexList->Begin();
72 typename LineType::Pointer newLine = LineType::New();
73 while (it != vertexList->End())
75 itk::Point<double, 2> point;
76 itk::ContinuousIndex<double, 2> index;
77 typename LineType::VertexType pointCoord = it.Value();
78 point = m_Transform->TransformPoint(pointCoord);
81 if (!vnl_math_isnan(index[0]) && !vnl_math_isnan(index[1]))
82 newLine->AddVertex(index);
93 template <
class TInputVectorData,
class TOutputVectorData>
97 typedef typename PolygonType::VertexListType::ConstPointer VertexListConstPointerType;
98 typedef typename PolygonType::VertexListConstIteratorType VertexListConstIteratorType;
99 VertexListConstPointerType vertexList = polygon->GetVertexList();
100 VertexListConstIteratorType it = vertexList->Begin();
101 typename PolygonType::Pointer newPolygon = PolygonType::New();
102 while (it != vertexList->End())
104 itk::Point<double, 2> point;
105 itk::ContinuousIndex<double, 2> index;
106 typename PolygonType::VertexType pointCoord = it.Value();
107 point = m_Transform->TransformPoint(pointCoord);
110 if (!vnl_math_isnan(index[0]) && !vnl_math_isnan(index[1]))
111 newPolygon->AddVertex(index);
121 template <
class TInputVectorData,
class TOutputVectorData>
127 for (
typename PolygonListType::ConstIterator it = polygonList->Begin(); it != polygonList->End(); ++it)
129 newPolygonList->PushBack(this->ProcessPolygon(it.Get()));
131 return newPolygonList;
138 template <
class TInputVectorData,
class TOutputVectorData>
141 Superclass::GenerateOutputInformation();
142 this->AllocateOutputs();
148 outputPtr->SetProjectionRef(inputPtr->GetProjectionRef());
156 newDataNode->SetNodeType(inputRoot->Get()->GetNodeType());
157 newDataNode->SetNodeId(inputRoot->Get()->GetNodeId());
158 typename OutputInternalTreeNodeType::Pointer outputRoot = OutputInternalTreeNodeType::New();
159 outputRoot->Set(newDataNode);
160 tree->SetRoot(outputRoot);
164 this->ProcessNode(inputRoot, outputRoot);