18 #ifndef __otbVectorDataToVectorDataFilter_txx
19 #define __otbVectorDataToVectorDataFilter_txx
32 template <
class TInputVectorData,
class TOutputVectorData>
36 this->SetNumberOfRequiredInputs(1);
39 template <
class TInputVectorData,
class TOutputVectorData>
46 const_cast<InputVectorDataType *>(input));
49 template <
class TInputVectorData,
class TOutputVectorData>
54 if (this->GetNumberOfInputs() < 1)
59 return static_cast<const TInputVectorData *
>
63 template <
class TInputVectorData,
class TOutputVectorData>
68 Superclass::GenerateOutputInformation();
71 typename InputVectorDataType::ConstPointer input = this->GetInput();
72 output->SetMetaDataDictionary(input->GetMetaDataDictionary());
79 template <
class TInputVectorData,
class TOutputVectorData>
84 this->AllocateOutputs();
88 typedef typename OutputVectorDataType::DataTreePointerType OutputDataTreePointerType;
89 OutputDataTreePointerType tree = outputPtr->GetDataTree();
95 typedef typename OutputVectorDataType::DataNodePointerType OutputDataNodePointerType;
96 OutputDataNodePointerType newDataNode = OutputDataNodeType::New();
97 newDataNode->SetNodeType(inputRoot->Get()->GetNodeType());
98 newDataNode->SetNodeId(inputRoot->Get()->GetNodeId());
99 typename OutputInternalTreeNodeType::Pointer outputRoot = OutputInternalTreeNodeType::New();
100 outputRoot->Set(newDataNode);
101 tree->SetRoot(outputRoot);
106 this->ProcessNode(inputRoot, outputRoot);
111 template <
class TInputVectorData,
class TOutputVectorData>
117 typedef typename InputInternalTreeNodeType::ChildrenListType InputChildrenListType;
118 InputChildrenListType children = source->GetChildrenList();
121 typename InputChildrenListType::const_iterator it = children.begin();
122 while (it != children.end())
124 typename OutputInternalTreeNodeType::Pointer newContainer;
125 typedef typename InputVectorDataType::DataNodePointerType InputDataNodePointerType;
126 typedef typename OutputVectorDataType::DataNodePointerType OutputDataNodePointerType;
128 InputDataNodePointerType dataNode = (*it)->Get();
129 OutputDataNodePointerType newDataNode = OutputDataNodeType::New();
130 newDataNode->SetNodeType(dataNode->GetNodeType());
131 newDataNode->SetNodeId(dataNode->GetNodeId());
132 newDataNode->SetMetaDataDictionary(dataNode->GetMetaDataDictionary());
134 switch (dataNode->GetNodeType())
138 newContainer = OutputInternalTreeNodeType::New();
139 newContainer->Set(newDataNode);
140 destination->AddChild(newContainer);
141 ProcessNode((*it), newContainer);
146 newContainer = OutputInternalTreeNodeType::New();
147 newContainer->Set(newDataNode);
148 destination->AddChild(newContainer);
149 ProcessNode((*it), newContainer);
154 newContainer = OutputInternalTreeNodeType::New();
155 newContainer->Set(newDataNode);
156 destination->AddChild(newContainer);
157 ProcessNode((*it), newContainer);
162 newDataNode->SetPoint(this->ProcessPoint(dataNode->GetPoint()));
163 newContainer = OutputInternalTreeNodeType::New();
164 newContainer->Set(newDataNode);
165 destination->AddChild(newContainer);
170 newDataNode->SetLine(this->ProcessLine(dataNode->GetLine()));
171 newContainer = OutputInternalTreeNodeType::New();
172 newContainer->Set(newDataNode);
173 destination->AddChild(newContainer);
178 newDataNode->SetPolygonExteriorRing(this->ProcessPolygon(dataNode->GetPolygonExteriorRing()));
179 newDataNode->SetPolygonInteriorRings(this->ProcessPolygonList(dataNode->GetPolygonInteriorRings()));
180 newContainer = OutputInternalTreeNodeType::New();
181 newContainer->Set(newDataNode);
182 destination->AddChild(newContainer);
187 newContainer = OutputInternalTreeNodeType::New();
188 newContainer->Set(newDataNode);
189 destination->AddChild(newContainer);
190 ProcessNode((*it), newContainer);
195 newContainer = OutputInternalTreeNodeType::New();
196 newContainer->Set(newDataNode);
197 destination->AddChild(newContainer);
198 ProcessNode((*it), newContainer);
203 newContainer = OutputInternalTreeNodeType::New();
204 newContainer->Set(newDataNode);
205 destination->AddChild(newContainer);
206 ProcessNode((*it), newContainer);
211 newContainer = OutputInternalTreeNodeType::New();
212 newContainer->Set(newDataNode);
213 destination->AddChild(newContainer);
214 ProcessNode((*it), newContainer);
225 template <
class TInputVectorData,
class TOutputVectorData>
230 Superclass::PrintSelf(os, indent);