OmniSciDB  8fa3bf436f
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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
 
- 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
}
 
- 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 99 of file Types.h.

Constructor & Destructor Documentation

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

Definition at line 536 of file Types.cpp.

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

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

+ Here is the call graph for this function:

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

Definition at line 549 of file Types.cpp.

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

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

+ Here is the call graph for this function:

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

Definition at line 108 of file Types.h.

108 : GeoBase(geom, owns_geom_obj) {}

Member Function Documentation

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

Definition at line 562 of file Types.cpp.

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

Referenced by import_export::importGeoFromLonLat().

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

+ Here is the caller graph for this function:

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

Implements Geospatial::GeoBase.

Definition at line 105 of file Types.h.

References Geospatial::GeoBase::kPOINT.

Friends And Related Function Documentation

friend class GeoTypesFactory
friend

Definition at line 110 of file Types.h.


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