PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches
cu_remove_irrelevant_points_for_view.c
Go to the documentation of this file.
1/**********************************************************************
2 *
3 * PostGIS - Spatial Types for PostgreSQL
4 * http://postgis.net
5 *
6 * Copyright (C) 2024 Sam Peters <gluser1357@gmx.de>
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU General Public Licence. See the COPYING file.
10 *
11 **********************************************************************/
12
13#include "CUnit/Basic.h"
14#include "cu_tester.h"
15
17
18// test case for lwgeom_remove_irrelevant_points_for_view()
20{
21 LWGEOM *geom;
22 char *wkt, *in_wkt;
23 GBOX *bbox;
24
25 bbox = gbox_new(0);
26 bbox->xmin = 12;
27 bbox->xmax = 18;
28 bbox->ymin = 12;
29 bbox->ymax = 18;
30
31 geom = lwgeom_from_wkt("POLYGON((0 30, 15 30, 30 30, 30 0, 0 0, 0 30))", LW_PARSER_CHECK_NONE);
32 CU_ASSERT(geom != NULL);
33
35 wkt = lwgeom_to_ewkt(geom);
36 in_wkt = "POLYGON((15 30,30 0,0 0,15 30))";
37 ASSERT_STRING_EQUAL(wkt, in_wkt);
38
39 lwfree(wkt);
40 lwgeom_free(geom);
41 lwfree(bbox);
42}
43
45void
47{
48 CU_pSuite suite = CU_add_suite("remove_irrelevant_points_for_view", NULL, NULL);
50}
static void test_lwgeom_remove_irrelevant_points_for_view(void)
void remove_irrelevant_points_for_view_suite_setup(void)
GBOX * gbox_new(lwflags_t flags)
Create a new gbox with the dimensionality indicated by the flags.
Definition gbox.c:32
#define PG_ADD_TEST(suite, testfunc)
#define ASSERT_STRING_EQUAL(o, e)
void lwgeom_remove_irrelevant_points_for_view(LWGEOM *geom, GBOX *bbox, bool cartesian_hint)
remove points that are irrelevant for rendering the geometry within a view specified by rectangular b...
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1246
#define LW_PARSER_CHECK_NONE
Definition liblwgeom.h:2149
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an allocated string.
Definition lwgeom.c:593
void lwfree(void *mem)
Definition lwutil.c:248
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition lwin_wkt.c:940
double ymax
Definition liblwgeom.h:357
double xmax
Definition liblwgeom.h:355
double ymin
Definition liblwgeom.h:356
double xmin
Definition liblwgeom.h:354