7#include "GisGeometry.h" 
   11#include <QScopedPointer> 
   19#include "IException.h" 
   20#include "ImagePolygon.h" 
   21#include "GisTopology.h" 
   22#include "SpecialPixel.h" 
   51                           m_type(GeosGis), m_geom(0), m_preparedGeom(0){
 
 
   86                           m_type(t), m_geom(0), m_preparedGeom(0) {
 
   89      m_geom = gis->geomFromWKT(gisSource);
 
   92      m_geom = gis->geomFromWKB(gisSource);
 
  101                       QString(
"Unknown GIS type given [%1]").arg(
typeToString(t)),
 
 
  165    if ( 
this != &geom ) {
 
 
  218    return (1 == GEOSisValid(this->
m_geom));
 
 
  228    QString result = 
"Not defined!";
 
  231      char *reason = GEOSisValidReason(this->
m_geom);
 
  233      gis->destroy(reason);
 
 
  257    QString gtype = gstrType.toLower();
 
  258    if (
"wkt" == gtype) 
return (
WKT);
 
  259    if (
"wkb" == gtype) 
return (
WKB);
 
  260    if (
"cube" == gtype) 
return (
IsisCube);
 
  261    if (
"isiscube" == gtype) 
return (
IsisCube);
 
  262    if (
"geometry" == gtype) 
return (
GeosGis);
 
  263    if (
"geosgis" == gtype) 
return (
GeosGis);
 
  264    if (
"gis" == gtype) 
return (
GeosGis);
 
  265    if (
"geos" == gtype) 
return (
GeosGis);
 
 
  324    QScopedPointer<GisGeometry> geom(
new GisGeometry());
 
  327    geom->m_geom = gis->clone(
m_geom);
 
  329    return (geom.take());
 
 
  342    return (1 == GEOSisEmpty(this->
m_geom));
 
 
  365    double gisArea = 0.0;
 
  366    result = GEOSArea(this->
m_geom, &gisArea);
 
 
  388    double gisLength = 0.0;
 
  389    result = GEOSLength(this->
m_geom, &gisLength);
 
 
  430    if (!
isValid() ) { 
return (0); }
 
  432    int ngeoms =  GEOSGetNumGeometries(
m_geom);
 
  434    for (
int i = 0 ; i < ngeoms ; i++) {
 
  435      npoints += GEOSGetNumCoordinates(GEOSGetGeometryN(
m_geom, i));
 
 
  467    return (1 == result);
 
 
  494    return (1 == result);
 
 
  520    return (1 == result);
 
 
  547    return (1 == result);
 
 
  567    return ( 1 == result );
 
 
  596    if (this->
area() == 0) {
 
  600    QScopedPointer<GisGeometry> inCommon(
intersection(target));
 
  601    double ratio = inCommon->area() / this->
area();
 
 
  624    GEOSGeometry *geom = GEOSEnvelope(
m_geom);
 
 
  641    GEOSGeometry *geom = GEOSConvexHull(
m_geom);
 
 
  663    GEOSGeometry *geom = GEOSTopologyPreserveSimplify(
m_geom, tolerance);
 
 
  724    xlongitude = ylatitude = 
Null;
 
  729    GEOSGeometry *center = GEOSGetCentroid(
m_geom);
 
  731      GEOSGeomGetX(center, &xlongitude);
 
  732      GEOSGeomGetY(center, &ylatitude);
 
 
  751    GEOSGeometry *center = GEOSGetCentroid(
m_geom);
 
 
  764  #if defined(DISABLE_PREPARED_GEOMETRY) 
  768    return (gis->preparedGeometry(geom));
 
 
  781    GEOSCoordSequence *point = GEOSCoordSeq_create(1, 2);
 
  782    GEOSCoordSeq_setX(point, 0, x);
 
  783    GEOSCoordSeq_setY(point, 0, y);
 
  785    return (GEOSGeom_createPoint(point));
 
 
  798    QString polyStr = QString::fromStdString(myGis.polyStr());
 
  799    return (gis->geomFromWKT(polyStr));
 
 
IO Handler for Isis Cubes.
 
ImagePolygon readFootprint() const
Read the footprint polygon for the Cube.
 
void open(const QString &cfile, QString access="r")
This method will open an existing isis cube for reading or reading/writing.
 
Encapsulation class provides support for GEOS-C API.
 
GEOSPreparedGeometry const * makePrepared(const GEOSGeometry *geom) const
Creates a prepared geometry of current geometry.
 
static QString typeToString(const Type &type)
Returns the type of the Geometry as a QString.
 
virtual ~GisGeometry()
Destructor.
 
double intersectRatio(const GisGeometry &geom) const
Computes intersect ratio between two geometries.
 
bool overlaps(const GisGeometry &target) const
Test for overlapping geometries.
 
GisGeometry * centroid() const
Computes the centroid of the geometry and returns it as a new geometry.
 
GEOSGeometry * fromCube(Cube &cube) const
Reads Polygon from ISIS Cube and returns geometry from contents.
 
bool contains(const GisGeometry &target) const
Test if the target geometry is contained within this geometry.
 
double area() const
Computes the area of a geometry.
 
Type type() const
Returns the type (origin) of the geometry.
 
bool equals(const GisGeometry &target) const
Test if target and this geometry are equal.
 
bool disjoint(const GisGeometry &target) const
Tests for disjoint geometries.
 
bool intersects(const GisGeometry &target) const
Computes a new geometry from the intersection of the two geomtries.
 
GisGeometry * convexHull() const
Computes the convex hull of the geometry.
 
void destroy()
Destroys the GEOS elements of this geometry object.
 
GisGeometry * g_union(const GisGeometry &geom) const
Computes the union of two geometries.
 
Type
Source type of the geometry.
 
@ IsisCube
An ISIS Cube is used to create the geometry.
 
@ GeosGis
GEOS GIS. A geometry object cannot be created with this geometry type.
 
@ None
No geometry. A geometry object cannot be created with this geometry type.
 
@ WKB
The GEOS library WKB reader is used to create the geometry.
 
@ WKT
The GEOS library WKT reader is used to create the geometry.
 
GisGeometry * clone() const
Clones the contents of this geometry to a new instance.
 
const GEOSGeometry * geometry() const
Returns the GEOSGeometry object to extend functionality.
 
GisGeometry & operator=(GisGeometry const &geom)
Assignment operator for GISGeomtries.
 
double distance(const GisGeometry &target) const
Computes the distance between two geometries.
 
double length() const
Computes the length of a geometry.
 
GEOSGeometry * m_geom
Pointer to GEOS-C opaque structure.
 
bool isValid() const
Determines validity of the geometry contained in this object.
 
const GEOSPreparedGeometry * preparedGeometry() const
Returns special GEOS prepared geometry if it exists.
 
void setGeometry(GEOSGeometry *geom)
Set the geometry directly taking ownership.
 
GisGeometry * envelope() const
Computes the envelope or bounding box of this geometry.
 
GEOSPreparedGeometry const  * m_preparedGeom
A prepared geometry from the GEOS library.
 
int points() const
Get number of points in geometry.
 
GisGeometry * simplify(const double &tolerance) const
Simplify complex or overdetermined geoemtry.
 
bool isDefined() const
Determines if the current geometry is valid.
 
bool isEmpty() const
Tests for a defined but empty geometry.
 
Type m_type
Geometry type of GIS source.
 
GisGeometry * intersection(const GisGeometry &geom) const
Computes the intersection of two geometries.
 
QString isValidReason() const
Returns a string describing reason for invalid geometry.
 
GEOSGeometry * makePoint(const double x, const double y) const
Create a point geometry.
 
GisGeometry()
Fundamental constructor of an empty object.
 
This class models GIS topology.
 
static GisTopology * instance()
Gets the singleton instance of this class.
 
@ Programmer
This error is for when a programmer made an API call that was illegal.
 
Create cube polygons, read/write polygons to blobs.
 
This is free and unencumbered software released into the public domain.
 
const double Null
Value for an Isis Null pixel.
 
Namespace for the standard library.