27 #include <terralib_buildconfig.h> 33 #include "../Config.h" 40 #include <boost/test/unit_test.hpp> 41 #include <boost/shared_ptr.hpp> 49 std::map<std::string, std::string> rinfo;
50 rinfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/pattern1.tif";
53 std::vector<te::gm::Geometry*> polygons;
54 std::vector< double > polygonsValues;
57 vectorizerInstance.
run( polygons, &polygonsValues);
58 BOOST_CHECK( !polygons.empty() );
59 BOOST_CHECK( polygons.size() == polygonsValues.size() );
64 for(
unsigned int polygonsIdx = 0 ; polygonsIdx < polygons.size() ; ++polygonsIdx )
66 BOOST_CHECK( polygons[ polygonsIdx ]->isValid() );
73 std::unique_ptr<te::da::DataSetType> dataSetTypePtr1(
new te::da::DataSetType(
"RasterVectorizerTestPolygons"));
80 std::unique_ptr<te::da::DataSetType> dataSetTypePtr2(
new te::da::DataSetType( *dataSetTypePtr1 ) );
82 std::unique_ptr< te::mem::DataSet > memDataSetPtr(
new te::mem::DataSet( dataSetTypePtr1.get()) );
84 for(
unsigned int polygonsIdx = 0 ; polygonsIdx < polygons.size() ; ++polygonsIdx )
87 dsItemPtr->
setDouble( 0, polygonsValues[ polygonsIdx ] );
89 dsItemPtr->
setGeometry( 2, polygons[ polygonsIdx ] );
91 memDataSetPtr->add( dsItemPtr );
94 remove(
"RasterVectorizerTestPolygons.dbf" );
95 remove(
"RasterVectorizerTestPolygons.prj" );
96 remove(
"RasterVectorizerTestPolygons.shp" );
97 remove(
"RasterVectorizerTestPolygons.shx" );
99 std::string connInfo(
"file://RasterVectorizerTestPolygons.shp");
103 memDataSetPtr->moveBeforeFirst();
105 te::da::Create(dsOGR.get(), dataSetTypePtr2.get(), memDataSetPtr.get());
111 BOOST_AUTO_TEST_SUITE_END()
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
void setGeometry(std::size_t i, te::gm::Geometry *value)
It sets the value of the i-th property.
This file contains include headers for the memory data source of TerraLib.
void setDouble(std::size_t i, double value)
It sets the value of the i-th property.
An atomic property like an integer or double.
BOOST_AUTO_TEST_SUITE(rasterVectorizer_tests) BOOST_AUTO_TEST_CASE(rasterVectorizer_test)
A class that models the description of a dataset.
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
TEDATAACCESSEXPORT void Create(DataSource *ds, DataSetType *dt, DataSet *d, std::size_t limit=0)
It creates the dataset definition in a data source and then fill it with data from the input dataset...
It implements the vectorizer, based on TerraLib 4 algorithm.
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
BOOST_AUTO_TEST_CASE(encoding_test_utf8_latin1)
bool run(std::vector< te::gm::Geometry * > &polygons, std::vector< double > *const polygonsValues=0)
Returns true if current algorithm implementation runs ok, false otherwise.
This file contains include headers for the Vector Geometry model of TerraLib.
This file contains include headers for the Data Access module of TerraLib.
static Raster * open(const std::map< std::string, std::string > &rinfo, te::common::AccessPolicy p=te::common::RAccess)
It opens a raster with the given parameters and default raster driver.