OmniSciDB  72c90bc290
 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

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

Definition at line 591 of file Types.cpp.

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

Referenced by clone().

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

+ Here is the caller graph for this function:

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

Definition at line 601 of file Types.cpp.

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

601  {
602  const auto err = GeoBase::createFromWktString(wkt, &geom_);
603  if (err != OGRERR_NONE) {
604  throw GeoTypesError("MultiPoint", err);
605  }
606  CHECK(geom_);
607  if (wkbFlatten(geom_->getGeometryType()) != OGRwkbGeometryType::wkbMultiPoint) {
608  throw GeoTypesError("MultiPoint",
609  "Unexpected geometry type from WKT string: " +
610  std::string(OGRGeometryTypeToName(geom_->getGeometryType())));
611  }
612 }
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::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 > Geospatial::GeoMultiPoint::clone ( ) const
finalvirtual

Implements Geospatial::GeoBase.

Definition at line 586 of file Types.cpp.

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

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

+ Here is the call graph for this function:

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

Definition at line 614 of file Types.cpp.

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

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

Implements Geospatial::GeoBase.

Definition at line 133 of file Types.h.

References kMULTIPOINT.

133 { return GeoType::kMULTIPOINT; }

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: