OmniSciDB  a987f07e93
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Geospatial::GeoMultiPoint Class Reference

#include <Types.h>

+ Inheritance diagram for Geospatial::GeoMultiPoint:
+ Collaboration diagram for Geospatial::GeoMultiPoint:

Public Member Functions

 GeoMultiPoint (const std::vector< double > &coords)
 
 GeoMultiPoint (const std::string &wkt)
 
void getColumns (std::vector< double > &coords, std::vector< double > &bounds) const
 
GeoType getType () const final
 
std::unique_ptr< GeoBaseclone () 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

 GeoMultiPoint (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 127 of file Types.h.

Constructor & Destructor Documentation

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

Definition at line 590 of file Types.cpp.

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

Referenced by clone().

590  {
591  geom_ = OGRGeometryFactory::createGeometry(OGRwkbGeometryType::wkbMultiPoint);
592  OGRMultiPoint* multipoint = dynamic_cast<OGRMultiPoint*>(geom_);
593  CHECK(multipoint);
594  for (size_t i = 0; i < coords.size(); i += 2) {
595  OGRPoint pt(coords[i], coords[i + 1]);
596  multipoint->addGeometry(&pt);
597  }
598 }
OGRGeometry * geom_
Definition: Types.h:102
#define CHECK(condition)
Definition: Logger.h:289

+ Here is the caller graph for this function:

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

Definition at line 600 of file Types.cpp.

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

600  {
601  const auto err = GeoBase::createFromWktString(wkt, &geom_);
602  if (err != OGRERR_NONE) {
603  throw GeoTypesError("MultiPoint", err);
604  }
605  CHECK(geom_);
606  if (wkbFlatten(geom_->getGeometryType()) != OGRwkbGeometryType::wkbMultiPoint) {
607  throw GeoTypesError("MultiPoint",
608  "Unexpected geometry type from WKT string: " +
609  std::string(OGRGeometryTypeToName(geom_->getGeometryType())));
610  }
611 }
OGRGeometry * geom_
Definition: Types.h:102
static int createFromWktString(const std::string &wkt, OGRGeometry **geom)
Definition: Types.cpp:154
#define CHECK(condition)
Definition: Logger.h:289

+ Here is the call graph for this function:

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

Definition at line 138 of file Types.h.

139  : GeoBase(geom, owns_geom_obj) {}

Member Function Documentation

std::unique_ptr< GeoBase > GeoMultiPoint::clone ( ) const
finalvirtual

Implements Geospatial::GeoBase.

Definition at line 585 of file Types.cpp.

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

585  {
586  CHECK(geom_);
587  return std::unique_ptr<GeoBase>(new GeoMultiPoint(geom_->clone(), true));
588 }
OGRGeometry * geom_
Definition: Types.h:102
GeoMultiPoint(const std::vector< double > &coords)
Definition: Types.cpp:590
#define CHECK(condition)
Definition: Logger.h:289

+ Here is the call graph for this function:

void GeoMultiPoint::getColumns ( std::vector< double > &  coords,
std::vector< double > &  bounds 
) const

Definition at line 613 of file Types.cpp.

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

614  {
615  auto multipoint_geom = dynamic_cast<OGRMultiPoint*>(geom_);
616  CHECK(multipoint_geom);
617 
618  if (multipoint_geom->IsEmpty()) {
619  // until the run-time can handle empties
620  throw GeoTypesError("MultiPoint", "'EMPTY' not supported");
621  // return null bounds
622  bounds.push_back(NULL_DOUBLE);
623  bounds.push_back(NULL_DOUBLE);
624  bounds.push_back(NULL_DOUBLE);
625  bounds.push_back(NULL_DOUBLE);
626  return;
627  }
628 
629  BoundingBox bbox;
630  for (auto i = 0; i < multipoint_geom->getNumGeometries(); i++) {
631  OGRPoint* point = dynamic_cast<OGRPoint*>(multipoint_geom->getGeometryRef(i));
632  CHECK(point);
633  double x = point->getX();
634  double y = point->getY();
635  coords.push_back(x);
636  coords.push_back(y);
637  bbox.update(x, y);
638  }
639  bounds.push_back(bbox.min.x);
640  bounds.push_back(bbox.min.y);
641  bounds.push_back(bbox.max.x);
642  bounds.push_back(bbox.max.y);
643 }
OGRGeometry * geom_
Definition: Types.h:102
#define NULL_DOUBLE
#define CHECK(condition)
Definition: Logger.h:289
GeoType Geospatial::GeoMultiPoint::getType ( ) const
inlinefinalvirtual

Friends And Related Function Documentation

friend class GeoTypesFactory
friend

Definition at line 141 of file Types.h.


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