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/utils/Utils.h"
35 #include "../geometry/GeometryProperty.h"
37 #include "../memory/DataSet.h"
38 #include "../memory/DataSetItem.h"
54 std::auto_ptr<te::da::DataSetType> outDsType = buildOutDataSetType();
56 std::auto_ptr<te::da::DataSetType> inDsType = m_inDsrc->getDataSetType(m_inDsetName);
58 std::string geomName = geomProp->
getName();
60 std::auto_ptr<te::da::DataSet> inDset;
63 inDset = m_inDsrc->getDataSet(m_inDsetName);
65 inDset = m_inDsrc->getDataSet(m_inDsetName, m_oidSet);
67 std::auto_ptr<te::mem::DataSet> outDSet(
new te::mem::DataSet(outDsType.get()));
73 inDset->moveBeforeFirst();
74 while(inDset->moveNext())
77 bool geomState =
true;
87 std::auto_ptr<te::gm::Geometry> geom = inDset->getGeometry(geomName);
94 std::auto_ptr<te::gm::MultiLineString> lineResult = polygon2Line(geom.get());
95 if(!lineResult->isValid())
98 size_t size = lineResult->getNumGeometries();
113 outDSet->add(outDsItem);
116 throw te::vp::Exception(
TE_TR(
"Operation canceled!"));
121 te::vp::Save(m_outDsrc.get(), outDSet.get(), outDsType.get());
127 std::vector<te::gm::LineString*> lines;
130 getLines(geom, lines);
133 lineResult->add(lines[0]);
134 for (
size_t i = 1; i < lines.size(); ++i)
135 lineResult->Union(lines[i]);
148 getLines(dynamic_cast<te::gm::GeometryCollection*>(geom), lines);
152 getLines(dynamic_cast<te::gm::Polygon*>(geom), lines);
156 getLines(dynamic_cast<te::gm::LineString*>(geom), lines);
176 std::vector<te::gm::Curve*>& rings = p->
getRings();
178 for(std::size_t i = 0; i < rings.size(); ++i)
std::size_t getNumGeometries() const
It returns the number of geometries in this GeometryCollection.
int getSRID() const
It returns the Spatial Reference System ID associated to this geometric object.
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.
Utility functions for the data access module.
std::string getPropertyName(std::size_t pos) const
It returns the name of the pos-th property.
std::auto_ptr< te::gm::MultiLineString > polygon2Line(te::gm::Geometry *geom)
int getPropertyDataType(std::size_t pos) const
It returns the type of the pos-th property.
void useTimer(bool flag)
Used to define if task use progress timer information.
Polygon to Line Vector Processing functions.
void Save(te::da::DataSource *source, te::da::DataSet *result, te::da::DataSetType *outDsType)
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.
std::size_t getNumProperties() const
It returns the number of properties.
bool isActive() const
Verify if the task is active.
void setTotalSteps(int value)
Set the task total stepes.
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
LineString is a curve with linear interpolation between points.
void pulse()
Calls setCurrentStep() function using getCurrentStep() + 1.
void getLines(te::gm::Geometry *geom, std::vector< te::gm::LineString * > &lines)
GeomType getGeomTypeId() const
It returns the geometry subclass type identifier.
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.
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.
It is a collection of other geometric objects.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
const std::string & getName() const
It returns the property name.