TsGeometry.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 TsGeometry.h
22 
23  \brief Test suite for the Vector Geometry Model.
24  */
25 
26 #ifndef __TERRALIB_UNITTEST_GEOMETRY_INTERNAL_GEOMETRY_H
27 #define __TERRALIB_UNITTEST_GEOMETRY_INTERNAL_GEOMETRY_H
28 
29 // STL
30 #include <string>
31 #include <vector>
32 
33 // cppUnit
34 #include <cppunit/extensions/HelperMacros.h>
35 
36 /*!
37  \class TsGeometry
38 
39  \brief Test suite for the Vector Geometry Model.
40 
41  This test suite will check the following:
42  <ul>
43  <li>PostGIS Extended-WKB reading and writing;</li>
44  <li>Official OGC WKB reading/writing;</li>
45  <li>Spatial Operators;</li>
46  <li>Re-projection (transformation of SRS);</li>
47  </ul>
48  */
49 class TsGeometry : 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
65  //CPPUNIT_TEST( tcCreatePolygonZ );
66  //CPPUNIT_TEST( tcCreatePolygonM );
67  //CPPUNIT_TEST( tcCreatePolygonZM );
72 
74 
75  public:
76 
77 // It sets up context before running the test.
78  void setUp();
79 
80 // It cleann up after the test run.
81  void tearDown();
82 
83  protected:
84 
85 // Test Cases:
86 
87  /*! \brief Test Case: Creating several type of objects and testing some basic methods. */
88  void tcMisc();
89 
90  /*! \brief Test Case: Creating a point object. */
91  void tcCreatePoint();
92 
93  /*! \brief Test Case: Creating a point with z value. */
94  void tcCreatePointZ();
95 
96  /*! \brief Test Case: Creating a point with m value. */
97  void tcCreatePointM();
98 
99  /*! \brief Test Case: Creating a point with z and m value. */
100  void tcCreatePointZM();
101 
102  /*! \brief Test Case: Creating a linestring object. */
103  void tcCreateLineString();
104 
105  /*! \brief Test Case: Creating a linestring with z value. */
106  void tcCreateLineStringZ();
107 
108  /*! \brief Test Case: Creating a linestring with m value. */
109  void tcCreateLineStringM();
110 
111  /*! \brief Test Case: Creating a linestring with z and m value. */
112  void tcCreateLineStringZM();
113 
114  /*! \brief Test Case: Creating a polygon. */
115  void tcCreatePolygon();
116 
117  /*! \brief Test Case: Creating a polygon with Z values. */
118  void tcCreatePolygonZ();
119 
120  /*! \brief Test Case: Creating a polygon with M values. */
121  void tcCreatePolygonM();
122 
123  /*! \brief Test Case: Creating a polygon with ZM values. */
124  void tcCreatePolygonZM();
125 
126  /*! \brief Test Case: Reading (binary) geometries and getting the WKT. */
127  void tcAsText();
128 
129  /*! \brief Test Case: Reading WKT geometries and conveting to another proj SRID. */
130  void tcTransform();
131 
132  /*! \brief Test Case: testing the basic geometry methods. */
133  void tcBasicGeometryMethods();
134 
135  /*! \brief Test Case: testing the basic geometry methods. */
137 
138  private:
139 
140  /* Auxiliary data structure when testing geometry basic methods */
141  struct WKBEntry
142  {
143  std::string m_hwkb; //!<
144  int m_srid; //!<
145  std::string m_geomType; //!<
146  int m_dimensonality; //!<
147  int m_ndims; //!<
148  std::string m_wkt; //!<
149  int m_geomTypeId; //!<
150  bool m_is3D; //!<
151  bool m_isMeasured; //!<
152  };
153 
154  /*!
155  \brief Auxiliary method for reading geometry information from an ASCII file.
156 
157  \param hwkbVec An output vector with geometry information.
158  */
159  void loadGeometry(std::vector<WKBEntry>& hwkbVec) const;
160 
161 };
162 
163 #endif // __TERRALIB_UNITTEST_GEOMETRY_INTERNAL_GEOMETRY_H
164 
void tcCreatePolygon()
Test Case: Creating a polygon.
void tcCreatePoint()
Test Case: Creating a point object.
Definition: TsGeometry.cpp:492
std::string m_geomType
Definition: TsGeometry.h:145
void loadGeometry(std::vector< WKBEntry > &hwkbVec) const
Auxiliary method for reading geometry information from an ASCII file.
void tcCreatePolygonZM()
Test Case: Creating a polygon with ZM values.
void tcCreateLineStringZM()
Test Case: Creating a linestring with z and m value.
void tcCreatePolygonZ()
Test Case: Creating a polygon with Z values.
void tcCreateLineStringM()
Test Case: Creating a linestring with m value.
Definition: TsGeometry.cpp:981
CPPUNIT_TEST(tcMisc)
void tcCreatePointZ()
Test Case: Creating a point with z value.
Definition: TsGeometry.cpp:569
Test suite for the Vector Geometry Model.
Definition: TsGeometry.h:49
CPPUNIT_TEST_SUITE_END()
void tcBasicGeometryMethods()
Test Case: testing the basic geometry methods.
void tcCreatePointM()
Test Case: Creating a point with m value.
Definition: TsGeometry.cpp:650
CPPUNIT_TEST_SUITE(TsGeometry)
void setUp()
Definition: TsGeometry.cpp:39
void tcMisc()
Test Case: Creating several type of objects and testing some basic methods.
Definition: TsGeometry.cpp:47
void tcCreatePointZM()
Test Case: Creating a point with z and m value.
Definition: TsGeometry.cpp:731
void tcCreatePolygonM()
Test Case: Creating a polygon with M values.
std::string m_hwkb
Definition: TsGeometry.h:143
void tcAsText()
Test Case: Reading (binary) geometries and getting the WKT.
void tcSpatialRelationsMethods()
Test Case: testing the basic geometry methods.
void tcCreateLineStringZ()
Test Case: Creating a linestring with z value.
Definition: TsGeometry.cpp:895
std::string m_wkt
Definition: TsGeometry.h:148
void tearDown()
Definition: TsGeometry.cpp:43
void tcTransform()
Test Case: Reading WKT geometries and conveting to another proj SRID.
void tcCreateLineString()
Test Case: Creating a linestring object.
Definition: TsGeometry.cpp:813