| 233 | } |
| 234 | |
| 235 | static void treeSplitBounds( rectObj *in, rectObj *out1, rectObj *out2) |
| 236 | { |
| 237 | double range; |
| 238 | |
| 239 | /* -------------------------------------------------------------------- */ |
| 240 | /* The output bounds will be very similar to the input bounds, */ |
| 241 | /* so just copy over to start. */ |
| 242 | /* -------------------------------------------------------------------- */ |
| 243 | memcpy(out1, in, sizeof(rectObj)); |
| 244 | memcpy(out2, in, sizeof(rectObj)); |
| 245 | |
| 246 | /* -------------------------------------------------------------------- */ |
| 247 | /* Split in X direction. */ |
| 248 | /* -------------------------------------------------------------------- */ |
| 249 | if((in->maxx - in->minx) > (in->maxy - in->miny)) |
| 250 | { |
| 251 | range = in->maxx - in->minx; |
| 252 | |
| 253 | out1->maxx = in->minx + range * SPLITRATIO; |
| 254 | out2->minx = in->maxx - range * SPLITRATIO; |
| 255 | } |
| 256 | |
| 257 | /* -------------------------------------------------------------------- */ |
| 258 | /* Otherwise split in Y direction. */ |
| 259 | /* -------------------------------------------------------------------- */ |
| 260 | else |
| 261 | { |
| 262 | range = in->maxy - in->miny; |
| 263 | |
| 264 | out1->maxy = in->miny + range * SPLITRATIO; |
| 265 | out2->miny = in->maxy - range * SPLITRATIO; |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | /* alloc memory for a new tentative cluster */ |
| 270 | static clusterInfo *clusterInfoCreate(msClusterLayerInfo* layerinfo) |