bugs fixed
855253 Compiler error: gcalc_slicescan.cc:2036: error: suggest parentheses around comparison in operand of .|. in maria-5.3-gis 850775 ST_AREA does not work on GEOMETRYCOLLECTIONs in maria-5.3-gis per-file comments: mysql-test/r/gis.result test result updated. mysql-test/t/gis.test test case added for 850775. sql/gcalc_slicescan.cc compiler error fixed. sql/spatial.cc ST_AREA implementation for GEOMETRY_COLLECTION, POINT and LINESTRING. sql/spatial.h area() declarations added.
This commit is contained in:
parent
0249413a6a
commit
25b5019c34
@ -230,7 +230,7 @@ fid AsText(Envelope(g))
|
||||
119 POLYGON((0 0,3 0,3 3,0 3,0 0))
|
||||
120 POLYGON((0 0,10 0,10 10,0 10,0 0))
|
||||
121 POLYGON((3 6,44 6,44 9,3 9,3 6))
|
||||
122 POLYGON((1.79769313486232e+308 1.79769313486232e+308,-1.79769313486232e+308 1.79769313486232e+308,-1.79769313486232e+308 -1.79769313486232e+308,1.79769313486232e+308 -1.79769313486232e+308,1.79769313486232e+308 1.79769313486232e+308))
|
||||
122 NULL
|
||||
explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 22 100.00
|
||||
@ -396,13 +396,13 @@ FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second
|
||||
first second w c o e d t i r
|
||||
120 120 1 1 0 1 0 1 1 1
|
||||
120 121 0 0 1 0 0 0 1 0
|
||||
120 122 0 1 0 0 1 0 0 0
|
||||
120 122 0 1 NULL NULL NULL 0 NULL 0
|
||||
121 120 0 0 1 0 0 0 1 0
|
||||
121 121 1 1 0 1 0 1 1 1
|
||||
121 122 0 1 0 0 1 0 0 0
|
||||
122 120 1 0 0 0 1 0 0 0
|
||||
122 121 1 0 0 0 1 0 0 0
|
||||
122 122 1 1 0 1 1 0 0 0
|
||||
121 122 0 1 NULL NULL NULL 0 NULL 0
|
||||
122 120 1 0 NULL NULL NULL 0 NULL 0
|
||||
122 121 1 0 NULL NULL NULL 0 NULL 0
|
||||
122 122 1 1 NULL NULL NULL 0 NULL 0
|
||||
explain extended SELECT g1.fid as first, g2.fid as second,
|
||||
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
||||
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
||||
@ -1077,6 +1077,9 @@ SPATIAL INDEX i1 (col1, col2)
|
||||
ERROR HY000: Incorrect arguments to SPATIAL INDEX
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'));
|
||||
ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'))
|
||||
1.5
|
||||
DROP DATABASE IF EXISTS gis_ogs;
|
||||
CREATE DATABASE gis_ogs;
|
||||
USE gis_ogs;
|
||||
|
@ -804,6 +804,11 @@ CREATE TABLE t3 (
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
||||
#bug 850775 ST_AREA does not work on GEOMETRYCOLLECTIONs in maria-5.3-gis
|
||||
select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'));
|
||||
|
||||
|
||||
|
||||
# Conformance tests
|
||||
#
|
||||
# C.3.3 Geometry types and functions
|
||||
|
@ -2033,7 +2033,7 @@ double Gcalc_scan_iterator::get_h() const
|
||||
double Gcalc_scan_iterator::get_sp_x(const point *sp) const
|
||||
{
|
||||
double dy;
|
||||
if (sp->event == scev_end | scev_two_ends | scev_point)
|
||||
if (sp->event & (scev_end | scev_two_ends | scev_point))
|
||||
return sp->pi->x;
|
||||
dy= sp->next_pi->y - sp->pi->y;
|
||||
if (fabs(dy) < 1e-12)
|
||||
|
@ -489,6 +489,14 @@ bool Gis_point::get_mbr(MBR *mbr, const char **end) const
|
||||
}
|
||||
|
||||
|
||||
int Gis_point::area(double *ar, const char **end) const
|
||||
{
|
||||
*ar= 0;
|
||||
*end= m_data+ POINT_DATA_SIZE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int Gis_point::store_shapes(Gcalc_shape_transporter *trn) const
|
||||
{
|
||||
double x, y;
|
||||
@ -634,6 +642,20 @@ int Gis_line_string::geom_length(double *len) const
|
||||
}
|
||||
|
||||
|
||||
int Gis_line_string::area(double *ar, const char **end) const
|
||||
{
|
||||
uint32 n_points;
|
||||
*ar= 0.0;
|
||||
|
||||
/* read number of points */
|
||||
if (no_data(m_data, 4))
|
||||
return 1;
|
||||
n_points= uint4korr(m_data);
|
||||
*end= m_data + 4 + POINT_DATA_SIZE * n_points;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int Gis_line_string::is_closed(int *closed) const
|
||||
{
|
||||
uint32 n_points;
|
||||
@ -2253,6 +2275,44 @@ bool Gis_geometry_collection::get_mbr(MBR *mbr, const char **end) const
|
||||
}
|
||||
|
||||
|
||||
int Gis_geometry_collection::area(double *ar, const char **end_of_data) const
|
||||
{
|
||||
uint32 n_objects;
|
||||
const char *data= m_data;
|
||||
Geometry_buffer buffer;
|
||||
Geometry *geom;
|
||||
double result;
|
||||
|
||||
if (no_data(data, 4))
|
||||
return 1;
|
||||
n_objects= uint4korr(data);
|
||||
data+= 4;
|
||||
if (n_objects == 0)
|
||||
return 1;
|
||||
|
||||
result= 0.0;
|
||||
while (n_objects--)
|
||||
{
|
||||
uint32 wkb_type;
|
||||
|
||||
if (no_data(data, WKB_HEADER_SIZE))
|
||||
return 1;
|
||||
wkb_type= uint4korr(data + 1);
|
||||
data+= WKB_HEADER_SIZE;
|
||||
|
||||
if (!(geom= create_by_typeid(&buffer, wkb_type)))
|
||||
return 1;
|
||||
geom->set_data_ptr(data, (uint32) (m_data_end - data));
|
||||
if (geom->area(ar, &data))
|
||||
return 1;
|
||||
result+= *ar;
|
||||
}
|
||||
*end_of_data= data;
|
||||
*ar= result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int Gis_geometry_collection::num_geometries(uint32 *num) const
|
||||
{
|
||||
if (no_data(m_data, 4))
|
||||
|
@ -375,6 +375,7 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
int area(double *ar, const char **end) const;
|
||||
bool dimension(uint32 *dim, const char **end) const
|
||||
{
|
||||
*dim= 0;
|
||||
@ -399,6 +400,7 @@ public:
|
||||
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 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;
|
||||
@ -540,6 +542,7 @@ public:
|
||||
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 num_geometries(uint32 *num) const;
|
||||
int geometry_n(uint32 num, String *result) const;
|
||||
bool dimension(uint32 *dim, const char **end) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user