rebuild the clusters according to the current extent */
| 932 | |
| 933 | /* rebuild the clusters according to the current extent */ |
| 934 | int RebuildClusters(layerObj *layer, int isQuery) |
| 935 | { |
| 936 | mapObj* map; |
| 937 | layerObj* srcLayer; |
| 938 | double distance, maxDistanceX, maxDistanceY, cellSizeX, cellSizeY; |
| 939 | rectObj searchrect; |
| 940 | int status; |
| 941 | clusterInfo* current; |
| 942 | int depth; |
| 943 | #ifdef USE_CLUSTER_EXTERNAL |
| 944 | int layerIndex; |
| 945 | #endif |
| 946 | |
| 947 | msClusterLayerInfo* layerinfo = layer->layerinfo; |
| 948 | |
| 949 | if (!layerinfo) |
| 950 | { |
| 951 | msSetError(MS_MISCERR, "Layer is not open: %s", layer->name); |
| 952 | return MS_FAILURE; |
| 953 | } |
| 954 | |
| 955 | if (!layer->map) |
| 956 | { |
| 957 | msSetError(MS_MISCERR, "No map associated with this layer: %s", layer->name); |
| 958 | return MS_FAILURE; |
| 959 | } |
| 960 | |
| 961 | map = layer->map; |
| 962 | |
| 963 | layerinfo->current = layerinfo->finalized; /* restart */ |
| 964 | |
| 965 | /* identify the current extent */ |
| 966 | if(layer->transform == MS_TRUE) |
| 967 | searchrect = map->extent; |
| 968 | else |
| 969 | { |
| 970 | searchrect.minx = searchrect.miny = 0; |
| 971 | searchrect.maxx = map->width-1; |
| 972 | searchrect.maxy = map->height-1; |
| 973 | } |
| 974 | |
| 975 | if (searchrect.minx == layerinfo->searchRect.minx && |
| 976 | searchrect.miny == layerinfo->searchRect.miny && |
| 977 | searchrect.maxx == layerinfo->searchRect.maxx && |
| 978 | searchrect.maxy == layerinfo->searchRect.maxy) |
| 979 | { |
| 980 | /* already built */ |
| 981 | return MS_SUCCESS; |
| 982 | } |
| 983 | |
| 984 | /* destroy previous data*/ |
| 985 | clusterDestroyData(layerinfo); |
| 986 | |
| 987 | layerinfo->searchRect = searchrect; |
| 988 | |
| 989 | /* reproject the rectangle to layer coordinates */ |
| 990 | #ifdef USE_PROJ |
| 991 | if((map->projection.numargs > 0) && (layer->projection.numargs > 0)) |
no test coverage detected