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];
51 } last_error = {0,
"",
""};
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]);
1077 for (uint64_t i = 0; i < n; ++i)
1080 for (uint64_t j = 0; j < d; ++j)
1082 tmp[j] = mins[i*d_i_stri + j*d_j_stri];
1083 tmp[j + d] = maxs[i*d_i_stri + j*d_j_stri];
1089 idx.intersectsWithQuery(r, visitor);
1107 "Index_Intersects_id_v");
1109 }
catch (std::exception
const& e)
1113 "Index_Intersects_id_v");
1118 "Index_Intersects_id_v");
1131 uint32_t nDimension,
1135 Index* idx =
reinterpret_cast<Index*
>(index);
1152 "Index_TPIntersects_count");
1156 }
catch (std::exception
const& e)
1160 "Index_TPIntersects_count");
1167 "Index_TPIntersects_count");
1180 uint32_t nDimension,
1184 Index* idx =
reinterpret_cast<Index*
>(index);
1202 "Index_MVRIntersects_count");
1206 }
catch (std::exception
const& e)
1210 "Index_MVRIntersects_count");
1217 "Index_MVRIntersects_count");
1228 uint32_t nDimension,
1232 Index* idx =
reinterpret_cast<Index*
>(index);
1250 "Index_Intersects_count");
1254 }
catch (std::exception
const& e)
1258 "Index_Intersects_count");
1265 "Index_Intersects_count");
1276 uint32_t nDimension,
1280 Index* idx =
reinterpret_cast<Index*
>(index);
1297 "Index_Contains_count");
1301 }
catch (std::exception
const& e)
1305 "Index_Contains_count");
1312 "Index_Contains_count");
1321 double* pdStartPoint,
1323 uint32_t nDimension,
1328 Index* idx =
reinterpret_cast<Index*
>(index);
1330 int64_t nResultLimit, nStart;
1351 "Index_Intersects_obj");
1355 }
catch (std::exception
const& e)
1359 "Index_Intersects_obj");
1366 "Index_Intersects_obj");
1375 double* pdStartPoint,
1377 uint32_t nDimension,
1382 Index* idx =
reinterpret_cast<Index*
>(index);
1383 int64_t nResultLimit, nStart;
1404 "Index_Intersects_id");
1408 }
catch (std::exception
const& e)
1412 "Index_Intersects_id");
1419 "Index_Intersects_id");
1428 double* pdStartPoint,
1430 uint32_t nDimension,
1434 Index* idx =
reinterpret_cast<Index*
>(index);
1452 "Index_Intersects_count");
1456 }
catch (std::exception
const& e)
1460 "Index_Intersects_count");
1467 "Index_Intersects_count");
1482 uint32_t nDimension,
1487 Index* idx =
reinterpret_cast<Index*
>(index);
1488 int64_t nResultLimit, nStart;
1511 "Index_TPNearestNeighbors_id");
1515 }
catch (std::exception
const& e)
1519 "Index_TPNearestNeighbors_id");
1526 "Index_TPNearestNeighbors_id");
1539 uint32_t nDimension,
1544 Index* idx =
reinterpret_cast<Index*
>(index);
1545 int64_t nResultLimit, nStart;
1568 "Index_MVRNearestNeighbors_id");
1572 }
catch (std::exception
const& e)
1576 "Index_MVRNearestNeighbors_id");
1583 "Index_MVRNearestNeighbors_id");
1594 uint32_t nDimension,
1599 Index* idx =
reinterpret_cast<Index*
>(index);
1600 int64_t nResultLimit, nStart;
1619 "Index_NearestNeighbors_id");
1621 }
catch (std::exception
const& e)
1625 "Index_NearestNeighbors_id");
1630 "Index_NearestNeighbors_id");
1651 auto& idx =
reinterpret_cast<Index*
>(index)->index();
1653 std::unique_ptr<double[]> tmp = std::unique_ptr<double[]>(
new double[2*d]);
1660 for (uint64_t i = 0; i < n; ++i)
1662 double max_dist = dists ? dists[i] : 0.0;
1665 for (uint64_t j = 0; j < d; ++j)
1667 tmp[j] = mins[i*d_i_stri + j*d_j_stri];
1668 tmp[j + d] = maxs[i*d_i_stri + j*d_j_stri];
1674 max_dist = idx.nearestNeighborQuery(
static_cast<uint32_t
>(abs(knn)), r, visitor, max_dist);
1678 nrc = std::min<uint64_t>(nrc, -knn);
1683 dists[i] = max_dist;
1691 for (uint64_t l = 0; l < nrc; ++l)
1699 "Index_NearestNeighbors_id_v");
1701 }
catch (std::exception
const& e)
1705 "Index_NearestNeighbors_id_v");
1710 "Index_NearestNeighbors_id_v");
1723 uint32_t nDimension,
1728 Index* idx =
reinterpret_cast<Index*
>(index);
1730 int64_t nResultLimit, nStart;
1753 "Index_TPNearestNeighbors_obj");
1757 }
catch (std::exception
const& e)
1761 "Index_TPNearestNeighbors_obj");
1768 "Index_NearestNeighbors_obj");
1780 uint32_t nDimension,
1785 Index* idx =
reinterpret_cast<Index*
>(index);
1787 int64_t nResultLimit, nStart;
1810 "Index_MVRNearestNeighbors_obj");
1814 }
catch (std::exception
const& e)
1818 "Index_MVRNearestNeighbors_obj");
1825 "Index_NearestNeighbors_obj");
1836 uint32_t nDimension,
1841 Index* idx =
reinterpret_cast<Index*
>(index);
1843 int64_t nResultLimit, nStart;
1866 "Index_NearestNeighbors_obj");
1870 }
catch (std::exception
const& e)
1874 "Index_NearestNeighbors_obj");
1881 "Index_NearestNeighbors_obj");
1892 uint32_t nDimension,
1897 Index* idx =
reinterpret_cast<Index*
>(index);
1899 int64_t nResultLimit, nStart;
1919 "Index_Intersects_internal");
1922 }
catch (std::exception
const& e)
1926 "Index_Intersects_internal");
1932 "Index_Intersects_internal");
1942 uint32_t* nDimension)
1945 Index* idx =
reinterpret_cast<Index*
>(index);
1961 *ppdMin = (
double*) malloc (*nDimension *
sizeof(
double));
1962 *ppdMax = (
double*) malloc (*nDimension *
sizeof(
double));
1964 for (uint32_t i=0; i< *nDimension; ++i) {
1965 (*ppdMin)[i] = bounds->
getLow(i);
1966 (*ppdMax)[i] = bounds->
getHigh(i);
1978 }
catch (std::exception
const& e)
2000 Index* idx =
reinterpret_cast<Index*
>(index);
2006 "Index_SetResultSetOffset");
2015 Index* idx =
reinterpret_cast<Index*
>(index);
2024 Index* idx =
reinterpret_cast<Index*
>(index);
2030 "Index_SetResultSetLimit");
2039 Index* idx =
reinterpret_cast<Index*
>(index);
2046 Index* idx =
reinterpret_cast<Index*
>(index);
2053 Index* idx =
reinterpret_cast<Index*
>(index);
2066 Index* idx =
reinterpret_cast<Index*
>(index);
2074 for (uint32_t i=0; i< nResults; ++i) {
2075 if (results[i] != NULL) {
2094 uint32_t* nNumLeafNodes,
2095 uint32_t** nLeafSizes,
2097 int64_t*** nLeafChildIDs,
2100 uint32_t* nDimension)
2103 Index* idx =
reinterpret_cast<Index*
>(index);
2105 std::vector<LeafQueryResult>::const_iterator i;
2119 "Property Dimension must be Tools::VT_ULONG",
2131 const std::vector<LeafQueryResult>& results = query->
GetResults();
2133 *nNumLeafNodes = (uint32_t)results.size();
2135 *nLeafSizes = (uint32_t*) malloc (*nNumLeafNodes *
sizeof(uint32_t));
2136 *nLeafIDs = (int64_t*) malloc (*nNumLeafNodes *
sizeof(int64_t));
2138 *nLeafChildIDs = (int64_t**) malloc(*nNumLeafNodes *
sizeof(int64_t*));
2139 *pppdMin = (
double**) malloc (*nNumLeafNodes *
sizeof(
double*));
2140 *pppdMax = (
double**) malloc (*nNumLeafNodes *
sizeof(
double*));
2143 for (i = results.begin(); i != results.end(); ++i)
2145 std::vector<SpatialIndex::id_type>
const& ids = (*i).GetIDs();
2148 (*nLeafIDs)[k] = (*i).getIdentifier();
2149 (*nLeafSizes)[k] = (uint32_t)ids.size();
2151 (*nLeafChildIDs)[k] = (int64_t*) malloc( (*nLeafSizes)[k] *
sizeof(int64_t));
2152 (*pppdMin)[k] = (
double*) malloc (*nDimension *
sizeof(
double));
2153 (*pppdMax)[k] = (
double*) malloc (*nDimension *
sizeof(
double));
2154 for (uint32_t c=0; c< *nDimension; ++c) {
2155 (*pppdMin)[k][c] = b->
getLow(c);
2156 (*pppdMax)[k][c] = b->
getHigh(c);
2158 for (uint32_t cChild = 0; cChild < ids.size(); cChild++)
2160 (*nLeafChildIDs)[k][cChild] = ids[cChild];
2175 }
catch (std::exception
const& e)
2197 if (it != 0)
delete it;
2207 uint32_t* l=
new uint32_t;
2210 *length = (uint64_t)*l;
2211 *data = (uint8_t*) malloc (*length *
sizeof(uint8_t));
2213 memcpy(*data, p_data, *length);
2231 uint32_t* nDimension)
2250 *ppdMin = (
double*) malloc (*nDimension *
sizeof(
double));
2251 *ppdMax = (
double*) malloc (*nDimension *
sizeof(
double));
2253 if (ppdMin == NULL || ppdMax == NULL) {
2255 "Unable to allocation bounds array(s)",
2256 "IndexItem_GetBounds");
2262 for (uint32_t i=0; i< *nDimension; ++i) {
2263 (*ppdMin)[i] = bounds->
getLow(i);
2264 (*ppdMax)[i] = bounds->
getHigh(i);
2281 if (prop != 0)
delete prop;
2293 throw std::runtime_error(
"Inputted value is not a valid index type");
2305 "IndexProperty_SetIndexType");
2307 }
catch (std::exception
const& e)
2311 "IndexProperty_SetIndexType");
2316 "IndexProperty_SetIndexType");
2334 "Property IndexType must be Tools::VT_ULONG",
2335 "IndexProperty_GetIndexType");
2342 "Property IndexType was empty",
2343 "IndexProperty_GetIndexType");
2363 "IndexProperty_SetDimension");
2365 }
catch (std::exception
const& e)
2369 "IndexProperty_SetDimension");
2374 "IndexProperty_SetDimension");
2392 "Property IndexType must be Tools::VT_ULONG",
2393 "IndexProperty_GetDimension");
2402 "Property Dimension was empty",
2403 "IndexProperty_GetDimension");
2421 throw std::runtime_error(
"Inputted value is not a valid index variant");
2428 "Index type is not properly set",
2429 "IndexProperty_SetIndexVariant");
2447 "IndexProperty_SetIndexVariant");
2449 }
catch (std::exception
const& e)
2453 "IndexProperty_SetIndexCapacity");
2458 "IndexProperty_SetIndexCapacity");
2467 "IndexProperty_GetIndexVariant",
2480 "Property IndexVariant must be Tools::VT_LONG",
2481 "IndexProperty_GetIndexVariant");
2490 "Property IndexVariant was empty",
2491 "IndexProperty_GetIndexVariant");
2505 throw std::runtime_error(
"Inputted value is not a valid index storage type");
2515 "IndexProperty_SetIndexStorage");
2517 }
catch (std::exception
const& e)
2521 "IndexProperty_SetIndexStorage");
2526 "IndexProperty_SetIndexStorage");
2535 "IndexProperty_GetIndexStorage",
2547 "Property IndexStorage must be Tools::VT_ULONG",
2548 "IndexProperty_GetIndexStorage");
2557 "Property IndexStorage was empty",
2558 "IndexProperty_GetIndexStorage");
2579 "IndexProperty_SetIndexCapacity");
2581 }
catch (std::exception
const& e)
2585 "IndexProperty_SetIndexCapacity");
2590 "IndexProperty_SetIndexCapacity");
2608 "Property IndexCapacity must be Tools::VT_ULONG",
2609 "IndexProperty_GetIndexCapacity");
2618 "Property IndexCapacity was empty",
2619 "IndexProperty_GetIndexCapacity");
2639 "IndexProperty_SetLeafCapacity");
2641 }
catch (std::exception
const& e)
2645 "IndexProperty_SetLeafCapacity");
2650 "IndexProperty_SetLeafCapacity");
2668 "Property LeafCapacity must be Tools::VT_ULONG",
2669 "IndexProperty_GetLeafCapacity");
2678 "Property LeafCapacity was empty",
2679 "IndexProperty_GetLeafCapacity");
2699 "IndexProperty_SetPagesize");
2701 }
catch (std::exception
const& e)
2705 "IndexProperty_SetPagesize");
2710 "IndexProperty_SetPagesize");
2728 "Property PageSize must be Tools::VT_ULONG",
2729 "IndexProperty_GetPagesize");
2738 "Property PageSize was empty",
2739 "IndexProperty_GetPagesize");
2759 "IndexProperty_SetLeafPoolCapacity");
2761 }
catch (std::exception
const& e)
2765 "IndexProperty_SetLeafPoolCapacity");
2770 "IndexProperty_SetLeafPoolCapacity");
2788 "Property LeafPoolCapacity must be Tools::VT_ULONG",
2789 "IndexProperty_GetLeafPoolCapacity");
2798 "Property LeafPoolCapacity was empty",
2799 "IndexProperty_GetLeafPoolCapacity");
2819 "IndexProperty_SetIndexPoolCapacity");
2821 }
catch (std::exception
const& e)
2825 "IndexProperty_SetIndexPoolCapacity");
2830 "IndexProperty_SetIndexPoolCapacity");
2848 "Property IndexPoolCapacity must be Tools::VT_ULONG",
2849 "IndexProperty_GetIndexPoolCapacity");
2858 "Property IndexPoolCapacity was empty",
2859 "IndexProperty_GetIndexPoolCapacity");
2879 "IndexProperty_SetRegionPoolCapacity");
2881 }
catch (std::exception
const& e)
2885 "IndexProperty_SetRegionPoolCapacity");
2890 "IndexProperty_SetRegionPoolCapacity");
2908 "Property RegionPoolCapacity must be Tools::VT_ULONG",
2909 "IndexProperty_GetRegionPoolCapacity");
2918 "Property RegionPoolCapacity was empty",
2919 "IndexProperty_GetRegionPoolCapacity");
2939 "IndexProperty_SetPointPoolCapacity");
2941 }
catch (std::exception
const& e)
2945 "IndexProperty_SetPointPoolCapacity");
2950 "IndexProperty_SetPointPoolCapacity");
2968 "Property PointPoolCapacity must be Tools::VT_ULONG",
2969 "IndexProperty_GetPointPoolCapacity");
2978 "Property PointPoolCapacity was empty",
2979 "IndexProperty_GetPointPoolCapacity");
2987 "IndexProperty_SetNearMinimumOverlapFactor",
2996 prop->
setProperty(
"NearMinimumOverlapFactor", var);
3001 "IndexProperty_SetNearMinimumOverlapFactor");
3003 }
catch (std::exception
const& e)
3007 "IndexProperty_SetNearMinimumOverlapFactor");
3012 "IndexProperty_SetNearMinimumOverlapFactor");
3024 var = prop->
getProperty(
"NearMinimumOverlapFactor");
3030 "Property NearMinimumOverlapFactor must be Tools::VT_ULONG",
3031 "IndexProperty_GetNearMinimumOverlapFactor");
3040 "Property NearMinimumOverlapFactor was empty",
3041 "IndexProperty_GetNearMinimumOverlapFactor");
3062 "IndexProperty_SetBufferingCapacity");
3064 }
catch (std::exception
const& e)
3068 "IndexProperty_SetBufferingCapacity");
3073 "IndexProperty_SetBufferingCapacity");
3091 "Property Capacity must be Tools::VT_ULONG",
3092 "IndexProperty_GetBufferingCapacity");
3101 "Property Capacity was empty",
3102 "IndexProperty_GetBufferingCapacity");
3116 "EnsureTightMBRs is a boolean value and must be 1 or 0",
3117 "IndexProperty_SetEnsureTightMBRs");
3128 "IndexProperty_SetEnsureTightMBRs");
3130 }
catch (std::exception
const& e)
3134 "IndexProperty_SetEnsureTightMBRs");
3139 "IndexProperty_SetEnsureTightMBRs");
3157 "Property EnsureTightMBRs must be Tools::VT_BOOL",
3158 "IndexProperty_GetEnsureTightMBRs");
3167 "Property EnsureTightMBRs was empty",
3168 "IndexProperty_GetEnsureTightMBRs");
3182 "WriteThrough is a boolean value and must be 1 or 0",
3183 "IndexProperty_SetWriteThrough");
3194 "IndexProperty_SetWriteThrough");
3196 }
catch (std::exception
const& e)
3200 "IndexProperty_SetWriteThrough");
3205 "IndexProperty_SetWriteThrough");
3223 "Property WriteThrough must be Tools::VT_BOOL",
3224 "IndexProperty_GetWriteThrough");
3233 "Property WriteThrough was empty",
3234 "IndexProperty_GetWriteThrough");
3248 "Overwrite is a boolean value and must be 1 or 0",
3249 "IndexProperty_SetOverwrite");
3260 "IndexProperty_SetOverwrite");
3262 }
catch (std::exception
const& e)
3266 "IndexProperty_SetOverwrite");
3271 "IndexProperty_SetOverwrite");
3289 "Property Overwrite must be Tools::VT_BOOL",
3290 "IndexProperty_GetOverwrite");
3299 "Property Overwrite was empty",
3300 "IndexProperty_GetOverwrite");
3321 "IndexProperty_SetFillFactor");
3323 }
catch (std::exception
const& e)
3327 "IndexProperty_SetFillFactor");
3332 "IndexProperty_SetFillFactor");
3350 "Property FillFactor must be Tools::VT_DOUBLE",
3351 "IndexProperty_GetFillFactor");
3360 "Property FillFactor was empty",
3361 "IndexProperty_GetFillFactor");
3369 "IndexProperty_SetSplitDistributionFactor",
3378 prop->
setProperty(
"SplitDistributionFactor", var);
3383 "IndexProperty_SetSplitDistributionFactor");
3385 }
catch (std::exception
const& e)
3389 "IndexProperty_SetSplitDistributionFactor");
3394 "IndexProperty_SetSplitDistributionFactor");
3406 var = prop->
getProperty(
"SplitDistributionFactor");
3412 "Property SplitDistributionFactor must be Tools::VT_DOUBLE",
3413 "IndexProperty_GetSplitDistributionFactor");
3422 "Property SplitDistributionFactor was empty",
3423 "IndexProperty_GetSplitDistributionFactor");
3431 "IndexProperty_SetTPRHorizon",
3445 "IndexProperty_SetTPRHorizon");
3447 }
catch (std::exception
const& e)
3451 "IndexProperty_SetTPRHorizon");
3456 "IndexProperty_SetTPRHorizon");
3474 "Property Horizon must be Tools::VT_DOUBLE",
3475 "IndexProperty_GetTPRHorizon");
3484 "Property Horizon was empty",
3485 "IndexProperty_GetTPRHorizon");
3493 "IndexProperty_SetReinsertFactor",
3507 "IndexProperty_SetReinsertFactor");
3509 }
catch (std::exception
const& e)
3513 "IndexProperty_SetReinsertFactor");
3518 "IndexProperty_SetReinsertFactor");
3536 "Property ReinsertFactor must be Tools::VT_DOUBLE",
3537 "IndexProperty_GetReinsertFactor");
3546 "Property ReinsertFactor was empty",
3547 "IndexProperty_GetReinsertFactor");
3555 "IndexProperty_SetFileName",
3569 "IndexProperty_SetFileName");
3571 }
catch (std::exception
const& e)
3575 "IndexProperty_SetFileName");
3580 "IndexProperty_SetFileName");
3598 "Property FileName must be Tools::VT_PCHAR",
3599 "IndexProperty_GetFileName");
3608 "Property FileName was empty",
3609 "IndexProperty_GetFileName");
3618 "IndexProperty_SetFileNameExtensionDat",
3633 "IndexProperty_SetFileNameExtensionDat");
3635 }
catch (std::exception
const& e)
3639 "IndexProperty_SetFileNameExtensionDat");
3644 "IndexProperty_SetFileNameExtensionDat");
3662 "Property FileNameDat must be Tools::VT_PCHAR",
3663 "IndexProperty_GetFileNameExtensionDat");
3672 "Property FileNameDat was empty",
3673 "IndexProperty_GetFileNameExtensionDat");
3681 "IndexProperty_SetFileNameExtensionIdx",
3696 "IndexProperty_SetFileNameExtensionIdx");
3698 }
catch (std::exception
const& e)
3702 "IndexProperty_SetFileNameExtensionIdx");
3707 "IndexProperty_SetFileNameExtensionIdx");
3725 "Property FileNameIdx must be Tools::VT_PCHAR",
3726 "IndexProperty_GetFileNameExtensionIdx");
3735 "Property FileNameIdx was empty",
3736 "IndexProperty_GetFileNameExtensionIdx");
3751 prop->
setProperty(
"CustomStorageCallbacksSize", var);
3756 "IndexProperty_SetCustomStorageCallbacksSize");
3758 }
catch (std::exception
const& e)
3762 "IndexProperty_SetCustomStorageCallbacksSize");
3767 "IndexProperty_SetCustomStorageCallbacksSize");
3779 var = prop->
getProperty(
"CustomStorageCallbacksSize");
3785 "Property CustomStorageCallbacksSize must be Tools::VT_ULONG",
3786 "IndexProperty_GetCustomStorageCallbacksSize");
3795 "Property CustomStorageCallbacksSize was empty",
3796 "IndexProperty_GetCustomStorageCallbacksSize");
3804 "IndexProperty_SetCustomStorageCallbacks",
3810 varSize = prop->
getProperty(
"CustomStorageCallbacksSize");
3813 std::ostringstream ss;
3814 ss <<
"The supplied storage callbacks size is wrong, expected "
3819 "IndexProperty_SetCustomStorageCallbacks");
3838 "IndexProperty_SetCustomStorageCallbacks");
3840 }
catch (std::exception
const& e)
3844 "IndexProperty_SetCustomStorageCallbacks");
3849 "IndexProperty_SetCustomStorageCallbacks");
3861 var = prop->
getProperty(
"CustomStorageCallbacks");
3867 "Property CustomStorageCallbacks must be Tools::VT_PVOID",
3868 "IndexProperty_GetCustomStorageCallbacks");
3877 "Property CustomStorageCallbacks was empty",
3878 "IndexProperty_GetCustomStorageCallbacks");
3898 "IndexProperty_SetIndexID");
3900 }
catch (std::exception
const& e)
3904 "IndexProperty_SetIndexID");
3909 "IndexProperty_SetIndexID");
3927 "Property IndexIdentifier must be Tools::VT_LONGLONG",
3928 "IndexProperty_GetIndexID");
3937 "Property IndexIdentifier was empty",
3938 "IndexProperty_GetIndexID");
3944 return new char[length];
3963 "IndexProperty_SetResultSetLimit");
3965 }
catch (std::exception
const& e)
3969 "IndexProperty_SetResultSetLimit");
3974 "IndexProperty_SetResultSetLimit");
3992 "Property ResultSetLimit must be Tools::VT_LONGLONG",
3993 "IndexProperty_GetResultSetLimit");
4002 "Property ResultSetLimit was empty",
4003 "IndexProperty_GetResultSetLimit");
4010 delete []
static_cast<char*
>(buffer);
4017 std::ostringstream ot;
4019 #ifdef SIDX_RELEASE_NAME
4025 std::string out(ot.str());
4026 return STRDUP(out.c_str());
4032 # 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