803{
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
823 int numfaces = -1;
826 int i;
827 int err = 0;
828
831
833
834
835
836
837
839 if ( numfaces != 0 ) {
840 if ( numfaces > 0 ) {
841
842 lwerror(
"Polygonize: face table is not empty.");
843 }
844
845 return -1;
846 }
847
848
850 if ( ! edgetable.
edges ) {
851 if (edgetable.
size == 0) {
852
853 return 0;
854 }
855
856 return -1;
857 }
858
859
861
862
863 for (i=0; i<edgetable.
size; ++i)
865
866 i = 0;
867 while (1)
868 {
870 if ( i < 0 ) break;
871 edge = &(edgetable.
edges[i]);
872
874
875 LWDEBUGF(1,
"Next face-missing edge has id:%lld, face_left:%lld, face_right:%lld",
878 {
880 &holes, &shells, &newface);
881 if ( err ) break;
882 LWDEBUGF(1,
"New face on the left of edge %lld is %lld",
885 }
887 {
889 &holes, &shells, &newface);
890 if ( err ) break;
891 LWDEBUGF(1,
"New face on the right of edge %lld is %lld",
894 }
895 }
896
897 if ( err )
898 {
902 lwerror(
"Errors fetching or registering face-missing edges: %s",
904 return -1;
905 }
906
908
909
910
911
912 for (i=0; i<holes.
size; ++i)
913 {
916
919 if ( containing_face == -1 )
920 {
924 lwerror(
"Errors finding face containing ring: %s",
926 return -1;
927 }
929 if ( ret )
930 {
934 lwerror(
"Errors updating edgering side face: %s",
936 return -1;
937 }
938 }
939
940 LWDEBUG(1,
"All holes assigned, cleaning up");
941
943
944
947
948 return 0;
949}
void lwgeom_geos_error(const char *fmt,...)
LWT_INT64 LWT_ELEMID
Identifier of topology element.
void _lwt_release_edges(LWT_ISO_EDGE *edges, int num_edges)
const char * lwt_be_lastErrorMessage(const LWT_BE_IFACE *be)
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
void lwnotice(const char *fmt,...) __attribute__((format(printf
Write a notice out to the notice handler.
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
static int _lwt_UpdateEdgeRingSideFace(LWT_TOPOLOGY *topo, LWT_EDGERING *ring, LWT_ELEMID face)
static int _lwt_CheckFacesExist(LWT_TOPOLOGY *topo)
#define LWT_EDGERING_ARRAY_INIT(a)
static int _lwt_RegisterFaceOnEdgeSide(LWT_TOPOLOGY *topo, LWT_ISO_EDGE *edge, int side, LWT_ISO_EDGE_TABLE *edges, LWT_EDGERING_ARRAY *holes, LWT_EDGERING_ARRAY *shells, LWT_ELEMID *registered)
static LWT_ISO_EDGE * _lwt_FetchAllEdges(LWT_TOPOLOGY *topo, int *numedges)
static LWT_ELEMID _lwt_FindFaceContainingRing(LWT_TOPOLOGY *topo, LWT_EDGERING *ring, LWT_EDGERING_ARRAY *shells)
#define LWT_EDGERING_ARRAY_CLEAN(a)
static int compare_iso_edges_by_id(const void *si1, const void *si2)
static int _lwt_FetchNextUnvisitedEdge(__attribute__((__unused__)) LWT_TOPOLOGY *topo, LWT_ISO_EDGE_TABLE *etab, int from)
const LWT_BE_IFACE * be_iface