27 #include "../common/Translator.h"
28 #include "../geometry/Curve.h"
29 #include "../geometry/Envelope.h"
30 #include "../geometry/LinearRing.h"
31 #include "../geometry/LineString.h"
32 #include "../geometry/Point.h"
33 #include "../geometry/Polygon.h"
34 #include "../geometry/MultiPolygon.h"
35 #include "../geometry/MultilineString.h"
36 #include "../geometry/MultiPoint.h"
37 #include "../geometry/Utils.h"
44 #include <terralib4/kernel/TeGeometry.h>
45 #include <terralib4/kernel/TeRepresentation.h>
49 std::auto_ptr<te::gm::Point> geom(
new te::gm::Point(pt.srid()));
50 geom->setX(pt.box().x1());
51 geom->setY(pt.box().y1());
59 TeComposite<TeCoord2D>::iterator it = line.begin();
62 while(it != line.end())
64 geom->setPoint(count, it->x(), it->y());
77 TeComposite<TeCoord2D>::iterator it = ring.begin();
80 while(it != ring.end())
82 geom->setPoint(count, it->x(), it->y());
95 TeComposite<TeLinearRing>::iterator it = poly.begin();
97 std::size_t count = 0;
98 while(it != poly.end())
100 geom->setRingN(count, getLinearRing(*it).release());
113 TeComposite<TePolygon>::iterator it = polySet.begin();
115 while(it != polySet.end())
117 geom->add(getPolygon(*it).release());
129 TeComposite<TeLine2D>::iterator it = lineSet.begin();
131 while(it != lineSet.end())
133 geom->add(getLineString(*it).release());
145 TeComposite<TePoint>::iterator it = pointSet.begin();
147 while(it != pointSet.end())
149 geom->add(getPoint(*it).release());
159 TeBox cellBox = cell.box();
165 std::auto_ptr<te::gm::Polygon> finalGeom(dynamic_cast<te::gm::Polygon*>(geom.release()));
172 TeGeomRep rep = geom.elemType();
178 TePolygon p =
dynamic_cast<const TePolygon&
>(geom);
179 return std::auto_ptr<te::gm::Geometry>(getPolygon(p).release());
184 TePoint p =
dynamic_cast<const TePoint&
>(geom);
185 return std::auto_ptr<te::gm::Geometry>(getPoint(p).release());
190 TeLine2D p =
dynamic_cast<const TeLine2D&
>(geom);
191 return std::auto_ptr<te::gm::Geometry>(getLineString(p).release());
196 TeCell p =
dynamic_cast<const TeCell&
>(geom);
197 return std::auto_ptr<te::gm::Geometry>(getPolygon(p).release());
202 TePoint p =
dynamic_cast<const TePoint&
>(geom);
203 return std::auto_ptr<te::gm::Geometry>(getPoint(p).release());
207 throw Exception(
TE_TR(
"Geometry Type Not supported!"));
212 return std::auto_ptr<te::gm::Geometry>(0);
MultiPolygon is a MultiSurface whose elements are Polygons.
static std::auto_ptr< te::gm::Geometry > getGeometry(const TeGeometry &geom)
static std::auto_ptr< te::gm::LineString > getLineString(const TeLine2D &line)
static std::auto_ptr< te::gm::MultiLineString > getMultiLineString(const TeLineSet &lineSet)
#define TE_TR(message)
It marks a string in order to get translated.
Configuration flags for the TerraLib 4 driver.
static std::auto_ptr< te::gm::LinearRing > getLinearRing(const TeLinearRing &ring)
A LinearRing is a LineString that is both closed and simple.
MultiPoint is a GeometryCollection whose elements are restricted to points.
LineString is a curve with linear interpolation between points.
A point with x and y coordinate values.
An Envelope defines a 2D rectangular region.
static std::auto_ptr< te::gm::MultiPolygon > getMultiPolygon(const TePolygonSet &polySet)
static std::auto_ptr< te::gm::Polygon > getPolygon(const TePolygon &poly)
Utility functions for the Geometry Module.
static std::auto_ptr< te::gm::Point > getPoint(const TePoint &pt)
MultiLineString is a MultiCurve whose elements are LineStrings.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
static std::auto_ptr< te::gm::MultiPoint > getMultiPoint(const TePointSet &pointSet)
An utility class for converting a TerraLib 4.x geometry to a TerraLib 5.
TEGEOMEXPORT Geometry * GetGeomFromEnvelope(const Envelope *const e, int srid)
It creates a Geometry (a polygon) from the given envelope.