TsGEOSWriterReader.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file TsGEOSWriterReader.h
22 
23  \brief Test suite for the GEOSWriter and GEOSReader class.
24  */
25 
26 #ifndef __TERRALIB_UNITTEST_GEOMETRY_INTERNAL_GEOSWRITERREADER_H
27 #define __TERRALIB_UNITTEST_GEOMETRY_INTERNAL_GEOSWRITERREADER_H
28 
29 // STL
30 #include <string>
31 #include <vector>
32 
33 // cppUnit
34 #include <cppunit/extensions/HelperMacros.h>
35 
36 /*!
37  \class TsGEOSWriterReader
38 
39  \brief Test suite for the GEOSWriter and GEOSReader class.
40 
41  This test suite will check the following:
42  <ul>
43  <li>The convertion of a TerraLib geometry to a GEOS geometry;</li>
44  <li>Official OGC WKB reading/writing;</li>
45  <li>Spatial Operators;</li>
46  <li>The convertion of a GEOS geometry to a Terralib geometry;</li>
47  </ul>
48  */
49 class TsGEOSWriterReader : public CPPUNIT_NS::TestFixture
50 {
51 // It registers this class as a Test Suit
53 
54 // It registers the class methods as Test Cases belonging to the suit
58 
59  //CPPUNIT_TEST( tcCreateGeometriesAndApplyReadTests );
60 
62 
63  public:
64 
65 // It sets up context before running the test.
66  void setUp();
67 
68 // It cleann up after the test run.
69  void tearDown();
70 
71  protected:
72 
73 // Test Cases:
74 
75  /*! \brief Test Case: Creating basic Geom and apply read test. */
77 
78  /*! \brief Test Case: Creating POINTS Geom from WKT and apply GEOS Write and Read test. */
80 
81  /*! \brief Test Case: Creating LINES Geom from WKT and apply GEOS Write and Read test. */
83 
84  /*! \brief Test Case: Creating POLYGONS Geom from WKT and apply GEOS Write and Read test. */
86 
87  /*! \brief Test Case: Creating PPLYGONS Geom from WKT and apply GEOS Write and Read test. */
89 
90  private:
91 
92  /* Auxiliary data structure when testing geometry basic methods */
93  struct WKBEntry
94  {
95  std::string m_hwkb; //!<
96  int m_srid; //!<
97  std::string m_geomType; //!<
98  int m_dimensonality; //!<
99  int m_ndims; //!<
100  std::string m_wkt; //!<
101  int m_geomTypeId; //!<
102  bool m_is3D; //!<
103  bool m_isMeasured; //!<
104  };
105 
106  /*!
107  \brief Auxiliary method for reading geometry information from an ASCII file.
108 
109  \param hwkbVec An output vector with geometry information.
110  */
111  void loadGeometry(std::vector<WKBEntry>& hwkbVec) const;
112  void loadWKT(std::vector<std::string>& geom_wkt) const;
113  void loadWKT(std::string filewkt, std::vector<std::string>& geom_wkt) const;
114 
115 };
116 
117 #endif // __TERRALIB_UNITTEST_GEOMETRY_INTERNAL_GEOSWRITERREADER_H
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.
CPPUNIT_TEST_SUITE(TsGEOSWriterReader)
void tcCreateLinesFromWKTAndApplyGEOSTests()
Test Case: Creating LINES Geom from WKT and apply GEOS Write and Read test.
CPPUNIT_TEST(tcCreatePointsFromWKTAndApplyGEOSTests)
void loadGeometry(std::vector< WKBEntry > &hwkbVec) const
Auxiliary method for reading geometry information from an ASCII file.
void tcCreatePolygonFromWKTAndApplyGEOSTests()
Test Case: Creating POLYGONS Geom from WKT and apply GEOS Write and Read test.
void tcCreatePointsFromWKTAndApplyGEOSTests()
Test Case: Creating POINTS Geom from WKT and apply GEOS Write and Read test.