28 #include "../common/progress/TaskProgress.h" 29 #include "../core/logger/Logger.h" 30 #include "../core/translator/Translator.h" 32 #include "../dataaccess/dataset/DataSet.h" 33 #include "../dataaccess/dataset/DataSetAdapter.h" 34 #include "../dataaccess/utils/Utils.h" 36 #include "../geometry/GeometryProperty.h" 37 #include "../geometry/Utils.h" 39 #include "../memory/DataSet.h" 40 #include "../memory/DataSetItem.h" 59 std::string geomName = geomProp->
getName();
62 std::unique_ptr<te::da::DataSet> inDsetSrc;
71 std::unique_ptr<te::mem::DataSet> outDSet(
new te::mem::DataSet(outDsType.get()));
77 inDset->moveBeforeFirst();
78 while(inDset->moveNext())
83 bool geomState =
true;
91 if(!inDset->isNull(pos))
96 std::unique_ptr<te::gm::Geometry> geom = inDset->getGeometry(geomPos);
103 std::unique_ptr<te::gm::MultiPolygon> polygonResult =
line2Polygon(geom.get());
105 if (polygonResult->isEmpty())
111 if (!polygonResult->isValid())
114 polygonResult.reset(dynamic_cast<te::gm::MultiPolygon*>(valid_geom));
116 if (!polygonResult.get() || !polygonResult->isValid())
123 outDsItem->
setGeometry(i, polygonResult.release());
129 outDSet->add(outDsItem);
132 throw te::vp::Exception(
TE_TR(
"Operation canceled!"));
150 std::vector<te::gm::Polygon*> polygons;
155 for(std::size_t i = 0; i < polygons.size(); ++i)
156 polygonResult->add(polygons[i]);
158 return polygonResult;
169 getPolygons(dynamic_cast<te::gm::GeometryCollection*>(geom), polygons);
173 getPolygons(dynamic_cast<te::gm::LineString*>(geom), polygons);
177 getPolygons(dynamic_cast<te::gm::LineString*>(geom), polygons);
181 getPolygons(dynamic_cast<te::gm::LineString*>(geom), polygons);
185 getPolygons(dynamic_cast<te::gm::LineString*>(geom), polygons);
215 for(std::size_t i = 0; i < size; ++i)
225 for(std::size_t i = 0; i < size; ++i)
226 ring->setPoint(i, l->
getX(i), l->
getY(i));
228 ring->setPoint(size, l->
getX(0), l->
getY(0));
239 polygons.push_back(p);
std::size_t getNumGeometries() const
It returns the number of geometries in this GeometryCollection.
void add(Curve *ring)
It adds the ring to the curve polygon.
MultiPolygon is a MultiSurface whose elements are Polygons.
void setGeometry(std::size_t i, te::gm::Geometry *value)
It sets the value of the i-th property.
std::string getPropertyName(std::size_t pos) const
It returns the name of the pos-th property.
int getPropertyDataType(std::size_t pos) const
It returns the type of the pos-th property.
Base exception class for plugin module.
virtual const char * what() const
It outputs the exception message.
void useTimer(bool flag)
Used to define if task use progress timer information.
GeomType getGeomTypeId() const _NOEXCEPT_OP(true)
It returns the geometry subclass type identifier.
std::unique_ptr< te::gm::MultiPolygon > line2Polygon(te::gm::Geometry *geom)
This class can be used to inform the progress of a task.
TEDATAACCESSEXPORT std::size_t GetPropertyPos(const DataSet *dataset, const std::string &name)
void setValue(std::size_t i, te::dt::AbstractData *value)
It sets the value of the i-th property.
const te::da::ObjectIdSet * m_oidSet
te::da::DataSourcePtr m_outDsrc
#define TE_TR(message)
It marks a string in order to get translated.
std::size_t getNumProperties() const
It returns the number of properties.
bool isActive() const
Verify if the task is active.
bool isClosed() const
It returns true if the curve is closed (startPoint = endPoint).
const double & getY(std::size_t i) const
It returns the n-th y coordinate value.
void setTotalSteps(int value)
Set the task total stepes.
te::gm::GeometryCollection * gc
TEVPEXPORT void Save(te::da::DataSource *source, te::da::DataSet *result, te::da::DataSetType *outDsType, const bool &enableProgress=true)
A LinearRing is a LineString that is both closed and simple.
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
int getSRID() const _NOEXCEPT_OP(true)
It returns the Spatial Reference System ID associated to this geometric object.
LineString is a curve with linear interpolation between points.
void getPolygons(te::gm::Geometry *geom, std::vector< te::gm::Polygon * > &polygons)
void setPoint(std::size_t i, const double &x, const double &y)
It sets the value of the specified point.
const double & getX(std::size_t i) const
It returns the n-th x coordinate value.
std::unique_ptr< te::da::DataSetTypeConverter > m_converter
std::size_t getNPoints() const
It returns the number of points (vertexes) in the linestring.
void pulse()
Calls setCurrentStep() function using getCurrentStep() + 1.
Utility functions for the data access module.
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.
Geometry * getGeometryN(std::size_t i) const
It returns the n-th geometry in this GeometryCollection.
te::da::DataSourcePtr m_inDsrc
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
#define TE_LOG_ERROR(message)
Use this tag in order to log a message to the TerraLib default logger with the ERROR level...
It is a collection of other geometric objects.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
Line to Polygon Vector Processing functions.
TEDATAACCESSEXPORT DataSetAdapter * CreateAdapter(DataSet *ds, DataSetTypeConverter *converter, bool isOwner=false)
TEGEOMEXPORT te::gm::Geometry * Validate(te::gm::Geometry *geom)
Get/create a valid version of the geometry given. If the geometry is a polygon or multi polygon...
std::unique_ptr< te::da::DataSetType > buildOutDataSetType()
const std::string & getName() const
It returns the property name.