@@ -965,50 +965,21 @@ class Item_func_spatial_mbr_rel: public Item_bool_func2
965
965
};
966
966
967
967
968
- class Item_func_spatial_rel final : public Item_bool_func2
968
+ class Item_func_spatial_rel : public Item_bool_func2
969
969
{
970
- enum Functype spatial_rel;
971
- String tmp_value1,tmp_value2;
972
970
public:
973
- Item_func_spatial_rel (const POS &pos, Item *a,Item *b, enum Functype sp_rel);
974
- virtual ~Item_func_spatial_rel ();
971
+ Item_func_spatial_rel (const POS &pos, Item *a, Item *b)
972
+ : Item_bool_func2(pos, a, b)
973
+ {}
975
974
longlong val_int () override ;
976
- enum Functype functype () const override
977
- {
978
- return spatial_rel;
979
- }
980
- enum Functype rev_functype () const override
981
- {
982
- switch (spatial_rel)
983
- {
984
- case SP_CONTAINS_FUNC:
985
- return SP_WITHIN_FUNC;
986
- case SP_WITHIN_FUNC:
987
- return SP_CONTAINS_FUNC;
988
- default :
989
- return spatial_rel;
990
- }
991
- }
992
975
993
- const char *func_name () const override ;
994
- void print (String *str, enum_query_type query_type) override
995
- {
996
- Item_func::print (str, query_type);
997
- }
998
-
999
- bool resolve_type (THD *) override
1000
- {
1001
- maybe_null= true ;
1002
- return false ;
1003
- }
1004
- bool is_null () override { val_int (); return null_value; }
1005
-
1006
- template <typename CoordinateSystemType>
976
+ // Use is not restricted to subclasses. Also used by setops,
977
+ // BG_geometry_collection::merge_one_run() and
978
+ // linear_areal_intersect_infinite().
1007
979
static int bg_geo_relation_check (Geometry *g1, Geometry *g2,
1008
980
Functype relchk_type, bool *);
1009
981
1010
- protected:
1011
-
982
+ private:
1012
983
template <typename Geom_types>
1013
984
friend class BG_wrap ;
1014
985
@@ -1043,7 +1014,6 @@ class Item_func_spatial_rel final : public Item_bool_func2
1043
1014
1044
1015
template <typename Coordsys>
1045
1016
int geocol_relation_check (Geometry *g1, Geometry *g2);
1046
- template <typename Coordsys>
1047
1017
int geocol_relcheck_intersect_disjoint (const typename BG_geometry_collection::
1048
1018
Geometry_list *gv1,
1049
1019
const typename BG_geometry_collection::
@@ -1052,7 +1022,8 @@ class Item_func_spatial_rel final : public Item_bool_func2
1052
1022
int geocol_relcheck_within (const typename BG_geometry_collection::
1053
1023
Geometry_list *gv1,
1054
1024
const typename BG_geometry_collection::
1055
- Geometry_list *gv2);
1025
+ Geometry_list *gv2,
1026
+ Functype spatial_rel);
1056
1027
template <typename Coordsys>
1057
1028
int geocol_equals_check (const typename BG_geometry_collection::
1058
1029
Geometry_list *gv1,
@@ -1061,6 +1032,198 @@ class Item_func_spatial_rel final : public Item_bool_func2
1061
1032
};
1062
1033
1063
1034
1035
+ class Item_func_st_contains final : public Item_func_spatial_rel
1036
+ {
1037
+ public:
1038
+ Item_func_st_contains (const POS &pos, Item *a, Item *b)
1039
+ : Item_func_spatial_rel(pos, a, b)
1040
+ {}
1041
+ enum Functype functype () const override
1042
+ { return SP_CONTAINS_FUNC; }
1043
+ enum Functype rev_functype () const override
1044
+ { return SP_WITHIN_FUNC; }
1045
+ const char *func_name () const override
1046
+ { return " st_contains" ; }
1047
+ bool resolve_type (THD *) override
1048
+ {
1049
+ maybe_null= true ;
1050
+ return false ;
1051
+ }
1052
+ void print (String *str, enum_query_type query_type) override
1053
+ {
1054
+ Item_func::print (str, query_type);
1055
+ }
1056
+ };
1057
+
1058
+
1059
+ class Item_func_st_crosses final : public Item_func_spatial_rel
1060
+ {
1061
+ public:
1062
+ Item_func_st_crosses (const POS &pos, Item *a, Item *b)
1063
+ : Item_func_spatial_rel(pos, a, b)
1064
+ {}
1065
+ enum Functype functype () const override
1066
+ { return SP_CROSSES_FUNC; }
1067
+ enum Functype rev_functype () const override
1068
+ { return SP_CROSSES_FUNC; }
1069
+ const char *func_name () const override
1070
+ { return " st_crosses" ; }
1071
+ bool resolve_type (THD *) override
1072
+ {
1073
+ maybe_null= true ;
1074
+ return false ;
1075
+ }
1076
+ void print (String *str, enum_query_type query_type) override
1077
+ {
1078
+ Item_func::print (str, query_type);
1079
+ }
1080
+ };
1081
+
1082
+
1083
+ class Item_func_st_disjoint final : public Item_func_spatial_rel
1084
+ {
1085
+ public:
1086
+ Item_func_st_disjoint (const POS &pos, Item *a, Item *b)
1087
+ : Item_func_spatial_rel(pos, a, b)
1088
+ {}
1089
+ enum Functype functype () const override
1090
+ { return SP_DISJOINT_FUNC; }
1091
+ enum Functype rev_functype () const override
1092
+ { return SP_DISJOINT_FUNC; }
1093
+ const char *func_name () const override
1094
+ { return " st_disjoint" ; }
1095
+ bool resolve_type (THD *) override
1096
+ {
1097
+ maybe_null= true ;
1098
+ return false ;
1099
+ }
1100
+ void print (String *str, enum_query_type query_type) override
1101
+ {
1102
+ Item_func::print (str, query_type);
1103
+ }
1104
+ };
1105
+
1106
+
1107
+ class Item_func_st_equals final : public Item_func_spatial_rel
1108
+ {
1109
+ public:
1110
+ Item_func_st_equals (const POS &pos, Item *a, Item *b)
1111
+ : Item_func_spatial_rel(pos, a, b)
1112
+ {}
1113
+ enum Functype functype () const override
1114
+ { return SP_EQUALS_FUNC; }
1115
+ enum Functype rev_functype () const override
1116
+ { return SP_EQUALS_FUNC; }
1117
+ const char *func_name () const override
1118
+ { return " st_equals" ; }
1119
+ bool resolve_type (THD *) override
1120
+ {
1121
+ maybe_null= true ;
1122
+ return false ;
1123
+ }
1124
+ void print (String *str, enum_query_type query_type) override
1125
+ {
1126
+ Item_func::print (str, query_type);
1127
+ }
1128
+ };
1129
+
1130
+
1131
+ class Item_func_st_intersects final : public Item_func_spatial_rel
1132
+ {
1133
+ public:
1134
+ Item_func_st_intersects (const POS &pos, Item *a, Item *b)
1135
+ : Item_func_spatial_rel(pos, a, b)
1136
+ {}
1137
+ enum Functype functype () const override
1138
+ { return SP_INTERSECTS_FUNC; }
1139
+ enum Functype rev_functype () const override
1140
+ { return SP_INTERSECTS_FUNC; }
1141
+ const char *func_name () const override
1142
+ { return " st_intersects" ; }
1143
+ bool resolve_type (THD *) override
1144
+ {
1145
+ maybe_null= true ;
1146
+ return false ;
1147
+ }
1148
+ void print (String *str, enum_query_type query_type) override
1149
+ {
1150
+ Item_func::print (str, query_type);
1151
+ }
1152
+ };
1153
+
1154
+
1155
+ class Item_func_st_overlaps final : public Item_func_spatial_rel
1156
+ {
1157
+ public:
1158
+ Item_func_st_overlaps (const POS &pos, Item *a, Item *b)
1159
+ : Item_func_spatial_rel(pos, a, b)
1160
+ {}
1161
+ enum Functype functype () const override
1162
+ { return SP_OVERLAPS_FUNC; }
1163
+ enum Functype rev_functype () const override
1164
+ { return SP_OVERLAPS_FUNC; }
1165
+ const char *func_name () const override
1166
+ { return " st_overlaps" ; }
1167
+ bool resolve_type (THD *) override
1168
+ {
1169
+ maybe_null= true ;
1170
+ return false ;
1171
+ }
1172
+ void print (String *str, enum_query_type query_type) override
1173
+ {
1174
+ Item_func::print (str, query_type);
1175
+ }
1176
+ };
1177
+
1178
+
1179
+ class Item_func_st_touches final : public Item_func_spatial_rel
1180
+ {
1181
+ public:
1182
+ Item_func_st_touches (const POS &pos, Item *a, Item *b)
1183
+ : Item_func_spatial_rel(pos, a, b)
1184
+ {}
1185
+ enum Functype functype () const override
1186
+ { return SP_TOUCHES_FUNC; }
1187
+ enum Functype rev_functype () const override
1188
+ { return SP_TOUCHES_FUNC; }
1189
+ const char *func_name () const override
1190
+ { return " st_touches" ; }
1191
+ bool resolve_type (THD *) override
1192
+ {
1193
+ maybe_null= true ;
1194
+ return false ;
1195
+ }
1196
+ void print (String *str, enum_query_type query_type) override
1197
+ {
1198
+ Item_func::print (str, query_type);
1199
+ }
1200
+ };
1201
+
1202
+
1203
+ class Item_func_st_within final : public Item_func_spatial_rel
1204
+ {
1205
+ public:
1206
+ Item_func_st_within (const POS &pos, Item *a, Item *b)
1207
+ : Item_func_spatial_rel(pos, a, b)
1208
+ {}
1209
+ enum Functype functype () const override
1210
+ { return SP_WITHIN_FUNC; }
1211
+ enum Functype rev_functype () const override
1212
+ { return SP_CONTAINS_FUNC; }
1213
+ const char *func_name () const override
1214
+ { return " st_within" ; }
1215
+ bool resolve_type (THD *) override
1216
+ {
1217
+ maybe_null= true ;
1218
+ return false ;
1219
+ }
1220
+ void print (String *str, enum_query_type query_type) override
1221
+ {
1222
+ Item_func::print (str, query_type);
1223
+ }
1224
+ };
1225
+
1226
+
1064
1227
/* *
1065
1228
Spatial operations
1066
1229
*/
0 commit comments