Definition at line 351 of file cu_measures.c.
352{
355
356
357
358
359 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);
361
362
363
364
365
366
367 CU_ASSERT_EQUAL(
tree_pt(tree, 5, 7.5), 0);
368
369 CU_ASSERT_EQUAL(
tree_pt(tree, 8, 9), 1);
370
371 CU_ASSERT_EQUAL(
tree_pt(tree, -1, 5), 0);
372
373 CU_ASSERT_EQUAL(
tree_pt(tree, -1, 7.5), 0);
374
375 CU_ASSERT_EQUAL(
tree_pt(tree, 0.2, 7.5), 0);
376
377 CU_ASSERT_EQUAL(
tree_pt(tree, 0.5, 0.5), 1);
378
379 CU_ASSERT_EQUAL(
tree_pt(tree, 2, 7.5), 1);
380
381 CU_ASSERT_EQUAL(
tree_pt(tree, 7, 7), 1);
382
385
386
387
388
389
390 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);
392
393
394 CU_ASSERT_EQUAL(
tree_pt(tree, 3, 6), 1);
395
396 CU_ASSERT_EQUAL(
tree_pt(tree, 3, 5.5), 1);
397
398 CU_ASSERT_EQUAL(
tree_pt(tree, -3, 5.5), 0);
399
400 CU_ASSERT_EQUAL(
tree_pt(tree, 4, 4), 1);
401 CU_ASSERT_EQUAL(
tree_pt(tree, 6, 6), 1);
402
403 CU_ASSERT_EQUAL(
tree_pt(tree, 4.5, 4), 1);
404
405 CU_ASSERT_EQUAL(
tree_pt(tree, 8, 0), 1);
406 CU_ASSERT_EQUAL(
tree_pt(tree, 9, 0), 1);
407 CU_ASSERT_EQUAL(
tree_pt(tree, 10, 1), 1);
408 CU_ASSERT_EQUAL(
tree_pt(tree, 9.5, 1), 1);
409 CU_ASSERT_EQUAL(
tree_pt(tree, 0, 10), 1);
410
411 CU_ASSERT_EQUAL(
tree_pt(tree, 1, 6), 1);
412
413 CU_ASSERT_EQUAL(
tree_pt(tree, -1, 6), 0);
414
415 CU_ASSERT_EQUAL(
tree_pt(tree, 5, 5), 0);
416
417 CU_ASSERT_EQUAL(
tree_pt(tree, 0.5, 4), 1);
418 CU_ASSERT_EQUAL(
tree_pt(tree, 0.5, 6), 1);
419 CU_ASSERT_EQUAL(
tree_pt(tree, 0.5, 9), 1);
420
423
424
425
426
429
430
431 CU_ASSERT_EQUAL(
tree_pt(tree, 0.5, 0.5), 1);
432
433 CU_ASSERT_EQUAL(
tree_pt(tree, 1.5, 0.5), 0);
434
435 CU_ASSERT_EQUAL(
tree_pt(tree, -1, 1), 0);
436
437 CU_ASSERT_EQUAL(
tree_pt(tree, 1, 1), 1);
438
439 CU_ASSERT_EQUAL(
tree_pt(tree, 0.5, 1), 1);
440
441 CU_ASSERT_EQUAL(
tree_pt(tree, 1, 0.5), 1);
442
445
446
449
450
451 CU_ASSERT_EQUAL(
tree_pt(tree, -0.5, 0.5), 0);
452
453 CU_ASSERT_EQUAL(
tree_pt(tree, 3, 1), 0);
454
455 CU_ASSERT_EQUAL(
tree_pt(tree, 2, 1), 1);
456
457 CU_ASSERT_EQUAL(
tree_pt(tree, 0, 1), 1);
458
459 CU_ASSERT_EQUAL(
tree_pt(tree, 0, 3), 1);
460
461 CU_ASSERT_EQUAL(
tree_pt(tree, 4, 0), 1);
462
463 CU_ASSERT_EQUAL(
tree_pt(tree, 3, 3), 1);
464
465 CU_ASSERT_EQUAL(
tree_pt(tree, 2, 0), 1);
466
469
470
471
472
473 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);
475
476
477 CU_ASSERT_EQUAL(
tree_pt(tree, -0.5, 3.5), 0);
478
479 CU_ASSERT_EQUAL(
tree_pt(tree, 6.0, 2.2), 0);
480
481 CU_ASSERT_EQUAL(
tree_pt(tree, 3, 2), 1);
482
483 CU_ASSERT_EQUAL(
tree_pt(tree, 1, 0), 1);
484
485 CU_ASSERT_EQUAL(
tree_pt(tree, 3, 6), 1);
486
487 CU_ASSERT_EQUAL(
tree_pt(tree, 3, 1), 1);
488
489 CU_ASSERT_EQUAL(
tree_pt(tree, 0, 2), 1);
490
491 CU_ASSERT_EQUAL(
tree_pt(tree, 0, 6), 1);
492
495
496}
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().