Isis 3 Programmer 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 
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.
GEOSWKBWriter * m_WKBwriter
A GEOS library writer for well-known binary format.
Definition: GisTopology.h:108
GEOSGeometry * geomFromWKT(const QString &wkt)
Reads in the geometry from the given well-known text formatted string.
GEOSWKBWriter * wkbWriter()
Accessor for the GEOS well-known binary writer.
Destroy the geometry.
Definition: GisTopology.h:58
GEOSWKTWriter * m_WKTwriter
A GEOS library writer for well-known text format.
Definition: GisTopology.h:106
static GisTopology * m_gisfactory
A static member variable representing the GIS factory.
Definition: GisTopology.h:104
void geosInit()
Initializes the GEOS C API.
void geosFinish()
Shuts down the GEOS C API.
GisTopology()
Private default constructor so that this class is only instatiated through the instance() method...
Definition: GisTopology.cpp:56
QString wkb(const GEOSGeometry *geom, const Disposition &disp=PreserveGeometry)
Writes a well-known binary string from the given geometry.
QString wkt(const GEOSGeometry *geom, const Disposition &disp=PreserveGeometry)
Writes a well-known text string from the given geometry.
static void error(const char *fmt,...)
A static method for handling errors.
GEOSWKBReader * wkbReader()
Accessor for the GEOS well-known binary reader.
const GEOSPreparedGeometry * preparedGeometry(const GEOSGeometry *geom) const
Gets a GEOSPreparedGeometry from the given GEOSGeometry.
GEOSWKBReader * m_WKBreader
A GEOS library parser for well-known binary format.
Definition: GisTopology.h:107
This class models GIS topology.
Definition: GisTopology.h:51
static void dieAtExit()
Exit termination routine.
GEOSWKTWriter * wktWriter()
Accessor for the GEOS well-known text writer.
static void notice(const char *fmt,...)
A static method for handling errors.
GEOSWKTReader * m_WKTreader
A GEOS library parser for well-known text format.
Definition: GisTopology.h:105
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.
GEOSWKTReader * wktReader()
Accessor for the GEOS well-known text reader.
void destroy(GEOSGeometry *geom) const
Destroys the given GEOS geometry.
~GisTopology()
Destroy the GisTopology object.
Definition: GisTopology.cpp:69
static GisTopology * instance()
Gets the singleton instance of this class.