25 #include "../postgis_config.h" 58 LWDEBUGF(2,
"BOX X range is %g..%g, cutx:%g, amount:%g", box_in->
xmin, box_in->
xmax, cutx, amount);
61 if ( ( amount < 0 && box_in->xmin >= cutx ) || ( amount > 0 && box_in->
xmax <= cutx ) )
65 LWDEBUGG(2, split,
"returning the translated geometry");
70 if ( ( amount < 0 && box_in->xmax <= cutx ) || ( amount > 0 && box_in->
xmin >= cutx ) )
73 LWDEBUGG(2, split,
"returning the cloned geometry");
82 pt.
y = box_in->
ymin - 1;
84 pt.
y = box_in->
ymax + 1;
88 LWDEBUG(2,
"splitting the geometry");
97 LWDEBUGG(2, split,
"split geometry");
104 lwnotice(
"WARNING: unexpected lack of split in lwgeom_split_wrapx");
112 LWDEBUGF(2,
"col_out:%p, unaryunion_out:%p", col_out, out);
126 int outtype = lwcoll_in->
type;
131 lwerror(
"Out of virtual memory");
135 for (i=0; i<lwcoll_in->
ngeoms; ++i)
137 LWDEBUGF(3,
"Wrapping collection element %d", i);
140 if ( ! wrap_geoms[i] ) {
141 lwnotice(
"Error wrapping geometry, cleaning up");
143 lwnotice(
"cleaning geometry %d (%p)", i, wrap_geoms[i]);
160 lwcoll_in->
ngeoms, wrap_geoms);
172 LWDEBUG(2,
"geom is empty, cloning");
179 LWDEBUG(2,
"amount is zero, cloning");
183 switch (lwgeom_in->
type)
187 LWDEBUG(2,
"split-wrapping line or polygon");
196 LWDEBUGF(2,
"POINT X is %g, cutx:%g, amount:%g", pt4d.
x, cutx, amount);
198 if ( ( amount < 0 && pt4d.x > cutx ) || ( amount > 0 && pt4d.
x < cutx ) )
210 LWDEBUG(2,
"collection-wrapping multi");
216 lwerror(
"Wrapping of %s geometries is unsupported",
void ptarray_set_point4d(POINTARRAY *pa, int n, const POINT4D *p4d)
POINTARRAY * ptarray_construct(char hasz, char hasm, uint32_t npoints)
Construct an empty pointarray, allocating storage and setting the npoints, but not filling in any inf...
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
void lwgeom_free(LWGEOM *geom)
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
#define LWDEBUG(level, msg)
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep clone an LWGEOM, everything is copied.
LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
static LWCOLLECTION * lwcollection_wrapx(const LWCOLLECTION *lwcoll_in, double cutx, double amount)
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
static LWGEOM * lwgeom_split_wrapx(const LWGEOM *geom_in, double cutx, double amount)
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
LWLINE * lwline_construct(int srid, GBOX *bbox, POINTARRAY *points)
const GBOX * lwgeom_get_bbox(const LWGEOM *lwgeom)
Get a non-empty geometry bounding box, computing and caching it if not already there.
LWGEOM * lwgeom_wrapx(const LWGEOM *lwgeom_in, double cutx, double amount)
wrap geometry on given cut x value
#define LWDEBUGG(level, geom, msg)
uint8_t MULTITYPE[NUMTYPES]
Look-up for the correct MULTI* type promotion for singleton types.
LWGEOM * lwgeom_unaryunion(const LWGEOM *geom1)
LWCOLLECTION * lwgeom_as_lwcollection(const LWGEOM *lwgeom)
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
void lwcollection_free(LWCOLLECTION *col)
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
void * lwalloc(size_t size)
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
#define LWDEBUGF(level, msg,...)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
int getPoint4d_p(const POINTARRAY *pa, int n, POINT4D *point)
void lwgeom_affine(LWGEOM *geom, const AFFINE *affine)
LWGEOM * lwgeom_split(const LWGEOM *lwgeom_in, const LWGEOM *blade_in)
LWGEOM * lwcollection_as_lwgeom(const LWCOLLECTION *obj)