Return the list of directed edges bounding a face.
3023{
3027 uint64_t numfaceedges;
3028 int fields;
3029 uint32_t i;
3030 int nseid = 0;
3031 int prevseid;
3033
3034
3035 numfaceedges = 1;
3040 ;
3042 if (numfaceedges == UINT64_MAX)
3043 {
3045 return -1;
3046 }
3047 if ( ! numfaceedges ) return 0;
3048
3049
3050
3052 if ( ! face )
3053 {
3054
3056 lwerror(
"Corrupted topology: unable to build geometry of face %"
3057 LWTFMT_ELEMID " from its %"PRIu64
" edges", face_id, numfaceedges);
3058 return -1;
3059 }
3060
3062 {
3063
3066 return 0;
3067 }
3068
3069
3070
3071
3073
3074#if 0
3075 {
3076 size_t sz;
3079 face_id, wkt);
3081 }
3082#endif
3083
3085 if ( ! facepoly )
3086 {
3090 return -1;
3091 }
3092
3093 nseid = prevseid = 0;
3095
3096
3097 for ( i=0; i<facepoly->
nrings; ++i )
3098 {
3100 int32_t j = 0;
3103
3105
3106 while ( j < (int32_t) ring->
npoints-1 )
3107 {
3108 LWDEBUGF(1,
"Looking for edge covering ring %d from vertex %d",
3109 i, j);
3110
3112 if ( edgeno == -1 )
3113 {
3114
3118 lwerror(
"No edge (among %d) found to be defining geometry of face %"
3120 return -1;
3121 }
3122
3123 nextedge = &(edges[edgeno]);
3124 nextline = nextedge->
geom;
3125
3127 " covers ring %d from vertex %d to %d",
3129
3130#if 0
3131 {
3132 size_t sz;
3137 }
3138#endif
3139
3141
3142
3143 seid[nseid++] = nextedge->
face_left == face_id ?
3146
3147
3149 }
3150
3151
3152
3153
3154 if ( (nseid - prevseid) > 1 )
3155 {{
3157 int minidx = 0;
3158 LWDEBUGF(1,
"Looking for smallest id among the %d edges "
3159 "composing ring %d", (nseid-prevseid), i);
3160 for ( j=prevseid; j<nseid; ++j )
3161 {
3164 if ( ! minid || id < minid )
3165 {
3166 minid = id;
3167 minidx = j;
3168 }
3169 }
3171 " at position %d", minid, minidx);
3172 if ( minidx != prevseid )
3173 {
3175 }
3176 }}
3177
3178 prevseid = nseid;
3179 }
3180
3183
3184 *out = seid;
3185 return nseid;
3186}
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 LWDEBUGF(level, msg,...)
void lwerror(const char *fmt,...)
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)
const char * lwt_be_lastErrorMessage(const LWT_BE_IFACE *be)
static 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)
const LWT_BE_IFACE * be_iface