Commit 6e7d578b authored by Alexey Botchkov's avatar Alexey Botchkov

bug 857087 Wrong result with ST_INTERSECTS and LINESTRINGs

        Line autointersection point was treated as if it doesn't belong to the line.
        It's in some way logical, but seems to confuse people. Fixed.

per_file_comments:
  mysql-test/r/gis-precise.result
bug 857087 Wrong result with ST_INTERSECTS and LINESTRINGs
        test result updated.
  mysql-test/t/gis-precise.test
bug 857087 Wrong result with ST_INTERSECTS and LINESTRINGs
        test case added.
  sql/gcalc_tools.cc
bug 857087 Wrong result with ST_INTERSECTS and LINESTRINGs
        Point of line autointersection handled as it belongs to the line.
  sql/gcalc_tools.h
bug 857087 Wrong result with ST_INTERSECTS and LINESTRINGs
        Gcalc_function::set_i_state() added
parent 5b83aee3
......@@ -431,3 +431,6 @@ ST_EQUALS( MULTIPOINTFROMTEXT(' MULTIPOINT( 5 1 , 6 9 , 1 4 , 4 0 ) ') , MULTIPO
SELECT ST_WITHIN( MULTIPOINTFROMTEXT(' MULTIPOINT( 2 9 , 2 9 , 4 9 , 9 1 ) ') , POLYGONFROMTEXT(' POLYGON( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) '));
ST_WITHIN( MULTIPOINTFROMTEXT(' MULTIPOINT( 2 9 , 2 9 , 4 9 , 9 1 ) ') , POLYGONFROMTEXT(' POLYGON( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) '))
0
SELECT ST_INTERSECTS( GeomFromText('MULTILINESTRING( ( 4030 3045 , 3149 2461 , 3004 3831 , 3775 2976 ) )') , GeomFromText('LINESTRING(3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29,3039.07 3175.05,3039.07 3175.05,3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29)') );
ST_INTERSECTS( GeomFromText('MULTILINESTRING( ( 4030 3045 , 3149 2461 , 3004 3831 , 3775 2976 ) )') , GeomFromText('LINESTRING(3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29,3039.07 3175.05,3039.07 3175.05,3058.41 3187.91,3081.52 3153.19,
1
......@@ -306,3 +306,7 @@ SELECT ST_EQUALS( MULTIPOINTFROMTEXT(' MULTIPOINT( 5 1 , 6 9 , 1 4 , 4 0 ) ') ,
#bug 857050 ST_WITHIN returns wrong result with MULTIPOINT and POLYGON
SELECT ST_WITHIN( MULTIPOINTFROMTEXT(' MULTIPOINT( 2 9 , 2 9 , 4 9 , 9 1 ) ') , POLYGONFROMTEXT(' POLYGON( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) '));
#bug 857087 Wrong result with ST_INTERSECTS and LINESTRINGs
SELECT ST_INTERSECTS( GeomFromText('MULTILINESTRING( ( 4030 3045 , 3149 2461 , 3004 3831 , 3775 2976 ) )') , GeomFromText('LINESTRING(3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29,3039.07 3175.05,3039.07 3175.05,3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29)') );
......@@ -297,7 +297,7 @@ int Gcalc_function::check_function(Gcalc_scan_iterator &scan_it)
(get_shape_kind(si) == Gcalc_function::shape_polygon))
set_b_state(si);
else if (get_shape_kind(si) == Gcalc_function::shape_line)
invert_i_state(si);
set_i_state(si);
}
if (count())
......@@ -313,7 +313,7 @@ int Gcalc_function::check_function(Gcalc_scan_iterator &scan_it)
(get_shape_kind(si) == Gcalc_function::shape_polygon))
clear_b_state(si);
else if (get_shape_kind(si) == Gcalc_function::shape_line)
invert_i_state(si);
clear_i_state(si);
}
if (scan_it.get_event_position() == scan_it.get_event_end())
......
......@@ -104,6 +104,8 @@ public:
void set_states(int *shape_states) { i_states= shape_states; }
int alloc_states();
void invert_i_state(gcalc_shape_info shape) { i_states[shape]^= 1; }
void set_i_state(gcalc_shape_info shape) { i_states[shape]= 1; }
void clear_i_state(gcalc_shape_info shape) { i_states[shape]= 0; }
void set_b_state(gcalc_shape_info shape) { b_states[shape]= 1; }
void clear_b_state(gcalc_shape_info shape) { b_states[shape]= 0; }
int get_state(gcalc_shape_info shape)
......
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