27 #include "../dataaccess/dataset/DataSetTypeConverter.h"
28 #include "../dataaccess/dataset/DataSetTypeCapabilities.h"
29 #include "../dataaccess/datasource/DataSource.h"
30 #include "../dataaccess/datasource/DataSourceCapabilities.h"
31 #include "../dataaccess/datasource/DataSourceInfo.h"
32 #include "../dataaccess/datasource/DataSourceManager.h"
33 #include "../dataaccess/datasource/DataSourceTransactor.h"
34 #include "../dataaccess/utils/Utils.h"
35 #include "../geometry/Geometry.h"
36 #include "../geometry/GeometryCollection.h"
37 #include "../geometry/GeometryProperty.h"
38 #include "../geometry/MultiPoint.h"
39 #include "../geometry/MultiLineString.h"
40 #include "../geometry/MultiPolygon.h"
41 #include "../geometry/Point.h"
42 #include "../memory/DataSet.h"
50 #include <boost/algorithm/string.hpp>
56 std::auto_ptr<te::gm::Geometry> seedGeometry = items[0]->getGeometry(geomIdx);
59 resultGeometry = seedGeometry.release();
63 std::auto_ptr<te::gm::Geometry> teGeom = items[1]->getGeometry(geomIdx);
66 resultGeometry = seedGeometry->
Union(teGeom.release());
68 resultGeometry = seedGeometry.release();
74 for(std::size_t i = 1; i < items.size(); ++i)
76 std::auto_ptr<te::gm::Geometry> currentGeom = items[i]->getGeometry(geomIdx);
78 if(currentGeom->isValid())
79 teGeomColl->
add(currentGeom.release());
82 resultGeometry = seedGeometry->
Union(teGeomColl);
92 for(std::size_t i = 0; i < geomVec.size(); ++i)
110 return resultGeometry;
117 std::auto_ptr<te::gm::Geometry> seedGeometry = items[0]->getGeometry(geomIdx);
120 resultGeometry = seedGeometry.release();
122 if(items.size() == 2)
124 std::auto_ptr<te::gm::Geometry> teGeom = items[1]->getGeometry(geomIdx);
126 if(teGeom->isValid())
127 resultGeometry = seedGeometry->
Union(teGeom.release());
129 resultGeometry = seedGeometry.release();
135 for(std::size_t i = 1; i < items.size(); ++i)
137 std::auto_ptr<te::gm::Geometry> currentGeom = items[i]->getGeometry(geomIdx);
139 if(currentGeom->isValid())
140 teGeomColl->
add(currentGeom.release());
143 resultGeometry = seedGeometry->
Union(teGeomColl);
146 return resultGeometry;
152 for(std::size_t i = 0; i < geomVec.size(); ++i)
156 gcOut->
add(geomVec[i]);
164 std::size_t found = fullName.rfind(
".");
166 if(found >= std::string::npos)
169 return fullName.substr(found + 1);
219 std::auto_ptr<te::da::DataSourceTransactor> t = source->
getTransactor();
221 std::map<std::string, std::string> options;
232 std::string name = dsTypeResult->getName();
233 source->
add(dsTypeResult->getName(),result, options);
240 t->createDataSet(dsTypeResult, options);
244 std::string name = dsTypeResult->getName();
245 t->add(dsTypeResult->getName(),result, options);
256 catch(std::exception& e)
std::size_t getNumGeometries() const
It returns the number of geometries in this GeometryCollection.
int getSRID() const
It returns the Spatial Reference System ID associated to this geometric object.
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Utility functions for the data access module.
void Multi2Single(te::gm::Geometry *g, std::vector< te::gm::Geometry * > &geoms)
A class that models the description of a dataset.
virtual void createDataSet(DataSetType *dt, const std::map< std::string, std::string > &options)
It creates the dataset schema definition in the target data source.
virtual std::auto_ptr< DataSourceTransactor > getTransactor()=0
It returns an object that can execute transactions in the context of a data source.
te::gm::Geometry * GetGeometryUnion(const std::vector< te::mem::DataSetItem * > &items, size_t geomIdx, te::gm::GeomType outGeoType)
It returns the union of a geometry vector.
DataSetType * getResult() const
void Save(te::da::DataSource *source, te::da::DataSet *result, te::da::DataSetType *outDsType)
virtual void add(const std::string &datasetName, DataSet *d, const std::map< std::string, std::string > &options, std::size_t limit=0)
It adds data items to the dataset in the data source.
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
An converter for DataSetType.
void SplitGeometryCollection(te::gm::GeometryCollection *geomIn, te::gm::GeometryCollection *gcOut)
virtual std::string getType() const =0
It returns the data source type name (in UPPER CASE). Ex: POSTGIS, SQLITE, WFS, WMS, or MYSQL.
virtual const DataSourceCapabilities & getCapabilities() const =0
It returns the known capabilities of the data source.
GeomType getGeomTypeId() const
It returns the geometry subclass type identifier.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Geometry * getGeometryN(std::size_t i) const
It returns the n-th geometry in this GeometryCollection.
A dataset is the unit of information manipulated by the data access module of TerraLib.
te::gm::GeomType GeomOpResultType(te::gm::GeomType firstGeom, te::gm::GeomType secondGeom)
void add(Geometry *g)
It adds the geometry into the collection.
virtual bool moveBeforeFirst()=0
It moves the internal pointer to a position before the first item in the collection.
const std::vector< Geometry * > & getGeometries() const
It returns a reference to the internal list of geometries.
void setGeometryN(std::size_t i, Geometry *g)
It sets the n-th geometry in this geometry collection.
te::gm::GeomType GetSimpleType(te::gm::GeomType geomType)
virtual Geometry * Union(const Geometry *const rhs) const
It returns a geometric object that represents the point set union with another geometry.
It is a collection of other geometric objects.
bool IsMultiType(te::gm::GeomType geomType)
std::string GetSimpleTableName(std::string fullName)