| 1 | /* |
| 2 | Copyright (C) 2009-2016 Brazil |
| 3 | Copyright (C) 2025 Sutou Kouhei <[email protected]> |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | This library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with this library; if not, write to the Free Software |
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #pragma once |
| 21 | |
| 22 | #include "grn.h"cxx . . $ `<file>/lib/grn.h`/ |
| 23 | #include "grn_ii.h"cxx . . $ `<file>/lib/grn_ii.h`/ |
| 24 | #include "grn_db.h"cxx . . $ `<file>/lib/grn_db.h`/ |
| 25 | |
| 26 | #ifdef __cpluspluscxx . . $ `<built-in>:470:9`! |
| 27 | extern "C" { |
| 28 | #endif |
| 29 | |
| 30 | #define GRN_GEO_RADIUScxx . . $ `lib/grn_geo.h:30:9`! 6357303 |
| 31 | #define GRN_GEO_BES_C1cxx . . $ `lib/grn_geo.h:31:9`! 6334834 |
| 32 | #define GRN_GEO_BES_C2cxx . . $ `lib/grn_geo.h:32:9`! 6377397 |
| 33 | #define GRN_GEO_BES_C3cxx . . $ `lib/grn_geo.h:33:9`! 0.006674 |
| 34 | #define GRN_GEO_GRS_C1cxx . . $ `lib/grn_geo.h:34:9`! 6335439 |
| 35 | #define GRN_GEO_GRS_C2cxx . . $ `lib/grn_geo.h:35:9`! 6378137 |
| 36 | #define GRN_GEO_GRS_C3cxx . . $ `lib/grn_geo.h:36:9`! 0.006694 |
| 37 | |
| 38 | #define GRN_GEO_MAX_LATITUDEcxx . . $ `lib/grn_geo.h:38:9`! 324000000 /* 90 * 60 * 60 * 1000 */ |
| 39 | #define GRN_GEO_MAX_LONGITUDEcxx . . $ `lib/grn_geo.h:39:9`! (648000000 - 1) /* 180 * 60 * 60 * 1000 - 1 */ |
| 40 | #define GRN_GEO_MIN_LATITUDEcxx . . $ `lib/grn_geo.h:40:9`! -GRN_GEO_MAX_LATITUDEcxx . . $ `lib/grn_geo.h:38:9`! |
| 41 | #define GRN_GEO_MIN_LONGITUDEcxx . . $ `lib/grn_geo.h:41:9`! -GRN_GEO_MAX_LONGITUDEcxx . . $ `lib/grn_geo.h:39:9`! |
| 42 | |
| 43 | #define GRN_GEO_KEY_MAX_BITScxx . . $ `lib/grn_geo.h:43:9`! 64 |
| 44 | |
| 45 | typedef enumcxx . . $ $anonymous_type_7c56213e446f27c4_0# { |
| 46 | GRN_GEO_APPROXIMATE_RECTANGLEcxx . . $ GRN_GEO_APPROXIMATE_RECTANGLE., |
| 47 | GRN_GEO_APPROXIMATE_SPHEREcxx . . $ GRN_GEO_APPROXIMATE_SPHERE., |
| 48 | GRN_GEO_APPROXIMATE_ELLIPSOIDcxx . . $ GRN_GEO_APPROXIMATE_ELLIPSOID. |
| 49 | } grn_geo_approximate_typecxx . . $ grn_geo_approximate_type#; |
| 50 | |
| 51 | typedef enumcxx . . $ $anonymous_type_7c56213e446f27c4_1# { |
| 52 | GRN_GEO_CURSOR_ENTRY_STATUS_NONEcxx . . $ GRN_GEO_CURSOR_ENTRY_STATUS_NONE. = 0, |
| 53 | GRN_GEO_CURSOR_ENTRY_STATUS_TOP_INCLUDEDcxx . . $ GRN_GEO_CURSOR_ENTRY_STATUS_TOP_INCLUDED. = 1 << 0, |
| 54 | GRN_GEO_CURSOR_ENTRY_STATUS_BOTTOM_INCLUDEDcxx . . $ GRN_GEO_CURSOR_ENTRY_STATUS_BOTTOM_INCLUDED. = 1 << 1, |
| 55 | GRN_GEO_CURSOR_ENTRY_STATUS_LEFT_INCLUDEDcxx . . $ GRN_GEO_CURSOR_ENTRY_STATUS_LEFT_INCLUDED. = 1 << 2, |
| 56 | GRN_GEO_CURSOR_ENTRY_STATUS_RIGHT_INCLUDEDcxx . . $ GRN_GEO_CURSOR_ENTRY_STATUS_RIGHT_INCLUDED. = 1 << 3, |
| 57 | GRN_GEO_CURSOR_ENTRY_STATUS_LATITUDE_INNERcxx . . $ GRN_GEO_CURSOR_ENTRY_STATUS_LATITUDE_INNER. = 1 << 4, |
| 58 | GRN_GEO_CURSOR_ENTRY_STATUS_LONGITUDE_INNERcxx . . $ GRN_GEO_CURSOR_ENTRY_STATUS_LONGITUDE_INNER. = 1 << 5 |
| 59 | } grn_geo_cursor_entry_status_flagcxx . . $ grn_geo_cursor_entry_status_flag#; |
| 60 | |
| 61 | typedef enumcxx . . $ $anonymous_type_7c56213e446f27c4_2# { |
| 62 | GRN_GEO_AREA_NORTH_EASTcxx . . $ GRN_GEO_AREA_NORTH_EAST., |
| 63 | GRN_GEO_AREA_NORTH_WESTcxx . . $ GRN_GEO_AREA_NORTH_WEST., |
| 64 | GRN_GEO_AREA_SOUTH_WESTcxx . . $ GRN_GEO_AREA_SOUTH_WEST., |
| 65 | GRN_GEO_AREA_SOUTH_EASTcxx . . $ GRN_GEO_AREA_SOUTH_EAST., |
| 66 | GRN_GEO_AREA_LASTcxx . . $ GRN_GEO_AREA_LAST. |
| 67 | } grn_geo_area_typecxx . . $ grn_geo_area_type#; |
| 68 | |
| 69 | #define GRN_GEO_N_AREAScxx . . $ `lib/grn_geo.h:69:9`! GRN_GEO_AREA_LAST |
| 70 | |
| 71 | typedef structcxx . . $ $anonymous_type_7c56213e446f27c4_3# { |
| 72 | uint8_tcxx . . $ uint8_t# keycxx . . $ $anonymous_type_7c56213e446f27c4_3#key.[sizeof(grn_geo_pointcxx . . $ grn_geo_point#)]; |
| 73 | int target_bitcxx . . $ $anonymous_type_7c56213e446f27c4_3#target_bit.; |
| 74 | int status_flagscxx . . $ $anonymous_type_7c56213e446f27c4_3#status_flags.; |
| 75 | } grn_geo_cursor_entrycxx . . $ grn_geo_cursor_entry#; |
| 76 | |
| 77 | typedef structcxx . . $ $anonymous_type_7c56213e446f27c4_4# { |
| 78 | grn_geo_pointcxx . . $ grn_geo_point# top_leftcxx . . $ $anonymous_type_7c56213e446f27c4_4#top_left.; |
| 79 | grn_geo_pointcxx . . $ grn_geo_point# bottom_rightcxx . . $ $anonymous_type_7c56213e446f27c4_4#bottom_right.; |
| 80 | uint8_tcxx . . $ uint8_t# top_left_keycxx . . $ $anonymous_type_7c56213e446f27c4_4#top_left_key.[sizeof(grn_geo_pointcxx . . $ grn_geo_point#)]; |
| 81 | uint8_tcxx . . $ uint8_t# bottom_right_keycxx . . $ $anonymous_type_7c56213e446f27c4_4#bottom_right_key.[sizeof(grn_geo_pointcxx . . $ grn_geo_point#)]; |
| 82 | int current_entrycxx . . $ $anonymous_type_7c56213e446f27c4_4#current_entry.; |
| 83 | grn_geo_cursor_entrycxx . . $ grn_geo_cursor_entry# entriescxx . . $ $anonymous_type_7c56213e446f27c4_4#entries.[GRN_GEO_KEY_MAX_BITScxx . . $ `lib/grn_geo.h:43:9`!]; |
| 84 | } grn_geo_cursor_areacxx . . $ grn_geo_cursor_area#; |
| 85 | |
| 86 | typedef structcxx . . $ $anonymous_type_7c56213e446f27c4_5# { |
| 87 | grn_db_objcxx . . $ grn_db_obj# objcxx . . $ $anonymous_type_7c56213e446f27c4_5#obj.; |
| 88 | grn_objcxx . . $ grn_obj# *patcxx . . $ $anonymous_type_7c56213e446f27c4_5#pat.; |
| 89 | grn_objcxx . . $ grn_obj# *indexcxx . . $ $anonymous_type_7c56213e446f27c4_5#index.; |
| 90 | grn_geo_pointcxx . . $ grn_geo_point# top_leftcxx . . $ $anonymous_type_7c56213e446f27c4_5#top_left.; |
| 91 | grn_geo_pointcxx . . $ grn_geo_point# bottom_rightcxx . . $ $anonymous_type_7c56213e446f27c4_5#bottom_right.; |
| 92 | grn_geo_pointcxx . . $ grn_geo_point# centercxx . . $ $anonymous_type_7c56213e446f27c4_5#center.; |
| 93 | grn_geo_pointcxx . . $ grn_geo_point# currentcxx . . $ $anonymous_type_7c56213e446f27c4_5#current.; |
| 94 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! need_distancecxx . . $ $anonymous_type_7c56213e446f27c4_5#need_distance.; |
| 95 | grn_table_cursorcxx . . $ grn_table_cursor# *pat_cursorcxx . . $ $anonymous_type_7c56213e446f27c4_5#pat_cursor.; |
| 96 | grn_ii_cursorcxx . . $ grn_ii_cursor# *ii_cursorcxx . . $ $anonymous_type_7c56213e446f27c4_5#ii_cursor.; |
| 97 | int offsetcxx . . $ $anonymous_type_7c56213e446f27c4_5#offset.; |
| 98 | int restcxx . . $ $anonymous_type_7c56213e446f27c4_5#rest.; |
| 99 | int minimum_reduce_bitcxx . . $ $anonymous_type_7c56213e446f27c4_5#minimum_reduce_bit.; |
| 100 | grn_geo_area_typecxx . . $ grn_geo_area_type# current_areacxx . . $ $anonymous_type_7c56213e446f27c4_5#current_area.; |
| 101 | grn_geo_cursor_areacxx . . $ grn_geo_cursor_area# areascxx . . $ $anonymous_type_7c56213e446f27c4_5#areas.[GRN_GEO_N_AREAScxx . . $ GRN_GEO_AREA_LAST.]; |
| 102 | } grn_geo_cursor_in_rectanglecxx . . $ grn_geo_cursor_in_rectangle#; |
| 103 | |
| 104 | grn_rccxx . . $ grn_rc# |
| 105 | grn_geo_cursor_closecxx . . $ grn_geo_cursor_close(4865d068a46d0f83).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *geo_cursor); |
| 106 | |
| 107 | grn_rccxx . . $ grn_rc# |
| 108 | grn_geo_resolve_approximate_typecxx . . $ grn_geo_resolve_approximate_type(86997f310e277b98).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 109 | grn_objcxx . . $ grn_obj# *type_name, |
| 110 | grn_geo_approximate_typecxx . . $ grn_geo_approximate_type# *type); |
| 111 | |
| 112 | /** |
| 113 | * grn_geo_select_in_circle: |
| 114 | * @index: the index column for TokyoGeoPoint or WGS84GeoPpoint type. |
| 115 | * @center_point: the center point of the target circle. (ShortText, Text, |
| 116 | * LongText, TokyoGeoPoint or WGS84GeoPoint) |
| 117 | * @distance: the radius of the target circle (Int32, |
| 118 | * UInt32, Int64, UInt64 or Float) or the point |
| 119 | * on the circumference of the target circle. (ShortText, Text, LongText, |
| 120 | * TokyoGeoPoint or WGS84GeoPoint) |
| 121 | * @approximate_type: the approximate type to compute |
| 122 | * distance. |
| 123 | * @res: the table to store found record IDs. It must be |
| 124 | * GRN_TABLE_HASH_KEY type table. |
| 125 | * @op: the operator for matched records. |
| 126 | * |
| 127 | * It selects records that are in the circle specified by |
| 128 | * @center_point and @distance from @center_point. Records |
| 129 | * are searched by @index. Found records are added to @res |
| 130 | * table with @op operation. |
| 131 | **/ |
| 132 | grn_rccxx . . $ grn_rc# |
| 133 | grn_geo_select_in_circlecxx . . $ grn_geo_select_in_circle(4c21f20e11d439c3).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 134 | grn_objcxx . . $ grn_obj# *index, |
| 135 | grn_objcxx . . $ grn_obj# *center_point, |
| 136 | grn_objcxx . . $ grn_obj# *distance, |
| 137 | grn_geo_approximate_typecxx . . $ grn_geo_approximate_type# approximate_type, |
| 138 | grn_objcxx . . $ grn_obj# *res, |
| 139 | grn_operatorcxx . . $ grn_operator# op); |
| 140 | |
| 141 | grn_rccxx . . $ grn_rc# |
| 142 | grn_selector_geo_in_circlecxx . . $ grn_selector_geo_in_circle(2267fc2522c8e143).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 143 | grn_objcxx . . $ grn_obj# *table, |
| 144 | grn_objcxx . . $ grn_obj# *index, |
| 145 | int nargs, |
| 146 | grn_objcxx . . $ grn_obj# **args, |
| 147 | grn_objcxx . . $ grn_obj# *res, |
| 148 | grn_operatorcxx . . $ grn_operator# op); |
| 149 | grn_rccxx . . $ grn_rc# |
| 150 | grn_selector_geo_in_rectanglecxx . . $ grn_selector_geo_in_rectangle(2267fc2522c8e143).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 151 | grn_objcxx . . $ grn_obj# *table, |
| 152 | grn_objcxx . . $ grn_obj# *index, |
| 153 | int nargs, |
| 154 | grn_objcxx . . $ grn_obj# **args, |
| 155 | grn_objcxx . . $ grn_obj# *res, |
| 156 | grn_operatorcxx . . $ grn_operator# op); |
| 157 | |
| 158 | GRN_APIcxx . . $ `lib/grn.h:84:13`! boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! |
| 159 | grn_geo_in_circlecxx . . $ grn_geo_in_circle(e6c95e462de3c07).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 160 | grn_objcxx . . $ grn_obj# *point, |
| 161 | grn_objcxx . . $ grn_obj# *center, |
| 162 | grn_objcxx . . $ grn_obj# *radius_or_point, |
| 163 | grn_geo_approximate_typecxx . . $ grn_geo_approximate_type# approximate_type); |
| 164 | GRN_APIcxx . . $ `lib/grn.h:84:13`! boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! |
| 165 | grn_geo_in_rectanglecxx . . $ grn_geo_in_rectangle(67353b157293bb80).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 166 | grn_objcxx . . $ grn_obj# *point, |
| 167 | grn_objcxx . . $ grn_obj# *top_left, |
| 168 | grn_objcxx . . $ grn_obj# *bottom_right); |
| 169 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! |
| 170 | grn_geo_in_rectangle_rawcxx . . $ grn_geo_in_rectangle_raw(673da8d2ce007d30).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 171 | grn_geo_pointcxx . . $ grn_geo_point# *point, |
| 172 | grn_geo_pointcxx . . $ grn_geo_point# *top_left, |
| 173 | grn_geo_pointcxx . . $ grn_geo_point# *bottom_right); |
| 174 | double |
| 175 | grn_geo_distancecxx . . $ grn_geo_distance(c8fc4aa50dd36c79).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 176 | grn_objcxx . . $ grn_obj# *point1, |
| 177 | grn_objcxx . . $ grn_obj# *point2, |
| 178 | grn_geo_approximate_typecxx . . $ grn_geo_approximate_type# type); |
| 179 | grn_rccxx . . $ grn_rc# |
| 180 | grn_geo_distance_sortercxx . . $ grn_geo_distance_sorter(7034fb15f72963af).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_sorter_datacxx . . $ grn_sorter_data# *data); |
| 181 | GRN_APIcxx . . $ `lib/grn.h:84:13`! double |
| 182 | grn_geo_distance_rectanglecxx . . $ grn_geo_distance_rectangle(58fe0e666eafa6a2).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *point1, grn_objcxx . . $ grn_obj# *point2); |
| 183 | GRN_APIcxx . . $ `lib/grn.h:84:13`! double |
| 184 | grn_geo_distance_spherecxx . . $ grn_geo_distance_sphere(58fe0e666eafa6a2).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *point1, grn_objcxx . . $ grn_obj# *point2); |
| 185 | GRN_APIcxx . . $ `lib/grn.h:84:13`! double |
| 186 | grn_geo_distance_ellipsoidcxx . . $ grn_geo_distance_ellipsoid(58fe0e666eafa6a2).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *point1, grn_objcxx . . $ grn_obj# *point2); |
| 187 | double |
| 188 | grn_geo_distance_rectangle_rawcxx . . $ grn_geo_distance_rectangle_raw(efce70e58f1fe0a0).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 189 | grn_geo_pointcxx . . $ grn_geo_point# *point1, |
| 190 | grn_geo_pointcxx . . $ grn_geo_point# *point2); |
| 191 | double |
| 192 | grn_geo_distance_sphere_rawcxx . . $ grn_geo_distance_sphere_raw(efce70e58f1fe0a0).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 193 | grn_geo_pointcxx . . $ grn_geo_point# *point1, |
| 194 | grn_geo_pointcxx . . $ grn_geo_point# *point2); |
| 195 | double |
| 196 | grn_geo_distance_ellipsoid_rawcxx . . $ grn_geo_distance_ellipsoid_raw(93f279ea6bc01a4e).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 197 | grn_geo_pointcxx . . $ grn_geo_point# *point1, |
| 198 | grn_geo_pointcxx . . $ grn_geo_point# *point2, |
| 199 | int c1, |
| 200 | int c2, |
| 201 | double c3); |
| 202 | double |
| 203 | grn_geo_distance_ellipsoid_raw_tokyocxx . . $ grn_geo_distance_ellipsoid_raw_tokyo(efce70e58f1fe0a0).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 204 | grn_geo_pointcxx . . $ grn_geo_point# *point1, |
| 205 | grn_geo_pointcxx . . $ grn_geo_point# *point2); |
| 206 | double |
| 207 | grn_geo_distance_ellipsoid_raw_wgs84cxx . . $ grn_geo_distance_ellipsoid_raw_wgs84(efce70e58f1fe0a0).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 208 | grn_geo_pointcxx . . $ grn_geo_point# *point1, |
| 209 | grn_geo_pointcxx . . $ grn_geo_point# *point2); |
| 210 | |
| 211 | #ifdef __cpluspluscxx . . $ `<built-in>:470:9`! |
| 212 | } |
| 213 | #endif |