22 #include "../Config.h" 53 std::vector<WKBEntry> hwkbVec;
56 for(
size_t i = 0; i < hwkbVec.size(); ++i)
68 std::size_t wkb1size = 0;
70 char* wkb1 =
new char[wkb1size];
75 CPPUNIT_ASSERT(g2->
equals(g1));
80 CPPUNIT_ASSERT(wkb1size == wkb2size);
82 char* wkb2 =
new char[wkb2size];
86 CPPUNIT_ASSERT(strcmp(hwkb1, hwkb2) == 0);
87 CPPUNIT_ASSERT(memcmp(wkb1, wkb2, wkb2size) == 0);
92 CPPUNIT_ASSERT(geomRead);
93 CPPUNIT_ASSERT(geomRead->
equals(g1));
95 char* wkb1Read =
new char [size1];
97 CPPUNIT_ASSERT(memcmp(wkb1, wkb1Read, size1) == 0);
99 const char* validHWKB = hwkb.
m_hwkb.c_str();
100 CPPUNIT_ASSERT(strcmp(hwkb1, validHWKB) == 0);
117 std::vector<std::string> wktGeom;
119 loadWKT(
"/data/wkt_point.txt", wktGeom);
120 for(
size_t i = 0; i < wktGeom.size(); ++i)
122 std::string rr_wkt = wktGeom[i];
131 CPPUNIT_ASSERT(g1->
equals(tl_geom_from_geos));
142 std::vector<std::string> wktGeom;
144 loadWKT(
"/data/wkt_line.txt", wktGeom);
145 for(
size_t i = 0; i < wktGeom.size(); ++i)
147 std::string rr_wkt = wktGeom[i];
156 CPPUNIT_ASSERT(g1->
equals(tl_geom_from_geos));
168 std::vector<std::string> wktGeom;
170 loadWKT(
"/data/wkt_polygon.txt", wktGeom);
171 for(
size_t i = 0; i < wktGeom.size(); ++i)
173 std::string rr_wkt = wktGeom[i];
182 CPPUNIT_ASSERT(g1->
equals(tl_geom_from_geos));
192 std::vector<std::string> wktGeom;
194 loadWKT(
"/data/wkt_geomcollection.txt", wktGeom);
195 for(
size_t i = 0; i < wktGeom.size(); ++i)
197 std::string rr_wkt = wktGeom[i];
206 CPPUNIT_ASSERT(g1->
equals(tl_geom_from_geos));
217 CPPUNIT_ASSERT(f != NULL);
221 std::vector<std::string> values;
222 std::string value(
"");
226 char c = (char)(fgetc(f));
230 values.push_back(value);
236 values.push_back(value);
243 if(values.size() != 9)
249 fe.
m_srid = atoi(values[1].c_str());
252 fe.
m_ndims = atoi(values[4].c_str());
253 fe.
m_wkt = values[5];
255 fe.
m_is3D = values[7] ==
"t";
258 hwkbVec.push_back(fe);
270 CPPUNIT_ASSERT(f != NULL);
274 std::vector<std::string> values;
275 std::string value(
"");
279 char c = (char)(fgetc(f));
283 geom_wkt.push_back(value);
297 std::string filename = TERRALIB_DATA_DIR + filewkt;
300 CPPUNIT_ASSERT(f != NULL);
304 std::vector<std::string> values;
305 std::string value(
"");
309 char c = (char)(fgetc(f));
313 geom_wkt.push_back(value);
void tcCreateGeomCollectionFromWKTAndApplyGEOSTests()
Test Case: Creating PPLYGONS Geom from WKT and apply GEOS Write and Read test.
void loadWKT(std::vector< std::string > &geom_wkt) const
Test suite for the GEOSWriter and GEOSReader class.
void tcCreateGeometriesAndApplyReadTests()
Test Case: Creating basic Geom and apply read test.
Test suite for the GEOSWriter and GEOSReader class.
static const MachineByteOrder sm_machineByteOrder
A flag that indicates the machine byte order (Big Endian or Little Endian).
void tcCreateLinesFromWKTAndApplyGEOSTests()
Test Case: Creating LINES Geom from WKT and apply GEOS Write and Read test.
static std::string fromUTF8(const std::string &src)
Convert a string in UTF-8 to the current locale encoding.
std::size_t getWkbSize() const _NOEXCEPT_OP(true)
It returns the size required by a WKB representation for this geometric object.
An static class with global definitions.
void loadGeometry(std::vector< WKBEntry > &hwkbVec) const
Auxiliary method for reading geometry information from an ASCII file.
This file contains several utilities functions for dealing with HEX strings.
A class for handling character enconding/decoding.
static geos::geom::Geometry * write(const Geometry *teGeom)
It reads a TerraLib geometry and make a GEOS geometry.
A class that converts a GEOS geometry to a TerraLib geometry.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
A class that converts a TerraLib geometry to a GEOS geometry.
virtual void setSRID(int srid) _NOEXCEPT_OP(true)=0
It sets the Spatial Reference System ID of the geometry and all its parts if it is a GeometryCollecti...
void tcCreatePolygonFromWKTAndApplyGEOSTests()
Test Case: Creating POLYGONS Geom from WKT and apply GEOS Write and Read test.
This file contains include headers for the TerraLib Common Runtime module.
This file contains include headers for the Vector Geometry model of TerraLib.
char * Binary2Hex(const char *s, std::size_t size)
Each char from the array of characters in binary format is converted into a pair of hex characters...
void tcCreatePointsFromWKTAndApplyGEOSTests()
Test Case: Creating POINTS Geom from WKT and apply GEOS Write and Read test.
CPPUNIT_TEST_SUITE_REGISTRATION(TsGEOSWriterReader)
static Geometry * read(const char *wkb)
It returns a valid geometry from a given WKB.
virtual bool equals(const Geometry *const rhs, const bool exact=false) const _NOEXCEPT_OP(false)
It returns true if the geometry object is spatially equal to rhs geometry.
void getWkb(char *wkb, te::common::MachineByteOrder byteOrder) const _NOEXCEPT_OP(false)
It serializes the geometry to a WKB representation into the specified buffer.
static Geometry * read(const char *wkt)
It returns a valid Geometry from a given WKT.