27 #include "../common/STLUtils.h"
28 #include "../dataaccess/dataset/DataSet.h"
29 #include "../dataaccess/dataset/DataSetAdapter.h"
30 #include "../dataaccess/dataset/DataSetType.h"
31 #include "../dataaccess/dataset/DataSetTypeConverter.h"
32 #include "../dataaccess/datasource/DataSource.h"
33 #include "../dataaccess/datasource/DataSourceFactory.h"
34 #include "../dataaccess/utils/Utils.h"
35 #include "../datatype/StringProperty.h"
36 #include "../geometry/GeometryProperty.h"
37 #include "../geometry/MultiPolygon.h"
38 #include "../geometry/Polygon.h"
39 #include "../memory/DataSet.h"
40 #include "../memory/DataSetItem.h"
44 #include <boost/filesystem.hpp>
58 std::map<std::string, te::cl::ROI*>::iterator it = m_roiMap.find(label);
60 if(it != m_roiMap.end())
73 std::map<std::string, te::cl::ROI*>::iterator it = m_roiMap.find(label);
75 if(it != m_roiMap.end())
87 std::auto_ptr<te::da::DataSetType> dsType = getDataSetType(srid);
90 std::map<std::string, std::string> connInfo;
91 connInfo[
"URI"] = fileName;
94 dsOGR->setConnectionInfo(connInfo);
102 boost::filesystem::path uri(fileName);
104 std::string val = uri.stem().string();
106 dsTypeResult->setName(val);
109 std::auto_ptr<te::da::DataSet> dataset = getDataSet(srid);
112 std::map<std::string,std::string> nopt;
114 dsOGR->createDataSet(dsTypeResult, nopt);
118 dsAdapter->setSRID(srid);
120 if(dataset->moveBeforeFirst())
121 dsOGR->add(dsTypeResult->getName(), dsAdapter.get(), dsOGR->getConnectionInfo());
130 assert(ds->getNumProperties() == 5);
137 ds->moveBeforeFirst();
141 while(ds->moveNext())
177 std::auto_ptr<te::da::DataSetType> dsType;
188 dst->
add(geomIdProp);
201 std::auto_ptr<te::da::DataSet> ds;
203 std::auto_ptr<te::da::DataSetType> dsType = getDataSetType(srid);
207 std::map<std::string, te::cl::ROI*>::iterator it = m_roiMap.begin();
209 while(it != m_roiMap.end())
213 std::map<std::string, te::gm::Polygon*> roiMap = roi->
getPolygons();
215 std::map<std::string, te::gm::Polygon*>::iterator itPols = roiMap.begin();
217 while(itPols != roiMap.end())
#define TE_CL_ROI_GEOM_NAME
This mark defines the geom attribute name.
te::cl::ROI * getROI(std::string label)
Gets a ROI from this set.
MultiPolygon is a MultiSurface whose elements are Polygons.
void add(te::dt::Property *p)
It adds a property to the list of properties of the primary key.
void setGeometry(std::size_t i, te::gm::Geometry *value)
It sets the value of the i-th property.
#define TE_CL_ROI_LABEL_NAME
This mark defines the label attribute name.
A class that models the description of a dataset.
virtual ~ROISet()
Virtual destructor.
DataSetType * getResult() const
static te::cl::ROISet * createROISet(std::auto_ptr< te::da::DataSet > ds)
Imports the ROISet from a dataset.
void addPolygon(te::gm::Polygon *p, std::string id)
Add a new region into this ROI.
A ROISet is a set of ROI's.
void addROI(te::cl::ROI *roi)
Add a new ROI to this set.
void exportToFile(std::string fileName, int srid)
Export the ROISet to a shapefile.
A ROISet is a set of ROI's.
virtual te::dt::AbstractData * clone() const
It clones the linestring.
An converter for DataSetType.
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
std::auto_ptr< te::da::DataSet > getDataSet(int srid)
Creates a dataset that with the roi set information.
static std::auto_ptr< DataSource > make(const std::string &dsType)
void removeROI(std::string label)
Removes a ROI from this set.
The type for string types: FIXED_STRING, VAR_STRING or STRING.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
void setColor(std::string color)
Set the ROI color using the hexadecimal color name.
A region of interest (often abbreviated ROI), is a selected subset of samples within a dataset identi...
void add(Constraint *c)
It adds a new constraint.
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.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
#define TE_CL_ROI_GEOM_ID_NAME
This mark defines the geom id attribute name.
It describes a primary key (pk) constraint.
const std::vector< Geometry * > & getGeometries() const
It returns a reference to the internal list of geometries.
std::string getLabel()
Get the ROI label.
ROISet()
Default constructor.
#define TE_CL_ROI_PK_NAME
This mark defines the primary key attribute name.
void setString(std::size_t i, const std::string &value)
It sets the value of the i-th property.
std::auto_ptr< te::da::DataSetType > getDataSetType(int srid)
Creates a dataset type that defines a roi.
#define TE_CL_ROI_COLOR_NAME
This mark defines the color attribute name.
TEDATAACCESSEXPORT DataSetAdapter * CreateAdapter(DataSet *ds, DataSetTypeConverter *converter, bool isOwner=false)
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map...
std::map< std::string, te::cl::ROI * > & getROISet()
Get the roi set map.
std::map< std::string, te::gm::Polygon * > & getPolygons()
Get all polygons belongs to this roi.
std::string getColor()
Get the ROI color defined by a hexadecimal color name.