OmniSciDB  72c90bc290
 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, GeoType::kMULTILINESTRING, GeoType::kMULTIPOINT
}
 
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,
  GeoOp::kCONCAVEHULL = 8, GeoOp::kCONVEXHULL = 9
}
 
- 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 createFromWkbView (OGRGeometry **geom, WkbView const)
 
- Protected Attributes inherited from Geospatial::GeoBase
OGRGeometry * geom_ = nullptr
 
bool owns_geom_obj_
 

Detailed Description

Definition at line 111 of file Types.h.

Constructor & Destructor Documentation

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

Definition at line 542 of file Types.cpp.

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

Referenced by clone().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 555 of file Types.cpp.

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

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

+ Here is the call graph for this function:

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

Definition at line 122 of file Types.h.

122 : GeoBase(geom, owns_geom_obj) {}

Member Function Documentation

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

Implements Geospatial::GeoBase.

Definition at line 537 of file Types.cpp.

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

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

+ Here is the call graph for this function:

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

Definition at line 568 of file Types.cpp.

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

Referenced by import_export::importGeoFromLonLat(), and foreign_storage::anonymous_namespace{TextFileBufferParser.cpp}::set_coordinates_from_separate_lon_lat_columns().

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

+ Here is the caller graph for this function:

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

Implements Geospatial::GeoBase.

Definition at line 117 of file Types.h.

References kPOINT.

117 { return GeoType::kPOINT; }

Friends And Related Function Documentation

friend class GeoTypesFactory
friend

Definition at line 124 of file Types.h.


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