Isis 3 Developer Reference
GisTopology.h
Go to the documentation of this file.
1 #ifndef GisTopology_h
2 #define GisTopology_h
3 
27 // geos library for types GEOSGeometry, GEOSPreparedGeometry, GEOSCoordSequence,
28 // GEOSWKTReader, GEOSWKTWriter, GEOSWKBReader, GEOSWKBWriter
29 #include <geos_c.h>
30 
31 class QString;
32 
33 namespace Isis {
34 
51  class GisTopology {
52  public:
53 
57  enum Disposition {
60  };
61 
62  static GisTopology *instance();
63 
64  GEOSGeometry *geomFromWKB(const QString &wkb);
65  GEOSGeometry *geomFromWKT(const QString &wkt);
66  GEOSGeometry *clone(const GEOSGeometry *geom) const;
67  const GEOSPreparedGeometry *preparedGeometry(const GEOSGeometry *geom) const;
68 
69 
70  QString wkb(const GEOSGeometry *geom,
71  const Disposition &disp = PreserveGeometry);
72  QString wkt(const GEOSGeometry *geom,
73  const Disposition &disp = PreserveGeometry);
74 
75  void destroy(GEOSGeometry *geom) const;
76  void destroy(const GEOSGeometry *geom) const;
77  void destroy(const GEOSPreparedGeometry *ppgeom) const;
78  void destroy(GEOSCoordSequence *sequence) const;
79  void destroy(const unsigned char *geos_text) const;
80  void destroy(const char *geos_text) const;
81 
82  private:
83  GisTopology();
84  ~GisTopology();
85 
86  static void dieAtExit();
87 
88  void initialize();
89 
90  // Initialize and shut down GEOS C API
91  void geosInit();
92  void geosFinish();
93 
94  static void notice(const char *fmt, ...);
95  static void error(const char *fmt, ...);
96 
97  // Reader/Writer allocations
98  GEOSWKTReader *wktReader();
99  GEOSWKTWriter *wktWriter();
100 
101  GEOSWKBReader *wkbReader();
102  GEOSWKBWriter *wkbWriter();
103 
104  static GisTopology *m_gisfactory;
105  GEOSWKTReader *m_WKTreader;
106  GEOSWKTWriter *m_WKTwriter;
107  GEOSWKBReader *m_WKBreader;
108  GEOSWKBWriter *m_WKBwriter;
109 
110  };
111 
112 } // namespace Isis
113 
114 #endif
115 
116 
Preserve the geometry.
Definition: GisTopology.h:59
GEOSGeometry * geomFromWKB(const QString &wkb)
Reads in the geometry from the given well-known binary formatted string.
Definition: GisTopology.cpp:117
GEOSGeometry * geomFromWKT(const QString &wkt)
Reads in the geometry from the given well-known text formatted string.
Definition: GisTopology.cpp:145
Destroy the geometry.
Definition: GisTopology.h:58
QString wkb(const GEOSGeometry *geom, const Disposition &disp=PreserveGeometry)
Writes a well-known binary string from the given geometry.
Definition: GisTopology.cpp:229
QString wkt(const GEOSGeometry *geom, const Disposition &disp=PreserveGeometry)
Writes a well-known text string from the given geometry.
Definition: GisTopology.cpp:203
const GEOSPreparedGeometry * preparedGeometry(const GEOSGeometry *geom) const
Gets a GEOSPreparedGeometry from the given GEOSGeometry.
Definition: GisTopology.cpp:180
This class models GIS topology.
Definition: GisTopology.h:51
Disposition
Enumeration to indicate whether the geometry should be preserved.
Definition: GisTopology.h:57
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
GEOSGeometry * clone(const GEOSGeometry *geom) const
Clones the given GEOSGeometry pointer.
Definition: GisTopology.cpp:165
void destroy(GEOSGeometry *geom) const
Destroys the given GEOS geometry.
Definition: GisTopology.cpp:249
static GisTopology * instance()
Gets the singleton instance of this class.
Definition: GisTopology.cpp:100