PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ test_point_density()

static void test_point_density ( void  )
static

Definition at line 1334 of file cu_algorithm.c.

1335 {
1336  LWGEOM *geom;
1337  LWMPOINT *mpt;
1338  // char *ewkt;
1339 
1340  /* POLYGON */
1341  geom = lwgeom_from_wkt("POLYGON((1 0,0 1,1 2,2 1,1 0))", LW_PARSER_CHECK_NONE);
1342  mpt = lwgeom_to_points(geom, 100);
1343  CU_ASSERT_EQUAL(mpt->ngeoms,100);
1344  // ewkt = lwgeom_to_ewkt((LWGEOM*)mpt);
1345  // printf("%s\n", ewkt);
1346  // lwfree(ewkt);
1347  lwmpoint_free(mpt);
1348 
1349  mpt = lwgeom_to_points(geom, 1);
1350  CU_ASSERT_EQUAL(mpt->ngeoms,1);
1351  lwmpoint_free(mpt);
1352 
1353  mpt = lwgeom_to_points(geom, 0);
1354  CU_ASSERT_EQUAL(mpt, NULL);
1355  lwmpoint_free(mpt);
1356 
1357  lwgeom_free(geom);
1358 
1359  /* MULTIPOLYGON */
1360  geom = lwgeom_from_wkt("MULTIPOLYGON(((10 0,0 10,10 20,20 10,10 0)),((0 0,5 0,5 5,0 5,0 0)))", LW_PARSER_CHECK_NONE);
1361 
1362  mpt = lwgeom_to_points(geom, 1000);
1363  CU_ASSERT_EQUAL(mpt->ngeoms,1000);
1364  lwmpoint_free(mpt);
1365 
1366  mpt = lwgeom_to_points(geom, 1);
1367  CU_ASSERT_EQUAL(mpt->ngeoms,1);
1368  lwmpoint_free(mpt);
1369 
1370  lwgeom_free(geom);
1371 }
void lwmpoint_free(LWMPOINT *mpt)
Definition: lwmpoint.c:72
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2005
LWMPOINT * lwgeom_to_points(const LWGEOM *lwgeom, uint32_t npoints)
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
uint32_t ngeoms
Definition: liblwgeom.h:471

References LW_PARSER_CHECK_NONE, lwgeom_free(), lwgeom_from_wkt(), lwgeom_to_points(), lwmpoint_free(), and LWMPOINT::ngeoms.

Referenced by algorithms_suite_setup().

Here is the call graph for this function:
Here is the caller graph for this function: