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. More... | |
GEOSGeometry * | geomFromWKT (const QString &wkt) |
Reads in the geometry from the given well-known text formatted string. More... | |
GEOSGeometry * | clone (const GEOSGeometry *geom) const |
Clones the given GEOSGeometry pointer. More... | |
const GEOSPreparedGeometry * | preparedGeometry (const GEOSGeometry *geom) const |
Gets a GEOSPreparedGeometry from the given GEOSGeometry. More... | |
QString | wkb (const GEOSGeometry *geom, const Disposition &disp=PreserveGeometry) |
Writes a well-known binary string from the given geometry. More... | |
QString | wkt (const GEOSGeometry *geom, const Disposition &disp=PreserveGeometry) |
Writes a well-known text string from the given geometry. More... | |
void | destroy (GEOSGeometry *geom) const |
Destroys the given GEOS geometry. More... | |
void | destroy (const GEOSGeometry *geom) const |
Destroys the given GEOS geometry. More... | |
void | destroy (const GEOSPreparedGeometry *ppgeom) const |
Destroys the given prepared GEOS geometry. More... | |
void | destroy (GEOSCoordSequence *sequence) const |
Destroys the given GEOS coordinate sequence. More... | |
void | destroy (const unsigned char *geos_text) const |
Destroys the given unsigned GEOS text geometry representation. More... | |
void | destroy (const char *geos_text) const |
Destroys the given GEOS text geometry representation. More... | |
Static Public Member Functions | |
static GisTopology * | instance () |
Gets the singleton instance of this class. More... | |
Private Member Functions | |
GisTopology () | |
Private default constructor so that this class is only instatiated through the instance() method. More... | |
~GisTopology () | |
Destroy the GisTopology object. More... | |
void | initialize () |
void | geosInit () |
Initializes the GEOS C API. More... | |
void | geosFinish () |
Shuts down the GEOS C API. More... | |
GEOSWKTReader * | wktReader () |
Accessor for the GEOS well-known text reader. More... | |
GEOSWKTWriter * | wktWriter () |
Accessor for the GEOS well-known text writer. More... | |
GEOSWKBReader * | wkbReader () |
Accessor for the GEOS well-known binary reader. More... | |
GEOSWKBWriter * | wkbWriter () |
Accessor for the GEOS well-known binary writer. More... | |
Static Private Member Functions | |
static void | dieAtExit () |
Exit termination routine. More... | |
static void | notice (const char *fmt,...) |
A static method for handling errors. More... | |
static void | error (const char *fmt,...) |
A static method for handling errors. More... | |
Private Attributes | |
GEOSWKTReader * | m_WKTreader |
A GEOS library parser for well-known text format. More... | |
GEOSWKTWriter * | m_WKTwriter |
A GEOS library writer for well-known text format. More... | |
GEOSWKBReader * | m_WKBreader |
A GEOS library parser for well-known binary format. More... | |
GEOSWKBWriter * | m_WKBwriter |
A GEOS library writer for well-known binary format. More... | |
Static Private Attributes | |
static GisTopology * | m_gisfactory = 0 |
A static member variable representing the GIS factory. More... | |
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 51 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 57 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 56 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 69 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 165 of file GisTopology.cpp.
Referenced by Isis::GisGeometry::clone(), Isis::GisGeometry::GisGeometry(), and Isis::GisGeometry::operator=().
void Isis::GisTopology::destroy | ( | GEOSGeometry * | geom | ) | const |
Destroys the given GEOS geometry.
geom | A pointer to the GEOSGeometry to be destroyed. |
Definition at line 249 of file GisTopology.cpp.
Referenced by Isis::GisGeometry::centroid(), destroy(), Isis::GisGeometry::destroy(), Isis::GisGeometry::isValidReason(), wkb(), and wkt().
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 262 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 275 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 288 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 314 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 301 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 439 of file GisTopology.cpp.
References m_gisfactory.
Referenced by GisTopology().
|
staticprivate |
A static method for handling errors.
fmt |
IException::Programmer |
Definition at line 363 of file GisTopology.cpp.
References _FILEINFO_, and 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 117 of file GisTopology.cpp.
References _FILEINFO_, Isis::IException::Programmer, wkb(), and wkbReader().
Referenced by Isis::GisGeometry::GisGeometry().
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 145 of file GisTopology.cpp.
References _FILEINFO_, Isis::IException::Programmer, wkt(), and wktReader().
Referenced by Isis::GisGeometry::fromCube(), and Isis::GisGeometry::GisGeometry().
|
private |
Shuts down the GEOS C API.
Definition at line 334 of file GisTopology.cpp.
Referenced by ~GisTopology().
|
private |
Initializes the GEOS C API.
Definition at line 325 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 100 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::isValidReason(), Isis::GisGeometry::makePrepared(), and Isis::GisGeometry::operator=().
|
staticprivate |
A static method for handling errors.
fmt |
IException::Programmer |
Definition at line 346 of file GisTopology.cpp.
References _FILEINFO_, and 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 180 of file GisTopology.cpp.
References _FILEINFO_, and Isis::IException::Programmer.
Referenced by Isis::GisGeometry::makePrepared().
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 229 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 407 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 421 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 203 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 379 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 393 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 104 of file GisTopology.h.
Referenced by dieAtExit(), and instance().
|
private |
A GEOS library parser for well-known binary format.
Definition at line 107 of file GisTopology.h.
Referenced by wkbReader(), and ~GisTopology().
|
private |
A GEOS library writer for well-known binary format.
Definition at line 108 of file GisTopology.h.
Referenced by wkbWriter(), and ~GisTopology().
|
private |
A GEOS library parser for well-known text format.
Definition at line 105 of file GisTopology.h.
Referenced by wktReader(), and ~GisTopology().
|
private |
A GEOS library writer for well-known text format.
Definition at line 106 of file GisTopology.h.
Referenced by wktWriter(), and ~GisTopology().