Definition at line 330 of file cu_measures.c.
331{
334
335
336
337
338 poly =
lwgeom_from_wkt(
"CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING(0 0,1 5,0 10),(0 10,10 10,10 0, 0 0)),COMPOUNDCURVE(CIRCULARSTRING(3 7,5 8,7 7),(7 7,7 3,3 3, 3 7)))",
LW_PARSER_CHECK_NONE);
340
341
342
343
344
345
346 CU_ASSERT_EQUAL(
tree_pt(tree, 5, 7.5), 0);
347
348 CU_ASSERT_EQUAL(
tree_pt(tree, 8, 9), 1);
349
350 CU_ASSERT_EQUAL(
tree_pt(tree, -1, 5), 0);
351
352 CU_ASSERT_EQUAL(
tree_pt(tree, -1, 7.5), 0);
353
354 CU_ASSERT_EQUAL(
tree_pt(tree, 0.2, 7.5), 0);
355
356 CU_ASSERT_EQUAL(
tree_pt(tree, 0.5, 0.5), 1);
357
358 CU_ASSERT_EQUAL(
tree_pt(tree, 2, 7.5), 1);
359
360 CU_ASSERT_EQUAL(
tree_pt(tree, 7, 7), 1);
361
364
365
366
367
368
369 poly =
lwgeom_from_wkt(
"POLYGON((0 0,0 10,10 10,10 0,9 0,9 9,8 6,8 0,2 0,2 9,1 6,1 0,0 0),(4 4,4 6,6 6,6 4,4 4))",
LW_PARSER_CHECK_NONE);
371
372
373 CU_ASSERT_EQUAL(
tree_pt(tree, 3, 6), 1);
374
375 CU_ASSERT_EQUAL(
tree_pt(tree, 3, 5.5), 1);
376
377 CU_ASSERT_EQUAL(
tree_pt(tree, -3, 5.5), 0);
378
379 CU_ASSERT_EQUAL(
tree_pt(tree, 4, 4), 1);
380 CU_ASSERT_EQUAL(
tree_pt(tree, 6, 6), 1);
381
382 CU_ASSERT_EQUAL(
tree_pt(tree, 4.5, 4), 1);
383
384 CU_ASSERT_EQUAL(
tree_pt(tree, 8, 0), 1);
385 CU_ASSERT_EQUAL(
tree_pt(tree, 9, 0), 1);
386 CU_ASSERT_EQUAL(
tree_pt(tree, 10, 1), 1);
387 CU_ASSERT_EQUAL(
tree_pt(tree, 9.5, 1), 1);
388 CU_ASSERT_EQUAL(
tree_pt(tree, 0, 10), 1);
389
390 CU_ASSERT_EQUAL(
tree_pt(tree, 1, 6), 1);
391
392 CU_ASSERT_EQUAL(
tree_pt(tree, -1, 6), 0);
393
394 CU_ASSERT_EQUAL(
tree_pt(tree, 5, 5), 0);
395
396 CU_ASSERT_EQUAL(
tree_pt(tree, 0.5, 4), 1);
397 CU_ASSERT_EQUAL(
tree_pt(tree, 0.5, 6), 1);
398 CU_ASSERT_EQUAL(
tree_pt(tree, 0.5, 9), 1);
399
402
403
404
405
408
409
410 CU_ASSERT_EQUAL(
tree_pt(tree, 0.5, 0.5), 1);
411
412 CU_ASSERT_EQUAL(
tree_pt(tree, 1.5, 0.5), 0);
413
414 CU_ASSERT_EQUAL(
tree_pt(tree, -1, 1), 0);
415
416 CU_ASSERT_EQUAL(
tree_pt(tree, 1, 1), 1);
417
418 CU_ASSERT_EQUAL(
tree_pt(tree, 0.5, 1), 1);
419
420 CU_ASSERT_EQUAL(
tree_pt(tree, 1, 0.5), 1);
421
424
425
428
429
430 CU_ASSERT_EQUAL(
tree_pt(tree, -0.5, 0.5), 0);
431
432 CU_ASSERT_EQUAL(
tree_pt(tree, 3, 1), 0);
433
434 CU_ASSERT_EQUAL(
tree_pt(tree, 2, 1), 1);
435
436 CU_ASSERT_EQUAL(
tree_pt(tree, 0, 1), 1);
437
438 CU_ASSERT_EQUAL(
tree_pt(tree, 0, 3), 1);
439
440 CU_ASSERT_EQUAL(
tree_pt(tree, 4, 0), 1);
441
442 CU_ASSERT_EQUAL(
tree_pt(tree, 3, 3), 1);
443
444 CU_ASSERT_EQUAL(
tree_pt(tree, 2, 0), 1);
445
448
449
450
451
452 poly =
lwgeom_from_wkt(
"POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
LW_PARSER_CHECK_NONE);
454
455
456 CU_ASSERT_EQUAL(
tree_pt(tree, -0.5, 3.5), 0);
457
458 CU_ASSERT_EQUAL(
tree_pt(tree, 6.0, 2.2), 0);
459
460 CU_ASSERT_EQUAL(
tree_pt(tree, 3, 2), 1);
461
462 CU_ASSERT_EQUAL(
tree_pt(tree, 1, 0), 1);
463
464 CU_ASSERT_EQUAL(
tree_pt(tree, 3, 6), 1);
465
466 CU_ASSERT_EQUAL(
tree_pt(tree, 3, 1), 1);
467
468 CU_ASSERT_EQUAL(
tree_pt(tree, 0, 2), 1);
469
470 CU_ASSERT_EQUAL(
tree_pt(tree, 0, 6), 1);
471
474
475}
static int tree_pt(RECT_NODE *tree, double x, double y)
void lwgeom_free(LWGEOM *geom)
#define LW_PARSER_CHECK_NONE
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
RECT_NODE * rect_tree_from_lwgeom(const LWGEOM *lwgeom)
Create a tree index on top an LWGEOM.
void rect_tree_free(RECT_NODE *node)
Recurse from top of node tree and free all children.
References LW_PARSER_CHECK_NONE, lwgeom_free(), lwgeom_from_wkt(), rect_tree_free(), rect_tree_from_lwgeom(), and tree_pt().
Referenced by measures_suite_setup().