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/dataset/DataSetAdapter.h"
34 #include "../dataaccess/utils/Utils.h"
36 #include "../geometry/GeometryProperty.h"
38 #include "../memory/DataSet.h"
39 #include "../memory/DataSetItem.h"
55 std::auto_ptr<te::da::DataSetType> outDsType = buildOutDataSetType();
59 std::string geomName = geomProp->
getName();
62 std::auto_ptr<te::da::DataSet> inDsetSrc;
65 inDsetSrc = m_inDsrc->getDataSet(m_inDsetName);
67 inDsetSrc = m_inDsrc->getDataSet(m_inDsetName, m_oidSet);
69 std::auto_ptr<te::da::DataSetAdapter> inDset(
te::da::CreateAdapter(inDsetSrc.get(), m_converter.get()));
71 std::auto_ptr<te::mem::DataSet> outDSet(
new te::mem::DataSet(outDsType.get()));
77 inDset->moveBeforeFirst();
78 while(inDset->moveNext())
81 bool geomState =
true;
91 std::auto_ptr<te::gm::Geometry> geom = inDset->getGeometry(geomPos);
98 std::auto_ptr<te::gm::MultiLineString> lineResult = polygon2Line(geom.get());
99 if (!lineResult->isValid())
114 outDSet->add(outDsItem);
117 throw te::vp::Exception(
TE_TR(
"Operation canceled!"));
122 te::vp::Save(m_outDsrc.get(), outDSet.get(), outDsType.get());
128 std::vector<te::gm::LineString*> lines;
131 getLines(geom, lines);
134 lineResult->add(lines[0]);
135 for (
size_t i = 1; i < lines.size(); ++i)
136 lineResult->Union(lines[i]);
149 getLines(dynamic_cast<te::gm::GeometryCollection*>(geom), lines);
153 getLines(dynamic_cast<te::gm::Polygon*>(geom), lines);
157 getLines(dynamic_cast<te::gm::LineString*>(geom), lines);
177 std::vector<te::gm::Curve*>& rings = p->
getRings();
179 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.
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.
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)
TEDATAACCESSEXPORT DataSetAdapter * CreateAdapter(DataSet *ds, DataSetTypeConverter *converter, bool isOwner=false)
const std::string & getName() const
It returns the property name.