PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ test_point_density()

static void test_point_density ( void  )
static

Definition at line 1083 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().

1084 {
1085  LWGEOM *geom;
1086  LWMPOINT *mpt;
1087  // char *ewkt;
1088 
1089  /* POLYGON */
1090  geom = lwgeom_from_wkt("POLYGON((1 0,0 1,1 2,2 1,1 0))", LW_PARSER_CHECK_NONE);
1091  mpt = lwgeom_to_points(geom, 100);
1092  CU_ASSERT_EQUAL(mpt->ngeoms,100);
1093  // ewkt = lwgeom_to_ewkt((LWGEOM*)mpt);
1094  // printf("%s\n", ewkt);
1095  // lwfree(ewkt);
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  mpt = lwgeom_to_points(geom, 0);
1103  CU_ASSERT_EQUAL(mpt, NULL);
1104  lwmpoint_free(mpt);
1105 
1106  lwgeom_free(geom);
1107 
1108  /* MULTIPOLYGON */
1109  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);
1110 
1111  mpt = lwgeom_to_points(geom, 1000);
1112  CU_ASSERT_EQUAL(mpt->ngeoms,1000);
1113  lwmpoint_free(mpt);
1114 
1115  mpt = lwgeom_to_points(geom, 1);
1116  CU_ASSERT_EQUAL(mpt->ngeoms,1);
1117  lwmpoint_free(mpt);
1118 
1119  lwgeom_free(geom);
1120 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1099
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2013
void lwmpoint_free(LWMPOINT *mpt)
Definition: lwmpoint.c:72
LWMPOINT * lwgeom_to_points(const LWGEOM *lwgeom, int npoints)
int ngeoms
Definition: liblwgeom.h:468
Here is the call graph for this function:
Here is the caller graph for this function: