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" 
   34 #include "../dataaccess/utils/Utils.h" 
   35 #include "../datatype/Property.h" 
   37 #include "../datatype/SimpleProperty.h" 
   38 #include "../datatype/StringProperty.h" 
   40 #include "../geometry/Geometry.h" 
   41 #include "../geometry/GeometryCollection.h" 
   42 #include "../geometry/GeometryProperty.h" 
   43 #include "../geometry/MultiLineString.h" 
   44 #include "../geometry/MultiPoint.h" 
   45 #include "../geometry/MultiPolygon.h" 
   46 #include "../geometry/Utils.h" 
   48 #include "../memory/DataSet.h" 
   49 #include "../memory/DataSetItem.h" 
   65 #include <boost/lexical_cast.hpp> 
   66 #include <boost/algorithm/string.hpp> 
   84   std::vector<te::dt::Property*> firstProps = getTabularProps(m_inFirstDsetType.get());
 
   87   firstMember.
dt = m_inFirstDsetType.release();
 
   88   if(m_firstOidSet == 0)
 
   89     firstMember.ds = m_inFirstDsrc->getDataSet(m_inFirstDsetName).release();
 
   91     firstMember.ds = m_inFirstDsrc->getDataSet(m_inFirstDsetName, m_firstOidSet).release();
 
   92   firstMember.props = firstProps;
 
   95   secondMember.
dt = m_inSecondDsetType.release();
 
   96   if(m_secondOidSet == 0)
 
   97     secondMember.
ds = m_inSecondDsrc->getDataSet(m_inSecondDsetName).release();
 
   99     secondMember.
ds = m_inSecondDsrc->getDataSet(m_inSecondDsetName, m_secondOidSet).release();
 
  100   if(m_copyInputColumns)
 
  101     secondMember.
props = getTabularProps(secondMember.
dt);
 
  103   std::pair<te::da::DataSetType*, te::da::DataSet*> resultPair;
 
  104   resultPair = this->pairwiseIntersection(m_outDsetName, firstMember, secondMember, m_SRID);
 
  106   if(resultPair.second->size() < 1)
 
  109   std::auto_ptr<te::da::DataSet> outDataSet(resultPair.second);
 
  110   std::auto_ptr<te::da::DataSetType> outDataSetType(resultPair.first);
 
  112   return save(outDataSet, outDataSetType);
 
  118                                                                                                   std::size_t outputSRID)
 
  125   size_t secondDsCount = 0;
 
  130     std::auto_ptr<te::gm::Geometry> g = secondMember.
ds->
getGeometry(secGeomPropPos);
 
  133       sridSecond = g->getSRID();
 
  135     rtree->
insert(*g->getMBR(), secondDsCount);
 
  149   std::pair<te::da::DataSetType*, te::da::DataSet*> resultPair;
 
  159     std::auto_ptr<te::gm::Geometry> currGeom = firstMember.
ds->
getGeometry(fiGeomPropPos);
 
  161     if(currGeom->getSRID() != sridSecond)
 
  162       currGeom->transform(sridSecond);
 
  164     std::vector<size_t> report;
 
  165     rtree->
search(*currGeom->getMBR(), report);
 
  168       currGeom->transform(outputSRID);
 
  170     for(
size_t i = 0; i < report.size(); ++i)
 
  172       secondMember.
ds->
move(report[i]);
 
  173       std::auto_ptr<te::gm::Geometry> secGeom = secondMember.
ds->
getGeometry(secGeomPropPos);
 
  175       if(secGeom->getSRID() != outputSRID)
 
  176         secGeom->transform(outputSRID);
 
  178       if(!currGeom->intersects(secGeom.get()))
 
  182       std::auto_ptr<te::gm::Geometry> resultGeom;
 
  184       if(currGeom->isValid() && secGeom->isValid())
 
  185         resultGeom.reset(currGeom->intersection(secGeom.get()));
 
  187       if(resultGeom.get()!=0 && resultGeom->isValid())
 
  200             newGeom->
add(resultGeom.release());
 
  213             newGeom->
add(resultGeom.release());
 
  226             newGeom->
add(resultGeom.release());
 
  233         te::common::Logger::logDebug(
"vp", 
"Intersection - Invalid geometry found");
 
  237       for(
size_t j = 0; j < firstMember.
props.size(); ++j)
 
  239         std::string name = firstMember.
props[j]->getName();
 
  249       for(
size_t j = 0; j < secondMember.
props.size(); ++j)
 
  251         std::string name = secondMember.
props[j]->getName();
 
  261       item->
setInt32(newName + 
"_id", pk);
 
  285   resultPair.first = outputDt;
 
  286   resultPair.second = outputDs;
 
  292                                                                   std::vector<te::dt::Property*> firstProps, 
 
  294                                                                   std::vector<te::dt::Property*> secondProps)
 
  302   outputDt->
add(pkProperty);
 
  308   for(
size_t i = 0; i < firstProps.size(); ++i)
 
  316   for(
size_t i = 0; i < secondProps.size(); ++i)
 
  329   outputDt->
add(newGeomProp);
 
void setAutoNumber(bool a)
It tells if the property is an autonumber or not. 
 
MultiPolygon is a MultiSurface whose elements are Polygons. 
 
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. 
 
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. 
 
A class that represents an R-tree. 
 
A class that models the description of a dataset. 
 
bool isNull(std::size_t i) const 
 
void useTimer(bool flag)
Used to define if task use progress timer information. 
 
std::vector< te::dt::Property * > props
 
virtual Property * clone() const =0
It returns a clone of the object. 
 
This class can be used to inform the progress of a task. 
 
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. 
 
bool isActive() const 
Verify if the task is active. 
 
te::da::DataSetType * createDataSetType(std::string newName, te::da::DataSetType *firstDt, std::vector< te::dt::Property * > firstProps, te::da::DataSetType *secondDt, std::vector< te::dt::Property * > secondProps)
 
void add(DataSetItem *item)
It adds a new item to the dataset and takes its ownership. 
 
virtual bool move(std::size_t i)=0
It moves the dataset internal pointer to a given position. 
 
void setTotalSteps(int value)
Set the task total stepes. 
 
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 setName(const std::string &name)
It sets the property name. 
 
MultiPoint is a GeometryCollection whose elements are restricted to points. 
 
TEDATAACCESSEXPORT std::size_t GetFirstSpatialPropertyPos(const te::da::DataSet *dataset)
It returns the first dataset spatial property or NULL if none is found. 
 
int getSRID() const 
It returns the spatial reference system identifier associated to this property. 
 
std::pair< te::da::DataSetType *, te::da::DataSet * > pairwiseIntersection(std::string newName, IntersectionMember firstMember, IntersectionMember secondMember, std::size_t outputSRID)
 
GeomType getGeometryType() const 
It returns the geometry subtype allowed for the property. 
 
virtual std::size_t size() const =0
It returns the collection size, if it is known. 
 
void pulse()
Calls setCurrentStep() function using getCurrentStep() + 1. 
 
A base class for values that can be retrieved from the data access module. 
 
int search(const te::gm::Envelope &mbr, std::vector< DATATYPE > &report) const 
Range search query. 
 
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
 
virtual std::auto_ptr< te::gm::Geometry > getGeometry(std::size_t i) const =0
Method for retrieving a geometric attribute value. 
 
bool moveBeforeFirst()
It moves the internal pointer to a position before the first item in the collection. 
 
bool moveNext()
It moves the internal pointer to the next item of the collection. 
 
void add(Constraint *c)
It adds a new constraint. 
 
MultiLineString is a MultiCurve whose elements are LineStrings. 
 
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
 
Property * findFirstPropertyOfType(const int t) const 
returns the first property of the given data type. Caller doesn't take ownership of the returned poin...
 
void insert(const te::gm::Envelope &mbr, const DATATYPE &data)
It inserts an item into the tree. 
 
te::gm::GeomType GeomOpResultType(te::gm::GeomType firstGeom, te::gm::GeomType secondGeom)
 
It describes a primary key (pk) constraint. 
 
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. 
 
std::size_t getPropertyPosition(const std::string &name) const 
It returns the property position based on its name. 
 
Configuration flags for the Terrralib Vector Processing module. 
 
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
 
void setPrimaryKey(PrimaryKey *pk)
It sets the primary key constraint. 
 
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. 
 
const std::string & getTitle() const 
A human descriptive title for the DataSetType. 
 
const std::string & getName() const 
It returns the property name. 
 
std::string GetSimpleTableName(std::string fullName)