21 #ifndef otbVectorDataToVectorDataFilter_hxx 22 #define otbVectorDataToVectorDataFilter_hxx 25 #include "itkProgressReporter.h" 35 template <
class TInputVectorData,
class TOutputVectorData>
38 this->SetNumberOfRequiredInputs(1);
41 template <
class TInputVectorData,
class TOutputVectorData>
45 this->itk::ProcessObject::SetNthInput(0, const_cast<InputVectorDataType*>(input));
48 template <
class TInputVectorData,
class TOutputVectorData>
52 if (this->GetNumberOfInputs() < 1)
57 return static_cast<const TInputVectorData*
>(this->itk::ProcessObject::GetInput(0));
60 template <
class TInputVectorData,
class TOutputVectorData>
63 Superclass::GenerateOutputInformation();
66 typename InputVectorDataType::ConstPointer input = this->GetInput();
67 output->SetMetaDataDictionary(input->GetMetaDataDictionary());
73 template <
class TInputVectorData,
class TOutputVectorData>
76 this->AllocateOutputs();
81 typedef typename OutputVectorDataType::DataTreePointerType OutputDataTreePointerType;
82 OutputDataTreePointerType tree = outputPtr->GetDataTree();
88 typedef typename OutputVectorDataType::DataNodePointerType OutputDataNodePointerType;
89 OutputDataNodePointerType newDataNode = OutputDataNodeType::New();
90 newDataNode->SetNodeType(inputRoot->Get()->GetNodeType());
91 newDataNode->SetNodeId(inputRoot->Get()->GetNodeId());
92 typename OutputInternalTreeNodeType::Pointer outputRoot = OutputInternalTreeNodeType::New();
93 outputRoot->Set(newDataNode);
94 tree->SetRoot(outputRoot);
98 this->ProcessNode(inputRoot, outputRoot);
103 template <
class TInputVectorData,
class TOutputVectorData>
108 typedef typename InputInternalTreeNodeType::ChildrenListType InputChildrenListType;
109 InputChildrenListType children = source->GetChildrenList();
112 typename InputChildrenListType::const_iterator it = children.begin();
113 while (it != children.end())
115 typename OutputInternalTreeNodeType::Pointer newContainer;
116 typedef typename InputVectorDataType::DataNodePointerType InputDataNodePointerType;
117 typedef typename OutputVectorDataType::DataNodePointerType OutputDataNodePointerType;
119 InputDataNodePointerType dataNode = (*it)->Get();
120 OutputDataNodePointerType newDataNode = OutputDataNodeType::New();
121 newDataNode->SetNodeType(dataNode->GetNodeType());
122 newDataNode->SetNodeId(dataNode->GetNodeId());
123 newDataNode->SetMetaDataDictionary(dataNode->GetMetaDataDictionary());
125 switch (dataNode->GetNodeType())
129 newContainer = OutputInternalTreeNodeType::New();
130 newContainer->Set(newDataNode);
131 destination->AddChild(newContainer);
132 ProcessNode((*it), newContainer);
137 newContainer = OutputInternalTreeNodeType::New();
138 newContainer->Set(newDataNode);
139 destination->AddChild(newContainer);
140 ProcessNode((*it), newContainer);
145 newContainer = OutputInternalTreeNodeType::New();
146 newContainer->Set(newDataNode);
147 destination->AddChild(newContainer);
148 ProcessNode((*it), newContainer);
153 newDataNode->SetPoint(this->ProcessPoint(dataNode->GetPoint()));
154 newContainer = OutputInternalTreeNodeType::New();
155 newContainer->Set(newDataNode);
156 destination->AddChild(newContainer);
161 newDataNode->SetLine(this->ProcessLine(dataNode->GetLine()));
162 newContainer = OutputInternalTreeNodeType::New();
163 newContainer->Set(newDataNode);
164 destination->AddChild(newContainer);
169 newDataNode->SetPolygonExteriorRing(this->ProcessPolygon(dataNode->GetPolygonExteriorRing()));
170 newDataNode->SetPolygonInteriorRings(this->ProcessPolygonList(dataNode->GetPolygonInteriorRings()));
171 newContainer = OutputInternalTreeNodeType::New();
172 newContainer->Set(newDataNode);
173 destination->AddChild(newContainer);
178 newContainer = OutputInternalTreeNodeType::New();
179 newContainer->Set(newDataNode);
180 destination->AddChild(newContainer);
181 ProcessNode((*it), newContainer);
186 newContainer = OutputInternalTreeNodeType::New();
187 newContainer->Set(newDataNode);
188 destination->AddChild(newContainer);
189 ProcessNode((*it), newContainer);
194 newContainer = OutputInternalTreeNodeType::New();
195 newContainer->Set(newDataNode);
196 destination->AddChild(newContainer);
197 ProcessNode((*it), newContainer);
202 newContainer = OutputInternalTreeNodeType::New();
203 newContainer->Set(newDataNode);
204 destination->AddChild(newContainer);
205 ProcessNode((*it), newContainer);
216 template <
class TInputVectorData,
class TOutputVectorData>
219 Superclass::PrintSelf(os, indent);
void GenerateOutputInformation(void) override
void GenerateData(void) override
static Stopwatch StartNew()
VectorDataToVectorDataFilter()
virtual void SetInput(const InputVectorDataType *input)
const InputVectorDataType * GetInput(void)
DurationType GetElapsedMilliseconds() const
virtual void ProcessNode(InputInternalTreeNodeType *source, OutputInternalTreeNodeType *destination) const
TVectorData ::Pointer OutputVectorDataPointer
void PrintSelf(std::ostream &os, itk::Indent indent) const override
OutputVectorDataType::DataTreeType::TreeNodeType OutputInternalTreeNodeType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
InputVectorDataType::DataTreeType::TreeNodeType InputInternalTreeNodeType
TVectorData InputVectorDataType
TVectorData ::ConstPointer InputVectorDataPointer
#define otbMsgDevMacro(x)