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

#include <Types.h>

+ Inheritance diagram for Geospatial::GeoLineString:
+ Collaboration diagram for Geospatial::GeoLineString:

Public Member Functions

 GeoLineString (const std::vector< double > &coords)
 
 GeoLineString (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

 GeoLineString (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 118 of file Types.h.

Constructor & Destructor Documentation

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

Definition at line 590 of file Types.cpp.

References CHECK, Geospatial::GeoBase::geom_, i, and parse_ast::line.

Referenced by clone().

590  {
591  geom_ = OGRGeometryFactory::createGeometry(OGRwkbGeometryType::wkbLineString);
592  OGRLineString* line = dynamic_cast<OGRLineString*>(geom_);
593  CHECK(line);
594  for (size_t i = 0; i < coords.size(); i += 2) {
595  line->addPoint(coords[i], coords[i + 1]);
596  }
597 }
OGRGeometry * geom_
Definition: Types.h:93
tuple line
Definition: parse_ast.py:10
#define CHECK(condition)
Definition: Logger.h:209

+ Here is the caller graph for this function:

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

Definition at line 599 of file Types.cpp.

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

599  {
600  const auto err = GeoBase::createFromWktString(wkt, &geom_);
601  if (err != OGRERR_NONE) {
602  throw GeoTypesError("LineString", err);
603  }
604  CHECK(geom_);
605  if (wkbFlatten(geom_->getGeometryType()) != OGRwkbGeometryType::wkbLineString) {
606  throw GeoTypesError("LineString",
607  "Unexpected geometry type from WKT string: " +
608  std::string(OGRGeometryTypeToName(geom_->getGeometryType())));
609  }
610 }
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::GeoLineString::GeoLineString ( OGRGeometry *  geom,
const bool  owns_geom_obj 
)
inlineprotected

Definition at line 129 of file Types.h.

130  : GeoBase(geom, owns_geom_obj) {}

Member Function Documentation

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

Implements Geospatial::GeoBase.

Definition at line 585 of file Types.cpp.

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

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

+ Here is the call graph for this function:

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

Definition at line 612 of file Types.cpp.

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

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

Friends And Related Function Documentation

friend class GeoTypesFactory
friend

Definition at line 132 of file Types.h.


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