|
Isis 3 Programmer Reference
|
7 #include "GisTopology.h"
14 #include <QCoreApplication>
21 #include "IException.h"
31 GisTopology *GisTopology::m_gisfactory = 0;
39 GisTopology::GisTopology() : m_WKTreader(0), m_WKTwriter(0),
40 m_WKBreader(0), m_WKBwriter(0) {
102 QByteArray wkb_data =
wkb.toLatin1();
103 const unsigned char *footy =
reinterpret_cast<const unsigned char *
> (wkb_data.data());
104 GEOSGeometry *geom = GEOSWKBReader_readHEX(
wkbReader(), footy,
wkb.size());
106 GEOSGeometry *geom = GEOSWKBReader_readHEX(
wkbReader(),
107 reinterpret_cast<const unsigned char *
> (
wkb.toLatin1().data()),
111 QString mess =
"Unable convert the given WKB string [" +
wkb +
"] to a GEOSGeometry";
129 QByteArray wkt_data =
wkt.toLatin1();
130 const char *footy = wkt_data.data();
131 GEOSGeometry *geom = GEOSWKTReader_read(
wktReader(), footy);
133 QString mess =
"Unable convert the given WKT string [" +
wkt +
"] to a GEOSGeometry";
149 if (!geom)
return (0);
150 return (GEOSGeom_clone(geom));
164 const GEOSPreparedGeometry *ppgeom = GEOSPrepare(geom);
167 "Unable convert the given GEOSGeometry to a GEOSPreparedGeometry",
188 char *wkt_h = GEOSWKTWriter_write(
wktWriter(), geom);
189 QString thegeom = QString::fromLatin1(
reinterpret_cast<const char *
> (wkt_h));
215 unsigned char *wkt_h = GEOSWKBWriter_writeHEX(
wkbWriter(), geom, &length);
216 QString thegeom = QString::fromLatin1(
reinterpret_cast<const char *
> (wkt_h), length);
234 GEOSGeom_destroy(geom);
247 destroy(
const_cast<GEOSGeometry *
> (geom));
260 GEOSPreparedGeom_destroy(geom);
273 GEOSCoordSeq_destroy(sequence);
286 GEOSFree(
const_cast<char *
> (geos_text));
299 GEOSFree(
const_cast<unsigned char *
> (geos_text));
333 vsprintf(buffer, fmt, ap);
350 vsprintf(buffer, fmt, ap);
const GEOSPreparedGeometry * preparedGeometry(const GEOSGeometry *geom) const
Gets a GEOSPreparedGeometry from the given GEOSGeometry.
static void dieAtExit()
Exit termination routine.
GEOSWKTReader * m_WKTreader
A GEOS library parser for well-known text format.
This class models GIS topology.
GEOSWKBReader * wkbReader()
Accessor for the GEOS well-known binary reader.
GEOSWKTWriter * wktWriter()
Accessor for the GEOS well-known text writer.
static void notice(const char *fmt,...)
A static method for handling errors.
@ DestroyGeometry
Destroy the geometry.
GEOSGeometry * clone(const GEOSGeometry *geom) const
Clones the given GEOSGeometry pointer.
Disposition
Enumeration to indicate whether the geometry should be preserved.
GEOSWKTReader * wktReader()
Accessor for the GEOS well-known text reader.
GEOSGeometry * geomFromWKT(const QString &wkt)
Reads in the geometry from the given well-known text formatted string.
static GisTopology * instance()
Gets the singleton instance of this class.
GEOSGeometry * geomFromWKB(const QString &wkb)
Reads in the geometry from the given well-known binary formatted string.
void destroy(GEOSGeometry *geom) const
Destroys the given GEOS geometry.
~GisTopology()
Destroy the GisTopology object.
static GisTopology * m_gisfactory
A static member variable representing the GIS factory.
GEOSWKBWriter * m_WKBwriter
A GEOS library writer for well-known binary format.
GEOSWKTWriter * m_WKTwriter
A GEOS library writer for well-known text format.
@ Programmer
This error is for when a programmer made an API call that was illegal.
Namespace for the standard library.
GEOSWKBWriter * wkbWriter()
Accessor for the GEOS well-known binary writer.
static void error(const char *fmt,...)
A static method for handling errors.
GisTopology()
Private default constructor so that this class is only instatiated through the instance() method.
QString wkt(const GEOSGeometry *geom, const Disposition &disp=PreserveGeometry)
Writes a well-known text string from the given geometry.
void geosInit()
Initializes the GEOS C API.
void geosFinish()
Shuts down the GEOS C API.
This is free and unencumbered software released into the public domain.
GEOSWKBReader * m_WKBreader
A GEOS library parser for well-known binary format.
QString wkb(const GEOSGeometry *geom, const Disposition &disp=PreserveGeometry)
Writes a well-known binary string from the given geometry.