OmniSciDB  72c90bc290
 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, 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 144 of file Types.h.

Constructor & Destructor Documentation

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

Definition at line 651 of file Types.cpp.

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

Referenced by clone().

651  {
652  geom_ = OGRGeometryFactory::createGeometry(OGRwkbGeometryType::wkbLineString);
653  OGRLineString* line = dynamic_cast<OGRLineString*>(geom_);
654  CHECK(line);
655  for (size_t i = 0; i < coords.size(); i += 2) {
656  line->addPoint(coords[i], coords[i + 1]);
657  }
658 }
OGRGeometry * geom_
Definition: Types.h:102
tuple line
Definition: parse_ast.py:10
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the caller graph for this function:

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

Definition at line 660 of file Types.cpp.

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

660  {
661  const auto err = GeoBase::createFromWktString(wkt, &geom_);
662  if (err != OGRERR_NONE) {
663  throw GeoTypesError("LineString", err);
664  }
665  CHECK(geom_);
666  if (wkbFlatten(geom_->getGeometryType()) != OGRwkbGeometryType::wkbLineString) {
667  throw GeoTypesError("LineString",
668  "Unexpected geometry type from WKT string: " +
669  std::string(OGRGeometryTypeToName(geom_->getGeometryType())));
670  }
671 }
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::GeoLineString::GeoLineString ( OGRGeometry *  geom,
const bool  owns_geom_obj 
)
inlineprotected

Definition at line 155 of file Types.h.

156  : GeoBase(geom, owns_geom_obj) {}

Member Function Documentation

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

Implements Geospatial::GeoBase.

Definition at line 646 of file Types.cpp.

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

646  {
647  CHECK(geom_);
648  return std::unique_ptr<GeoBase>(new GeoLineString(geom_->clone(), true));
649 }
OGRGeometry * geom_
Definition: Types.h:102
#define CHECK(condition)
Definition: Logger.h:291
GeoLineString(const std::vector< double > &coords)
Definition: Types.cpp:651

+ Here is the call graph for this function:

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

Definition at line 673 of file Types.cpp.

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

674  {
675  auto linestring_geom = dynamic_cast<OGRLineString*>(geom_);
676  CHECK(linestring_geom);
677 
678  if (linestring_geom->IsEmpty()) {
679  // until the run-time can handle empties
680  throw GeoTypesError("LineString", "'EMPTY' not supported");
681  // return null bounds
682  bounds.push_back(NULL_DOUBLE);
683  bounds.push_back(NULL_DOUBLE);
684  bounds.push_back(NULL_DOUBLE);
685  bounds.push_back(NULL_DOUBLE);
686  return;
687  }
688 
689  BoundingBox bbox;
690  for (auto i = 0; i < linestring_geom->getNumPoints(); i++) {
691  OGRPoint point;
692  linestring_geom->getPoint(i, &point);
693  double x = point.getX();
694  double y = point.getY();
695  coords.push_back(x);
696  coords.push_back(y);
697  bbox.update(x, y);
698  }
699  bounds.push_back(bbox.min.x);
700  bounds.push_back(bbox.min.y);
701  bounds.push_back(bbox.max.x);
702  bounds.push_back(bbox.max.y);
703 }
OGRGeometry * geom_
Definition: Types.h:102
#define NULL_DOUBLE
#define CHECK(condition)
Definition: Logger.h:291
GeoType Geospatial::GeoLineString::getType ( ) const
inlinefinalvirtual

Implements Geospatial::GeoBase.

Definition at line 150 of file Types.h.

References kLINESTRING.

150 { return GeoType::kLINESTRING; }

Friends And Related Function Documentation

friend class GeoTypesFactory
friend

Definition at line 158 of file Types.h.


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