22 #include <boost/uuid/random_generator.hpp> 23 #include <boost/uuid/uuid_io.hpp> 27 static boost::uuids::basic_random_generator<boost::mt19937> gen;
29 if (dataset.get() == 0)
31 std::cout <<
"Can not convert a NULL dataset to a layer!" << std::endl;
35 boost::uuids::uuid u = gen();
36 std::string
id = boost::uuids::to_string(u);
38 std::string title = dataset->getTitle().empty() ? dataset->getName() : dataset->getTitle();
41 layer->setDataSetName(dataset->getName());
42 layer->setDataSourceId(source->getId());
44 layer->setRendererType(
"ABSTRACT_LAYER_RENDERER");
46 if (dataset->size() == 0)
53 std::unique_ptr<te::gm::Envelope> mbr(
te::da::GetExtent(dataset->getName(), gp->getName(), source->getId()));
54 layer->setSRID(gp->getSRID());
56 layer->setExtent(*mbr);
64 std::string filename(TERRALIB_DATA_DIR
"/shape/munic_2001.shp");
66 std::string srcInfo(
"file://" + filename);
68 static boost::uuids::basic_random_generator<boost::mt19937> gen;
69 boost::uuids::uuid u = gen();
70 std::string
id = boost::uuids::to_string(u);
77 filename = TERRALIB_DATA_DIR
"/shape/poligono_unico.shp";
79 srcInfo =
"file://" + filename;
82 id = boost::uuids::to_string(u);
85 fromSource->setId(
id);
89 std::string toDsName =
"munic_2001";
90 std::string fromDsName =
"poligono_unico";
95 if (!toSource->dataSetExists(toDsName))
97 std::cout <<
"\"To\" dataset not found: " << toDsName << std::endl;
101 if (!fromSource->dataSetExists(fromDsName))
103 std::cout <<
"\"From\" dataset not found: " << fromDsName << std::endl;
112 std::map<std::string, std::vector<te::attributefill::OperationType> > options;
116 std::vector<std::string> toLayerProps;
117 std::vector<te::dt::Property*> props = toDt->getProperties();
118 for (std::size_t i = 0; i < props.size(); ++i)
120 toLayerProps.push_back(props[i]->getName());
124 std::string outDsName;
127 std::string outDataSetName =
"v2v_result";
129 filename = TERRALIB_DATA_DIR
"/shape/v2v_result.shp";
131 srcInfo =
"file://" + filename;
136 if (outSource->dataSetExists(
"v2v_result"))
138 std::cout <<
"There is already a dataset with the requested name in the output data source. Remove it or select a new name and try again." << fromDsName << std::endl;
142 v2v->setInput(fromLayer, toLayer);
143 v2v->setParams(options, toLayerProps);
144 v2v->setOutput(outSource, outDsName);
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
TEDATAACCESSEXPORT te::gm::Envelope * GetExtent(const std::string &datasetName, const std::string &propertyName, const std::string &datasourceId)
TEDATAACCESSEXPORT void LoadProperties(te::da::DataSetType *dataset, const std::string &datasourceId)
boost::shared_ptr< DataSetType > DataSetTypePtr
boost::shared_ptr< DataSource > DataSourcePtr
Utility functions for Symbology Enconding module.
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
This is a singleton for managing all data source instances available in the system.
static te::dt::Date ds(2010, 01, 01)
A layer with reference to a dataset.
TESEEXPORT Style * CreateFeatureTypeStyle(const te::gm::GeomType &geomType)
Try creates an appropriate feature type style based on given geometry type.
Vector to Vector processing.
Utility functions for the Geometry Module.
static DataSourceManager & getInstance()
It returns a reference to the singleton instance.
A factory for data sources.
Utility functions for the data access module.
te::map::DataSetLayerPtr createLayer(te::da::DataSourcePtr source, te::da::DataSetTypePtr &dataset)
boost::intrusive_ptr< DataSetLayer > DataSetLayerPtr
Vector To Vector operation.
A layer with reference to a dataset.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr