27 #include "../common/progress/TaskProgress.h" 28 #include "../dataaccess.h" 29 #include "../datatype/SimpleProperty.h" 30 #include "../datatype/StringProperty.h" 31 #include "../geometry/Envelope.h" 32 #include "../geometry/GeometryProperty.h" 33 #include "../geometry/Point.h" 34 #include "../geometry/Polygon.h" 35 #include "../maptools/DataSetLayer.h" 36 #include "../memory/DataSet.h" 37 #include "../memory/DataSetItem.h" 38 #include "../raster.h" 51 const std::string& name,
60 maxrows = (
int)ceil((env.
m_ury-env.
m_lly)/resY);
63 std::unique_ptr<te::da::DataSet> refDs;
66 refDs = layerBase->getData();
69 if (layerBase->getSchema()->hasRaster())
77 std::unique_ptr<te::sam::rtree::Index<size_t, 8> > rtree;
91 std::map<std::string, std::string> options;
93 std::size_t count = 0;
96 for(
int lin = 0; lin < maxrows; ++lin)
103 y = env.
m_lly+(lin*resY);
110 std::unique_ptr<te::gm::Geometry> geom;
124 std::vector<size_t> report;
125 rtree->search(*geom->getMBR(), report);
131 for(std::size_t i = 0; i < report.size(); ++i)
133 refDs->move(report[i]);
135 std::unique_ptr<te::gm::Geometry> g = refDs->getGeometry(geomPos);
138 if(geom->intersects(g.get()))
140 addCell(outputDataSet,
col, lin, geom.release());
148 addCell(outputDataSet,
col, lin, geom.release());
153 source->createDataSet(outputDataSetType.get(), options);
154 source->add(outputDataSetType->getName(), outputDataSet, options);
156 delete outputDataSet;
161 if ((count / BLOCKSIZE) >= 1)
163 source->add(outputDataSetType->getName(), outputDataSet, options);
165 delete outputDataSet;
178 source->add(outputDataSetType->getName(), outputDataSet, options);
180 delete outputDataSet;
189 sprintf(celId,
"C%02dL%02d",col,row);
203 std::unique_ptr<te::da::DataSet>
ds = layerBase->getData();
207 ds->moveBeforeFirst();
211 while(ds->moveNext())
213 std::unique_ptr<te::gm::Geometry> geom = ds->getGeometry(geomPos);
215 rtree->
insert(*geom->getMBR(), count);
244 std::string pkName = name +
"_pk_id";
246 std::vector<te::dt::Property*> pkProp;
247 pkProp.push_back(idProp);
void addCell(te::mem::DataSet *ds, int col, int row, te::gm::Geometry *geom)
Add a cell in the memory dataset.
CellularSpacesOperations()
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
void setGeometry(std::size_t i, te::gm::Geometry *value)
It sets the value of the i-th property.
An atomic property like an integer or double.
~CellularSpacesOperations()
void setSubtype(StringType t)
It sets the string property sub type.
A class that represents an R-tree.
A class that models the description of a dataset.
void useTimer(bool flag)
Used to define if task use progress timer information.
void setSize(std::size_t s)
It sets the maximum number of characters for a varying string, or the number of characters for a fixe...
This class can be used to inform the progress of a task.
double m_urx
Upper right corner x-coordinate.
static te::dt::Date ds(2010, 01, 01)
#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.
void add(DataSetItem *item)
It adds a new item to the dataset and takes its ownership.
void setTotalSteps(int value)
Set the task total stepes.
te::da::DataSetType * createCellularDataSetType(const std::string &name, int srid, CellSpaceType type)
Create the DataSetType of the cellular space.
void setInt32(std::size_t i, boost::int32_t value)
It sets the value of the i-th property.
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
double m_llx
Lower left corner x-coordinate.
TEDATAACCESSEXPORT std::size_t GetFirstSpatialPropertyPos(const te::da::DataSet *dataset)
It returns the first dataset spatial property or NULL if none is found.
A point with x and y coordinate values.
An Envelope defines a 2D rectangular region.
void setProperties(const std::vector< te::dt::Property * > &properties)
It sets the properties that form the primary key.
void pulse()
Calls setCurrentStep() function using getCurrentStep() + 1.
te::sam::rtree::Index< size_t, 8 > * getRtree(te::map::AbstractLayerPtr layerBase)
Get a RTree with the geometries envelopes of layer.
The type for string types: FIXED_STRING, VAR_STRING or STRING.
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.
double m_lly
Lower left corner y-coordinate.
void add(Constraint *c)
It adds a new constraint.
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
void insert(const te::gm::Envelope &mbr, const DATATYPE &data)
It inserts an item into the tree.
double m_ury
Upper right corner y-coordinate.
It describes a primary key (pk) constraint.
void setString(std::size_t i, const std::string &value)
It sets the value of the i-th property.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
void createCellSpace(te::da::DataSourceInfoPtr outputSource, const std::string &name, const double &resX, const double &resY, const te::gm::Envelope &env, const int srid, CellSpaceType type, te::map::AbstractLayerPtr layerBase)
It creates a Cellular Space.
TEGEOMEXPORT Geometry * GetGeomFromEnvelope(const Envelope *const e, int srid)
It creates a Geometry (a polygon) from the given envelope.
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr