PostGIS  2.5.0beta1dev-r@@SVN_REVISION@@
liblwgeom_topo.h
Go to the documentation of this file.
1 /**********************************************************************
2  *
3  * PostGIS - Spatial Types for PostgreSQL
4  * http://postgis.net
5  *
6  * PostGIS is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * PostGIS is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with PostGIS. If not, see <http://www.gnu.org/licenses/>.
18  *
19  **********************************************************************
20  *
21  * Copyright (C) 2015-2017 Sandro Santilli <strk@kbt.io>
22  *
23  **********************************************************************/
24 
25 
26 #ifndef LIBLWGEOM_TOPO_H
27 #define LIBLWGEOM_TOPO_H 1
28 
29 #include "liblwgeom.h"
30 
31 /* INT64 */
32 typedef int64_t LWT_INT64;
33 
36 
37 /*
38  * ISO primitive elements
39  */
40 
42 typedef struct
43 {
45  LWT_ELEMID containing_face; /* -1 if not isolated */
47 }
49 
51 
53 #define LWT_COL_NODE_NODE_ID 1<<0
54 #define LWT_COL_NODE_CONTAINING_FACE 1<<1
55 #define LWT_COL_NODE_GEOM 1<<2
56 #define LWT_COL_NODE_ALL (1<<3)-1
57 
59 typedef struct
60 {
69 }
71 
73 #define LWT_COL_EDGE_EDGE_ID 1<<0
74 #define LWT_COL_EDGE_START_NODE 1<<1
75 #define LWT_COL_EDGE_END_NODE 1<<2
76 #define LWT_COL_EDGE_FACE_LEFT 1<<3
77 #define LWT_COL_EDGE_FACE_RIGHT 1<<4
78 #define LWT_COL_EDGE_NEXT_LEFT 1<<5
79 #define LWT_COL_EDGE_NEXT_RIGHT 1<<6
80 #define LWT_COL_EDGE_GEOM 1<<7
81 #define LWT_COL_EDGE_ALL (1<<8)-1
82 
84 typedef struct
85 {
88 }
90 
92 #define LWT_COL_FACE_FACE_ID 1<<0
93 #define LWT_COL_FACE_MBR 1<<1
94 #define LWT_COL_FACE_ALL (1<<2)-1
95 
96 typedef enum LWT_SPATIALTYPE_T {
99  LWT_AREAL = 2,
102 
103 /*
104  * Backend handling functions
105  */
106 
107 /* opaque pointers referencing native backend objects */
108 
115 typedef struct LWT_BE_DATA_T LWT_BE_DATA;
116 
125 
133 typedef struct LWT_BE_TOPOLOGY_T LWT_BE_TOPOLOGY;
134 
140 typedef struct LWT_BE_CALLBACKS_T {
141 
147  const char* (*lastErrorMessage) (const LWT_BE_DATA* be);
148 
159  LWT_BE_TOPOLOGY* (*createTopology) (
160  const LWT_BE_DATA* be,
161  const char* name, int srid, double precision, int hasZ
162  );
163 
171  LWT_BE_TOPOLOGY* (*loadTopologyByName) (
172  const LWT_BE_DATA* be,
173  const char* name
174  );
175 
183 
201  LWT_ISO_NODE* (*getNodeById) (
202  const LWT_BE_TOPOLOGY* topo,
203  const LWT_ELEMID* ids, int* numelems, int fields
204  );
205 
226  LWT_ISO_NODE* (*getNodeWithinDistance2D) (
227  const LWT_BE_TOPOLOGY* topo,
228  const LWPOINT* pt, double dist, int* numelems,
229  int fields, int limit
230  );
231 
245  int (*insertNodes) (
246  const LWT_BE_TOPOLOGY* topo,
247  LWT_ISO_NODE* nodes,
248  int numelems
249  );
250 
267  LWT_ISO_EDGE* (*getEdgeById) (
268  const LWT_BE_TOPOLOGY* topo,
269  const LWT_ELEMID* ids, int* numelems, int fields
270  );
271 
292  LWT_ISO_EDGE* (*getEdgeWithinDistance2D) (
293  const LWT_BE_TOPOLOGY* topo,
294  const LWPOINT* pt, double dist, int* numelems,
295  int fields, int limit
296  );
297 
309  const LWT_BE_TOPOLOGY* topo
310  );
311 
325  int (*insertEdges) (
326  const LWT_BE_TOPOLOGY* topo,
327  LWT_ISO_EDGE* edges,
328  int numelems
329  );
330 
349  int (*updateEdges) (
350  const LWT_BE_TOPOLOGY* topo,
351  const LWT_ISO_EDGE* sel_edge, int sel_fields,
352  const LWT_ISO_EDGE* upd_edge, int upd_fields,
353  const LWT_ISO_EDGE* exc_edge, int exc_fields
354  );
355 
372  LWT_ISO_FACE* (*getFaceById) (
373  const LWT_BE_TOPOLOGY* topo,
374  const LWT_ELEMID* ids, int* numelems, int fields
375  );
376 
388  const LWT_BE_TOPOLOGY* topo,
389  const LWPOINT* pt
390  );
391 
411  const LWT_BE_TOPOLOGY* topo,
412  LWT_ELEMID split_edge, LWT_ELEMID new_edge1, LWT_ELEMID new_edge2
413  );
414 
426  int (*deleteEdges) (
427  const LWT_BE_TOPOLOGY* topo,
428  const LWT_ISO_EDGE* sel_edge, int sel_fields
429  );
430 
450  LWT_ISO_NODE* (*getNodeWithinBox2D) (
451  const LWT_BE_TOPOLOGY* topo,
452  const GBOX* box,
453  int* numelems, int fields, int limit
454  );
455 
475  LWT_ISO_EDGE* (*getEdgeWithinBox2D) (
476  const LWT_BE_TOPOLOGY* topo,
477  const GBOX* box,
478  int* numelems, int fields, int limit
479  );
480 
499  LWT_ISO_EDGE* (*getEdgeByNode) (
500  const LWT_BE_TOPOLOGY* topo,
501  const LWT_ELEMID* ids, int* numelems, int fields
502  );
503 
522  int (*updateNodes) (
523  const LWT_BE_TOPOLOGY* topo,
524  const LWT_ISO_NODE* sel_node, int sel_fields,
525  const LWT_ISO_NODE* upd_node, int upd_fields,
526  const LWT_ISO_NODE* exc_node, int exc_fields
527  );
528 
544  const LWT_BE_TOPOLOGY* topo,
545  LWT_ELEMID split_face, LWT_ELEMID new_face1, LWT_ELEMID new_face2
546  );
547 
561  int (*insertFaces) (
562  const LWT_BE_TOPOLOGY* topo,
563  LWT_ISO_FACE* faces,
564  int numelems
565  );
566 
579  const LWT_BE_TOPOLOGY* topo,
580  const LWT_ISO_FACE* faces, int numfaces
581  );
582 
583  /*
584  * Get the ordered list edge visited by a side walk
585  *
586  * The walk starts from the side of an edge and stops when
587  * either the max number of visited edges OR the starting
588  * position is reached. The output list never includes a
589  * duplicated signed edge identifier.
590  *
591  * It is expected that the walk uses the "next_left" and "next_right"
592  * attributes of ISO edges to perform the walk (rather than recomputing
593  * the turns at each node).
594  *
595  * @param topo the topology to operate on
596  * @param edge walk start position and direction:
597  * abs value identifies the edge, sign expresses
598  * side (left if positive, right if negative)
599  * and direction (forward if positive, backward if negative).
600  * @param numedges output parameter, gets the number of edges visited
601  * @param limit max edges to return (to avoid an infinite loop in case
602  * of a corrupted topology). 0 is for unlimited.
603  * The function is expected to error out if the limit is hit.
604  *
605  * @return an array of signed edge identifiers (positive edges being
606  * walked in their direction, negative ones in opposite) or
607  * NULL on error (@see lastErrorMessage)
608  */
609  LWT_ELEMID* (*getRingEdges) (
610  const LWT_BE_TOPOLOGY* topo,
611  LWT_ELEMID edge, int *numedges, int limit
612  );
613 
628  const LWT_BE_TOPOLOGY* topo,
629  const LWT_ISO_EDGE* edges, int numedges,
630  int upd_fields
631  );
632 
653  LWT_ISO_EDGE* (*getEdgeByFace) (
654  const LWT_BE_TOPOLOGY* topo,
655  const LWT_ELEMID* ids, int* numelems, int fields,
656  const GBOX *box
657  );
658 
677  LWT_ISO_NODE* (*getNodeByFace) (
678  const LWT_BE_TOPOLOGY* topo,
679  const LWT_ELEMID* faces, int* numelems, int fields,
680  const GBOX *box
681  );
682 
697  const LWT_BE_TOPOLOGY* topo,
698  const LWT_ISO_NODE* nodes, int numnodes,
699  int upd_fields
700  );
701 
713  const LWT_BE_TOPOLOGY* topo,
714  const LWT_ELEMID* ids,
715  int numelems
716  );
717 
722  int (*topoGetSRID) (
723  const LWT_BE_TOPOLOGY* topo
724  );
725 
729  double (*topoGetPrecision) (
730  const LWT_BE_TOPOLOGY* topo
731  );
732 
737  int (*topoHasZ) (
738  const LWT_BE_TOPOLOGY* topo
739  );
740 
752  const LWT_BE_TOPOLOGY* topo,
753  const LWT_ELEMID* ids,
754  int numelems
755  );
756 
770  const LWT_BE_TOPOLOGY* topo,
771  LWT_ELEMID rem_edge,
772  LWT_ELEMID face_left,
773  LWT_ELEMID face_right
774  );
775 
791  const LWT_BE_TOPOLOGY* topo,
792  LWT_ELEMID face1, LWT_ELEMID face2, LWT_ELEMID newface
793  );
794 
816  const LWT_BE_TOPOLOGY* topo,
817  LWT_ELEMID rem_node,
818  LWT_ELEMID e1,
819  LWT_ELEMID e2
820  );
821 
838  const LWT_BE_TOPOLOGY* topo,
839  LWT_ELEMID edge1, LWT_ELEMID edge2, LWT_ELEMID newedge
840  );
841 
861  LWT_ISO_FACE* (*getFaceWithinBox2D) (
862  const LWT_BE_TOPOLOGY* topo,
863  const GBOX* box,
864  int* numelems, int fields, int limit
865  );
866 
868 
869 
878 
886 
889 
890 /********************************************************************
891  *
892  * End of BE interface
893  *
894  *******************************************************************/
895 
899 typedef enum LWT_TOPOERR_TYPE_T {
911 
913 typedef struct LWT_TOPOERR_T {
920 } LWT_TOPOERR;
921 
922 /*
923  * Topology functions
924  */
925 
931 
932 
933 /*******************************************************************
934  *
935  * Non-ISO signatures here
936  *
937  *******************************************************************/
938 
951 LWT_TOPOLOGY *lwt_CreateTopology(LWT_BE_IFACE *iface, const char *name,
952  int srid, double prec, int hasz);
953 
963 LWT_TOPOLOGY *lwt_LoadTopology(LWT_BE_IFACE *iface, const char *name);
964 
970 void lwt_DropTopology(LWT_TOPOLOGY* topo);
971 
976 void lwt_FreeTopology(LWT_TOPOLOGY* topo);
977 
988 LWT_ELEMID lwt_GetNodeByPoint(LWT_TOPOLOGY *topo, LWPOINT *pt, double tol);
989 
1001 LWT_ELEMID lwt_GetEdgeByPoint(LWT_TOPOLOGY *topo, LWPOINT *pt, double tol);
1002 
1015 LWT_ELEMID lwt_GetFaceByPoint(LWT_TOPOLOGY *topo, LWPOINT *pt, double tol);
1016 
1017 
1018 /*******************************************************************
1019  *
1020  * Topology population (non-ISO)
1021  *
1022  *******************************************************************/
1023 
1037 LWT_ELEMID lwt_AddPoint(LWT_TOPOLOGY* topo, LWPOINT* point, double tol);
1038 
1056 LWT_ELEMID* lwt_AddLine(LWT_TOPOLOGY* topo, LWLINE* line, double tol,
1057  int* nedges);
1058 
1080 LWT_ELEMID* lwt_AddLineNoFace(LWT_TOPOLOGY* topo, LWLINE* line, double tol,
1081  int* nedges);
1082 
1083 /*
1084  * Determine and register all topology faces:
1085  *
1086  * - Determines which faces are generated by existing
1087  * edges.
1088  * - Creates face records with correct mbr
1089  * - Update edge left/right face attributes
1090  *
1091  * Precondition:
1092  * - the topology edges are correctly linked
1093  * - there are no faces registered in the topology
1094  *
1095  * Postconditions:
1096  * - all left/right face attributes of edges
1097  * reference faces with correct mbr.
1098  *
1099  * Notes:
1100  * - does not attempt to assign isolated nodes to their
1101  * containing faces
1102  * - does not remove existing face records
1103  * - loads in memory all the topology edges
1104  *
1105  * @param topo the topology to operate on
1106  *
1107  * @return 0 on success, -1 on error
1108  * (librtgeom error handler will be invoked with error
1109  * message)
1110  */
1111 int lwt_Polygonize(LWT_TOPOLOGY* topo);
1112 
1131 LWT_ELEMID* lwt_AddPolygon(LWT_TOPOLOGY* topo, LWPOLY* poly, double tol,
1132  int* nfaces);
1133 
1134 /*******************************************************************
1135  *
1136  * ISO signatures here
1137  *
1138  *******************************************************************/
1139 
1149 void lwt_CreateTopoGeo(LWT_TOPOLOGY* topo, LWGEOM *geom);
1150 
1168  LWPOINT* pt, int skipChecks);
1169 
1182 int lwt_MoveIsoNode(LWT_TOPOLOGY* topo,
1183  LWT_ELEMID node, LWPOINT* pt);
1184 
1196 int lwt_RemoveIsoNode(LWT_TOPOLOGY* topo, LWT_ELEMID node);
1197 
1209 int lwt_RemIsoEdge(LWT_TOPOLOGY* topo, LWT_ELEMID edge);
1210 
1225  LWT_ELEMID startNode, LWT_ELEMID endNode,
1226  const LWLINE *geom);
1227 
1250  LWT_ELEMID start_node, LWT_ELEMID end_node,
1251  LWLINE *geom, int skipChecks);
1252 
1271  LWT_ELEMID start_node, LWT_ELEMID end_node,
1272  LWLINE *geom, int skipChecks);
1273 
1286 
1303 
1315 int lwt_ChangeEdgeGeom(LWT_TOPOLOGY* topo, LWT_ELEMID edge, LWLINE* curve);
1316 
1331 LWT_ELEMID lwt_ModEdgeSplit(LWT_TOPOLOGY* topo, LWT_ELEMID edge, LWPOINT* pt, int skipChecks);
1332 
1346 LWT_ELEMID lwt_NewEdgesSplit(LWT_TOPOLOGY* topo, LWT_ELEMID edge, LWPOINT* pt, int skipChecks);
1347 
1361 
1375 
1389 int lwt_GetFaceEdges(LWT_TOPOLOGY* topo, LWT_ELEMID face, LWT_ELEMID **edges);
1390 
1403 
1404 #endif /* LIBLWGEOM_TOPO_H */
enum LWT_TOPOERR_TYPE_T LWT_TOPOERR_TYPE
Topology errors type.
LWT_ELEMID face_left
LWT_ELEMID lwt_AddIsoNode(LWT_TOPOLOGY *topo, LWT_ELEMID face, LWPOINT *pt, int skipChecks)
Add an isolated node.
Definition: lwgeom_topo.c:586
void lwt_FreeBackendIface(LWT_BE_IFACE *iface)
Release memory associated with an LWT_BE_IFACE.
Definition: lwgeom_topo.c:67
LWT_SPATIALTYPE_T
LWT_ELEMID containing_face
struct LWT_TOPOERR_T LWT_TOPOERR
Topology error.
struct LWT_BE_CALLBACKS_T LWT_BE_CALLBACKS
Structure containing base backend callbacks.
LWT_ELEMID lwt_RemEdgeNewFace(LWT_TOPOLOGY *topo, LWT_ELEMID edge)
Remove an edge, possibly merging two faces (replacing both with a new one)
Definition: lwgeom_topo.c:4160
LWPOINT * geom
int(* checkTopoGeomRemEdge)(const LWT_BE_TOPOLOGY *topo, LWT_ELEMID rem_edge, LWT_ELEMID face_left, LWT_ELEMID face_right)
Check TopoGeometry objects before an edge removal event.
void lwt_iso_node_release(LWT_ISO_NODE *node)
int(* freeTopology)(LWT_BE_TOPOLOGY *topo)
Release memory associated to a backend topology.
LWT_ELEMID lwt_ModEdgeSplit(LWT_TOPOLOGY *topo, LWT_ELEMID edge, LWPOINT *pt, int skipChecks)
Split an edge by a node, modifying the original edge and adding a new one.
Definition: lwgeom_topo.c:1019
int(* updateFacesById)(const LWT_BE_TOPOLOGY *topo, const LWT_ISO_FACE *faces, int numfaces)
Update faces by id.
LWT_ELEMID lwt_GetEdgeByPoint(LWT_TOPOLOGY *topo, LWPOINT *pt, double tol)
Find the edge-id of an edge that intersects a given point.
Definition: lwgeom_topo.c:4662
int(* updateTopoGeomFaceHeal)(const LWT_BE_TOPOLOGY *topo, LWT_ELEMID face1, LWT_ELEMID face2, LWT_ELEMID newface)
Update TopoGeometry objects after healing two faces.
LWT_BE_IFACE * lwt_CreateBackendIface(const LWT_BE_DATA *data)
Create a new backend interface.
Definition: lwgeom_topo.c:53
int(* insertNodes)(const LWT_BE_TOPOLOGY *topo, LWT_ISO_NODE *nodes, int numelems)
Insert nodes.
LWLINE * geom
data
Definition: ovdump.py:103
LWT_TOPOLOGY * lwt_LoadTopology(LWT_BE_IFACE *iface, const char *name)
Loads an existing topology by name from the database.
Definition: lwgeom_topo.c:483
LWT_ELEMID lwt_AddIsoEdge(LWT_TOPOLOGY *topo, LWT_ELEMID startNode, LWT_ELEMID endNode, const LWLINE *geom)
Add an isolated edge connecting two existing isolated nodes.
Definition: lwgeom_topo.c:770
LWGEOM * lwt_GetFaceGeometry(LWT_TOPOLOGY *topo, LWT_ELEMID face)
Return the geometry of a face.
Definition: lwgeom_topo.c:2778
int(* updateTopoGeomFaceSplit)(const LWT_BE_TOPOLOGY *topo, LWT_ELEMID split_face, LWT_ELEMID new_face1, LWT_ELEMID new_face2)
Update TopoGeometry objects after a face split event.
LWT_ELEMID lwt_NewEdgesSplit(LWT_TOPOLOGY *topo, LWT_ELEMID edge, LWPOINT *pt, int skipChecks)
Split an edge by a node, replacing it with two new edges.
Definition: lwgeom_topo.c:1176
LWT_ELEMID lwt_GetNodeByPoint(LWT_TOPOLOGY *topo, LWPOINT *pt, double tol)
Retrieve the id of a node at a point location.
Definition: lwgeom_topo.c:4627
Topology error.
int lwt_ChangeEdgeGeom(LWT_TOPOLOGY *topo, LWT_ELEMID edge, LWLINE *curve)
Changes the shape of an edge without affecting the topology structure.
Definition: lwgeom_topo.c:3171
LWT_ELEMID lwt_AddPoint(LWT_TOPOLOGY *topo, LWPOINT *point, double tol)
Adds a point to the topology.
Definition: lwgeom_topo.c:5200
LWT_ELEMID next_left
int(* updateNodes)(const LWT_BE_TOPOLOGY *topo, const LWT_ISO_NODE *sel_node, int sel_fields, const LWT_ISO_NODE *upd_node, int upd_fields, const LWT_ISO_NODE *exc_node, int exc_fields)
Update nodes selected by fields match/mismatch.
int lwt_Polygonize(LWT_TOPOLOGY *topo)
Definition: lwgeom_topo.c:6674
enum LWT_SPATIALTYPE_T LWT_SPATIALTYPE
int lwt_RemIsoEdge(LWT_TOPOLOGY *topo, LWT_ELEMID edge)
Remove an isolated edge.
Definition: lwgeom_topo.c:3613
LWT_ELEMID(* getNextEdgeId)(const LWT_BE_TOPOLOGY *topo)
Get next available edge identifier.
int(* deleteFacesById)(const LWT_BE_TOPOLOGY *topo, const LWT_ELEMID *ids, int numelems)
Delete faces by id.
int(* updateTopoGeomEdgeHeal)(const LWT_BE_TOPOLOGY *topo, LWT_ELEMID edge1, LWT_ELEMID edge2, LWT_ELEMID newedge)
Update TopoGeometry objects after healing two edges.
struct LWT_BE_DATA_T LWT_BE_DATA
Backend private data pointer.
LWT_ELEMID lwt_AddEdgeModFace(LWT_TOPOLOGY *topo, LWT_ELEMID start_node, LWT_ELEMID end_node, LWLINE *geom, int skipChecks)
Add a new edge possibly splitting a face (modifying it)
Definition: lwgeom_topo.c:2715
void lwt_CreateTopoGeo(LWT_TOPOLOGY *topo, LWGEOM *geom)
Populate an empty topology with data from a simple geometry.
LWT_ELEMID lwt_AddEdgeNewFaces(LWT_TOPOLOGY *topo, LWT_ELEMID start_node, LWT_ELEMID end_node, LWLINE *geom, int skipChecks)
Add a new edge possibly splitting a face (replacing with two new faces)
Definition: lwgeom_topo.c:2723
int(* insertEdges)(const LWT_BE_TOPOLOGY *topo, LWT_ISO_EDGE *edges, int numelems)
Insert edges.
int lwt_MoveIsoNode(LWT_TOPOLOGY *topo, LWT_ELEMID node, LWPOINT *pt)
Move an isolated node.
Definition: lwgeom_topo.c:3541
LWT_ELEMID(* getFaceContainingPoint)(const LWT_BE_TOPOLOGY *topo, const LWPOINT *pt)
Get face containing point.
int64_t LWT_INT64
LWT_ELEMID * lwt_AddLineNoFace(LWT_TOPOLOGY *topo, LWLINE *line, double tol, int *nedges)
Adds a linestring to the topology without determining generated faces.
Definition: lwgeom_topo.c:5773
int(* updateEdgesById)(const LWT_BE_TOPOLOGY *topo, const LWT_ISO_EDGE *edges, int numedges, int upd_fields)
Update edges by id.
LWT_ELEMID face_id
double(* topoGetPrecision)(const LWT_BE_TOPOLOGY *topo)
Get topology precision.
LWT_ELEMID face_right
uint8_t precision
Definition: cu_in_twkb.c:25
LWT_ELEMID elem1
Identifier of first affected element.
LWT_ELEMID lwt_NewEdgeHeal(LWT_TOPOLOGY *topo, LWT_ELEMID e1, LWT_ELEMID e2)
Merge two edges, replacing both with a new one.
Definition: lwgeom_topo.c:4621
LWT_ELEMID node_id
int(* deleteNodesById)(const LWT_BE_TOPOLOGY *topo, const LWT_ELEMID *ids, int numelems)
Delete nodes by id.
LWT_ELEMID lwt_GetFaceByPoint(LWT_TOPOLOGY *topo, LWPOINT *pt, double tol)
Find the face-id of a face containing a given point.
Definition: lwgeom_topo.c:4718
int(* insertFaces)(const LWT_BE_TOPOLOGY *topo, LWT_ISO_FACE *faces, int numelems)
Insert faces.
LWT_ELEMID edge_id
LWT_ELEMID lwt_ModEdgeHeal(LWT_TOPOLOGY *topo, LWT_ELEMID e1, LWT_ELEMID e2)
Merge two edges, modifying the first and deleting the second.
Definition: lwgeom_topo.c:4615
int(* topoHasZ)(const LWT_BE_TOPOLOGY *topo)
Get topology Z flag.
void lwt_DropTopology(LWT_TOPOLOGY *topo)
Drop a topology and all its associated objects from the database.
int(* updateTopoGeomEdgeSplit)(const LWT_BE_TOPOLOGY *topo, LWT_ELEMID split_edge, LWT_ELEMID new_edge1, LWT_ELEMID new_edge2)
Update TopoGeometry objects after an edge split event.
LWT_ELEMID * lwt_AddLine(LWT_TOPOLOGY *topo, LWLINE *line, double tol, int *nedges)
Adds a linestring to the topology.
Definition: lwgeom_topo.c:5767
struct LWT_BE_TOPOLOGY_T LWT_BE_TOPOLOGY
Topology handler.
LWT_TOPOLOGY * lwt_CreateTopology(LWT_BE_IFACE *iface, const char *name, int srid, double prec, int hasz)
Initializes a new topology.
LWT_TOPOERR_TYPE err
Type of error.
int lwt_RemoveIsoNode(LWT_TOPOLOGY *topo, LWT_ELEMID node)
Remove an isolated node.
Definition: lwgeom_topo.c:3582
int(* checkTopoGeomRemNode)(const LWT_BE_TOPOLOGY *topo, LWT_ELEMID rem_node, LWT_ELEMID e1, LWT_ELEMID e2)
Check TopoGeometry objects before a node removal event.
Structure containing base backend callbacks.
int lwt_GetFaceEdges(LWT_TOPOLOGY *topo, LWT_ELEMID face, LWT_ELEMID **edges)
Return the list of directed edges bounding a face.
Definition: lwgeom_topo.c:3007
int(* deleteEdges)(const LWT_BE_TOPOLOGY *topo, const LWT_ISO_EDGE *sel_edge, int sel_fields)
Delete edges.
LWT_ELEMID start_node
void lwt_BackendIfaceRegisterCallbacks(LWT_BE_IFACE *iface, const LWT_BE_CALLBACKS *cb)
Register backend callbacks into the opaque iface handler.
Definition: lwgeom_topo.c:61
LWT_ELEMID next_right
int(* updateEdges)(const LWT_BE_TOPOLOGY *topo, const LWT_ISO_EDGE *sel_edge, int sel_fields, const LWT_ISO_EDGE *upd_edge, int upd_fields, const LWT_ISO_EDGE *exc_edge, int exc_fields)
Update edges selected by fields match/mismatch.
LWT_INT64 LWT_ELEMID
Identifier of topology element.
LWT_ELEMID end_node
LWT_ELEMID lwt_RemEdgeModFace(LWT_TOPOLOGY *topo, LWT_ELEMID edge)
Remove an edge, possibly merging two faces (replacing one with the other)
Definition: lwgeom_topo.c:4154
int(* topoGetSRID)(const LWT_BE_TOPOLOGY *topo)
Get topology SRID.
LWT_ELEMID * lwt_AddPolygon(LWT_TOPOLOGY *topo, LWPOLY *poly, double tol, int *nfaces)
Adds a polygon to the topology.
Definition: lwgeom_topo.c:5779
int(* updateNodesById)(const LWT_BE_TOPOLOGY *topo, const LWT_ISO_NODE *nodes, int numnodes, int upd_fields)
Update nodes by id.
void lwt_FreeTopology(LWT_TOPOLOGY *topo)
Release memory associated with an LWT_TOPOLOGY.
Definition: lwgeom_topo.c:505
LWT_ELEMID elem2
Identifier of second affected element (0 if inapplicable)
This library is the generic geometry handling section of PostGIS.
LWT_TOPOERR_TYPE_T
Topology errors type.