6731 const GBOX *minenv = NULL;
6733 const GBOX *testbox;
6734 GEOSGeometry *ghole;
6752 if ( ! shells->
tree )
6755 LWDEBUG(1,
"Building STRtree");
6757 if (shells->
tree == NULL)
6762 for (i=0; i<shells->
size; ++i)
6766 LWDEBUGF(2,
"GBOX of shell %p for edge %d is %g %g,%g %g",
6772 pt.
x = shellbox->
xmin;
6773 pt.
y = shellbox->
ymin;
6775 pt.
x = shellbox->
xmax;
6776 pt.
y = shellbox->
ymax;
6783 GEOSSTRtree_insert(shells->
tree, sring->
genv, sring);
6785 LWDEBUG(1,
"STRtree build completed");
6791 LWDEBUGF(1,
"Found %d candidate shells containing first point of ring's originating edge %d",
6796 for (i=0; i<candidates.
size; ++i)
6804 LWDEBUGF(1,
"Shell %d is on other side of ring",
6812 LWDEBUGF(1,
"Bbox of shell %d equals that of hole ring",
6820 LWDEBUGF(1,
"Bbox of shell %d does not contain bbox of ring point",
6829 LWDEBUGF(2,
"Bbox of shell %d (face %d) not contained by bbox "
6830 "of last shell found to contain the point",
6841 LWDEBUGF(1,
"Shell %d contains hole of edge %d",
6848 if ( foundInFace == -1 ) foundInFace = 0;
6850 candidates.
size = 0;
6853 GEOSGeom_destroy(ghole);
int gbox_same(const GBOX *g1, const GBOX *g2)
Check if 2 given Gbox are the same.
int gbox_contains_2d(const GBOX *g1, const GBOX *g2)
Return LW_TRUE if the first GBOX contains the second on the 2d plane, LW_FALSE otherwise.
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
GEOSGeometry * LWGEOM2GEOS(const LWGEOM *lwgeom, uint8_t autofix)
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
LWPOINT * lwpoint_make2d(int32_t srid, double x, double y)
void lwpoint_free(LWPOINT *pt)
int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
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...
LWLINE * lwline_construct(int32_t srid, GBOX *bbox, POINTARRAY *points)
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
void ptarray_set_point4d(POINTARRAY *pa, uint32_t n, const POINT4D *p4d)
void lwline_free(LWLINE *line)
LWT_INT64 LWT_ELEMID
Identifier of topology element.
static const int STRTREE_NODE_CAPACITY
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
static int _lwt_EdgeRingContainsPoint(LWT_EDGERING *ring, POINT2D *p)
static LWT_ELEMID _lwt_EdgeRingGetFace(LWT_EDGERING *ring)
static GBOX * _lwt_EdgeRingGetBbox(LWT_EDGERING *ring)
#define LWT_EDGERING_ARRAY_INIT(a)
static void _lwt_AccumulateCanditates(void *item, void *userdata)
#define LWT_EDGERING_ARRAY_CLEAN(a)
Datum contains(PG_FUNCTION_ARGS)
LWT_EDGERING_ELEM ** elems