diff options
Diffstat (limited to 'sql/spatial.h')
-rw-r--r-- | sql/spatial.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sql/spatial.h b/sql/spatial.h index c3f5f16d39b..79a3553bc63 100644 --- a/sql/spatial.h +++ b/sql/spatial.h @@ -71,7 +71,11 @@ struct MBR MBR(const st_point_2d &min, const st_point_2d &max) :xmin(min.x), ymin(min.y), xmax(max.x), ymax(max.y) {} - + + MBR(const MBR &mbr1, const MBR &mbr2) + :xmin(mbr1.xmin), ymin(mbr1.ymin), xmax(mbr1.xmax), ymax(mbr1.ymax) + { add_mbr(&mbr2); } + inline void add_xy(double x, double y) { /* Not using "else" for proper one point MBR calculation */ @@ -196,8 +200,8 @@ struct MBR if (d != mbr->dimension() || d <= 0 || contains(mbr) || within(mbr)) return 0; - MBR intersection(max(xmin, mbr->xmin), max(ymin, mbr->ymin), - min(xmax, mbr->xmax), min(ymax, mbr->ymax)); + MBR intersection(MY_MAX(xmin, mbr->xmin), MY_MAX(ymin, mbr->ymin), + MY_MIN(xmax, mbr->xmax), MY_MIN(ymax, mbr->ymax)); return (d == intersection.dimension()); } @@ -298,7 +302,7 @@ public: bool init_stream=1); static Geometry *create_from_wkb(Geometry_buffer *buffer, const char *wkb, uint32 len, String *res); - static int create_from_opresult(Geometry_buffer *g_buf, + static Geometry *create_from_opresult(Geometry_buffer *g_buf, String *res, Gcalc_result_receiver &rr); int as_wkt(String *wkt, const char **end); @@ -316,6 +320,7 @@ public: bool envelope(String *result) const; static Class_info *ci_collection[wkb_last+1]; + static bool create_point(String *result, double x, double y); protected: static Class_info *find_class(int type_id) { @@ -326,7 +331,6 @@ protected: const char *append_points(String *txt, uint32 n_points, const char *data, uint32 offset) const; bool create_point(String *result, const char *data) const; - bool create_point(String *result, double x, double y) const; const char *get_mbr_for_points(MBR *mbr, const char *data, uint offset) const; |