28 #include "../common/progress/TaskProgress.h"
29 #include "../common/Logger.h"
30 #include "../common/Translator.h"
32 #include "../dataaccess/dataset/DataSet.h"
33 #include "../dataaccess/dataset/DataSetType.h"
35 #include "../datatype/Property.h"
36 #include "../datatype/SimpleProperty.h"
37 #include "../datatype/StringProperty.h"
39 #include "../dataaccess/dataset/ObjectIdSet.h"
40 #include "../dataaccess/query/And.h"
41 #include "../dataaccess/query/DataSetName.h"
42 #include "../dataaccess/query/Expression.h"
43 #include "../dataaccess/query/Field.h"
44 #include "../dataaccess/query/Fields.h"
45 #include "../dataaccess/query/From.h"
46 #include "../dataaccess/query/FromItem.h"
47 #include "../dataaccess/query/Join.h"
48 #include "../dataaccess/query/JoinConditionOn.h"
49 #include "../dataaccess/query/LiteralInt32.h"
50 #include "../dataaccess/query/PropertyName.h"
51 #include "../dataaccess/query/Select.h"
52 #include "../dataaccess/query/ST_Intersection.h"
53 #include "../dataaccess/query/ST_Intersects.h"
54 #include "../dataaccess/query/ST_SetSRID.h"
55 #include "../dataaccess/query/Where.h"
56 #include "../dataaccess/utils/Utils.h"
58 #include "../geometry/Geometry.h"
59 #include "../geometry/GeometryCollection.h"
60 #include "../geometry/GeometryProperty.h"
61 #include "../geometry/Utils.h"
63 #include "../memory/DataSet.h"
64 #include "../memory/DataSetItem.h"
89 std::vector<te::dt::Property*> firstProps = getTabularProps(m_firstConverter->getResult());
90 std::vector<te::dt::Property*> secondProps;
91 if(m_copyInputColumns)
92 secondProps = getTabularProps(m_secondConverter->getResult());
95 std::auto_ptr<te::da::DataSetType>firstDsTypeSource(m_inFirstDsrc->getDataSetType(m_inFirstDsetName));
96 std::auto_ptr<te::da::DataSetType>secondDsTypeSource(m_inSecondDsrc->getDataSetType(m_inSecondDsetName));
105 for(std::size_t i = 0; i < firstProps.size(); ++i)
108 fields->push_back(f_field);
111 for(std::size_t i = 0; i < secondProps.size(); ++i)
114 fields->push_back(f_field);
122 if (firstGeomSource->getSRID() != firstGeom->getSRID())
129 e_firstParam =
new te::da::PropertyName(m_firstConverter->getResult()->getName() +
"." + firstGeom->getName());
133 if (secondGeomSource->getSRID() != secondGeom->getSRID())
140 e_secondParam =
new te::da::PropertyName(m_secondConverter->getResult()->getName() +
"." + secondGeom->getName());
145 fields->push_back(f_intersection);
156 from->push_back(join);
163 if(m_firstOidSet && m_secondOidSet)
165 te::da::And* exp_and =
new te::da::And(m_firstOidSet->getExpressionByInClause(m_firstConverter->getResult()->getName()), m_secondOidSet->getExpressionByInClause(m_secondConverter->getResult()->getName()));
168 else if(m_firstOidSet)
169 w_oid =
new te::da::Where(m_firstOidSet->getExpressionByInClause(m_firstConverter->getResult()->getName()));
170 else if(m_secondOidSet)
171 w_oid =
new te::da::Where(m_secondOidSet->getExpressionByInClause(m_secondConverter->getResult()->getName()));
175 std::auto_ptr<te::da::DataSet> dsQuery = m_inFirstDsrc->query(select);
176 dsQuery->moveBeforeFirst();
178 if(dsQuery->size() == 0)
186 outDataSetType->add(pkProperty);
190 outDataSetType->setPrimaryKey(pk);
192 for(
size_t i = 0; i < firstProps.size(); ++i)
195 if (!m_inFirstDsetName.empty())
197 outDataSetType->add(prop);
200 for(
size_t i = 0; i < secondProps.size(); ++i)
203 if (!m_inSecondDsetName.empty())
205 outDataSetType->add(prop);
212 newGeomProp->setGeometryType(newType);
215 outDataSetType->add(newGeomProp);
217 std::auto_ptr<te::da::DataSet> outDset(this->updateGeomType(outDataSetType.get(), dsQuery.release()));
219 outDset->moveBeforeFirst();
221 te::vp::Save(m_outDsrc.get(), outDset.get(), outDataSetType.get());
230 std::size_t type = 0;
231 std::vector<te::dt::Property*> props = dsType->
getProperties();
236 std::string propName;
241 for(std::size_t i = 1; i < props.size(); ++i)
243 type = props[i]->getType();
244 propName = props[i]->getName();
248 if (!ds->
isNull(propName))
250 std::auto_ptr<te::dt::AbstractData> value = ds->
getValue(propName);
251 dsItem->
setValue(i, value.release());
256 std::auto_ptr<te::gm::Geometry> geom = ds->
getGeometry(propName);
268 newGeom->add(geom.release());
281 newGeom->add(geom.release());
294 newGeom->add(geom.release());
void setAutoNumber(bool a)
It tells if the property is an autonumber or not.
An exception class for the Vector processing module.
void add(te::dt::Property *p)
It adds a property to the list of properties of the primary key.
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
void setGeometry(std::size_t i, te::gm::Geometry *value)
It sets the value of the i-th property.
Utility functions for the data access module.
An abstract class that models a source of data in a query.
The Field class can be used to model an expression that takes part of the output items of a SELECT...
An atomic property like an integer or double.
Spatial intersects operator.
A class that models the name of a dataset used in a From clause.
Intersection Vector Processing functions.
A class that models the name of any property of an object.
A class that models the description of a dataset.
void Save(te::da::DataSource *source, te::da::DataSet *result, te::da::DataSetType *outDsType)
virtual Property * clone() const =0
It returns a clone of the object.
void setValue(std::size_t i, te::dt::AbstractData *value)
It sets the value of the i-th property.
#define TE_TR(message)
It marks a string in order to get translated.
It models a property definition.
Boolean logic operator: AND.
This is an abstract class that models a query expression.
void add(DataSetItem *item)
It adds a new item to the dataset and takes its ownership.
void setInt32(std::size_t i, boost::int32_t value)
It sets the value of the i-th property.
virtual bool moveNext()=0
It moves the internal pointer to the next item of the collection.
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
void setWhere(Where *w)
It sets the filter codition.
void setName(const std::string &name)
It sets the property name.
const std::vector< Property * > & getProperties() const
It returns the list of properties describing the CompositeProperty.
virtual bool isNull(std::size_t i) const =0
It checks if the attribute value is NULL.
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers.
A class that can be used to model a filter expression that can be applied to a query.
A Join clause combines two FromItems.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
A Select models a query to be used when retrieving data from a DataSource.
virtual std::auto_ptr< te::gm::Geometry > getGeometry(std::size_t i) const =0
Method for retrieving a geometric attribute value.
boost::ptr_vector< FromItem > From
It models the FROM clause for a query.
Spatial Set SRID operator.
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
A dataset is the unit of information manipulated by the data access module of TerraLib.
Spatial intersection operator.
te::da::DataSet * updateGeomType(te::da::DataSetType *dsType, te::da::DataSet *ds)
It describes a primary key (pk) constraint.
JoinConditionOn is a boolean expression and it specifies which items in a join are considered to matc...
Configuration flags for the Terrralib Vector Processing module.
It is a collection of other geometric objects.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
void setFields(Fields *f)
It sets the list of output expressions used to form the result set.
virtual std::auto_ptr< te::dt::AbstractData > getValue(std::size_t i) const
Method for retrieving any other type of data value stored in the data source.
void setFrom(From *f)
It sets the list of source information.
const std::string & getName() const
It returns the property name.
std::string GetSimpleTableName(std::string fullName)