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" 38 #include "../memory/DataSet.h" 39 #include "../memory/DataSetItem.h" 57 std::string geomName = geomProp->
getName();
60 std::unique_ptr<te::da::DataSet> inDsetSrc;
69 std::unique_ptr<te::mem::DataSet> outDSet(
new te::mem::DataSet(outDsType.get()));
75 inDset->moveBeforeFirst();
76 while(inDset->moveNext())
81 bool geomState =
true;
85 if (inDset->isNull(geomPos))
94 std::unique_ptr<te::gm::Geometry> geom = inDset->getGeometry(geomPos);
101 std::unique_ptr<te::gm::MultiLineString> lineResult =
polygon2Line(geom.get());
102 if (!lineResult->isValid())
117 outDSet->add(outDsItem);
120 throw te::vp::Exception(
TE_TR(
"Operation canceled!"));
138 std::vector<te::gm::Geometry*> geomVec;
143 for (
auto i : geomVec)
145 std::vector<te::gm::LineString*> lines;
163 getLines(dynamic_cast<te::gm::GeometryCollection*>(geom), lines);
167 getLines(dynamic_cast<te::gm::Polygon*>(geom), lines);
171 getLines(dynamic_cast<te::gm::LineString*>(geom), lines);
191 std::vector<te::gm::Curve*>& rings = p->
getRings();
193 for(std::size_t i = 0; i < rings.size(); ++i)
std::size_t getNumGeometries() const
It returns the number of geometries in this GeometryCollection.
std::vector< Curve * > & getRings()
It returns the polygon rings.
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.
Polygon to Line Vector Processing functions.
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.
#define TE_TR(message)
It marks a string in order to get translated.
std::size_t getNumProperties() const
It returns the number of properties.
TEGEOMEXPORT void Multi2Single(const te::gm::Geometry *g, std::vector< te::gm::Geometry * > &geoms)
It will get a GeometryCollection and distribute in a vector.
bool isActive() const
Verify if the task is active.
void setTotalSteps(int value)
Set the task total stepes.
te::gm::GeometryCollection * gc
std::unique_ptr< te::gm::MultiLineString > polygon2Line(te::gm::Geometry *geom)
TEVPEXPORT void Save(te::da::DataSource *source, te::da::DataSet *result, te::da::DataSetType *outDsType, const bool &enableProgress=true)
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.
std::unique_ptr< te::da::DataSetTypeConverter > m_converter
void pulse()
Calls setCurrentStep() function using getCurrentStep() + 1.
void getLines(te::gm::Geometry *geom, std::vector< te::gm::LineString * > &lines)
Utility functions for the data access module.
te::da::DataSourcePtr m_inDsrc
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.
te::da::DataSourcePtr m_outDsrc
Geometry * getGeometryN(std::size_t i) const
It returns the n-th geometry in this GeometryCollection.
MultiLineString is a MultiCurve whose elements are LineStrings.
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...
const te::da::ObjectIdSet * m_oidSet
It is a collection of other geometric objects.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
TEDATAACCESSEXPORT DataSetAdapter * CreateAdapter(DataSet *ds, DataSetTypeConverter *converter, bool isOwner=false)
std::unique_ptr< te::da::DataSetType > buildOutDataSetType()
const std::string & getName() const
It returns the property name.