Commit d8ebf142 authored by Aurélien Bricier's avatar Aurélien Bricier

TEST: added test for class VectorDataToRandomLineGenerator

parent e0ffa737
......@@ -1991,6 +1991,22 @@ ADD_TEST(bfTvLabelObjectOpeningMuParserFilterTest ${BASICFILTERS_TESTS14}
"SHAPE_Elongation>8"
)
# ----------------------- otbVectorDataToRandomLineGenerator -----------------------
ADD_TEST(bfTuVectorDataToRandomLineGeneratorNew ${BASICFILTERS_TESTS14}
otbVectorDataToRandomLineGeneratorNew
)
ADD_TEST(bfTuVectorDataToRandomLineGenerator ${BASICFILTERS_TESTS14}
--compare-ogr ${NOTOL}
${BASELINE_FILES}/bfTvVectorDataToRandomLineGeneratorOutput.shp
${TEMP}/bfTvVectorDataToRandomLineGeneratorOutput.shp
otbVectorDataToRandomLineGenerator
${INPUTDATA}/ObjectReco/Boats/maur_B010202_01Polygons.shp
${TEMP}/bfTvVectorDataToRandomLineGeneratorOutput.shp
)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbBasicFiltersTests15 ~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......@@ -2310,6 +2326,7 @@ otbBasicFiltersTests14.cxx
otbConnectedComponentMuParserFunctorTest.cxx
otbLabelObjectOpeningMuParserFilterNew.cxx
otbLabelObjectOpeningMuParserFilterTest.cxx
otbVectorDataToRandomLineGenerator.cxx
)
IF(OTB_DATA_USE_LARGEINPUT)
SET(BasicFilters_SRCS15
......
......@@ -29,4 +29,6 @@ void RegisterTests()
REGISTER_TEST(otbConnectedComponentMuParserFunctorTest);
REGISTER_TEST(otbLabelObjectOpeningMuParserFilterNew);
REGISTER_TEST(otbLabelObjectOpeningMuParserFilterTest);
REGISTER_TEST(otbVectorDataToRandomLineGeneratorNew);
REGISTER_TEST(otbVectorDataToRandomLineGenerator);
}
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
#include "otbVectorData.h"
#include "otbVectorDataFileReader.h"
#include "otbVectorDataFileWriter.h"
#include "otbVectorDataToRandomLineGenerator.h"
int otbVectorDataToRandomLineGeneratorNew(int argc, char* argv[])
{
typedef otb::VectorData<> VectorDataType;
typedef otb::VectorDataToRandomLineGenerator<VectorDataType> GeneratorType;
// instantiation
GeneratorType::Pointer generator = GeneratorType::New();
std::cout << generator << std::endl;
return EXIT_SUCCESS;
}
int otbVectorDataToRandomLineGenerator(int argc, char* argv[])
{
const char * inputVD = argv[1];
const char * outputVD = argv[2];
typedef otb::VectorData<> VectorDataType;
typedef otb::VectorDataFileReader<VectorDataType> VectorDataReaderType;
typedef otb::VectorDataFileWriter<VectorDataType> VectorDataWriterType;
typedef otb::VectorDataToRandomLineGenerator<VectorDataType> GeneratorType;
// instantiation
VectorDataReaderType::Pointer reader = VectorDataReaderType::New();
VectorDataWriterType::Pointer writer = VectorDataWriterType::New();
GeneratorType::Pointer generator = GeneratorType::New();
reader->SetFileName(inputVD);
reader->Update();
generator->SetInput(reader->GetOutput());
generator->SetSeed(0); // enable reproducible random number sequence
generator->SetNumberOfOutputLine(20);
generator->SetMinLineSize(5);
generator->SetMaxLineSize(20);
generator->Update();
writer->SetFileName(outputVD);
writer->SetInput(generator->GetOutput());
writer->Update();
return EXIT_SUCCESS;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment