Isis 3 Programmer Reference
|
This class models GIS topology. More...
#include <GisTopology.h>
Public Types | |
enum | Disposition { DestroyGeometry , PreserveGeometry } |
Enumeration to indicate whether the geometry should be preserved. More... | |
Public Member Functions | |
GEOSGeometry * | geomFromWKB (const QString &wkb) |
Reads in the geometry from the given well-known binary formatted string. | |
GEOSGeometry * | geomFromWKT (const QString &wkt) |
Reads in the geometry from the given well-known text formatted string. | |
GEOSGeometry * | clone (const GEOSGeometry *geom) const |
Clones the given GEOSGeometry pointer. | |
const GEOSPreparedGeometry * | preparedGeometry (const GEOSGeometry *geom) const |
Gets a GEOSPreparedGeometry from the given GEOSGeometry. | |
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. | |
void | destroy (GEOSGeometry *geom) const |
Destroys the given GEOS geometry. | |
void | destroy (const GEOSGeometry *geom) const |
Destroys the given GEOS geometry. | |
void | destroy (const GEOSPreparedGeometry *ppgeom) const |
Destroys the given prepared GEOS geometry. | |
void | destroy (GEOSCoordSequence *sequence) const |
Destroys the given GEOS coordinate sequence. | |
void | destroy (const unsigned char *geos_text) const |
Destroys the given unsigned GEOS text geometry representation. | |
void | destroy (const char *geos_text) const |
Destroys the given GEOS text geometry representation. | |
Static Public Member Functions | |
static GisTopology * | instance () |
Gets the singleton instance of this class. | |
Private Member Functions | |
GisTopology () | |
Private default constructor so that this class is only instatiated through the instance() method. | |
~GisTopology () | |
Destroy the GisTopology object. | |
void | initialize () |
void | geosInit () |
Initializes the GEOS C API. | |
void | geosFinish () |
Shuts down the GEOS C API. | |
GEOSWKTReader * | wktReader () |
Accessor for the GEOS well-known text reader. | |
GEOSWKTWriter * | wktWriter () |
Accessor for the GEOS well-known text writer. | |
GEOSWKBReader * | wkbReader () |
Accessor for the GEOS well-known binary reader. | |
GEOSWKBWriter * | wkbWriter () |
Accessor for the GEOS well-known binary writer. | |
Static Private Member Functions | |
static void | dieAtExit () |
Exit termination routine. | |
static void | notice (const char *fmt,...) |
A static method for handling errors. | |
static void | error (const char *fmt,...) |
A static method for handling errors. | |
Private Attributes | |
GEOSWKTReader * | m_WKTreader |
A GEOS library parser for well-known text format. | |
GEOSWKTWriter * | m_WKTwriter |
A GEOS library writer for well-known text format. | |
GEOSWKBReader * | m_WKBreader |
A GEOS library parser for well-known binary format. | |
GEOSWKBWriter * | m_WKBwriter |
A GEOS library writer for well-known binary format. | |
Static Private Attributes | |
static GisTopology * | m_gisfactory = 0 |
A static member variable representing the GIS factory. | |
This class models GIS topology.
This class allows us to create GEOS geometries from well-known binary (WKB) strings or well-known text (WKT) strings. It also allows us to create WKB or WKT strings from a GEOS geometry.
2012-07-15 Kris Becker - Original version.
2015-03-18 Jeannie Backer - Brought class files closer to ISIS coding standards.
2015-03-23 Jeannie Backer - Improved documentation.
2015-04-22 Jeannie Backer - Fixed typo "wkb" where it should have been "wkt".
2016-03-02 Ian Humphrey - Updated for coding standards compliance, fixed minor documentation issues, and added to jwbacker's unit test in preparation for adding this class to ISIS. Fixes #2398.
Definition at line 34 of file GisTopology.h.
Enumeration to indicate whether the geometry should be preserved.
Enumerator | |
---|---|
DestroyGeometry | Destroy the geometry. |
PreserveGeometry | Preserve the geometry. |
Definition at line 40 of file GisTopology.h.
|
private |
Private default constructor so that this class is only instatiated through the instance() method.
This ensures that only a singleton object is constructed. The GEOS readers/writers are set to null and the GEOS C API is initialized.
Definition at line 39 of file GisTopology.cpp.
References dieAtExit(), and geosInit().
Referenced by instance().
|
private |
Destroy the GisTopology object.
The GEOS readers/writers are destroyed and set to null and the GEOS C API is shut down.
Definition at line 52 of file GisTopology.cpp.
References geosFinish(), m_WKBreader, m_WKBwriter, m_WKTreader, and m_WKTwriter.
GEOSGeometry * Isis::GisTopology::clone | ( | const GEOSGeometry * | geom | ) | const |
Clones the given GEOSGeometry pointer.
geom | A pointer to the GEOSGeometry object to be cloned. |
Definition at line 148 of file GisTopology.cpp.
void Isis::GisTopology::destroy | ( | const char * | geos_text | ) | const |
Destroys the given GEOS text geometry representation.
geos_text | A pointer to the GEOS text char to be destroyed. |
Definition at line 284 of file GisTopology.cpp.
void Isis::GisTopology::destroy | ( | const GEOSGeometry * | geom | ) | const |
Destroys the given GEOS geometry.
geom | A pointer to the GEOSGeometry to be destroyed. |
Definition at line 245 of file GisTopology.cpp.
References destroy().
void Isis::GisTopology::destroy | ( | const GEOSPreparedGeometry * | geom | ) | const |
Destroys the given prepared GEOS geometry.
geom | A pointer to the GEOSPreparedGeometry to be destroyed. |
Definition at line 258 of file GisTopology.cpp.
void Isis::GisTopology::destroy | ( | const unsigned char * | geos_text | ) | const |
Destroys the given unsigned GEOS text geometry representation.
geos_text | A pointer to the GEOS text char to be destroyed. |
Definition at line 297 of file GisTopology.cpp.
void Isis::GisTopology::destroy | ( | GEOSCoordSequence * | sequence | ) | const |
Destroys the given GEOS coordinate sequence.
sequence | A pointer to the GEOSCoordSequence to be destroyed. |
Definition at line 271 of file GisTopology.cpp.
void Isis::GisTopology::destroy | ( | GEOSGeometry * | geom | ) | const |
Destroys the given GEOS geometry.
geom | A pointer to the GEOSGeometry to be destroyed. |
Definition at line 232 of file GisTopology.cpp.
|
staticprivate |
Exit termination routine.
This (static) method ensures that this object is destroyed when Qt exits.
Note that this should not be added to the system _atexit() routine because this object utilizes Qt classes. At the time the atexit call stack is executed, Qt is long gone resulting in Very Bad Things. Fortunately, Qt has an exit stack function as well. This method is added to the Qt exit call stack.
Definition at line 423 of file GisTopology.cpp.
References m_gisfactory.
Referenced by GisTopology().
|
staticprivate |
A static method for handling errors.
fmt |
IException::Programmer |
Definition at line 346 of file GisTopology.cpp.
References Isis::IException::Programmer.
Referenced by geosInit().
GEOSGeometry * Isis::GisTopology::geomFromWKB | ( | const QString & | wkb | ) |
Reads in the geometry from the given well-known binary formatted string.
wkb | The well-known binary formatted string containing the geometry information to be parsed. |
IException::Programmer | "Unable convert the given well-known binary to a GEOSGeometry. |
Definition at line 100 of file GisTopology.cpp.
References Isis::IException::Programmer, wkb(), and wkbReader().
GEOSGeometry * Isis::GisTopology::geomFromWKT | ( | const QString & | wkt | ) |
Reads in the geometry from the given well-known text formatted string.
wkt | The well-known text formatted string containing the geometry information to be parsed. |
IException::Programmer | "Unable convert the given well-known text to a GEOSGeometry. |
Definition at line 128 of file GisTopology.cpp.
References Isis::IException::Programmer, wkt(), and wktReader().
|
private |
Shuts down the GEOS C API.
Definition at line 317 of file GisTopology.cpp.
Referenced by ~GisTopology().
|
private |
Initializes the GEOS C API.
Definition at line 308 of file GisTopology.cpp.
References error(), and notice().
Referenced by GisTopology().
|
static |
Gets the singleton instance of this class.
If it has not been instantiated yet, the default constructor is called.
Definition at line 83 of file GisTopology.cpp.
References GisTopology(), and m_gisfactory.
Referenced by Isis::GisGeometry::centroid(), Isis::GisGeometry::clone(), Isis::GisGeometry::destroy(), Isis::GisGeometry::fromCube(), Isis::GisGeometry::GisGeometry(), Isis::GisGeometry::GisGeometry(), Isis::GisGeometry::GisGeometry(), Isis::GisGeometry::GisGeometry(), Isis::GisGeometry::GisGeometry(), Isis::GisGeometry::GisGeometry(), Isis::GisGeometry::isValidReason(), Isis::GisGeometry::makePrepared(), and Isis::GisGeometry::operator=().
|
staticprivate |
A static method for handling errors.
fmt |
IException::Programmer |
Definition at line 329 of file GisTopology.cpp.
References Isis::IException::Programmer.
Referenced by geosInit().
const GEOSPreparedGeometry * Isis::GisTopology::preparedGeometry | ( | const GEOSGeometry * | geom | ) | const |
Gets a GEOSPreparedGeometry from the given GEOSGeometry.
geom | A pointer to a GEOSGeometry object to be converted. |
IException::Programmer | "Unable to convert the given GEOSGeometry to a GEOSPreparedGeometry." |
Definition at line 163 of file GisTopology.cpp.
References Isis::IException::Programmer.
QString Isis::GisTopology::wkb | ( | const GEOSGeometry * | geom, |
const Disposition & | disp = PreserveGeometry ) |
Writes a well-known binary string from the given geometry.
This method will destroy the given GEOSGeometry pointer if so indicated by the given Disposition enumeration.
geom | A pointer to the geometry to be represented as a WKT string |
disp | A reference to a topology disposition enumeration indicating whether to preserve or destroy the passed in geometry. |
Definition at line 212 of file GisTopology.cpp.
References destroy(), DestroyGeometry, and wkbWriter().
Referenced by geomFromWKB().
|
private |
Accessor for the GEOS well-known binary reader.
This method creates the reader if it doesn't exist.
Definition at line 391 of file GisTopology.cpp.
References m_WKBreader.
Referenced by geomFromWKB().
|
private |
Accessor for the GEOS well-known binary writer.
This method creates the writer if it doesn't exist.
Definition at line 405 of file GisTopology.cpp.
References m_WKBwriter.
Referenced by wkb().
QString Isis::GisTopology::wkt | ( | const GEOSGeometry * | geom, |
const Disposition & | disp = PreserveGeometry ) |
Writes a well-known text string from the given geometry.
This method will destroy the given GEOSGeometry pointer if so indicated by the given Disposition enumeration.
geom | A pointer to the geometry to be represented as a WKT string |
disp | A reference to a topology disposition enumeration indicating whether to preserve or destroy the passed in geometry. |
Definition at line 186 of file GisTopology.cpp.
References destroy(), DestroyGeometry, and wktWriter().
Referenced by geomFromWKT().
|
private |
Accessor for the GEOS well-known text reader.
This method creates the reader if it doesn't exist.
Definition at line 362 of file GisTopology.cpp.
References m_WKTreader.
Referenced by geomFromWKT().
|
private |
Accessor for the GEOS well-known text writer.
This method creates the writer if it doesn't exist.
Definition at line 376 of file GisTopology.cpp.
References m_WKTwriter.
Referenced by wkt().
|
staticprivate |
A static member variable representing the GIS factory.
A static instance of the GIS topology class.
It is initialized to NULL and instantiated when the instance() method is called.
Definition at line 87 of file GisTopology.h.
Referenced by dieAtExit(), and instance().
|
private |
A GEOS library parser for well-known binary format.
Definition at line 90 of file GisTopology.h.
Referenced by wkbReader(), and ~GisTopology().
|
private |
A GEOS library writer for well-known binary format.
Definition at line 91 of file GisTopology.h.
Referenced by wkbWriter(), and ~GisTopology().
|
private |
A GEOS library parser for well-known text format.
Definition at line 88 of file GisTopology.h.
Referenced by wktReader(), and ~GisTopology().
|
private |
A GEOS library writer for well-known text format.
Definition at line 89 of file GisTopology.h.
Referenced by wktWriter(), and ~GisTopology().