OmniSciDB  471d68cefb
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Geospatial::GeoPoint Class Reference

#include <Types.h>

+ Inheritance diagram for Geospatial::GeoPoint:
+ Collaboration diagram for Geospatial::GeoPoint:

Public Member Functions

 GeoPoint (const std::vector< double > &coords)
 
 GeoPoint (const std::string &wkt)
 
void getColumns (std::vector< double > &coords) const
 
GeoType getType () const final
 
std::unique_ptr< GeoBaseclone () const override
 
- Public Member Functions inherited from Geospatial::GeoBase
 GeoBase ()
 
virtual ~GeoBase ()
 
std::string getWktString () const
 
bool getWkb (std::vector< uint8_t > &) const
 
const OGRGeometry * getOGRGeometry () const
 
int32_t getBestPlanarSRID () const
 
bool transform (int32_t srid0, int32_t srid1)
 
bool transform (SQLTypeInfo &ti)
 
virtual bool operator== (const GeoBase &other) const
 
bool isEmpty () const
 
std::unique_ptr< GeoBaserun (GeoOp op, const GeoBase &other) const
 
std::unique_ptr< GeoBaseoptimized_run (GeoOp op, const GeoBase &other) const
 
std::unique_ptr< GeoBaserun (GeoOp op, double param) const
 
bool run (GeoOp op) const
 

Protected Member Functions

 GeoPoint (OGRGeometry *geom, const bool owns_geom_obj)
 
- Protected Member Functions inherited from Geospatial::GeoBase
 GeoBase (OGRGeometry *geom, const bool owns_geom_obj)
 

Friends

class GeoTypesFactory
 

Additional Inherited Members

- Public Types inherited from Geospatial::GeoBase
enum  GeoType {
  GeoType::kPOINT, GeoType::kLINESTRING, GeoType::kPOLYGON, GeoType::kMULTIPOLYGON,
  GeoType::kGEOMETRY, GeoType::kGEOMETRYCOLLECTION
}
 
enum  GeoOp {
  GeoOp::kPROJECTION = 0, GeoOp::kINTERSECTION = 1, GeoOp::kDIFFERENCE = 2, GeoOp::kUNION = 3,
  GeoOp::kBUFFER = 4, GeoOp::kISVALID = 5, GeoOp::kISEMPTY = 6, GeoOp::kEQUALS = 7
}
 
- Static Public Member Functions inherited from Geospatial::GeoBase
static std::shared_ptr
< OGRCoordinateTransformation > 
getTransformation (int32_t srid0, int32_t srid1)
 
- Static Protected Member Functions inherited from Geospatial::GeoBase
static int createFromWktString (const std::string &wkt, OGRGeometry **geom)
 
static int createFromWkb (const std::vector< uint8_t > &wkb, OGRGeometry **geom)
 
- Protected Attributes inherited from Geospatial::GeoBase
OGRGeometry * geom_ = nullptr
 
bool owns_geom_obj_
 

Detailed Description

Definition at line 102 of file Types.h.

Constructor & Destructor Documentation

GeoPoint::GeoPoint ( const std::vector< double > &  coords)

Definition at line 541 of file Types.cpp.

References CHECK, Geospatial::GeoBase::geom_, and to_string().

Referenced by clone().

541  {
542  if (coords.size() != 2) {
543  throw GeoTypesError("Point",
544  "Incorrect coord size of " + std::to_string(coords.size()) +
545  " supplied. Expected 2.");
546  }
547  geom_ = OGRGeometryFactory::createGeometry(OGRwkbGeometryType::wkbPoint);
548  OGRPoint* point = dynamic_cast<OGRPoint*>(geom_);
549  CHECK(point);
550  point->setX(coords[0]);
551  point->setY(coords[1]);
552 }
OGRGeometry * geom_
Definition: Types.h:93
std::string to_string(char const *&&v)
#define CHECK(condition)
Definition: Logger.h:209

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

GeoPoint::GeoPoint ( const std::string &  wkt)

Definition at line 554 of file Types.cpp.

References CHECK, Geospatial::GeoBase::createFromWktString(), and Geospatial::GeoBase::geom_.

554  {
555  const auto err = GeoBase::createFromWktString(wkt, &geom_);
556  if (err != OGRERR_NONE) {
557  throw GeoTypesError("Point", err);
558  }
559  CHECK(geom_);
560  if (wkbFlatten(geom_->getGeometryType()) != OGRwkbGeometryType::wkbPoint) {
561  throw GeoTypesError("Point",
562  "Unexpected geometry type from WKT string: " +
563  std::string(OGRGeometryTypeToName(geom_->getGeometryType())));
564  }
565 }
OGRGeometry * geom_
Definition: Types.h:93
static int createFromWktString(const std::string &wkt, OGRGeometry **geom)
Definition: Types.cpp:154
#define CHECK(condition)
Definition: Logger.h:209

+ Here is the call graph for this function:

Geospatial::GeoPoint::GeoPoint ( OGRGeometry *  geom,
const bool  owns_geom_obj 
)
inlineprotected

Definition at line 113 of file Types.h.

113 : GeoBase(geom, owns_geom_obj) {}

Member Function Documentation

std::unique_ptr< GeoBase > GeoPoint::clone ( ) const
overridevirtual

Implements Geospatial::GeoBase.

Definition at line 536 of file Types.cpp.

References CHECK, Geospatial::GeoBase::geom_, and GeoPoint().

536  {
537  CHECK(geom_);
538  return std::unique_ptr<GeoBase>(new GeoPoint(geom_->clone(), true));
539 }
OGRGeometry * geom_
Definition: Types.h:93
GeoPoint(const std::vector< double > &coords)
Definition: Types.cpp:541
#define CHECK(condition)
Definition: Logger.h:209

+ Here is the call graph for this function:

void GeoPoint::getColumns ( std::vector< double > &  coords) const

Definition at line 567 of file Types.cpp.

References CHECK, Geospatial::GeoBase::geom_, and NULL_DOUBLE.

Referenced by import_export::importGeoFromLonLat().

567  {
568  const auto point_geom = dynamic_cast<OGRPoint*>(geom_);
569  CHECK(point_geom);
570 
571  if (point_geom->IsEmpty()) {
572  // until the run-time can handle empties
573  throw GeoTypesError("Point", "'EMPTY' not supported");
574  // we cannot yet handle NULL fixed-length array
575  // so we have to store sentinel values instead
576  coords.push_back(NULL_DOUBLE);
577  coords.push_back(NULL_DOUBLE);
578  return;
579  }
580 
581  coords.push_back(point_geom->getX());
582  coords.push_back(point_geom->getY());
583 }
OGRGeometry * geom_
Definition: Types.h:93
#define NULL_DOUBLE
#define CHECK(condition)
Definition: Logger.h:209

+ Here is the caller graph for this function:

GeoType Geospatial::GeoPoint::getType ( ) const
inlinefinalvirtual

Implements Geospatial::GeoBase.

Definition at line 108 of file Types.h.

References Geospatial::GeoBase::kPOINT.

Friends And Related Function Documentation

friend class GeoTypesFactory
friend

Definition at line 115 of file Types.h.


The documentation for this class was generated from the following files: