Commit f2366bf0 authored by hf@deer.(none)'s avatar hf@deer.(none)

Spatial code changed to get rid of inconsistent this->* operation

Now we use virtual calls instead and redirect VMT pointer of the
geometry object with 'new' operation
parent 082a01d1
......@@ -4765,7 +4765,8 @@ void Field_blob::get_key_image(char *buff,uint length,
{
const char *dummy;
MBR mbr;
Geometry gobj;
Geometry_buffer buffer;
Geometry *gobj;
if (blob_length < SRID_SIZE)
{
......@@ -4773,8 +4774,9 @@ void Field_blob::get_key_image(char *buff,uint length,
return;
}
get_ptr(&blob);
gobj.create_from_wkb(blob + SRID_SIZE, blob_length - SRID_SIZE);
if (gobj.get_mbr(&mbr, &dummy))
gobj= Geometry::create_from_wkb(&buffer,
blob + SRID_SIZE, blob_length - SRID_SIZE);
if (gobj->get_mbr(&mbr, &dummy))
bzero(buff, SIZEOF_STORED_DOUBLE*4);
else
{
......@@ -5013,9 +5015,11 @@ void Field_geom::get_key_image(char *buff, uint length, CHARSET_INFO *cs,
return;
}
get_ptr(&blob);
Geometry gobj;
gobj.create_from_wkb(blob + SRID_SIZE, blob_length - SRID_SIZE);
if (gobj.get_mbr(&mbr, &dummy))
Geometry_buffer buffer;
Geometry *gobj;
gobj= Geometry::create_from_wkb(&buffer,
blob + SRID_SIZE, blob_length - SRID_SIZE);
if (gobj->get_mbr(&mbr, &dummy))
bzero(buff, SIZEOF_STORED_DOUBLE*4);
else
{
......@@ -5075,7 +5079,7 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
if (length < SRID_SIZE + WKB_HEADER_SIZE + SIZEOF_STORED_DOUBLE*2)
goto err;
wkb_type= uint4korr(from + WKB_HEADER_SIZE);
if (wkb_type < (uint32) Geometry::wkbPoint ||
if (wkb_type < (uint32) Geometry::wkb_point ||
wkb_type > (uint32) Geometry::wkb_end)
return 1;
Field_blob::store_length(length);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -2941,14 +2941,14 @@ geometry_function:
{ $$= GEOM_NEW(Item_func_geometry_from_wkb($3, $5)); }
| GEOMETRYCOLLECTION '(' expr_list ')'
{ $$= GEOM_NEW(Item_func_spatial_collection(* $3,
Geometry::wkbGeometryCollection,
Geometry::wkbPoint)); }
Geometry::wkb_geometrycollection,
Geometry::wkb_point)); }
| LINESTRING '(' expr_list ')'
{ $$= GEOM_NEW(Item_func_spatial_collection(* $3,
Geometry::wkbLineString, Geometry::wkbPoint)); }
Geometry::wkb_linestring, Geometry::wkb_point)); }
| MULTILINESTRING '(' expr_list ')'
{ $$= GEOM_NEW( Item_func_spatial_collection(* $3,
Geometry::wkbMultiLineString, Geometry::wkbLineString)); }
Geometry::wkb_multilinestring, Geometry::wkb_linestring)); }
| MLINEFROMTEXT '(' expr ')'
{ $$= GEOM_NEW(Item_func_geometry_from_text($3)); }
| MLINEFROMTEXT '(' expr ',' expr ')'
......@@ -2963,10 +2963,10 @@ geometry_function:
{ $$= GEOM_NEW(Item_func_geometry_from_text($3, $5)); }
| MULTIPOINT '(' expr_list ')'
{ $$= GEOM_NEW(Item_func_spatial_collection(* $3,
Geometry::wkbMultiPoint, Geometry::wkbPoint)); }
Geometry::wkb_multipoint, Geometry::wkb_point)); }
| MULTIPOLYGON '(' expr_list ')'
{ $$= GEOM_NEW(Item_func_spatial_collection(* $3,
Geometry::wkbMultiPolygon, Geometry::wkbPolygon)); }
Geometry::wkb_multipolygon, Geometry::wkb_polygon)); }
| POINT_SYM '(' expr ',' expr ')'
{ $$= GEOM_NEW(Item_func_point($3,$5)); }
| POINTFROMTEXT '(' expr ')'
......@@ -2979,7 +2979,7 @@ geometry_function:
{ $$= GEOM_NEW(Item_func_geometry_from_text($3, $5)); }
| POLYGON '(' expr_list ')'
{ $$= GEOM_NEW(Item_func_spatial_collection(* $3,
Geometry::wkbPolygon, Geometry::wkbLineString)); }
Geometry::wkb_polygon, Geometry::wkb_linestring)); }
| GEOMCOLLFROMTEXT '(' expr ')'
{ $$= GEOM_NEW(Item_func_geometry_from_text($3)); }
| GEOMCOLLFROMTEXT '(' expr ',' expr ')'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment