1#ifndef GEOFUNC_INTERNAL_INCLUDED
2#define GEOFUNC_INTERNAL_INCLUDED
34#include <boost/concept/usage.hpp>
35#include <boost/geometry/core/cs.hpp>
36#include <boost/geometry/core/tags.hpp>
37#include <boost/geometry/geometries/box.hpp>
38#include <boost/geometry/geometries/point.hpp>
39#include <boost/geometry/geometries/segment.hpp>
40#include <boost/geometry/index/rtree.hpp>
52#define GIS_ZERO 0.00000000001
58template <
typename CoordinateSystemType>
75namespace bgm = boost::geometry::model;
77namespace bgi = boost::geometry::index;
78namespace bgm = boost::geometry::model;
80typedef bgm::point<double, 2, bgcs::cartesian>
BG_point;
84typedef bgi::rtree<BG_rtree_entry, bgi::quadratic<64>>
Rtree_index;
90 box->min_corner().set<0>(mbr.
xmin);
91 box->min_corner().set<1>(mbr.
ymin);
92 box->max_corner().set<0>(mbr.
xmax);
93 box->max_corner().set<1>(mbr.
ymax);
97 return !(!std::isfinite(box.min_corner().get<0>()) ||
98 !std::isfinite(box.min_corner().get<1>()) ||
99 !std::isfinite(box.max_corner().get<0>()) ||
100 !std::isfinite(box.max_corner().get<1>()) ||
101 box.max_corner().get<0>() < box.min_corner().get<0>() ||
102 box.max_corner().get<1>() < box.min_corner().get<1>());
119template <
typename MultiGeometry>
154 template <
typename Po
int>
156 if (p1.template get<0>() != p2.template get<0>())
157 return p1.template get<0>() < p2.template get<0>();
159 return p1.template get<1>() < p2.template get<1>();
167 template <
typename Po
int>
169 return p1.template get<0>() == p2.template get<0>() &&
170 p1.template get<1>() == p2.template get<1>();
186template <
typename BG_geotype>
std::vector< Geometry * > Geometry_list
Definition: item_geofunc.h:149
A wrapper and interface for all geometry types used here.
Definition: item_geofunc_internal.h:59
Gis_multi_polygon Multipolygon
Definition: item_geofunc_internal.h:68
Gis_line_string Linestring
Definition: item_geofunc_internal.h:65
Gis_multi_point Multipoint
Definition: item_geofunc_internal.h:66
Gis_multi_line_string Multilinestring
Definition: item_geofunc_internal.h:67
Gis_polygon Polygon
Definition: item_geofunc_internal.h:64
double Coordinate_type
Definition: item_geofunc_internal.h:70
CoordinateSystemType Coordinate_system
Definition: item_geofunc_internal.h:71
Gis_point Point
Definition: item_geofunc_internal.h:61
We have to hold result buffers in functions that return a GEOMETRY string, because such a function's ...
Definition: item_geofunc.h:81
Definition: spatial.h:212
@ wkb_invalid_type
Definition: spatial.h:290
bool envelope(String *result) const
Definition: spatial.cc:957
Definition: spatial.h:2408
Definition: spatial.h:2098
Definition: spatial.h:2332
Definition: spatial.h:2289
Definition: spatial.h:2372
Definition: spatial.h:1151
Definition: spatial.h:2186
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:166
bgi::rtree< BG_rtree_entry, bgi::quadratic< 64 > > Rtree_index
Definition: item_geofunc_internal.h:84
void make_rtree_bggeom(const MultiGeometry &mg, Rtree_index *rtree)
Build an rtree set using array of Boost.Geometry objects, which are components of a multi geometry.
Definition: geometry_rtree.cc:79
bool post_fix_result(BG_result_buf_mgr *resbuf_mgr, BG_geotype &geout, String *res)
For every Geometry object write-accessed by a boost geometry function, i.e.
Definition: item_geofunc_internal.cc:155
std::vector< BG_rtree_entry > Rtree_result
Definition: item_geofunc_internal.h:85
Gis_geometry_collection * empty_collection(String *str, gis::srid_t srid)
Definition: item_geofunc_internal.h:122
bgm::box< BG_point > BG_box
Definition: item_geofunc_internal.h:81
std::pair< BG_box, size_t > BG_rtree_entry
Definition: item_geofunc_internal.h:82
void make_rtree(const BG_geometry_collection::Geometry_list &gl, Rtree_index *rtree)
Build an rtree set using a geometry collection.
Definition: geometry_rtree.cc:54
bool is_box_valid(const BG_box &box)
Definition: item_geofunc_internal.h:96
std::vector< BG_rtree_entry > BG_rtree_entries
Definition: item_geofunc_internal.h:83
bool is_empty_geocollection(const Geometry *g)
Definition: item_geofunc_internal.cc:228
void make_bg_box(const Geometry *g, BG_box *box)
Definition: item_geofunc_internal.h:87
bgm::point< double, 2, bgcs::cartesian > BG_point
Definition: item_geofunc_internal.h:80
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1054
Definition: item_geofunc.cc:99
Definition: box_traits.h:41
std::uint32_t srid_t
A spatial reference system ID (SRID).
Definition: srid.h:32
double xmin
Definition: spatial.h:83
double ymax
Definition: spatial.h:83
double xmax
Definition: spatial.h:83
double ymin
Definition: spatial.h:83
Equals comparator for points used by BG.
Definition: item_geofunc_internal.h:166
bool operator()(const Point &p1, const Point &p2) const
Definition: item_geofunc_internal.h:168
Less than comparator for points used by BG.
Definition: item_geofunc_internal.h:153
bool operator()(const Point &p1, const Point &p2) const
Definition: item_geofunc_internal.h:155