24 #include "../dataaccess/dataset/DataSet.h"
25 #include "../dataaccess/dataset/DataSetAdapter.h"
26 #include "../dataaccess/dataset/DataSetType.h"
27 #include "../dataaccess/dataset/DataSetTypeConverter.h"
28 #include "../dataaccess/datasource/DataSource.h"
29 #include "../dataaccess/datasource/DataSourceCapabilities.h"
30 #include "../dataaccess/utils/Utils.h"
32 #include "../datatype/Property.h"
33 #include "../datatype/SimpleProperty.h"
34 #include "../datatype/StringProperty.h"
36 #include "../geometry/GeometryProperty.h"
38 #include "../statistics/core/Utils.h"
48 std::string inDsetName,
49 std::auto_ptr<te::da::DataSetType> inDsetType,
53 m_inDsetName = inDsetName;
54 m_inDsetType = inDsetType;
59 const int& bufferPolygonRule,
60 const int& bufferBoundariesRule,
61 const bool& copyInputColumns,
64 m_distance = distance;
65 m_bufferPolygonRule = bufferPolygonRule;
66 m_bufferBoundariesRule = bufferBoundariesRule;
67 m_copyInputColumns = copyInputColumns;
74 m_outDsetName = dsname;
79 if (!m_inDsetType->hasGeom())
82 if (m_outDsetName.empty() || !m_outDsrc.get())
95 std::map<std::string, std::string> options;
97 m_outDsrc->createDataSet(dsTypeResult, options);
100 result->moveBeforeFirst();
101 m_outDsrc->add(dsTypeResult->getName(),result.get(), options);
104 if (m_outDsrc->getCapabilities().getDataSetTypeCapabilities().supportsPrimaryKey())
106 std::string pk_name = dsTypeResult->getName() +
"_pkey";
108 pk->
add(dsTypeResult->getProperty(0));
109 m_outDsrc->addPrimaryKey(m_outDsetName,pk);
122 dsType->
add(pkProperty);
129 dsType->
add(levelProperty);
132 dsType->
add(distanceProperty);
135 if(m_copyInputColumns)
137 std::vector<te::dt::Property*> props = m_inDsetType->getProperties();
139 for(std::size_t i = 0; i < props.size(); ++i)
141 const std::string name = props[i]->getName();
142 int type = props[i]->getType();
153 std::auto_ptr<te::gm::GeometryProperty> p (static_cast<te::gm::GeometryProperty*>(gp->
clone()));
156 geometry->
setSRID(p->getSRID());
157 dsType->
add(geometry);
void setAutoNumber(bool a)
It tells if the property is an autonumber or not.
void add(te::dt::Property *p)
It adds a property to the list of properties of the primary key.
void setSRID(int srid)
It sets the spatial reference system identifier associated to this property.
void setGeometryType(GeomType t)
It sets the geometry subtype.
An atomic property like an integer or double.
boost::shared_ptr< DataSource > DataSourcePtr
A class that models the description of a dataset.
DataSetType * getResult() const
te::dt::Property * clone() const
It returns a clone of the object.
An converter for DataSetType.
This class represents a set of unique ids created in the same context. i.e. from the same data set...
te::da::DataSetType * GetDataSetType()
void setParams(const double &distance, const int &bufferPolygonRule, const int &bufferBoundariesRule, const bool ©InputColumns, const int &levels)
void setInput(te::da::DataSourcePtr inDsrc, std::string inDsetName, std::auto_ptr< te::da::DataSetType > inDsetType, const te::da::ObjectIdSet *oidSet=0)
virtual bool paramsAreValid()
void setOutput(te::da::DataSourcePtr outDsrc, std::string dsname)
void add(Constraint *c)
It adds a new constraint.
bool save(std::auto_ptr< te::mem::DataSet > result, std::auto_ptr< te::da::DataSetType > outDsType)
It describes a primary key (pk) constraint.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
TEDATAACCESSEXPORT DataSetAdapter * CreateAdapter(DataSet *ds, DataSetTypeConverter *converter, bool isOwner=false)
void setPrimaryKey(PrimaryKey *pk)
It sets the primary key constraint.