Skip to content
Snippets Groups Projects
Commit d97108dc authored by Otmane Lahlou's avatar Otmane Lahlou
Browse files

ENH: Printing the shapefile inforamtion instead of using the vectordata Printself

parent 012aea44
Branches
Tags
No related merge requests found
......@@ -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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment