PostGIS  2.3.6-r@@SVN_REVISION@@
static void test_point_density ( void  )
static

Definition at line 1066 of file cu_algorithm.c.

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

Referenced by algorithms_suite_setup().

1067 {
1068  LWGEOM *geom;
1069  LWMPOINT *mpt;
1070  // char *ewkt;
1071 
1072  /* POLYGON */
1073  geom = lwgeom_from_wkt("POLYGON((1 0,0 1,1 2,2 1,1 0))", LW_PARSER_CHECK_NONE);
1074  mpt = lwgeom_to_points(geom, 100);
1075  CU_ASSERT_EQUAL(mpt->ngeoms,100);
1076  // ewkt = lwgeom_to_ewkt((LWGEOM*)mpt);
1077  // printf("%s\n", ewkt);
1078  // lwfree(ewkt);
1079  lwmpoint_free(mpt);
1080 
1081  mpt = lwgeom_to_points(geom, 1);
1082  CU_ASSERT_EQUAL(mpt->ngeoms,1);
1083  lwmpoint_free(mpt);
1084 
1085  mpt = lwgeom_to_points(geom, 0);
1086  CU_ASSERT_EQUAL(mpt, NULL);
1087  lwmpoint_free(mpt);
1088 
1089  lwgeom_free(geom);
1090 
1091  /* MULTIPOLYGON */
1092  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);
1093 
1094  mpt = lwgeom_to_points(geom, 1000);
1095  CU_ASSERT_EQUAL(mpt->ngeoms,1000);
1096  lwmpoint_free(mpt);
1097 
1098  mpt = lwgeom_to_points(geom, 1);
1099  CU_ASSERT_EQUAL(mpt->ngeoms,1);
1100  lwmpoint_free(mpt);
1101 
1102  lwgeom_free(geom);
1103 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1063
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1985
void lwmpoint_free(LWMPOINT *mpt)
Definition: lwmpoint.c:72
LWMPOINT * lwgeom_to_points(const LWGEOM *lwgeom, int npoints)
int ngeoms
Definition: liblwgeom.h:467

Here is the call graph for this function:

Here is the caller graph for this function: