diff --git a/Testing/Code/IO/otbVectorDataFileReader.cxx b/Testing/Code/IO/otbVectorDataFileReader.cxx index fac6a0b93de0dc5cafd8f2fa83a55fa006767630..d2770238d4332406c3ba3636c2f72f07cf725944 100644 --- a/Testing/Code/IO/otbVectorDataFileReader.cxx +++ b/Testing/Code/IO/otbVectorDataFileReader.cxx @@ -20,19 +20,49 @@ #include "otbVectorData.h" #include <fstream> +#include "itkTreeContainer.h" +#include "itkDataObject.h" +#include "otbDataNode.h" + int otbVectorDataFileReader(int argc, char * argv[]) { typedef otb::VectorData<> VectorDataType; typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; VectorDataFileReaderType::Pointer reader = VectorDataFileReaderType::New(); + typedef otb::DataNode<double,2,double> DataNodeType; + typedef DataNodeType::Pointer DataNodePointerType; + typedef itk::TreeContainer<DataNodePointerType> DataTreeType; + + typedef itk::DataObject dataobjectType; + itk::Indent indent; + reader->SetFileName(argv[1]); reader->Update(); VectorDataType::Pointer data = reader->GetOutput(); - + DataTreeType::Pointer dataTree = DataTreeType::New(); + dataTree = data->GetDataTree(); + std::ofstream fout (argv[2]); - fout << data <<std::endl; + + itk::PreOrderTreeIterator<DataTreeType> it(dataTree); + it.GoToBegin(); + + while(!it.IsAtEnd()) + { + itk::PreOrderTreeIterator<DataTreeType> itParent = it; + bool goesOn = true; + while(itParent.HasParent() && goesOn ) + { + fout<<indent; + goesOn = itParent.GoToParent(); + } + fout<<"+"<<it.Get()->GetNodeTypeAsString()<<std::endl; + ++it; + } + /*added PrintSelf*/ + fout.close(); return EXIT_SUCCESS; }