Return the list of directed edges bounding a face.
3210{
3214 uint64_t numfaceedges;
3215 int fields;
3216 uint32_t i;
3217 int nseid = 0;
3218 int prevseid;
3220
3221
3222 numfaceedges = 1;
3227 ;
3229 if (numfaceedges == UINT64_MAX)
3230 {
3232 return -1;
3233 }
3234 if ( ! numfaceedges ) return 0;
3235 LWDEBUGF(1,
"lwt_GetFaceEdges: lwt_be_getEdgeByFace returned %llu edges", numfaceedges);
3236
3237
3238
3240 if ( ! face )
3241 {
3242
3244 lwerror(
"Corrupted topology: unable to build geometry of face %"
3245 LWTFMT_ELEMID " from its %"PRIu64
" edges", face_id, numfaceedges);
3246 return -1;
3247 }
3248
3250 {
3251
3254 return 0;
3255 }
3256
3257
3258
3259
3261
3262#if 0
3263 {
3264 size_t sz;
3267 face_id, wkt);
3269 }
3270#endif
3271
3273 if ( ! facepoly )
3274 {
3278 return -1;
3279 }
3280
3281 nseid = prevseid = 0;
3283
3284
3285 for ( i=0; i<facepoly->
nrings; ++i )
3286 {
3288 int32_t j = 0;
3291
3293
3294 while ( j < (int32_t) ring->
npoints-1 )
3295 {
3296 LWDEBUGF(1,
"Looking for edge covering ring %d from vertex %d",
3297 i, j);
3298
3300 if ( edgeno == -1 )
3301 {
3302
3306 lwerror(
"No edge (among %" PRIu64
") found to be defining geometry of face %"
3308 return -1;
3309 }
3310
3311 nextedge = &(edges[edgeno]);
3312 nextline = nextedge->
geom;
3313
3315 " covers ring %d from vertex %d to %d",
3317
3318#if 0
3319 {
3320 size_t sz;
3325 }
3326#endif
3327
3329
3330
3331 seid[nseid++] = nextedge->
face_left == face_id ?
3334
3335
3337 }
3338
3339
3340
3341
3342 if ( (nseid - prevseid) > 1 )
3343 {{
3345 int minidx = 0;
3346 LWDEBUGF(1,
"Looking for smallest id among the %d edges "
3347 "composing ring %d", (nseid-prevseid), i);
3348 for ( j=prevseid; j<nseid; ++j )
3349 {
3352 if ( ! minid || id < minid )
3353 {
3354 minid = id;
3355 minidx = j;
3356 }
3357 }
3359 " at position %d", minid, minidx);
3360 if ( minidx != prevseid )
3361 {
3363 }
3364 }}
3365
3366 prevseid = nseid;
3367 }
3368
3371
3372 *out = seid;
3373 return nseid;
3374}
void lwgeom_free(LWGEOM *geom)
char * lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
WKT emitter function.
void * lwalloc(size_t size)
LWPOLY * lwgeom_as_lwpoly(const LWGEOM *lwgeom)
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
void lwgeom_reverse_in_place(LWGEOM *lwgeom)
Reverse vertex order of LWGEOM.
#define LWT_COL_EDGE_FACE_RIGHT
LWT_INT64 LWT_ELEMID
Identifier of topology element.
#define LWT_COL_EDGE_FACE_LEFT
#define LWT_COL_EDGE_EDGE_ID
Edge fields.
#define LWT_COL_EDGE_GEOM
#define PGTOPO_BE_ERROR()
#define LWDEBUGF(level, msg,...)
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
static int _lwt_FindNextRingEdge(const POINTARRAY *ring, int from, const LWT_ISO_EDGE *edges, int numedges)
static void _lwt_RotateElemidArray(LWT_ELEMID *ary, int from, int to, int rotidx)
static LWT_ISO_EDGE * lwt_be_getEdgeByFace(LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields, const GBOX *box)
void _lwt_release_edges(LWT_ISO_EDGE *edges, int num_edges)
static LWGEOM * _lwt_FaceByEdges(LWT_TOPOLOGY *topo, LWT_ISO_EDGE *edges, int numfaceedges)
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)