31 #include <QCoreApplication> 48 GisTopology *GisTopology::m_gisfactory = 0;
56 GisTopology::GisTopology() : m_WKTreader(0), m_WKTwriter(0),
57 m_WKBreader(0), m_WKBwriter(0) {
119 QByteArray wkb_data =
wkb.toLatin1();
120 const unsigned char *footy =
reinterpret_cast<const unsigned char *
> (wkb_data.data());
121 GEOSGeometry *geom = GEOSWKBReader_readHEX(
wkbReader(), footy,
wkb.size());
123 GEOSGeometry *geom = GEOSWKBReader_readHEX(
wkbReader(),
124 reinterpret_cast<const unsigned char *> (
wkb.toLatin1().data()),
128 QString mess =
"Unable convert the given WKB string [" +
wkb +
"] to a GEOSGeometry";
146 QByteArray wkt_data =
wkt.toLatin1();
147 const char *footy = wkt_data.data();
148 GEOSGeometry *geom = GEOSWKTReader_read(
wktReader(), footy);
150 QString mess =
"Unable convert the given WKT string [" +
wkt +
"] to a GEOSGeometry";
166 if (!geom)
return (0);
167 return (GEOSGeom_clone(geom));
181 const GEOSPreparedGeometry *ppgeom = GEOSPrepare(geom);
184 "Unable convert the given GEOSGeometry to a GEOSPreparedGeometry",
205 char *wkt_h = GEOSWKTWriter_write(
wktWriter(), geom);
206 QString thegeom = QString::fromLatin1(reinterpret_cast<const char *> (wkt_h));
232 unsigned char *wkt_h = GEOSWKBWriter_writeHEX(
wkbWriter(), geom, &length);
233 QString thegeom = QString::fromLatin1(reinterpret_cast<const char *> (wkt_h), length);
251 GEOSGeom_destroy(geom);
264 destroy(const_cast<GEOSGeometry *> (geom));
277 GEOSPreparedGeom_destroy(geom);
290 GEOSCoordSeq_destroy(sequence);
303 GEOSFree(const_cast<char *> (geos_text));
316 GEOSFree(const_cast<unsigned char *> (geos_text));
350 vsprintf(buffer, fmt, ap);
367 vsprintf(buffer, fmt, ap);
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.
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.
Namespace for the standard library.
GEOSWKTWriter * m_WKTwriter
A GEOS library writer for well-known text format.
static GisTopology * m_gisfactory
A static member variable representing the GIS factory.
void geosInit()
Initializes the GEOS C API.
void geosFinish()
Shuts down the GEOS C API.
This error is for when a programmer made an API call that was illegal.
GisTopology()
Private default constructor so that this class is only instatiated through the instance() method...
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.
#define _FILEINFO_
Macro for the filename and line number.
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.
This class models GIS topology.
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.
Disposition
Enumeration to indicate whether the geometry should be preserved.
Namespace for ISIS/Bullet specific routines.
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.
static GisTopology * instance()
Gets the singleton instance of this class.