38 # define LAST_ERROR_BUFFER_SIZE 1024
46 static __thread
struct
49 char message[LAST_ERROR_BUFFER_SIZE];
50 char method[LAST_ERROR_BUFFER_SIZE];
57 # pragma warning(push)
58 # pragma warning(disable: 4127)
61 #define VALIDATE_POINTER0(ptr, func) \
62 do { if( NULL == ptr ) { \
63 RTError const ret = RT_Failure; \
64 std::ostringstream msg; \
65 msg << "Pointer \'" << #ptr << "\' is NULL in \'" << (func) <<"\'."; \
66 std::string message(msg.str()); \
67 Error_PushError( ret, message.c_str(), (func)); \
71 #define VALIDATE_POINTER1(ptr, func, rc) \
72 do { if( NULL == ptr ) { \
73 RTError const ret = RT_Failure; \
74 std::ostringstream msg; \
75 msg << "Pointer \'" << #ptr << "\' is NULL in \'" << (func) <<"\'."; \
76 std::string message(msg.str()); \
77 Error_PushError( ret, message.c_str(), (func)); \
87 if (
errors.empty())
return;
96 if (
errors.empty())
return;
103 return last_error.code;
116 if (last_error.code) {
117 return STRDUP(last_error.message);
133 if (last_error.code) {
134 return STRDUP(last_error.method);
151 last_error.code = code;
152 strncpy(last_error.message, message, LAST_ERROR_BUFFER_SIZE - 1);
153 strncpy(last_error.method, method, LAST_ERROR_BUFFER_SIZE - 1);
154 last_error.message[LAST_ERROR_BUFFER_SIZE-1] =
'\0';
155 last_error.method[LAST_ERROR_BUFFER_SIZE-1] =
'\0';
157 Error err =
Error(code, std::string(message), std::string(method));
164 return last_error.code ? 1 : 0;
166 return static_cast<int>(
errors.size());
183 }
catch (std::exception
const& e)
198 int (*readNext)(
SpatialIndex::id_type *
id,
double **pMin,
double **pMax, uint32_t *nDimension,
const uint8_t **pData,
size_t *nDataLength)
211 "Index_CreateWithStream");
212 }
catch (std::exception
const& e)
216 "Index_CreateWithStream");
221 "Index_CreateWithStream");
236 ArrayStream(uint64_t n_, uint32_t d_, uint64_t i_stri_, uint64_t d_i_stri_,
237 uint64_t d_j_stri_, int64_t* ids_,
double* mins_,
double* maxs_)
238 : d(d_), i(0), n(n_), i_stri(i_stri_), d_i_stri(d_i_stri_),
239 d_j_stri(d_j_stri_), ids(ids_), tmp(
new double[2*d_]), mins(mins_),
243 ~ArrayStream() {
delete[] tmp; }
245 IData* getNext()
override
250 for (uint32_t j = 0; j < d; ++j)
252 tmp[j] = mins[i*d_i_stri + j*d_j_stri];
253 tmp[j + d] = maxs[i*d_i_stri + j*d_j_stri];
255 Region r(tmp, tmp + d, d);
257 return new RTree::Data(0,
nullptr, r, ids[i++*i_stri]);
260 bool hasNext()
override {
return i < n; }
261 void rewind()
override {}
262 uint32_t size()
override {
return 0; }
265 uint64_t i, n, i_stri, d_i_stri, d_j_stri;
267 double* tmp, *mins, *maxs;
270 ArrayStream* bs =
new ArrayStream(n, dimension, i_stri, d_i_stri, d_j_stri,
274 return (
IndexH)
new Index(*prop, std::unique_ptr<IDataStream>(bs));
279 "Index_CreateWithArray");
280 }
catch (std::exception
const& e)
284 "Index_CreateWithArray");
288 "Index_CreateWithArray");
331 "Index_DeleteTPData");
333 }
catch (std::exception
const& e)
337 "Index_DeleteTPData");
342 "Index_DeleteTPData");
367 "Index_DeleteMVRData");
369 }
catch (std::exception
const& e)
373 "Index_DeleteMVRData");
378 "Index_DeleteMVRData");
402 }
catch (std::exception
const& e)
426 const uint8_t* pData,
438 bool isPoint =
false;
440 double const epsilon = std::numeric_limits<double>::epsilon();
442 double length(0), vlength(0);
443 for (uint32_t i = 0; i < nDimension; ++i) {
444 double delta = pdMin[i] - pdMax[i];
445 length += std::fabs(delta);
447 double vDelta = pdVMin[i] - pdVMax[i];
448 vlength += std::fabs(vDelta);
451 if ((length <= epsilon) && (vlength <= epsilon)){
455 if (isPoint ==
true) {
473 "Index_InsertTPData");
476 }
catch (std::exception
const& e)
480 "Index_InsertTPData");
486 "Index_InsertTPData");
501 const uint8_t* pData,
513 bool isPoint =
false;
515 double const epsilon = std::numeric_limits<double>::epsilon();
518 for (uint32_t i = 0; i < nDimension; ++i) {
519 double delta = pdMin[i] - pdMax[i];
520 length += std::fabs(delta);
523 if (length <= epsilon){
527 if (isPoint ==
true) {
545 "Index_InsertMVRData");
548 }
catch (std::exception
const& e)
552 "Index_InsertMVRData");
558 "Index_InsertMVRData");
571 const uint8_t* pData,
582 bool isPoint =
false;
584 double const epsilon = std::numeric_limits<double>::epsilon();
587 for (uint32_t i = 0; i < nDimension; ++i) {
588 double delta = pdMin[i] - pdMax[i];
589 length += std::fabs(delta);
592 if (length <= epsilon) {
596 if (isPoint ==
true) {
617 }
catch (std::exception
const& e)
647 int64_t nResultLimit, nStart;
668 "Index_TPIntersects_obj");
672 }
catch (std::exception
const& e)
676 "Index_TPIntersects_obj");
683 "Index_TPIntersects_obj");
702 int64_t nResultLimit, nStart;
723 "Index_MVRIntersects_obj");
727 }
catch (std::exception
const& e)
731 "Index_TPIntersects_obj");
738 "Index_TPIntersects_obj");
755 int64_t nResultLimit, nStart;
778 "Index_Intersects_obj");
779 }
catch (std::exception
const& e)
785 "Index_Intersects_obj");
792 "Index_Intersects_obj");
806 int64_t nResultLimit, nStart;
828 "Index_Contains_obj");
829 }
catch (std::exception
const& e)
835 "Index_Contains_obj");
842 "Index_Contains_obj");
861 int64_t nResultLimit, nStart;
881 "Index_TPIntersects_id");
885 }
catch (std::exception
const& e)
889 "Index_TPIntersects_id");
896 "Index_TPIntersects_id");
916 int64_t nResultLimit, nStart;
936 "Index_MVRIntersects_id");
940 }
catch (std::exception
const& e)
944 "Index_MVRIntersects_id");
951 "Index_MVRIntersects_id");
970 int64_t nResultLimit, nStart;
990 "Index_Contains_id");
994 }
catch (std::exception
const& e)
998 "Index_Contains_id");
1005 "Index_Contains_id");
1017 uint32_t nDimension,
1022 Index* idx =
reinterpret_cast<Index*
>(index);
1024 int64_t nResultLimit, nStart;
1038 "Index_Intersects_id");
1040 }
catch (std::exception
const& e)
1044 "Index_Intersects_id");
1049 "Index_Intersects_id");
1068 auto& idx =
reinterpret_cast<Index*
>(index)->index();
1070 std::unique_ptr<double[]> tmp = std::unique_ptr<double[]>(
new double[2*d]);
1074 for (uint64_t i = 0; i < n; ++i)
1077 for (uint64_t j = 0; j < d; ++j)
1079 tmp[j] = mins[i*d_i_stri + j*d_j_stri];
1080 tmp[j + d] = maxs[i*d_i_stri + j*d_j_stri];
1086 idx.intersectsWithQuery(r, visitor);
1104 "Index_Intersects_id_v");
1106 }
catch (std::exception
const& e)
1110 "Index_Intersects_id_v");
1115 "Index_Intersects_id_v");
1128 uint32_t nDimension,
1132 Index* idx =
reinterpret_cast<Index*
>(index);
1149 "Index_TPIntersects_count");
1153 }
catch (std::exception
const& e)
1157 "Index_TPIntersects_count");
1164 "Index_TPIntersects_count");
1177 uint32_t nDimension,
1181 Index* idx =
reinterpret_cast<Index*
>(index);
1199 "Index_MVRIntersects_count");
1203 }
catch (std::exception
const& e)
1207 "Index_MVRIntersects_count");
1214 "Index_MVRIntersects_count");
1225 uint32_t nDimension,
1229 Index* idx =
reinterpret_cast<Index*
>(index);
1247 "Index_Intersects_count");
1251 }
catch (std::exception
const& e)
1255 "Index_Intersects_count");
1262 "Index_Intersects_count");
1273 uint32_t nDimension,
1277 Index* idx =
reinterpret_cast<Index*
>(index);
1294 "Index_Contains_count");
1298 }
catch (std::exception
const& e)
1302 "Index_Contains_count");
1309 "Index_Contains_count");
1318 double* pdStartPoint,
1320 uint32_t nDimension,
1325 Index* idx =
reinterpret_cast<Index*
>(index);
1327 int64_t nResultLimit, nStart;
1348 "Index_Intersects_obj");
1352 }
catch (std::exception
const& e)
1356 "Index_Intersects_obj");
1363 "Index_Intersects_obj");
1372 double* pdStartPoint,
1374 uint32_t nDimension,
1379 Index* idx =
reinterpret_cast<Index*
>(index);
1380 int64_t nResultLimit, nStart;
1401 "Index_Intersects_id");
1405 }
catch (std::exception
const& e)
1409 "Index_Intersects_id");
1416 "Index_Intersects_id");
1425 double* pdStartPoint,
1427 uint32_t nDimension,
1431 Index* idx =
reinterpret_cast<Index*
>(index);
1449 "Index_Intersects_count");
1453 }
catch (std::exception
const& e)
1457 "Index_Intersects_count");
1464 "Index_Intersects_count");
1479 uint32_t nDimension,
1484 Index* idx =
reinterpret_cast<Index*
>(index);
1485 int64_t nResultLimit, nStart;
1508 "Index_TPNearestNeighbors_id");
1512 }
catch (std::exception
const& e)
1516 "Index_TPNearestNeighbors_id");
1523 "Index_TPNearestNeighbors_id");
1536 uint32_t nDimension,
1541 Index* idx =
reinterpret_cast<Index*
>(index);
1542 int64_t nResultLimit, nStart;
1565 "Index_MVRNearestNeighbors_id");
1569 }
catch (std::exception
const& e)
1573 "Index_MVRNearestNeighbors_id");
1580 "Index_MVRNearestNeighbors_id");
1591 uint32_t nDimension,
1596 Index* idx =
reinterpret_cast<Index*
>(index);
1597 int64_t nResultLimit, nStart;
1616 "Index_NearestNeighbors_id");
1618 }
catch (std::exception
const& e)
1622 "Index_NearestNeighbors_id");
1627 "Index_NearestNeighbors_id");
1648 auto& idx =
reinterpret_cast<Index*
>(index)->index();
1650 std::unique_ptr<double[]> tmp = std::unique_ptr<double[]>(
new double[2*d]);
1654 for (uint64_t i = 0; i < n; ++i)
1656 double max_dist = dists ? dists[i] : 0.0;
1659 for (uint64_t j = 0; j < d; ++j)
1661 tmp[j] = mins[i*d_i_stri + j*d_j_stri];
1662 tmp[j + d] = maxs[i*d_i_stri + j*d_j_stri];
1668 max_dist = idx.nearestNeighborQuery(
static_cast<uint32_t
>(abs(knn)), r, visitor, max_dist);
1672 nrc = std::min<uint64_t>(nrc, -knn);
1677 dists[i] = max_dist;
1685 for (uint64_t l = 0; l < nrc; ++l)
1693 "Index_NearestNeighbors_id_v");
1695 }
catch (std::exception
const& e)
1699 "Index_NearestNeighbors_id_v");
1704 "Index_NearestNeighbors_id_v");
1717 uint32_t nDimension,
1722 Index* idx =
reinterpret_cast<Index*
>(index);
1724 int64_t nResultLimit, nStart;
1747 "Index_TPNearestNeighbors_obj");
1751 }
catch (std::exception
const& e)
1755 "Index_TPNearestNeighbors_obj");
1762 "Index_NearestNeighbors_obj");
1774 uint32_t nDimension,
1779 Index* idx =
reinterpret_cast<Index*
>(index);
1781 int64_t nResultLimit, nStart;
1804 "Index_MVRNearestNeighbors_obj");
1808 }
catch (std::exception
const& e)
1812 "Index_MVRNearestNeighbors_obj");
1819 "Index_NearestNeighbors_obj");
1830 uint32_t nDimension,
1835 Index* idx =
reinterpret_cast<Index*
>(index);
1837 int64_t nResultLimit, nStart;
1860 "Index_NearestNeighbors_obj");
1864 }
catch (std::exception
const& e)
1868 "Index_NearestNeighbors_obj");
1875 "Index_NearestNeighbors_obj");
1886 uint32_t nDimension,
1891 Index* idx =
reinterpret_cast<Index*
>(index);
1893 int64_t nResultLimit, nStart;
1913 "Index_Intersects_internal");
1916 }
catch (std::exception
const& e)
1920 "Index_Intersects_internal");
1926 "Index_Intersects_internal");
1936 uint32_t* nDimension)
1939 Index* idx =
reinterpret_cast<Index*
>(index);
1955 *ppdMin = (
double*) malloc (*nDimension *
sizeof(
double));
1956 *ppdMax = (
double*) malloc (*nDimension *
sizeof(
double));
1958 for (uint32_t i=0; i< *nDimension; ++i) {
1959 (*ppdMin)[i] = bounds->
getLow(i);
1960 (*ppdMax)[i] = bounds->
getHigh(i);
1972 }
catch (std::exception
const& e)
1994 Index* idx =
reinterpret_cast<Index*
>(index);
2000 "Index_SetResultSetOffset");
2009 Index* idx =
reinterpret_cast<Index*
>(index);
2018 Index* idx =
reinterpret_cast<Index*
>(index);
2024 "Index_SetResultSetLimit");
2033 Index* idx =
reinterpret_cast<Index*
>(index);
2040 Index* idx =
reinterpret_cast<Index*
>(index);
2047 Index* idx =
reinterpret_cast<Index*
>(index);
2060 Index* idx =
reinterpret_cast<Index*
>(index);
2068 for (uint32_t i=0; i< nResults; ++i) {
2069 if (results[i] != NULL) {
2088 uint32_t* nNumLeafNodes,
2089 uint32_t** nLeafSizes,
2091 int64_t*** nLeafChildIDs,
2094 uint32_t* nDimension)
2097 Index* idx =
reinterpret_cast<Index*
>(index);
2099 std::vector<LeafQueryResult>::const_iterator i;
2113 "Property Dimension must be Tools::VT_ULONG",
2125 const std::vector<LeafQueryResult>& results = query->
GetResults();
2127 *nNumLeafNodes = (uint32_t)results.size();
2129 *nLeafSizes = (uint32_t*) malloc (*nNumLeafNodes *
sizeof(uint32_t));
2130 *nLeafIDs = (int64_t*) malloc (*nNumLeafNodes *
sizeof(int64_t));
2132 *nLeafChildIDs = (int64_t**) malloc(*nNumLeafNodes *
sizeof(int64_t*));
2133 *pppdMin = (
double**) malloc (*nNumLeafNodes *
sizeof(
double*));
2134 *pppdMax = (
double**) malloc (*nNumLeafNodes *
sizeof(
double*));
2137 for (i = results.begin(); i != results.end(); ++i)
2139 std::vector<SpatialIndex::id_type>
const& ids = (*i).GetIDs();
2142 (*nLeafIDs)[k] = (*i).getIdentifier();
2143 (*nLeafSizes)[k] = (uint32_t)ids.size();
2145 (*nLeafChildIDs)[k] = (int64_t*) malloc( (*nLeafSizes)[k] *
sizeof(int64_t));
2146 (*pppdMin)[k] = (
double*) malloc (*nDimension *
sizeof(
double));
2147 (*pppdMax)[k] = (
double*) malloc (*nDimension *
sizeof(
double));
2148 for (uint32_t c=0; c< *nDimension; ++c) {
2149 (*pppdMin)[k][c] = b->
getLow(c);
2150 (*pppdMax)[k][c] = b->
getHigh(c);
2152 for (uint32_t cChild = 0; cChild < ids.size(); cChild++)
2154 (*nLeafChildIDs)[k][cChild] = ids[cChild];
2169 }
catch (std::exception
const& e)
2191 if (it != 0)
delete it;
2201 uint32_t* l=
new uint32_t;
2204 *length = (uint64_t)*l;
2205 *data = (uint8_t*) malloc (*length *
sizeof(uint8_t));
2207 memcpy(*data, p_data, *length);
2225 uint32_t* nDimension)
2244 *ppdMin = (
double*) malloc (*nDimension *
sizeof(
double));
2245 *ppdMax = (
double*) malloc (*nDimension *
sizeof(
double));
2247 if (ppdMin == NULL || ppdMax == NULL) {
2249 "Unable to allocation bounds array(s)",
2250 "IndexItem_GetBounds");
2256 for (uint32_t i=0; i< *nDimension; ++i) {
2257 (*ppdMin)[i] = bounds->
getLow(i);
2258 (*ppdMax)[i] = bounds->
getHigh(i);
2275 if (prop != 0)
delete prop;
2287 throw std::runtime_error(
"Inputted value is not a valid index type");
2299 "IndexProperty_SetIndexType");
2301 }
catch (std::exception
const& e)
2305 "IndexProperty_SetIndexType");
2310 "IndexProperty_SetIndexType");
2328 "Property IndexType must be Tools::VT_ULONG",
2329 "IndexProperty_GetIndexType");
2336 "Property IndexType was empty",
2337 "IndexProperty_GetIndexType");
2357 "IndexProperty_SetDimension");
2359 }
catch (std::exception
const& e)
2363 "IndexProperty_SetDimension");
2368 "IndexProperty_SetDimension");
2386 "Property IndexType must be Tools::VT_ULONG",
2387 "IndexProperty_GetDimension");
2396 "Property Dimension was empty",
2397 "IndexProperty_GetDimension");
2415 throw std::runtime_error(
"Inputted value is not a valid index variant");
2422 "Index type is not properly set",
2423 "IndexProperty_SetIndexVariant");
2441 "IndexProperty_SetIndexVariant");
2443 }
catch (std::exception
const& e)
2447 "IndexProperty_SetIndexCapacity");
2452 "IndexProperty_SetIndexCapacity");
2461 "IndexProperty_GetIndexVariant",
2474 "Property IndexVariant must be Tools::VT_LONG",
2475 "IndexProperty_GetIndexVariant");
2484 "Property IndexVariant was empty",
2485 "IndexProperty_GetIndexVariant");
2499 throw std::runtime_error(
"Inputted value is not a valid index storage type");
2509 "IndexProperty_SetIndexStorage");
2511 }
catch (std::exception
const& e)
2515 "IndexProperty_SetIndexStorage");
2520 "IndexProperty_SetIndexStorage");
2529 "IndexProperty_GetIndexStorage",
2541 "Property IndexStorage must be Tools::VT_ULONG",
2542 "IndexProperty_GetIndexStorage");
2551 "Property IndexStorage was empty",
2552 "IndexProperty_GetIndexStorage");
2573 "IndexProperty_SetIndexCapacity");
2575 }
catch (std::exception
const& e)
2579 "IndexProperty_SetIndexCapacity");
2584 "IndexProperty_SetIndexCapacity");
2602 "Property IndexCapacity must be Tools::VT_ULONG",
2603 "IndexProperty_GetIndexCapacity");
2612 "Property IndexCapacity was empty",
2613 "IndexProperty_GetIndexCapacity");
2633 "IndexProperty_SetLeafCapacity");
2635 }
catch (std::exception
const& e)
2639 "IndexProperty_SetLeafCapacity");
2644 "IndexProperty_SetLeafCapacity");
2662 "Property LeafCapacity must be Tools::VT_ULONG",
2663 "IndexProperty_GetLeafCapacity");
2672 "Property LeafCapacity was empty",
2673 "IndexProperty_GetLeafCapacity");
2693 "IndexProperty_SetPagesize");
2695 }
catch (std::exception
const& e)
2699 "IndexProperty_SetPagesize");
2704 "IndexProperty_SetPagesize");
2722 "Property PageSize must be Tools::VT_ULONG",
2723 "IndexProperty_GetPagesize");
2732 "Property PageSize was empty",
2733 "IndexProperty_GetPagesize");
2753 "IndexProperty_SetLeafPoolCapacity");
2755 }
catch (std::exception
const& e)
2759 "IndexProperty_SetLeafPoolCapacity");
2764 "IndexProperty_SetLeafPoolCapacity");
2782 "Property LeafPoolCapacity must be Tools::VT_ULONG",
2783 "IndexProperty_GetLeafPoolCapacity");
2792 "Property LeafPoolCapacity was empty",
2793 "IndexProperty_GetLeafPoolCapacity");
2813 "IndexProperty_SetIndexPoolCapacity");
2815 }
catch (std::exception
const& e)
2819 "IndexProperty_SetIndexPoolCapacity");
2824 "IndexProperty_SetIndexPoolCapacity");
2842 "Property IndexPoolCapacity must be Tools::VT_ULONG",
2843 "IndexProperty_GetIndexPoolCapacity");
2852 "Property IndexPoolCapacity was empty",
2853 "IndexProperty_GetIndexPoolCapacity");
2873 "IndexProperty_SetRegionPoolCapacity");
2875 }
catch (std::exception
const& e)
2879 "IndexProperty_SetRegionPoolCapacity");
2884 "IndexProperty_SetRegionPoolCapacity");
2902 "Property RegionPoolCapacity must be Tools::VT_ULONG",
2903 "IndexProperty_GetRegionPoolCapacity");
2912 "Property RegionPoolCapacity was empty",
2913 "IndexProperty_GetRegionPoolCapacity");
2933 "IndexProperty_SetPointPoolCapacity");
2935 }
catch (std::exception
const& e)
2939 "IndexProperty_SetPointPoolCapacity");
2944 "IndexProperty_SetPointPoolCapacity");
2962 "Property PointPoolCapacity must be Tools::VT_ULONG",
2963 "IndexProperty_GetPointPoolCapacity");
2972 "Property PointPoolCapacity was empty",
2973 "IndexProperty_GetPointPoolCapacity");
2981 "IndexProperty_SetNearMinimumOverlapFactor",
2990 prop->
setProperty(
"NearMinimumOverlapFactor", var);
2995 "IndexProperty_SetNearMinimumOverlapFactor");
2997 }
catch (std::exception
const& e)
3001 "IndexProperty_SetNearMinimumOverlapFactor");
3006 "IndexProperty_SetNearMinimumOverlapFactor");
3018 var = prop->
getProperty(
"NearMinimumOverlapFactor");
3024 "Property NearMinimumOverlapFactor must be Tools::VT_ULONG",
3025 "IndexProperty_GetNearMinimumOverlapFactor");
3034 "Property NearMinimumOverlapFactor was empty",
3035 "IndexProperty_GetNearMinimumOverlapFactor");
3056 "IndexProperty_SetBufferingCapacity");
3058 }
catch (std::exception
const& e)
3062 "IndexProperty_SetBufferingCapacity");
3067 "IndexProperty_SetBufferingCapacity");
3085 "Property Capacity must be Tools::VT_ULONG",
3086 "IndexProperty_GetBufferingCapacity");
3095 "Property Capacity was empty",
3096 "IndexProperty_GetBufferingCapacity");
3110 "EnsureTightMBRs is a boolean value and must be 1 or 0",
3111 "IndexProperty_SetEnsureTightMBRs");
3122 "IndexProperty_SetEnsureTightMBRs");
3124 }
catch (std::exception
const& e)
3128 "IndexProperty_SetEnsureTightMBRs");
3133 "IndexProperty_SetEnsureTightMBRs");
3151 "Property EnsureTightMBRs must be Tools::VT_BOOL",
3152 "IndexProperty_GetEnsureTightMBRs");
3161 "Property EnsureTightMBRs was empty",
3162 "IndexProperty_GetEnsureTightMBRs");
3176 "WriteThrough is a boolean value and must be 1 or 0",
3177 "IndexProperty_SetWriteThrough");
3188 "IndexProperty_SetWriteThrough");
3190 }
catch (std::exception
const& e)
3194 "IndexProperty_SetWriteThrough");
3199 "IndexProperty_SetWriteThrough");
3217 "Property WriteThrough must be Tools::VT_BOOL",
3218 "IndexProperty_GetWriteThrough");
3227 "Property WriteThrough was empty",
3228 "IndexProperty_GetWriteThrough");
3242 "Overwrite is a boolean value and must be 1 or 0",
3243 "IndexProperty_SetOverwrite");
3254 "IndexProperty_SetOverwrite");
3256 }
catch (std::exception
const& e)
3260 "IndexProperty_SetOverwrite");
3265 "IndexProperty_SetOverwrite");
3283 "Property Overwrite must be Tools::VT_BOOL",
3284 "IndexProperty_GetOverwrite");
3293 "Property Overwrite was empty",
3294 "IndexProperty_GetOverwrite");
3315 "IndexProperty_SetFillFactor");
3317 }
catch (std::exception
const& e)
3321 "IndexProperty_SetFillFactor");
3326 "IndexProperty_SetFillFactor");
3344 "Property FillFactor must be Tools::VT_DOUBLE",
3345 "IndexProperty_GetFillFactor");
3354 "Property FillFactor was empty",
3355 "IndexProperty_GetFillFactor");
3363 "IndexProperty_SetSplitDistributionFactor",
3372 prop->
setProperty(
"SplitDistributionFactor", var);
3377 "IndexProperty_SetSplitDistributionFactor");
3379 }
catch (std::exception
const& e)
3383 "IndexProperty_SetSplitDistributionFactor");
3388 "IndexProperty_SetSplitDistributionFactor");
3400 var = prop->
getProperty(
"SplitDistributionFactor");
3406 "Property SplitDistributionFactor must be Tools::VT_DOUBLE",
3407 "IndexProperty_GetSplitDistributionFactor");
3416 "Property SplitDistributionFactor was empty",
3417 "IndexProperty_GetSplitDistributionFactor");
3425 "IndexProperty_SetTPRHorizon",
3439 "IndexProperty_SetTPRHorizon");
3441 }
catch (std::exception
const& e)
3445 "IndexProperty_SetTPRHorizon");
3450 "IndexProperty_SetTPRHorizon");
3468 "Property Horizon must be Tools::VT_DOUBLE",
3469 "IndexProperty_GetTPRHorizon");
3478 "Property Horizon was empty",
3479 "IndexProperty_GetTPRHorizon");
3487 "IndexProperty_SetReinsertFactor",
3501 "IndexProperty_SetReinsertFactor");
3503 }
catch (std::exception
const& e)
3507 "IndexProperty_SetReinsertFactor");
3512 "IndexProperty_SetReinsertFactor");
3530 "Property ReinsertFactor must be Tools::VT_DOUBLE",
3531 "IndexProperty_GetReinsertFactor");
3540 "Property ReinsertFactor was empty",
3541 "IndexProperty_GetReinsertFactor");
3549 "IndexProperty_SetFileName",
3563 "IndexProperty_SetFileName");
3565 }
catch (std::exception
const& e)
3569 "IndexProperty_SetFileName");
3574 "IndexProperty_SetFileName");
3592 "Property FileName must be Tools::VT_PCHAR",
3593 "IndexProperty_GetFileName");
3602 "Property FileName was empty",
3603 "IndexProperty_GetFileName");
3612 "IndexProperty_SetFileNameExtensionDat",
3627 "IndexProperty_SetFileNameExtensionDat");
3629 }
catch (std::exception
const& e)
3633 "IndexProperty_SetFileNameExtensionDat");
3638 "IndexProperty_SetFileNameExtensionDat");
3656 "Property FileNameDat must be Tools::VT_PCHAR",
3657 "IndexProperty_GetFileNameExtensionDat");
3666 "Property FileNameDat was empty",
3667 "IndexProperty_GetFileNameExtensionDat");
3675 "IndexProperty_SetFileNameExtensionIdx",
3690 "IndexProperty_SetFileNameExtensionIdx");
3692 }
catch (std::exception
const& e)
3696 "IndexProperty_SetFileNameExtensionIdx");
3701 "IndexProperty_SetFileNameExtensionIdx");
3719 "Property FileNameIdx must be Tools::VT_PCHAR",
3720 "IndexProperty_GetFileNameExtensionIdx");
3729 "Property FileNameIdx was empty",
3730 "IndexProperty_GetFileNameExtensionIdx");
3745 prop->
setProperty(
"CustomStorageCallbacksSize", var);
3750 "IndexProperty_SetCustomStorageCallbacksSize");
3752 }
catch (std::exception
const& e)
3756 "IndexProperty_SetCustomStorageCallbacksSize");
3761 "IndexProperty_SetCustomStorageCallbacksSize");
3773 var = prop->
getProperty(
"CustomStorageCallbacksSize");
3779 "Property CustomStorageCallbacksSize must be Tools::VT_ULONG",
3780 "IndexProperty_GetCustomStorageCallbacksSize");
3789 "Property CustomStorageCallbacksSize was empty",
3790 "IndexProperty_GetCustomStorageCallbacksSize");
3798 "IndexProperty_SetCustomStorageCallbacks",
3804 varSize = prop->
getProperty(
"CustomStorageCallbacksSize");
3807 std::ostringstream ss;
3808 ss <<
"The supplied storage callbacks size is wrong, expected "
3813 "IndexProperty_SetCustomStorageCallbacks");
3832 "IndexProperty_SetCustomStorageCallbacks");
3834 }
catch (std::exception
const& e)
3838 "IndexProperty_SetCustomStorageCallbacks");
3843 "IndexProperty_SetCustomStorageCallbacks");
3855 var = prop->
getProperty(
"CustomStorageCallbacks");
3861 "Property CustomStorageCallbacks must be Tools::VT_PVOID",
3862 "IndexProperty_GetCustomStorageCallbacks");
3871 "Property CustomStorageCallbacks was empty",
3872 "IndexProperty_GetCustomStorageCallbacks");
3892 "IndexProperty_SetIndexID");
3894 }
catch (std::exception
const& e)
3898 "IndexProperty_SetIndexID");
3903 "IndexProperty_SetIndexID");
3921 "Property IndexIdentifier must be Tools::VT_LONGLONG",
3922 "IndexProperty_GetIndexID");
3931 "Property IndexIdentifier was empty",
3932 "IndexProperty_GetIndexID");
3938 return new char[length];
3957 "IndexProperty_SetResultSetLimit");
3959 }
catch (std::exception
const& e)
3963 "IndexProperty_SetResultSetLimit");
3968 "IndexProperty_SetResultSetLimit");
3986 "Property ResultSetLimit must be Tools::VT_LONGLONG",
3987 "IndexProperty_GetResultSetLimit");
3996 "Property ResultSetLimit was empty",
3997 "IndexProperty_GetResultSetLimit");
4004 delete []
static_cast<char*
>(buffer);
4011 std::ostringstream ot;
4013 #ifdef SIDX_RELEASE_NAME
4019 std::string out(ot.str());
4020 return STRDUP(out.c_str());
4026 # pragma warning(pop)
SIDX_DLL void Page_ResultSet_Ids(IdVisitor &visitor, int64_t **ids, int64_t nStart, int64_t nResultLimit, uint64_t *nResults)
SIDX_DLL Tools::PropertySet * GetDefaults()
SIDX_DLL void Page_ResultSet_Obj(ObjVisitor &visitor, IndexItemH **items, int64_t nStart, int64_t nResultLimit, uint64_t *nResults)
#define SIDX_RELEASE_NAME
SpatialIndex::Region * GetBounds() const
uint64_t GetResultCount() const
const char * GetMessage() const
const char * GetMethod() const
std::vector< uint64_t > & GetResults()
uint64_t GetResultCount() const
SpatialIndex::ISpatialIndex & index()
const Tools::PropertySet GetProperties()
int64_t GetResultSetOffset()
SpatialIndex::StorageManager::IBuffer & buffer()
void SetResultSetLimit(int64_t v)
void SetResultSetOffset(int64_t v)
int64_t GetResultSetLimit()
std::vector< LeafQueryResult > const & GetResults() const
virtual void getData(uint32_t &len, uint8_t **data) const =0
virtual void getShape(IShape **out) const =0
virtual id_type getIdentifier() const =0
virtual void getMBR(Region &out) const =0
virtual void intersectsWithQuery(const IShape &query, IVisitor &v)=0
virtual bool deleteData(const IShape &shape, id_type shapeIdentifier)=0
virtual void internalNodesQuery(const IShape &query, IVisitor &v)=0
virtual void insertData(uint32_t len, const uint8_t *pData, const IShape &shape, id_type shapeIdentifier)=0
virtual double nearestNeighborQuery(uint32_t k, const IShape &query, IVisitor &v, INearestNeighborComparator &nnc, double max_dist=0.0)=0
virtual bool isIndexValid()=0
virtual void getIndexProperties(Tools::PropertySet &out) const =0
virtual void queryStrategy(IQueryStrategy &qs)=0
virtual void containsWhatQuery(const IShape &query, IVisitor &v)=0
uint32_t getDimension() const override
virtual double getHigh(uint32_t index) const
virtual double getLow(uint32_t index) const
SIDX_C_DLL char * IndexProperty_GetFileName(IndexPropertyH hProp)
SIDX_C_DLL RTError IndexProperty_SetRegionPoolCapacity(IndexPropertyH hProp, uint32_t value)
SIDX_C_DLL RTError Index_Intersects_obj(IndexH index, double *pdMin, double *pdMax, uint32_t nDimension, IndexItemH **items, uint64_t *nResults)
SIDX_C_DLL RTError Index_InsertTPData(IndexH index, int64_t id, double *pdMin, double *pdMax, double *pdVMin, double *pdVMax, double tStart, double tEnd, uint32_t nDimension, const uint8_t *pData, size_t nDataLength)
SIDX_C_DLL RTError Index_MVRNearestNeighbors_id(IndexH index, double *pdMin, double *pdMax, double tStart, double tEnd, uint32_t nDimension, int64_t **ids, uint64_t *nResults)
SIDX_C_DLL RTError IndexProperty_SetFileNameExtensionIdx(IndexPropertyH hProp, const char *value)
SIDX_DLL RTError Index_SetResultSetLimit(IndexH index, int64_t value)
SIDX_C_DLL double IndexProperty_GetSplitDistributionFactor(IndexPropertyH hProp)
SIDX_C_DLL char * IndexProperty_GetFileNameExtensionDat(IndexPropertyH hProp)
SIDX_C_DLL RTError IndexProperty_SetTPRHorizon(IndexPropertyH hProp, double value)
SIDX_DLL RTError IndexProperty_SetResultSetLimit(IndexPropertyH hProp, uint64_t value)
SIDX_C_DLL void IndexItem_Destroy(IndexItemH item)
SIDX_C_DLL RTError IndexItem_GetBounds(IndexItemH item, double **ppdMin, double **ppdMax, uint32_t *nDimension)
SIDX_C_DLL void Index_Free(void *results)
SIDX_C_DLL RTError IndexProperty_SetCustomStorageCallbacksSize(IndexPropertyH hProp, uint32_t value)
SIDX_C_DLL RTError IndexProperty_SetOverwrite(IndexPropertyH hProp, uint32_t value)
SIDX_C_DLL void * IndexProperty_GetCustomStorageCallbacks(IndexPropertyH hProp)
SIDX_C_DLL IndexPropertyH IndexProperty_Create()
SIDX_C_DLL RTError Index_Contains_obj(IndexH index, double *pdMin, double *pdMax, uint32_t nDimension, IndexItemH **items, uint64_t *nResults)
SIDX_DLL IndexH Index_CreateWithArray(IndexPropertyH hProp, uint64_t n, uint32_t dimension, uint64_t i_stri, uint64_t d_i_stri, uint64_t d_j_stri, int64_t *ids, double *mins, double *maxs)
SIDX_C_DLL RTError IndexProperty_SetEnsureTightMBRs(IndexPropertyH hProp, uint32_t value)
SIDX_C_DLL int64_t IndexProperty_GetIndexID(IndexPropertyH hProp)
IDX_C_START SIDX_C_DLL void Error_Reset(void)
SIDX_C_DLL RTError Index_NearestNeighbors_id_v(IndexH index, int64_t knn, int64_t n, uint32_t d, uint64_t idsz, uint64_t d_i_stri, uint64_t d_j_stri, const double *mins, const double *maxs, int64_t *ids, uint64_t *cnts, double *dists, int64_t *nr)
SIDX_C_DLL RTError IndexProperty_SetIndexCapacity(IndexPropertyH hProp, uint32_t value)
SIDX_C_DLL RTError Index_TPNearestNeighbors_obj(IndexH index, double *pdMin, double *pdMax, double *pdVMin, double *pdVMax, double tStart, double tEnd, uint32_t nDimension, IndexItemH **items, uint64_t *nResults)
SIDX_C_DLL RTError Index_Intersects_id_v(IndexH index, int64_t n, uint32_t d, uint64_t idsz, uint64_t d_i_stri, uint64_t d_j_stri, const double *mins, const double *maxs, int64_t *ids, uint64_t *cnts, int64_t *nr)
SIDX_C_DLL RTError Index_MVRIntersects_obj(IndexH index, double *pdMin, double *pdMax, double tStart, double tEnd, uint32_t nDimension, IndexItemH **items, uint64_t *nResults)
SIDX_C_DLL int Error_GetErrorCount(void)
SIDX_C_DLL RTError Index_TPIntersects_count(IndexH index, double *pdMin, double *pdMax, double *pdVMin, double *pdVMax, double tStart, double tEnd, uint32_t nDimension, uint64_t *nResults)
SIDX_C_DLL double IndexProperty_GetFillFactor(IndexPropertyH hProp)
SIDX_C_DLL char * Error_GetLastErrorMsg(void)
SIDX_C_DLL RTIndexVariant IndexProperty_GetIndexVariant(IndexPropertyH hProp)
SIDX_C_DLL uint32_t IndexProperty_GetCustomStorageCallbacksSize(IndexPropertyH hProp)
SIDX_C_DLL RTError IndexProperty_SetBufferingCapacity(IndexPropertyH hProp, uint32_t value)
SIDX_C_DLL RTError Index_SegmentIntersects_id(IndexH index, double *pdStartPoint, double *pdEndPoint, uint32_t nDimension, int64_t **ids, uint64_t *nResults)
SIDX_C_DLL RTError Index_InsertData(IndexH index, int64_t id, double *pdMin, double *pdMax, uint32_t nDimension, const uint8_t *pData, size_t nDataLength)
SIDX_C_DLL uint32_t IndexProperty_GetBufferingCapacity(IndexPropertyH hProp)
SIDX_DLL uint64_t IndexProperty_GetResultSetLimit(IndexPropertyH hProp)
SIDX_C_DLL RTError Index_DeleteData(IndexH index, int64_t id, double *pdMin, double *pdMax, uint32_t nDimension)
SIDX_C_DLL RTIndexType IndexProperty_GetIndexType(IndexPropertyH hProp)
SIDX_C_DLL uint32_t IndexProperty_GetOverwrite(IndexPropertyH hProp)
SIDX_C_DLL RTError Index_DeleteMVRData(IndexH index, int64_t id, double *pdMin, double *pdMax, double tStart, double tEnd, uint32_t nDimension)
SIDX_C_DLL RTError IndexProperty_SetIndexID(IndexPropertyH hProp, int64_t value)
SIDX_C_DLL RTError IndexProperty_SetWriteThrough(IndexPropertyH hProp, uint32_t value)
SIDX_C_DLL void IndexProperty_Destroy(IndexPropertyH hProp)
SIDX_C_DLL uint32_t IndexProperty_GetRegionPoolCapacity(IndexPropertyH hProp)
SIDX_C_DLL RTError IndexProperty_SetIndexStorage(IndexPropertyH hProp, RTStorageType value)
SIDX_C_DLL RTError Index_MVRIntersects_count(IndexH index, double *pdMin, double *pdMax, double tStart, double tEnd, uint32_t nDimension, uint64_t *nResults)
SIDX_C_DLL RTError IndexProperty_SetSplitDistributionFactor(IndexPropertyH hProp, double value)
SIDX_C_DLL RTError Index_InsertMVRData(IndexH index, int64_t id, double *pdMin, double *pdMax, double tStart, double tEnd, uint32_t nDimension, const uint8_t *pData, size_t nDataLength)
SIDX_C_DLL RTError Index_TPIntersects_id(IndexH index, double *pdMin, double *pdMax, double *pdVMin, double *pdVMax, double tStart, double tEnd, uint32_t nDimension, int64_t **ids, uint64_t *nResults)
static std::stack< Error > errors
#define VALIDATE_POINTER0(ptr, func)
SIDX_C_DLL RTError IndexProperty_SetCustomStorageCallbacks(IndexPropertyH hProp, const void *value)
SIDX_C_DLL RTError Index_TPIntersects_obj(IndexH index, double *pdMin, double *pdMax, double *pdVMin, double *pdVMax, double tStart, double tEnd, uint32_t nDimension, IndexItemH **items, uint64_t *nResults)
SIDX_C_DLL double IndexProperty_GetReinsertFactor(IndexPropertyH hProp)
SIDX_C_DLL RTError IndexProperty_SetReinsertFactor(IndexPropertyH hProp, double value)
SIDX_C_DLL uint32_t IndexProperty_GetNearMinimumOverlapFactor(IndexPropertyH hProp)
SIDX_C_DLL void Error_PushError(int code, const char *message, const char *method)
SIDX_C_DLL RTError IndexProperty_SetLeafCapacity(IndexPropertyH hProp, uint32_t value)
SIDX_C_DLL RTError Index_NearestNeighbors_obj(IndexH index, double *pdMin, double *pdMax, uint32_t nDimension, IndexItemH **items, uint64_t *nResults)
SIDX_C_DLL RTError Index_SegmentIntersects_obj(IndexH index, double *pdStartPoint, double *pdEndPoint, uint32_t nDimension, IndexItemH **items, uint64_t *nResults)
SIDX_C_DLL uint32_t IndexProperty_GetIndexCapacity(IndexPropertyH hProp)
SIDX_C_DLL RTError IndexProperty_SetDimension(IndexPropertyH hProp, uint32_t value)
SIDX_C_DLL void Index_Flush(IndexH index)
SIDX_C_DLL uint32_t IndexProperty_GetDimension(IndexPropertyH hProp)
SIDX_C_DLL char * IndexProperty_GetFileNameExtensionIdx(IndexPropertyH hProp)
SIDX_C_DLL RTError IndexProperty_SetIndexType(IndexPropertyH hProp, RTIndexType value)
SIDX_C_DLL uint32_t IndexProperty_GetWriteThrough(IndexPropertyH hProp)
SIDX_C_DLL int64_t IndexItem_GetID(IndexItemH item)
SIDX_C_DLL RTError IndexProperty_SetIndexPoolCapacity(IndexPropertyH hProp, uint32_t value)
SIDX_C_DLL RTError IndexProperty_SetPointPoolCapacity(IndexPropertyH hProp, uint32_t value)
SIDX_C_DLL RTError Index_NearestNeighbors_id(IndexH index, double *pdMin, double *pdMax, uint32_t nDimension, int64_t **ids, uint64_t *nResults)
SIDX_C_DLL RTError IndexProperty_SetPagesize(IndexPropertyH hProp, uint32_t value)
SIDX_C_DLL RTError IndexItem_GetData(IndexItemH item, uint8_t **data, uint64_t *length)
SIDX_C_DLL RTError Index_Intersects_internal(IndexH index, double *pdMin, double *pdMax, uint32_t nDimension, IndexItemH **ids, uint64_t *nResults)
SIDX_C_DLL RTError IndexProperty_SetFillFactor(IndexPropertyH hProp, double value)
SIDX_C_DLL RTError IndexProperty_SetNearMinimumOverlapFactor(IndexPropertyH hProp, uint32_t value)
SIDX_C_DLL RTError Index_MVRIntersects_id(IndexH index, double *pdMin, double *pdMax, double tStart, double tEnd, uint32_t nDimension, int64_t **ids, uint64_t *nResults)
SIDX_C_DLL uint32_t IndexProperty_GetEnsureTightMBRs(IndexPropertyH hProp)
SIDX_C_DLL RTError Index_Intersects_count(IndexH index, double *pdMin, double *pdMax, uint32_t nDimension, uint64_t *nResults)
#define VALIDATE_POINTER1(ptr, func, rc)
SIDX_C_DLL RTError IndexProperty_SetIndexVariant(IndexPropertyH hProp, RTIndexVariant value)
SIDX_C_DLL RTError Index_Intersects_id(IndexH index, double *pdMin, double *pdMax, uint32_t nDimension, int64_t **ids, uint64_t *nResults)
SIDX_DLL RTError Index_SetResultSetOffset(IndexH index, int64_t value)
SIDX_C_DLL uint32_t IndexProperty_GetLeafPoolCapacity(IndexPropertyH hProp)
SIDX_C_DLL void Index_Destroy(IndexH index)
SIDX_C_DLL RTError Index_Contains_count(IndexH index, double *pdMin, double *pdMax, uint32_t nDimension, uint64_t *nResults)
SIDX_C_DLL IndexPropertyH Index_GetProperties(IndexH index)
SIDX_C_DLL RTError Index_SegmentIntersects_count(IndexH index, double *pdStartPoint, double *pdEndPoint, uint32_t nDimension, uint64_t *nResults)
SIDX_C_DLL RTError IndexProperty_SetLeafPoolCapacity(IndexPropertyH hProp, uint32_t value)
SIDX_C_DLL RTError Index_GetLeaves(IndexH index, uint32_t *nNumLeafNodes, uint32_t **nLeafSizes, int64_t **nLeafIDs, int64_t ***nLeafChildIDs, double ***pppdMin, double ***pppdMax, uint32_t *nDimension)
SIDX_C_DLL RTError Index_TPNearestNeighbors_id(IndexH index, double *pdMin, double *pdMax, double *pdVMin, double *pdVMax, double tStart, double tEnd, uint32_t nDimension, int64_t **ids, uint64_t *nResults)
SIDX_C_DLL RTError IndexProperty_SetFileNameExtensionDat(IndexPropertyH hProp, const char *value)
SIDX_C_DLL IndexH Index_Create(IndexPropertyH hProp)
SIDX_C_DLL char * Error_GetLastErrorMethod(void)
SIDX_C_DLL void * SIDX_NewBuffer(size_t length)
SIDX_C_DLL uint32_t IndexProperty_GetPointPoolCapacity(IndexPropertyH hProp)
SIDX_C_DLL char * SIDX_Version()
SIDX_C_DLL void Index_DestroyObjResults(IndexItemH *results, uint32_t nResults)
SIDX_C_DLL RTError Index_Contains_id(IndexH index, double *pdMin, double *pdMax, uint32_t nDimension, int64_t **ids, uint64_t *nResults)
SIDX_DLL int64_t Index_GetResultSetOffset(IndexH index)
SIDX_C_DLL RTError Index_DeleteTPData(IndexH index, int64_t id, double *pdMin, double *pdMax, double *pdVMin, double *pdVMax, double tStart, double tEnd, uint32_t nDimension)
SIDX_C_DLL void SIDX_DeleteBuffer(void *buffer)
SIDX_C_DLL RTError Index_MVRNearestNeighbors_obj(IndexH index, double *pdMin, double *pdMax, double tStart, double tEnd, uint32_t nDimension, IndexItemH **items, uint64_t *nResults)
SIDX_C_DLL double IndexProperty_GetTPRHorizon(IndexPropertyH hProp)
SIDX_C_DLL void Error_Pop(void)
SIDX_C_DLL RTError Index_GetBounds(IndexH index, double **ppdMin, double **ppdMax, uint32_t *nDimension)
SIDX_C_DLL RTStorageType IndexProperty_GetIndexStorage(IndexPropertyH hProp)
SIDX_C_DLL void Index_ClearBuffer(IndexH index)
SIDX_C_DLL uint32_t Index_IsValid(IndexH index)
SIDX_C_DLL int Error_GetLastErrorNum(void)
SIDX_C_DLL uint32_t IndexProperty_GetIndexPoolCapacity(IndexPropertyH hProp)
SIDX_DLL int64_t Index_GetResultSetLimit(IndexH index)
SIDX_C_DLL RTError IndexProperty_SetFileName(IndexPropertyH hProp, const char *value)
SIDX_C_DLL IndexH Index_CreateWithStream(IndexPropertyH hProp, int(*readNext)(SpatialIndex::id_type *id, double **pMin, double **pMax, uint32_t *nDimension, const uint8_t **pData, size_t *nDataLength))
SIDX_C_DLL uint32_t IndexProperty_GetPagesize(IndexPropertyH hProp)
SIDX_C_DLL uint32_t IndexProperty_GetLeafCapacity(IndexPropertyH hProp)
struct SpatialIndex_IData * IndexItemH
struct Tools_PropertySet * IndexPropertyH