18 #ifndef __otbVectorDataProjectionFilter_txx
19 #define __otbVectorDataProjectionFilter_txx
32 template <
class TInputVectorData,
class TOutputVectorData>
36 m_InputProjectionRef.clear();
37 m_OutputProjectionRef.clear();
38 m_InputKeywordList.Clear();
39 m_OutputKeywordList.Clear();
40 m_InputSpacing.Fill(1);
41 m_InputOrigin.Fill(0);
42 m_OutputSpacing.Fill(1);
43 m_OutputOrigin.Fill(0);
47 template <
class TInputVectorData,
class TOutputVectorData>
52 itkDebugMacro(
"setting Spacing to " << spacing);
53 if (this->m_InputSpacing != spacing)
55 this->m_InputSpacing = spacing;
61 template <
class TInputVectorData,
class TOutputVectorData>
67 this->SetInputSpacing(s);
71 template <
class TInputVectorData,
class TOutputVectorData>
79 this->SetInputSpacing(s);
83 template <
class TInputVectorData,
class TOutputVectorData>
89 this->SetInputOrigin(p);
93 template <
class TInputVectorData,
class TOutputVectorData>
101 this->SetInputOrigin(p);
105 template <
class TInputVectorData,
class TOutputVectorData>
110 itkDebugMacro(
"setting Spacing to " << spacing);
111 if (this->m_OutputSpacing != spacing)
113 this->m_OutputSpacing = spacing;
119 template <
class TInputVectorData,
class TOutputVectorData>
125 this->SetOutputSpacing(s);
129 template <
class TInputVectorData,
class TOutputVectorData>
137 this->SetOutputSpacing(s);
141 template <
class TInputVectorData,
class TOutputVectorData>
147 this->SetOutputOrigin(p);
151 template <
class TInputVectorData,
class TOutputVectorData>
159 this->SetOutputOrigin(p);
162 template <
class TInputVectorData,
class TOutputVectorData>
167 Superclass::GenerateOutputInformation();
179 template <
class TInputVectorData,
class TOutputVectorData>
186 point = m_Transform->TransformPoint(pointCoord);
193 template <
class TInputVectorData,
class TOutputVectorData>
198 typedef typename InputLineType::VertexListType::ConstPointer VertexListConstPointerType;
199 typedef typename InputLineType::VertexListConstIteratorType VertexListConstIteratorType;
200 VertexListConstPointerType vertexList = line->GetVertexList();
201 VertexListConstIteratorType it = vertexList->Begin();
202 typename OutputLineType::Pointer newLine = OutputLineType::New();
203 while (it != vertexList->End())
207 typename InputLineType::VertexType pointCoord = it.Value();
208 point = m_Transform->TransformPoint(pointCoord);
212 newLine->AddVertex(index);
222 template <
class TInputVectorData,
class TOutputVectorData>
227 typedef typename InputPolygonType::VertexListType::ConstPointer VertexListConstPointerType;
228 typedef typename InputPolygonType::VertexListConstIteratorType VertexListConstIteratorType;
229 VertexListConstPointerType vertexList = polygon->GetVertexList();
230 VertexListConstIteratorType it = vertexList->Begin();
231 typename OutputPolygonType::Pointer newPolygon = OutputPolygonType::New();
232 while (it != vertexList->End())
236 typename InputPolygonType::VertexType pointCoord = it.Value();
237 point = m_Transform->TransformPoint(pointCoord);
240 newPolygon->AddVertex(index);
249 template <
class TInputVectorData,
class TOutputVectorData>
256 for (
typename InputPolygonListType::ConstIterator it = polygonList->Begin();
257 it != polygonList->End(); ++it)
259 newPolygonList->PushBack(this->ProcessPolygon(it.Get()));
261 return newPolygonList;
267 template <
class TInputVectorData,
class TOutputVectorData>
285 m_Transform = InternalTransformType::New();
294 m_Transform->SetInputDictionary(inputDict);
295 m_Transform->SetOutputDictionary(output->GetMetaDataDictionary());
297 m_Transform->SetInputProjectionRef(m_InputProjectionRef);
298 m_Transform->SetOutputProjectionRef(m_OutputProjectionRef);
299 m_Transform->SetInputKeywordList(m_InputKeywordList);
300 m_Transform->SetOutputKeywordList(m_OutputKeywordList);
301 m_Transform->SetInputSpacing(m_InputSpacing);
302 m_Transform->SetInputOrigin(m_InputOrigin);
303 m_Transform->SetOutputSpacing(m_OutputSpacing);
304 m_Transform->SetOutputOrigin(m_OutputOrigin);
306 m_Transform->InstanciateTransform();
310 m_OutputProjectionRef = m_Transform->GetOutputProjectionRef();
314 if (m_OutputKeywordList.GetSize() != 0)
318 if (!m_OutputProjectionRef.empty())
322 output->SetSpacing(m_OutputSpacing);
323 output->SetOrigin(m_OutputOrigin);
330 template <
class TInputVectorData,
class TOutputVectorData>
335 this->AllocateOutputs();
340 this->InstanciateTransform();
342 typedef typename OutputVectorDataType::DataTreePointerType OutputDataTreePointerType;
343 OutputDataTreePointerType tree = outputPtr->GetDataTree();
349 typedef typename OutputVectorDataType::DataNodePointerType OutputDataNodePointerType;
350 OutputDataNodePointerType newDataNode = OutputDataNodeType::New();
351 newDataNode->SetNodeType(inputRoot->Get()->GetNodeType());
352 newDataNode->SetNodeId(inputRoot->Get()->GetNodeId());
353 typename OutputInternalTreeNodeType::Pointer outputRoot = OutputInternalTreeNodeType::New();
354 outputRoot->Set(newDataNode);
355 tree->SetRoot(outputRoot);
360 this->ProcessNode(inputRoot, outputRoot);