mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
5.3->5.5 merge
This commit is contained in:
@@ -23,6 +23,8 @@
|
||||
|
||||
class Gis_read_stream;
|
||||
|
||||
#include "gcalc_tools.h"
|
||||
|
||||
const uint SRID_SIZE= 4;
|
||||
const uint SIZEOF_STORED_DOUBLE= 8;
|
||||
const uint POINT_DATA_SIZE= SIZEOF_STORED_DOUBLE*2;
|
||||
@@ -247,16 +249,19 @@ public:
|
||||
virtual const Class_info *get_class_info() const=0;
|
||||
virtual uint32 get_data_size() const=0;
|
||||
virtual bool init_from_wkt(Gis_read_stream *trs, String *wkb)=0;
|
||||
|
||||
/* returns the length of the wkb that was read */
|
||||
virtual uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo,
|
||||
String *res)=0;
|
||||
virtual uint init_from_opresult(String *bin,
|
||||
const char *opres, uint res_len)
|
||||
{ return init_from_wkb(opres + 4, UINT_MAX32, wkb_ndr, bin) + 4; }
|
||||
|
||||
virtual bool get_data_as_wkt(String *txt, const char **end) const=0;
|
||||
virtual bool get_mbr(MBR *mbr, const char **end) const=0;
|
||||
virtual bool dimension(uint32 *dim, const char **end) const=0;
|
||||
virtual int get_x(double *x) const { return -1; }
|
||||
virtual int get_y(double *y) const { return -1; }
|
||||
virtual int geom_length(double *len) const { return -1; }
|
||||
virtual int geom_length(double *len, const char **end) const { return -1; }
|
||||
virtual int area(double *ar, const char **end) const { return -1;}
|
||||
virtual int is_closed(int *closed) const { return -1; }
|
||||
virtual int num_interior_ring(uint32 *n_int_rings) const { return -1; }
|
||||
@@ -269,6 +274,7 @@ public:
|
||||
virtual int point_n(uint32 num, String *result) const { return -1; }
|
||||
virtual int interior_ring_n(uint32 num, String *result) const { return -1; }
|
||||
virtual int geometry_n(uint32 num, String *result) const { return -1; }
|
||||
virtual int store_shapes(Gcalc_shape_transporter *trn) const=0;
|
||||
|
||||
public:
|
||||
static Geometry *create_by_typeid(Geometry_buffer *buffer, int type_id);
|
||||
@@ -278,20 +284,11 @@ public:
|
||||
static Geometry *create_from_wkt(Geometry_buffer *buffer,
|
||||
Gis_read_stream *trs, String *wkt,
|
||||
bool init_stream=1);
|
||||
static Geometry *create_from_wkb(Geometry_buffer *buffer, const char *wkb,
|
||||
uint32 len, String *res);
|
||||
int as_wkt(String *wkt, const char **end)
|
||||
{
|
||||
uint32 len= (uint) get_class_info()->m_name.length;
|
||||
if (wkt->reserve(len + 2, 512))
|
||||
return 1;
|
||||
wkt->qs_append(get_class_info()->m_name.str, len);
|
||||
wkt->qs_append('(');
|
||||
if (get_data_as_wkt(wkt, end))
|
||||
return 1;
|
||||
wkt->qs_append(')');
|
||||
return 0;
|
||||
}
|
||||
static Geometry *create_from_wkb(Geometry_buffer *buffer,
|
||||
const char *wkb, uint32 len, String *res);
|
||||
static int create_from_opresult(Geometry_buffer *g_buf,
|
||||
String *res, Gcalc_result_receiver &rr);
|
||||
int as_wkt(String *wkt, const char **end);
|
||||
|
||||
inline void set_data_ptr(const char *data, uint32 data_len)
|
||||
{
|
||||
@@ -369,12 +366,15 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
int geom_length(double *len, const char **end) const;
|
||||
int area(double *ar, const char **end) const;
|
||||
bool dimension(uint32 *dim, const char **end) const
|
||||
{
|
||||
*dim= 0;
|
||||
*end= 0; /* No default end */
|
||||
return 0;
|
||||
}
|
||||
int store_shapes(Gcalc_shape_transporter *trn) const;
|
||||
const Class_info *get_class_info() const;
|
||||
};
|
||||
|
||||
@@ -391,7 +391,8 @@ public:
|
||||
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
|
||||
bool get_data_as_wkt(String *txt, const char **end) const;
|
||||
bool get_mbr(MBR *mbr, const char **end) const;
|
||||
int geom_length(double *len) const;
|
||||
int geom_length(double *len, const char **end) const;
|
||||
int area(double *ar, const char **end) const;
|
||||
int is_closed(int *closed) const;
|
||||
int num_points(uint32 *n_points) const;
|
||||
int start_point(String *point) const;
|
||||
@@ -403,6 +404,7 @@ public:
|
||||
*end= 0; /* No default end */
|
||||
return 0;
|
||||
}
|
||||
int store_shapes(Gcalc_shape_transporter *trn) const;
|
||||
const Class_info *get_class_info() const;
|
||||
};
|
||||
|
||||
@@ -417,6 +419,7 @@ public:
|
||||
uint32 get_data_size() const;
|
||||
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
|
||||
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
|
||||
uint init_from_opresult(String *bin, const char *opres, uint res_len);
|
||||
bool get_data_as_wkt(String *txt, const char **end) const;
|
||||
bool get_mbr(MBR *mbr, const char **end) const;
|
||||
int area(double *ar, const char **end) const;
|
||||
@@ -431,6 +434,7 @@ public:
|
||||
*end= 0; /* No default end */
|
||||
return 0;
|
||||
}
|
||||
int store_shapes(Gcalc_shape_transporter *trn) const;
|
||||
const Class_info *get_class_info() const;
|
||||
};
|
||||
|
||||
@@ -445,6 +449,7 @@ public:
|
||||
uint32 get_data_size() const;
|
||||
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
|
||||
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
|
||||
uint init_from_opresult(String *bin, const char *opres, uint res_len);
|
||||
bool get_data_as_wkt(String *txt, const char **end) const;
|
||||
bool get_mbr(MBR *mbr, const char **end) const;
|
||||
int num_geometries(uint32 *num) const;
|
||||
@@ -455,6 +460,7 @@ public:
|
||||
*end= 0; /* No default end */
|
||||
return 0;
|
||||
}
|
||||
int store_shapes(Gcalc_shape_transporter *trn) const;
|
||||
const Class_info *get_class_info() const;
|
||||
};
|
||||
|
||||
@@ -469,11 +475,12 @@ public:
|
||||
uint32 get_data_size() const;
|
||||
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
|
||||
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
|
||||
uint init_from_opresult(String *bin, const char *opres, uint res_len);
|
||||
bool get_data_as_wkt(String *txt, const char **end) const;
|
||||
bool get_mbr(MBR *mbr, const char **end) const;
|
||||
int num_geometries(uint32 *num) const;
|
||||
int geometry_n(uint32 num, String *result) const;
|
||||
int geom_length(double *len) const;
|
||||
int geom_length(double *len, const char **end) const;
|
||||
int is_closed(int *closed) const;
|
||||
bool dimension(uint32 *dim, const char **end) const
|
||||
{
|
||||
@@ -481,6 +488,7 @@ public:
|
||||
*end= 0; /* No default end */
|
||||
return 0;
|
||||
}
|
||||
int store_shapes(Gcalc_shape_transporter *trn) const;
|
||||
const Class_info *get_class_info() const;
|
||||
};
|
||||
|
||||
@@ -507,7 +515,9 @@ public:
|
||||
*end= 0; /* No default end */
|
||||
return 0;
|
||||
}
|
||||
int store_shapes(Gcalc_shape_transporter *trn) const;
|
||||
const Class_info *get_class_info() const;
|
||||
uint init_from_opresult(String *bin, const char *opres, uint res_len);
|
||||
};
|
||||
|
||||
|
||||
@@ -521,11 +531,15 @@ public:
|
||||
uint32 get_data_size() const;
|
||||
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
|
||||
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
|
||||
uint init_from_opresult(String *bin, const char *opres, uint res_len);
|
||||
bool get_data_as_wkt(String *txt, const char **end) const;
|
||||
bool get_mbr(MBR *mbr, const char **end) const;
|
||||
int area(double *ar, const char **end) const;
|
||||
int geom_length(double *len, const char **end) const;
|
||||
int num_geometries(uint32 *num) const;
|
||||
int geometry_n(uint32 num, String *result) const;
|
||||
bool dimension(uint32 *dim, const char **end) const;
|
||||
int store_shapes(Gcalc_shape_transporter *trn) const;
|
||||
const Class_info *get_class_info() const;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user