Debian Codegraph @

rtree/core.py

raw symbols SCIP
1 from __future__ import annotations
2
3 import ctypes
4
5 from . import finder
6 from .exceptions import RTreeError
7
8
9 def check_return(result, func, cargs):
10 "Error checking for Error calls"
11 if result != 0:
12 s = rt.Error_GetLastErrorMsg().decode()
13 msg = f'Error in "{func.__name__}": {s}'
14 rt.Error_Reset()
15 raise RTreeError(msg)
16 return True
17
18
19 def check_void(result, func, cargs):
20 "Error checking for void* returns"
21 if not bool(result):
22 s = rt.Error_GetLastErrorMsg().decode()
23 msg = f'Error in "{func.__name__}": {s}'
24 rt.Error_Reset()
25 raise RTreeError(msg)
26 return result
27
28
29 def check_void_done(result, func, cargs):
30 "Error checking for void* returns that might be empty with no error"
31 if rt.Error_GetErrorCount():
32 s = rt.Error_GetLastErrorMsg().decode()
33 msg = f'Error in "{func.__name__}": {s}'
34 rt.Error_Reset()
35 raise RTreeError(msg)
36 return result
37
38
39 def check_value(result, func, cargs):
40 "Error checking proper value returns"
41 count = rt.Error_GetErrorCount()
42 if count != 0:
43 s = rt.Error_GetLastErrorMsg().decode()
44 msg = f'Error in "{func.__name__}": {s}'
45 rt.Error_Reset()
46 raise RTreeError(msg)
47 return result
48
49
50 def check_value_free(result, func, cargs):
51 "Error checking proper value returns"
52 count = rt.Error_GetErrorCount()
53 if count != 0:
54 s = rt.Error_GetLastErrorMsg().decode()
55 msg = f'Error in "{func.__name__}": {s}'
56 rt.Error_Reset()
57 raise RTreeError(msg)
58 return result
59
60
61 def free_returned_char_p(result, func, cargs):
62 retvalue = ctypes.string_at(result)
63 p = ctypes.cast(result, ctypes.POINTER(ctypes.c_void_p))
64 rt.Index_Free(p)
65 return retvalue
66
67
68 def free_error_msg_ptr(result, func, cargs):
69 retvalue = ctypes.string_at(result)
70 p = ctypes.cast(result, ctypes.POINTER(ctypes.c_void_p))
71 rt.Index_Free(p)
72 return retvalue
73
74
75 # load the shared library by looking in likely places
76 rt = finder.load()
77
78 rt.SIDX_Version.argtypes = []
79 rt.SIDX_Version.restype = ctypes.POINTER(ctypes.c_char)
80 rt.SIDX_Version.errcheck = free_returned_char_p # type: ignore
81
82 rt.Error_GetLastErrorNum.argtypes = []
83 rt.Error_GetLastErrorNum.restype = ctypes.c_int
84
85 rt.Error_GetLastErrorMsg.argtypes = []
86 rt.Error_GetLastErrorMsg.restype = ctypes.POINTER(ctypes.c_char)
87 rt.Error_GetLastErrorMsg.errcheck = free_error_msg_ptr # type: ignore
88
89 rt.Error_GetLastErrorMethod.argtypes = []
90 rt.Error_GetLastErrorMethod.restype = ctypes.POINTER(ctypes.c_char)
91 rt.Error_GetLastErrorMethod.errcheck = free_returned_char_p # type: ignore
92
93 rt.Error_GetErrorCount.argtypes = []
94 rt.Error_GetErrorCount.restype = ctypes.c_int
95
96 rt.Error_Reset.argtypes = []
97 rt.Error_Reset.restype = None
98
99 rt.Index_Create.argtypes = [ctypes.c_void_p]
100 rt.Index_Create.restype = ctypes.c_void_p
101 rt.Index_Create.errcheck = check_void # type: ignore
102
103 _nDataLength_size_t = True
104 try:
105 _major, _minor, _patch = (
106 int(part) for part in rt.SIDX_Version().decode("ascii").split(".")
107 )
108 except (ValueError, UnicodeDecodeError):
109 pass # weird version; assume latest ABI
110 else:
111 if (_major, _minor, _patch) < (1, 9, 0):
112 # Headers had size_t*, but implementation had uint32_t*
113 _nDataLength_size_t = False
114 NEXTFUNC = ctypes.CFUNCTYPE(
115 ctypes.c_int,
116 ctypes.POINTER(ctypes.c_int64),
117 ctypes.POINTER(ctypes.POINTER(ctypes.c_double)),
118 ctypes.POINTER(ctypes.POINTER(ctypes.c_double)),
119 ctypes.POINTER(ctypes.c_uint32),
120 ctypes.POINTER(ctypes.POINTER(ctypes.c_ubyte)),
121 ctypes.POINTER(ctypes.c_size_t if _nDataLength_size_t else ctypes.c_uint32),
122 )
123
124 rt.Index_CreateWithStream.argtypes = [ctypes.c_void_p, NEXTFUNC]
125 rt.Index_CreateWithStream.restype = ctypes.c_void_p
126 rt.Index_CreateWithStream.errcheck = check_void # type: ignore
127
128 try:
129 rt.Index_CreateWithArray.argtypes = [
130 ctypes.c_void_p,
131 ctypes.c_uint64,
132 ctypes.c_uint32,
133 ctypes.c_uint64,
134 ctypes.c_uint64,
135 ctypes.c_uint64,
136 ctypes.c_void_p,
137 ctypes.c_void_p,
138 ctypes.c_void_p,
139 ]
140 rt.Index_CreateWithArray.restype = ctypes.c_void_p
141 rt.Index_CreateWithArray.errcheck = check_void # type: ignore
142 except AttributeError:
143 pass
144
145 rt.Index_Destroy.argtypes = [ctypes.c_void_p]
146 rt.Index_Destroy.restype = None
147 rt.Index_Destroy.errcheck = check_void_done # type: ignore
148
149 rt.Index_GetProperties.argtypes = [ctypes.c_void_p]
150 rt.Index_GetProperties.restype = ctypes.c_void_p
151 rt.Index_GetProperties.errcheck = check_void # type: ignore
152
153 rt.Index_DeleteData.argtypes = [
154 ctypes.c_void_p,
155 ctypes.c_int64,
156 ctypes.POINTER(ctypes.c_double),
157 ctypes.POINTER(ctypes.c_double),
158 ctypes.c_uint32,
159 ]
160 rt.Index_DeleteData.restype = ctypes.c_int
161 rt.Index_DeleteData.errcheck = check_return # type: ignore
162
163 rt.Index_InsertData.argtypes = [
164 ctypes.c_void_p,
165 ctypes.c_int64,
166 ctypes.POINTER(ctypes.c_double),
167 ctypes.POINTER(ctypes.c_double),
168 ctypes.c_uint32,
169 ctypes.POINTER(ctypes.c_ubyte),
170 ctypes.c_uint32,
171 ]
172 rt.Index_InsertData.restype = ctypes.c_int
173 rt.Index_InsertData.errcheck = check_return # type: ignore
174
175 rt.Index_GetBounds.argtypes = [
176 ctypes.c_void_p,
177 ctypes.POINTER(ctypes.POINTER(ctypes.c_double)),
178 ctypes.POINTER(ctypes.POINTER(ctypes.c_double)),
179 ctypes.POINTER(ctypes.c_uint32),
180 ]
181 rt.Index_GetBounds.restype = ctypes.c_int
182 rt.Index_GetBounds.errcheck = check_value # type: ignore
183
184 rt.Index_IsValid.argtypes = [ctypes.c_void_p]
185 rt.Index_IsValid.restype = ctypes.c_int
186 rt.Index_IsValid.errcheck = check_value # type: ignore
187
188 rt.Index_Intersects_obj.argtypes = [
189 ctypes.c_void_p,
190 ctypes.POINTER(ctypes.c_double),
191 ctypes.POINTER(ctypes.c_double),
192 ctypes.c_uint32,
193 ctypes.POINTER(ctypes.POINTER(ctypes.c_void_p)),
194 ctypes.POINTER(ctypes.c_uint64),
195 ]
196 rt.Index_Intersects_obj.restype = ctypes.c_int
197 rt.Index_Intersects_obj.errcheck = check_return # type: ignore
198
199
200 rt.Index_Intersects_id.argtypes = [
201 ctypes.c_void_p,
202 ctypes.POINTER(ctypes.c_double),
203 ctypes.POINTER(ctypes.c_double),
204 ctypes.c_uint32,
205 ctypes.POINTER(ctypes.POINTER(ctypes.c_int64)),
206 ctypes.POINTER(ctypes.c_uint64),
207 ]
208 rt.Index_Intersects_id.restype = ctypes.c_int
209 rt.Index_Intersects_id.errcheck = check_return # type: ignore
210
211 rt.Index_Intersects_count.argtypes = [
212 ctypes.c_void_p,
213 ctypes.POINTER(ctypes.c_double),
214 ctypes.POINTER(ctypes.c_double),
215 ctypes.c_uint32,
216 ctypes.POINTER(ctypes.c_uint64),
217 ]
218
219 rt.Index_NearestNeighbors_obj.argtypes = [
220 ctypes.c_void_p,
221 ctypes.POINTER(ctypes.c_double),
222 ctypes.POINTER(ctypes.c_double),
223 ctypes.c_uint32,
224 ctypes.POINTER(ctypes.POINTER(ctypes.c_void_p)),
225 ctypes.POINTER(ctypes.c_uint64),
226 ]
227 rt.Index_NearestNeighbors_obj.restype = ctypes.c_int
228 rt.Index_NearestNeighbors_obj.errcheck = check_return # type: ignore
229
230 rt.Index_NearestNeighbors_id.argtypes = [
231 ctypes.c_void_p,
232 ctypes.POINTER(ctypes.c_double),
233 ctypes.POINTER(ctypes.c_double),
234 ctypes.c_uint32,
235 ctypes.POINTER(ctypes.POINTER(ctypes.c_int64)),
236 ctypes.POINTER(ctypes.c_uint64),
237 ]
238 rt.Index_NearestNeighbors_id.restype = ctypes.c_int
239 rt.Index_NearestNeighbors_id.errcheck = check_return # type: ignore
240
241 try:
242 rt.Index_NearestNeighbors_id_v.argtypes = [
243 ctypes.c_void_p,
244 ctypes.c_int64,
245 ctypes.c_int64,
246 ctypes.c_uint32,
247 ctypes.c_uint64,
248 ctypes.c_uint64,
249 ctypes.c_uint64,
250 ctypes.c_void_p,
251 ctypes.c_void_p,
252 ctypes.c_void_p,
253 ctypes.c_void_p,
254 ctypes.c_void_p,
255 ctypes.POINTER(ctypes.c_int64),
256 ]
257 rt.Index_NearestNeighbors_id_v.restype = ctypes.c_int
258 rt.Index_NearestNeighbors_id_v.errcheck = check_return # type: ignore
259
260 rt.Index_Intersects_id_v.argtypes = [
261 ctypes.c_void_p,
262 ctypes.c_int64,
263 ctypes.c_uint32,
264 ctypes.c_uint64,
265 ctypes.c_uint64,
266 ctypes.c_uint64,
267 ctypes.c_void_p,
268 ctypes.c_void_p,
269 ctypes.c_void_p,
270 ctypes.c_void_p,
271 ctypes.POINTER(ctypes.c_int64),
272 ]
273 rt.Index_Intersects_id_v.restype = ctypes.c_int
274 rt.Index_Intersects_id_v.errcheck = check_return # type: ignore
275 except AttributeError:
276 pass
277
278
279 rt.Index_GetLeaves.argtypes = [
280 ctypes.c_void_p,
281 ctypes.POINTER(ctypes.c_uint32),
282 ctypes.POINTER(ctypes.POINTER(ctypes.c_uint32)),
283 ctypes.POINTER(ctypes.POINTER(ctypes.c_int64)),
284 ctypes.POINTER(ctypes.POINTER(ctypes.POINTER(ctypes.c_int64))),
285 ctypes.POINTER(ctypes.POINTER(ctypes.POINTER(ctypes.c_double))),
286 ctypes.POINTER(ctypes.POINTER(ctypes.POINTER(ctypes.c_double))),
287 ctypes.POINTER(ctypes.c_uint32),
288 ]
289 rt.Index_GetLeaves.restype = ctypes.c_int
290 rt.Index_GetLeaves.errcheck = check_return # type: ignore
291
292 rt.Index_DestroyObjResults.argtypes = [
293 ctypes.POINTER(ctypes.POINTER(ctypes.c_void_p)),
294 ctypes.c_uint32,
295 ]
296 rt.Index_DestroyObjResults.restype = None
297 rt.Index_DestroyObjResults.errcheck = check_void_done # type: ignore
298
299 rt.Index_ClearBuffer.argtypes = [ctypes.c_void_p]
300 rt.Index_ClearBuffer.restype = None
301 rt.Index_ClearBuffer.errcheck = check_void_done # type: ignore
302
303 rt.Index_Free.argtypes = [ctypes.POINTER(ctypes.c_void_p)]
304 rt.Index_Free.restype = None
305
306 rt.IndexItem_Destroy.argtypes = [ctypes.c_void_p]
307 rt.IndexItem_Destroy.restype = None
308 rt.IndexItem_Destroy.errcheck = check_void_done # type: ignore
309
310 rt.IndexItem_GetData.argtypes = [
311 ctypes.c_void_p,
312 ctypes.POINTER(ctypes.POINTER(ctypes.c_ubyte)),
313 ctypes.POINTER(ctypes.c_uint64),
314 ]
315 rt.IndexItem_GetData.restype = ctypes.c_int
316 rt.IndexItem_GetData.errcheck = check_value # type: ignore
317
318 rt.IndexItem_GetBounds.argtypes = [
319 ctypes.c_void_p,
320 ctypes.POINTER(ctypes.POINTER(ctypes.c_double)),
321 ctypes.POINTER(ctypes.POINTER(ctypes.c_double)),
322 ctypes.POINTER(ctypes.c_uint32),
323 ]
324 rt.IndexItem_GetBounds.restype = ctypes.c_int
325 rt.IndexItem_GetBounds.errcheck = check_value # type: ignore
326
327 rt.IndexItem_GetID.argtypes = [ctypes.c_void_p]
328 rt.IndexItem_GetID.restype = ctypes.c_int64
329 rt.IndexItem_GetID.errcheck = check_value # type: ignore
330
331 try:
332 rt.Index_GetResultSetOffset.argtypes = [ctypes.c_void_p]
333 rt.Index_GetResultSetOffset.restype = ctypes.c_int64
334 rt.Index_GetResultSetOffset.errcheck = check_value # type: ignore
335
336 rt.Index_SetResultSetOffset.argtypes = [ctypes.c_void_p, ctypes.c_int64]
337 rt.Index_SetResultSetOffset.restype = ctypes.c_int
338 rt.Index_SetResultSetOffset.errcheck = check_return # type: ignore
339
340 rt.Index_GetResultSetLimit.argtypes = [ctypes.c_void_p]
341 rt.Index_GetResultSetLimit.restype = ctypes.c_int64
342 rt.Index_GetResultSetLimit.errcheck = check_value # type: ignore
343
344 rt.Index_SetResultSetLimit.argtypes = [ctypes.c_void_p, ctypes.c_int64]
345 rt.Index_SetResultSetLimit.restype = ctypes.c_int
346 rt.Index_SetResultSetLimit.errcheck = check_return # type: ignore
347
348 rt.Index_Flush.argtypes = [ctypes.c_void_p]
349 rt.Index_Flush.restype = None
350 rt.Index_Flush.errcheck = check_void_done # type: ignore
351
352 rt.Index_Contains_obj.argtypes = [
353 ctypes.c_void_p,
354 ctypes.POINTER(ctypes.c_double),
355 ctypes.POINTER(ctypes.c_double),
356 ctypes.c_uint32,
357 ctypes.POINTER(ctypes.POINTER(ctypes.c_void_p)),
358 ctypes.POINTER(ctypes.c_uint64),
359 ]
360 rt.Index_Contains_obj.restype = ctypes.c_int
361 rt.Index_Contains_obj.errcheck = check_return # type: ignore
362
363 rt.Index_Contains_id.argtypes = [
364 ctypes.c_void_p,
365 ctypes.POINTER(ctypes.c_double),
366 ctypes.POINTER(ctypes.c_double),
367 ctypes.c_uint32,
368 ctypes.POINTER(ctypes.POINTER(ctypes.c_int64)),
369 ctypes.POINTER(ctypes.c_uint64),
370 ]
371 rt.Index_Contains_id.restype = ctypes.c_int
372 rt.Index_Contains_id.errcheck = check_return # type: ignore
373
374 except AttributeError:
375 pass
376
377 rt.IndexProperty_Create.argtypes = []
378 rt.IndexProperty_Create.restype = ctypes.c_void_p
379 rt.IndexProperty_Create.errcheck = check_void # type: ignore
380
381 rt.IndexProperty_Destroy.argtypes = [ctypes.c_void_p]
382 rt.IndexProperty_Destroy.restype = None
383 rt.IndexProperty_Destroy.errcheck = check_void_done # type: ignore
384
385 rt.IndexProperty_SetIndexType.argtypes = [ctypes.c_void_p, ctypes.c_int]
386 rt.IndexProperty_SetIndexType.restype = ctypes.c_int
387 rt.IndexProperty_SetIndexType.errcheck = check_return # type: ignore
388
389 rt.IndexProperty_GetIndexType.argtypes = [ctypes.c_void_p]
390 rt.IndexProperty_GetIndexType.restype = ctypes.c_int
391 rt.IndexProperty_GetIndexType.errcheck = check_value # type: ignore
392
393 rt.IndexProperty_SetDimension.argtypes = [ctypes.c_void_p, ctypes.c_uint32]
394 rt.IndexProperty_SetDimension.restype = ctypes.c_int
395 rt.IndexProperty_SetDimension.errcheck = check_return # type: ignore
396
397 rt.IndexProperty_GetDimension.argtypes = [ctypes.c_void_p]
398 rt.IndexProperty_GetDimension.restype = ctypes.c_uint32
399 rt.IndexProperty_GetDimension.errcheck = check_value # type: ignore
400
401 rt.IndexProperty_SetIndexVariant.argtypes = [ctypes.c_void_p, ctypes.c_int]
402 rt.IndexProperty_SetIndexVariant.restype = ctypes.c_int
403 rt.IndexProperty_SetIndexVariant.errcheck = check_return # type: ignore
404
405 rt.IndexProperty_GetIndexVariant.argtypes = [ctypes.c_void_p]
406 rt.IndexProperty_GetIndexVariant.restype = ctypes.c_int
407 rt.IndexProperty_GetIndexVariant.errcheck = check_value # type: ignore
408
409 rt.IndexProperty_SetIndexStorage.argtypes = [ctypes.c_void_p, ctypes.c_int]
410 rt.IndexProperty_SetIndexStorage.restype = ctypes.c_int
411 rt.IndexProperty_SetIndexStorage.errcheck = check_return # type: ignore
412
413 rt.IndexProperty_GetIndexStorage.argtypes = [ctypes.c_void_p]
414 rt.IndexProperty_GetIndexStorage.restype = ctypes.c_int
415 rt.IndexProperty_GetIndexStorage.errcheck = check_value # type: ignore
416
417 rt.IndexProperty_SetIndexCapacity.argtypes = [ctypes.c_void_p, ctypes.c_uint32]
418 rt.IndexProperty_SetIndexCapacity.restype = ctypes.c_int
419 rt.IndexProperty_SetIndexCapacity.errcheck = check_return # type: ignore
420
421 rt.IndexProperty_GetIndexCapacity.argtypes = [ctypes.c_void_p]
422 rt.IndexProperty_GetIndexCapacity.restype = ctypes.c_uint32
423 rt.IndexProperty_GetIndexCapacity.errcheck = check_value # type: ignore
424
425 rt.IndexProperty_SetLeafCapacity.argtypes = [ctypes.c_void_p, ctypes.c_uint32]
426 rt.IndexProperty_SetLeafCapacity.restype = ctypes.c_int
427 rt.IndexProperty_SetLeafCapacity.errcheck = check_return # type: ignore
428
429 rt.IndexProperty_GetLeafCapacity.argtypes = [ctypes.c_void_p]
430 rt.IndexProperty_GetLeafCapacity.restype = ctypes.c_uint32
431 rt.IndexProperty_GetLeafCapacity.errcheck = check_value # type: ignore
432
433 rt.IndexProperty_SetPagesize.argtypes = [ctypes.c_void_p, ctypes.c_uint32]
434 rt.IndexProperty_SetPagesize.restype = ctypes.c_int
435 rt.IndexProperty_SetPagesize.errcheck = check_return # type: ignore
436
437 rt.IndexProperty_GetPagesize.argtypes = [ctypes.c_void_p]
438 rt.IndexProperty_GetPagesize.restype = ctypes.c_uint32
439 rt.IndexProperty_GetPagesize.errcheck = check_value # type: ignore
440
441 rt.IndexProperty_SetLeafPoolCapacity.argtypes = [ctypes.c_void_p, ctypes.c_uint32]
442 rt.IndexProperty_SetLeafPoolCapacity.restype = ctypes.c_int
443 rt.IndexProperty_SetLeafPoolCapacity.errcheck = check_return # type: ignore
444
445 rt.IndexProperty_GetLeafPoolCapacity.argtypes = [ctypes.c_void_p]
446 rt.IndexProperty_GetLeafPoolCapacity.restype = ctypes.c_uint32
447 rt.IndexProperty_GetLeafPoolCapacity.errcheck = check_value # type: ignore
448
449 rt.IndexProperty_SetIndexPoolCapacity.argtypes = [ctypes.c_void_p, ctypes.c_uint32]
450 rt.IndexProperty_SetIndexPoolCapacity.restype = ctypes.c_int
451 rt.IndexProperty_SetIndexPoolCapacity.errcheck = check_return # type: ignore
452
453 rt.IndexProperty_GetIndexPoolCapacity.argtypes = [ctypes.c_void_p]
454 rt.IndexProperty_GetIndexPoolCapacity.restype = ctypes.c_uint32
455 rt.IndexProperty_GetIndexPoolCapacity.errcheck = check_value # type: ignore
456
457 rt.IndexProperty_SetRegionPoolCapacity.argtypes = [ctypes.c_void_p, ctypes.c_uint32]
458 rt.IndexProperty_SetRegionPoolCapacity.restype = ctypes.c_int
459 rt.IndexProperty_SetRegionPoolCapacity.errcheck = check_return # type: ignore
460
461 rt.IndexProperty_GetRegionPoolCapacity.argtypes = [ctypes.c_void_p]
462 rt.IndexProperty_GetRegionPoolCapacity.restype = ctypes.c_uint32
463 rt.IndexProperty_GetRegionPoolCapacity.errcheck = check_value # type: ignore
464
465 rt.IndexProperty_SetPointPoolCapacity.argtypes = [ctypes.c_void_p, ctypes.c_uint32]
466 rt.IndexProperty_SetPointPoolCapacity.restype = ctypes.c_int
467 rt.IndexProperty_SetPointPoolCapacity.errcheck = check_return # type: ignore
468
469 rt.IndexProperty_GetPointPoolCapacity.argtypes = [ctypes.c_void_p]
470 rt.IndexProperty_GetPointPoolCapacity.restype = ctypes.c_uint32
471 rt.IndexProperty_GetPointPoolCapacity.errcheck = check_value # type: ignore
472
473 rt.IndexProperty_SetBufferingCapacity.argtypes = [ctypes.c_void_p, ctypes.c_uint32]
474 rt.IndexProperty_SetBufferingCapacity.restype = ctypes.c_int
475 rt.IndexProperty_SetBufferingCapacity.errcheck = check_return # type: ignore
476
477 rt.IndexProperty_GetBufferingCapacity.argtypes = [ctypes.c_void_p]
478 rt.IndexProperty_GetBufferingCapacity.restype = ctypes.c_uint32
479 rt.IndexProperty_GetBufferingCapacity.errcheck = check_value # type: ignore
480
481 rt.IndexProperty_SetEnsureTightMBRs.argtypes = [ctypes.c_void_p, ctypes.c_uint32]
482 rt.IndexProperty_SetEnsureTightMBRs.restype = ctypes.c_int
483 rt.IndexProperty_SetEnsureTightMBRs.errcheck = check_return # type: ignore
484
485 rt.IndexProperty_GetEnsureTightMBRs.argtypes = [ctypes.c_void_p]
486 rt.IndexProperty_GetEnsureTightMBRs.restype = ctypes.c_uint32
487 rt.IndexProperty_GetEnsureTightMBRs.errcheck = check_value # type: ignore
488
489 rt.IndexProperty_SetOverwrite.argtypes = [ctypes.c_void_p, ctypes.c_uint32]
490 rt.IndexProperty_SetOverwrite.restype = ctypes.c_int
491 rt.IndexProperty_SetOverwrite.errcheck = check_return # type: ignore
492
493 rt.IndexProperty_GetOverwrite.argtypes = [ctypes.c_void_p]
494 rt.IndexProperty_GetOverwrite.restype = ctypes.c_uint32
495 rt.IndexProperty_GetOverwrite.errcheck = check_value # type: ignore
496
497 rt.IndexProperty_SetNearMinimumOverlapFactor.argtypes = [
498 ctypes.c_void_p,
499 ctypes.c_uint32,
500 ]
501 rt.IndexProperty_SetNearMinimumOverlapFactor.restype = ctypes.c_int
502 rt.IndexProperty_SetNearMinimumOverlapFactor.errcheck = check_return # type: ignore
503
504 rt.IndexProperty_GetNearMinimumOverlapFactor.argtypes = [ctypes.c_void_p]
505 rt.IndexProperty_GetNearMinimumOverlapFactor.restype = ctypes.c_uint32
506 rt.IndexProperty_GetNearMinimumOverlapFactor.errcheck = check_value # type: ignore
507
508 rt.IndexProperty_SetWriteThrough.argtypes = [ctypes.c_void_p, ctypes.c_uint32]
509 rt.IndexProperty_SetWriteThrough.restype = ctypes.c_int
510 rt.IndexProperty_SetWriteThrough.errcheck = check_return # type: ignore
511
512 rt.IndexProperty_GetWriteThrough.argtypes = [ctypes.c_void_p]
513 rt.IndexProperty_GetWriteThrough.restype = ctypes.c_uint32
514 rt.IndexProperty_GetWriteThrough.errcheck = check_value # type: ignore
515
516 rt.IndexProperty_SetFillFactor.argtypes = [ctypes.c_void_p, ctypes.c_double]
517 rt.IndexProperty_SetFillFactor.restype = ctypes.c_int
518 rt.IndexProperty_SetFillFactor.errcheck = check_return # type: ignore
519
520 rt.IndexProperty_GetFillFactor.argtypes = [ctypes.c_void_p]
521 rt.IndexProperty_GetFillFactor.restype = ctypes.c_double
522 rt.IndexProperty_GetFillFactor.errcheck = check_value # type: ignore
523
524 rt.IndexProperty_SetSplitDistributionFactor.argtypes = [
525 ctypes.c_void_p,
526 ctypes.c_double,
527 ]
528 rt.IndexProperty_SetSplitDistributionFactor.restype = ctypes.c_int
529 rt.IndexProperty_SetSplitDistributionFactor.errcheck = check_return # type: ignore
530
531 rt.IndexProperty_GetSplitDistributionFactor.argtypes = [ctypes.c_void_p]
532 rt.IndexProperty_GetSplitDistributionFactor.restype = ctypes.c_double
533 rt.IndexProperty_GetSplitDistributionFactor.errcheck = check_value # type: ignore
534
535 rt.IndexProperty_SetTPRHorizon.argtypes = [ctypes.c_void_p, ctypes.c_double]
536 rt.IndexProperty_SetTPRHorizon.restype = ctypes.c_int
537 rt.IndexProperty_SetTPRHorizon.errcheck = check_return # type: ignore
538
539 rt.IndexProperty_GetTPRHorizon.argtypes = [ctypes.c_void_p]
540 rt.IndexProperty_GetTPRHorizon.restype = ctypes.c_double
541 rt.IndexProperty_GetTPRHorizon.errcheck = check_value # type: ignore
542
543 rt.IndexProperty_SetReinsertFactor.argtypes = [ctypes.c_void_p, ctypes.c_double]
544 rt.IndexProperty_SetReinsertFactor.restype = ctypes.c_int
545 rt.IndexProperty_SetReinsertFactor.errcheck = check_return # type: ignore
546
547 rt.IndexProperty_GetReinsertFactor.argtypes = [ctypes.c_void_p]
548 rt.IndexProperty_GetReinsertFactor.restype = ctypes.c_double
549 rt.IndexProperty_GetReinsertFactor.errcheck = check_value # type: ignore
550
551 rt.IndexProperty_SetFileName.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
552 rt.IndexProperty_SetFileName.restype = ctypes.c_int
553 rt.IndexProperty_SetFileName.errcheck = check_return # type: ignore
554
555 rt.IndexProperty_GetFileName.argtypes = [ctypes.c_void_p]
556 rt.IndexProperty_GetFileName.errcheck = free_returned_char_p # type: ignore
557 rt.IndexProperty_GetFileName.restype = ctypes.POINTER(ctypes.c_char)
558
559 rt.IndexProperty_SetFileNameExtensionDat.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
560 rt.IndexProperty_SetFileNameExtensionDat.restype = ctypes.c_int
561 rt.IndexProperty_SetFileNameExtensionDat.errcheck = check_return # type: ignore
562
563 rt.IndexProperty_GetFileNameExtensionDat.argtypes = [ctypes.c_void_p]
564 rt.IndexProperty_GetFileNameExtensionDat.errcheck = free_returned_char_p # type: ignore
565 rt.IndexProperty_GetFileNameExtensionDat.restype = ctypes.POINTER(ctypes.c_char)
566
567 rt.IndexProperty_SetFileNameExtensionIdx.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
568 rt.IndexProperty_SetFileNameExtensionIdx.restype = ctypes.c_int
569 rt.IndexProperty_SetFileNameExtensionIdx.errcheck = check_return # type: ignore
570
571 rt.IndexProperty_GetFileNameExtensionIdx.argtypes = [ctypes.c_void_p]
572 rt.IndexProperty_GetFileNameExtensionIdx.errcheck = free_returned_char_p # type: ignore
573 rt.IndexProperty_GetFileNameExtensionIdx.restype = ctypes.POINTER(ctypes.c_char)
574
575 rt.IndexProperty_SetCustomStorageCallbacksSize.argtypes = [
576 ctypes.c_void_p,
577 ctypes.c_uint32,
578 ]
579 rt.IndexProperty_SetCustomStorageCallbacksSize.restype = ctypes.c_int
580 rt.IndexProperty_SetCustomStorageCallbacksSize.errcheck = check_return # type: ignore
581
582 rt.IndexProperty_GetCustomStorageCallbacksSize.argtypes = [ctypes.c_void_p]
583 rt.IndexProperty_GetCustomStorageCallbacksSize.restype = ctypes.c_uint32
584 rt.IndexProperty_GetCustomStorageCallbacksSize.errcheck = check_value # type: ignore
585
586 rt.IndexProperty_SetCustomStorageCallbacks.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
587 rt.IndexProperty_SetCustomStorageCallbacks.restype = ctypes.c_int
588 rt.IndexProperty_SetCustomStorageCallbacks.errcheck = check_return # type: ignore
589
590 rt.IndexProperty_GetCustomStorageCallbacks.argtypes = [ctypes.c_void_p]
591 rt.IndexProperty_GetCustomStorageCallbacks.restype = ctypes.c_void_p
592 rt.IndexProperty_GetCustomStorageCallbacks.errcheck = check_value # type: ignore
593
594 rt.IndexProperty_SetIndexID.argtypes = [ctypes.c_void_p, ctypes.c_int64]
595 rt.IndexProperty_SetIndexID.restype = ctypes.c_int
596 rt.IndexProperty_SetIndexID.errcheck = check_return # type: ignore
597
598 rt.IndexProperty_GetIndexID.argtypes = [ctypes.c_void_p]
599 rt.IndexProperty_GetIndexID.restype = ctypes.c_int64
600 rt.IndexProperty_GetIndexID.errcheck = check_value # type: ignore
601
602 rt.SIDX_NewBuffer.argtypes = [ctypes.c_size_t]
603 rt.SIDX_NewBuffer.restype = ctypes.c_void_p
604 rt.SIDX_NewBuffer.errcheck = check_void # type: ignore
605
606 rt.SIDX_DeleteBuffer.argtypes = [ctypes.c_void_p]
607 rt.SIDX_DeleteBuffer.restype = None
608
609 # TPR-Tree API
610 try:
611 rt.Index_InsertTPData.argtypes = [
612 ctypes.c_void_p,
613 ctypes.c_int64,
614 ctypes.POINTER(ctypes.c_double),
615 ctypes.POINTER(ctypes.c_double),
616 ctypes.POINTER(ctypes.c_double),
617 ctypes.POINTER(ctypes.c_double),
618 ctypes.c_double,
619 ctypes.c_double,
620 ctypes.c_uint32,
621 ctypes.POINTER(ctypes.c_ubyte),
622 ctypes.c_size_t,
623 ]
624 rt.Index_InsertTPData.restype = ctypes.c_int
625 rt.Index_InsertTPData.errcheck = check_return # type: ignore
626
627 rt.Index_DeleteTPData.argtypes = [
628 ctypes.c_void_p,
629 ctypes.c_int64,
630 ctypes.POINTER(ctypes.c_double),
631 ctypes.POINTER(ctypes.c_double),
632 ctypes.POINTER(ctypes.c_double),
633 ctypes.POINTER(ctypes.c_double),
634 ctypes.c_double,
635 ctypes.c_double,
636 ctypes.c_uint32,
637 ]
638 rt.Index_DeleteTPData.restype = ctypes.c_int
639 rt.Index_DeleteTPData.errcheck = check_return # type: ignore
640
641 rt.Index_TPIntersects_id.argtypes = [
642 ctypes.c_void_p,
643 ctypes.POINTER(ctypes.c_double),
644 ctypes.POINTER(ctypes.c_double),
645 ctypes.POINTER(ctypes.c_double),
646 ctypes.POINTER(ctypes.c_double),
647 ctypes.c_double,
648 ctypes.c_double,
649 ctypes.c_uint32,
650 ctypes.POINTER(ctypes.POINTER(ctypes.c_int64)),
651 ctypes.POINTER(ctypes.c_uint64),
652 ]
653 rt.Index_TPIntersects_id.restype = ctypes.c_int
654 rt.Index_TPIntersects_id.errcheck = check_return # type: ignore
655
656 rt.Index_TPIntersects_obj.argtypes = [
657 ctypes.c_void_p,
658 ctypes.POINTER(ctypes.c_double),
659 ctypes.POINTER(ctypes.c_double),
660 ctypes.POINTER(ctypes.c_double),
661 ctypes.POINTER(ctypes.c_double),
662 ctypes.c_double,
663 ctypes.c_double,
664 ctypes.c_uint32,
665 ctypes.POINTER(ctypes.POINTER(ctypes.c_void_p)),
666 ctypes.POINTER(ctypes.c_uint64),
667 ]
668 rt.Index_TPIntersects_obj.restype = ctypes.c_int
669 rt.Index_TPIntersects_obj.errcheck = check_return # type: ignore
670
671 rt.Index_TPIntersects_count.argtypes = [
672 ctypes.c_void_p,
673 ctypes.POINTER(ctypes.c_double),
674 ctypes.POINTER(ctypes.c_double),
675 ctypes.POINTER(ctypes.c_double),
676 ctypes.POINTER(ctypes.c_double),
677 ctypes.c_double,
678 ctypes.c_double,
679 ctypes.c_uint32,
680 ctypes.POINTER(ctypes.c_uint64),
681 ]
682 rt.Index_TPIntersects_count.restype = ctypes.c_int
683 rt.Index_TPIntersects_count.errcheck = check_return # type: ignore
684
685 rt.Index_TPNearestNeighbors_id.argtypes = [
686 ctypes.c_void_p,
687 ctypes.POINTER(ctypes.c_double),
688 ctypes.POINTER(ctypes.c_double),
689 ctypes.POINTER(ctypes.c_double),
690 ctypes.POINTER(ctypes.c_double),
691 ctypes.c_double,
692 ctypes.c_double,
693 ctypes.c_uint32,
694 ctypes.POINTER(ctypes.POINTER(ctypes.c_int64)),
695 ctypes.POINTER(ctypes.c_uint64),
696 ]
697 rt.Index_TPNearestNeighbors_id.restype = ctypes.c_int
698 rt.Index_TPNearestNeighbors_id.errcheck = check_return # type: ignore
699
700 rt.Index_TPNearestNeighbors_obj.argtypes = [
701 ctypes.c_void_p,
702 ctypes.POINTER(ctypes.c_double),
703 ctypes.POINTER(ctypes.c_double),
704 ctypes.POINTER(ctypes.c_double),
705 ctypes.POINTER(ctypes.c_double),
706 ctypes.c_double,
707 ctypes.c_double,
708 ctypes.c_uint32,
709 ctypes.POINTER(ctypes.POINTER(ctypes.c_void_p)),
710 ctypes.POINTER(ctypes.c_uint64),
711 ]
712 rt.Index_TPNearestNeighbors_obj.restype = ctypes.c_int
713 rt.Index_TPNearestNeighbors_obj.errcheck = check_return # type: ignore
714 except AttributeError:
715 pass