Isis Developer Reference
GisTopology.h
Go to the documentation of this file.
1 #ifndef GisTopology_h
2 #define GisTopology_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
9 
10 // geos library for types GEOSGeometry, GEOSPreparedGeometry, GEOSCoordSequence,
11 // GEOSWKTReader, GEOSWKTWriter, GEOSWKBReader, GEOSWKBWriter
12 #include <geos_c.h>
13 
14 class QString;
15 
16 namespace Isis {
17 
34  class GisTopology {
35  public:
36 
40  enum Disposition {
43  };
44 
45  static GisTopology *instance();
46 
47  GEOSGeometry *geomFromWKB(const QString &wkb);
48  GEOSGeometry *geomFromWKT(const QString &wkt);
49  GEOSGeometry *clone(const GEOSGeometry *geom) const;
50  const GEOSPreparedGeometry *preparedGeometry(const GEOSGeometry *geom) const;
51 
52 
53  QString wkb(const GEOSGeometry *geom,
54  const Disposition &disp = PreserveGeometry);
55  QString wkt(const GEOSGeometry *geom,
56  const Disposition &disp = PreserveGeometry);
57 
58  void destroy(GEOSGeometry *geom) const;
59  void destroy(const GEOSGeometry *geom) const;
60  void destroy(const GEOSPreparedGeometry *ppgeom) const;
61  void destroy(GEOSCoordSequence *sequence) const;
62  void destroy(const unsigned char *geos_text) const;
63  void destroy(const char *geos_text) const;
64 
65  private:
66  GisTopology();
67  ~GisTopology();
68 
69  static void dieAtExit();
70 
71  void initialize();
72 
73  // Initialize and shut down GEOS C API
74  void geosInit();
75  void geosFinish();
76 
77  static void notice(const char *fmt, ...);
78  static void error(const char *fmt, ...);
79 
80  // Reader/Writer allocations
81  GEOSWKTReader *wktReader();
82  GEOSWKTWriter *wktWriter();
83 
84  GEOSWKBReader *wkbReader();
85  GEOSWKBWriter *wkbWriter();
86 
87  static GisTopology *m_gisfactory;
88  GEOSWKTReader *m_WKTreader;
89  GEOSWKTWriter *m_WKTwriter;
90  GEOSWKBReader *m_WKBreader;
91  GEOSWKBWriter *m_WKBwriter;
92 
93  };
94 
95 } // namespace Isis
96 
97 #endif
98 
99 
Isis::GisTopology::preparedGeometry
const GEOSPreparedGeometry * preparedGeometry(const GEOSGeometry *geom) const
Gets a GEOSPreparedGeometry from the given GEOSGeometry.
Definition: GisTopology.cpp:163
Isis::GisTopology
This class models GIS topology.
Definition: GisTopology.h:34
GisTopology.h
Isis::GisTopology::DestroyGeometry
@ DestroyGeometry
Destroy the geometry.
Definition: GisTopology.h:41
Isis::GisTopology::PreserveGeometry
@ PreserveGeometry
Preserve the geometry.
Definition: GisTopology.h:42
Isis::GisTopology::clone
GEOSGeometry * clone(const GEOSGeometry *geom) const
Clones the given GEOSGeometry pointer.
Definition: GisTopology.cpp:148
Isis::GisTopology::Disposition
Disposition
Enumeration to indicate whether the geometry should be preserved.
Definition: GisTopology.h:40
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
Isis::GisTopology::geomFromWKT
GEOSGeometry * geomFromWKT(const QString &wkt)
Reads in the geometry from the given well-known text formatted string.
Definition: GisTopology.cpp:128
Isis::GisTopology::instance
static GisTopology * instance()
Gets the singleton instance of this class.
Definition: GisTopology.cpp:83
Isis::GisTopology::geomFromWKB
GEOSGeometry * geomFromWKB(const QString &wkb)
Reads in the geometry from the given well-known binary formatted string.
Definition: GisTopology.cpp:100
Isis::GisTopology::destroy
void destroy(GEOSGeometry *geom) const
Destroys the given GEOS geometry.
Definition: GisTopology.cpp:232
Isis::IException
Isis exception class.
Definition: IException.h:91
IException.h
std
Namespace for the standard library.
Isis::GisTopology::wkt
QString wkt(const GEOSGeometry *geom, const Disposition &disp=PreserveGeometry)
Writes a well-known text string from the given geometry.
Definition: GisTopology.cpp:186
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::GisTopology::wkb
QString wkb(const GEOSGeometry *geom, const Disposition &disp=PreserveGeometry)
Writes a well-known binary string from the given geometry.
Definition: GisTopology.cpp:212