diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2011-09-23 17:00:36 +0500 |
---|---|---|
committer | Alexey Botchkov <holyfoot@askmonty.org> | 2011-09-23 17:00:36 +0500 |
commit | 6e7d578b2b3fad8671504785b757e53b11516b22 (patch) | |
tree | bae936260d8fbced7090f092e5a8e0ca0064fbd1 | |
parent | 5b83aee35dffff0de4758a2a595624a18bec2b3e (diff) | |
download | mariadb-git-6e7d578b2b3fad8671504785b757e53b11516b22.tar.gz |
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
-rw-r--r-- | mysql-test/r/gis-precise.result | 3 | ||||
-rw-r--r-- | mysql-test/t/gis-precise.test | 4 | ||||
-rw-r--r-- | sql/gcalc_tools.cc | 4 | ||||
-rw-r--r-- | sql/gcalc_tools.h | 2 |
4 files changed, 11 insertions, 2 deletions
diff --git a/mysql-test/r/gis-precise.result b/mysql-test/r/gis-precise.result index 1bfd805d141..9086dec78a0 100644 --- a/mysql-test/r/gis-precise.result +++ b/mysql-test/r/gis-precise.result @@ -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 diff --git a/mysql-test/t/gis-precise.test b/mysql-test/t/gis-precise.test index 36218c56f17..1de8726a7bc 100644 --- a/mysql-test/t/gis-precise.test +++ b/mysql-test/t/gis-precise.test @@ -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)') ); + diff --git a/sql/gcalc_tools.cc b/sql/gcalc_tools.cc index 69071c16ee8..8e881b84c5d 100644 --- a/sql/gcalc_tools.cc +++ b/sql/gcalc_tools.cc @@ -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()) diff --git a/sql/gcalc_tools.h b/sql/gcalc_tools.h index 5e98d46a90f..d79ba630506 100644 --- a/sql/gcalc_tools.h +++ b/sql/gcalc_tools.h @@ -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) |