PostGIS  3.0.0dev-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 
202  LWT_ISO_NODE* (*getNodeById) (
203  const LWT_BE_TOPOLOGY* topo,
204  const LWT_ELEMID* ids, int* numelems, int fields
205  );
206 
228  LWT_ISO_NODE* (*getNodeWithinDistance2D) (
229  const LWT_BE_TOPOLOGY* topo,
230  const LWPOINT* pt, double dist, int* numelems,
231  int fields, int limit
232  );
233 
248  int (*insertNodes) (
249  const LWT_BE_TOPOLOGY* topo,
250  LWT_ISO_NODE* nodes,
251  int numelems
252  );
253 
270  LWT_ISO_EDGE* (*getEdgeById) (
271  const LWT_BE_TOPOLOGY* topo,
272  const LWT_ELEMID* ids, int* numelems, int fields
273  );
274 
295  LWT_ISO_EDGE* (*getEdgeWithinDistance2D) (
296  const LWT_BE_TOPOLOGY* topo,
297  const LWPOINT* pt, double dist, int* numelems,
298  int fields, int limit
299  );
300 
312  const LWT_BE_TOPOLOGY* topo
313  );
314 
329  int (*insertEdges) (
330  const LWT_BE_TOPOLOGY* topo,
331  LWT_ISO_EDGE* edges,
332  int numelems
333  );
334 
353  int (*updateEdges) (
354  const LWT_BE_TOPOLOGY* topo,
355  const LWT_ISO_EDGE* sel_edge, int sel_fields,
356  const LWT_ISO_EDGE* upd_edge, int upd_fields,
357  const LWT_ISO_EDGE* exc_edge, int exc_fields
358  );
359 
376  LWT_ISO_FACE* (*getFaceById) (
377  const LWT_BE_TOPOLOGY* topo,
378  const LWT_ELEMID* ids, int* numelems, int fields
379  );
380 
392  const LWT_BE_TOPOLOGY* topo,
393  const LWPOINT* pt
394  );
395 
415  const LWT_BE_TOPOLOGY* topo,
416  LWT_ELEMID split_edge, LWT_ELEMID new_edge1, LWT_ELEMID new_edge2
417  );
418 
430  int (*deleteEdges) (
431  const LWT_BE_TOPOLOGY* topo,
432  const LWT_ISO_EDGE* sel_edge, int sel_fields
433  );
434 
454  LWT_ISO_NODE* (*getNodeWithinBox2D) (
455  const LWT_BE_TOPOLOGY* topo,
456  const GBOX* box,
457  int* numelems, int fields, int limit
458  );
459 
479  LWT_ISO_EDGE* (*getEdgeWithinBox2D) (
480  const LWT_BE_TOPOLOGY* topo,
481  const GBOX* box,
482  int* numelems, int fields, int limit
483  );
484 
503  LWT_ISO_EDGE* (*getEdgeByNode) (
504  const LWT_BE_TOPOLOGY* topo,
505  const LWT_ELEMID* ids, int* numelems, int fields
506  );
507 
526  int (*updateNodes) (
527  const LWT_BE_TOPOLOGY* topo,
528  const LWT_ISO_NODE* sel_node, int sel_fields,
529  const LWT_ISO_NODE* upd_node, int upd_fields,
530  const LWT_ISO_NODE* exc_node, int exc_fields
531  );
532 
548  const LWT_BE_TOPOLOGY* topo,
549  LWT_ELEMID split_face, LWT_ELEMID new_face1, LWT_ELEMID new_face2
550  );
551 
566  int (*insertFaces) (
567  const LWT_BE_TOPOLOGY* topo,
568  LWT_ISO_FACE* faces,
569  int numelems
570  );
571 
585  const LWT_BE_TOPOLOGY* topo,
586  const LWT_ISO_FACE* faces, int numfaces
587  );
588 
589  /*
590  * Get the ordered list edge visited by a side walk
591  *
592  * The walk starts from the side of an edge and stops when
593  * either the max number of visited edges OR the starting
594  * position is reached. The output list never includes a
595  * duplicated signed edge identifier.
596  *
597  * It is expected that the walk uses the "next_left" and "next_right"
598  * attributes of ISO edges to perform the walk (rather than recomputing
599  * the turns at each node).
600  *
601  * @param topo the topology to operate on
602  * @param edge walk start position and direction:
603  * abs value identifies the edge, sign expresses
604  * side (left if positive, right if negative)
605  * and direction (forward if positive, backward if negative).
606  * @param numedges output parameter, gets the number of edges visited
607  *
608  * @param limit max edges to return (to avoid an infinite loop in case
609  * of a corrupted topology). 0 is for unlimited.
610  * The function is expected to error out if the limit is hit.
611  *
612  * @return an array of signed edge identifiers (positive edges being
613  * walked in their direction, negative ones in opposite) or
614  * NULL on error (@see lastErrorMessage)
615  */
616  LWT_ELEMID* (*getRingEdges) (
617  const LWT_BE_TOPOLOGY* topo,
618  LWT_ELEMID edge, int *numedges, int limit
619  );
620 
636  const LWT_BE_TOPOLOGY* topo,
637  const LWT_ISO_EDGE* edges, int numedges,
638  int upd_fields
639  );
640 
662  LWT_ISO_EDGE* (*getEdgeByFace) (
663  const LWT_BE_TOPOLOGY* topo,
664  const LWT_ELEMID* ids, int* numelems, int fields,
665  const GBOX *box
666  );
667 
687  LWT_ISO_NODE* (*getNodeByFace) (
688  const LWT_BE_TOPOLOGY* topo,
689  const LWT_ELEMID* faces, int* numelems, int fields,
690  const GBOX *box
691  );
692 
708  const LWT_BE_TOPOLOGY* topo,
709  const LWT_ISO_NODE* nodes, int numnodes,
710  int upd_fields
711  );
712 
725  const LWT_BE_TOPOLOGY* topo,
726  const LWT_ELEMID* ids,
727  int numelems
728  );
729 
734  int (*topoGetSRID) (
735  const LWT_BE_TOPOLOGY* topo
736  );
737 
741  double (*topoGetPrecision) (
742  const LWT_BE_TOPOLOGY* topo
743  );
744 
749  int (*topoHasZ) (
750  const LWT_BE_TOPOLOGY* topo
751  );
752 
765  const LWT_BE_TOPOLOGY* topo,
766  const LWT_ELEMID* ids,
767  int numelems
768  );
769 
783  const LWT_BE_TOPOLOGY* topo,
784  LWT_ELEMID rem_edge,
785  LWT_ELEMID face_left,
786  LWT_ELEMID face_right
787  );
788 
804  const LWT_BE_TOPOLOGY* topo,
805  LWT_ELEMID face1, LWT_ELEMID face2, LWT_ELEMID newface
806  );
807 
829  const LWT_BE_TOPOLOGY* topo,
830  LWT_ELEMID rem_node,
831  LWT_ELEMID e1,
832  LWT_ELEMID e2
833  );
834 
851  const LWT_BE_TOPOLOGY* topo,
852  LWT_ELEMID edge1, LWT_ELEMID edge2, LWT_ELEMID newedge
853  );
854 
875  LWT_ISO_FACE* (*getFaceWithinBox2D) (
876  const LWT_BE_TOPOLOGY* topo,
877  const GBOX* box,
878  int* numelems, int fields, int limit
879  );
880 
882 
883 
892 
900 
903 
904 /********************************************************************
905  *
906  * End of BE interface
907  *
908  *******************************************************************/
909 
913 typedef enum LWT_TOPOERR_TYPE_T {
925 
927 typedef struct LWT_TOPOERR_T {
934 } LWT_TOPOERR;
935 
936 /*
937  * Topology functions
938  */
939 
945 
946 
947 /*******************************************************************
948  *
949  * Non-ISO signatures here
950  *
951  *******************************************************************/
952 
965 LWT_TOPOLOGY *lwt_CreateTopology(LWT_BE_IFACE *iface, const char *name,
966  int srid, double prec, int hasz);
967 
977 LWT_TOPOLOGY *lwt_LoadTopology(LWT_BE_IFACE *iface, const char *name);
978 
984 void lwt_DropTopology(LWT_TOPOLOGY* topo);
985 
990 void lwt_FreeTopology(LWT_TOPOLOGY* topo);
991 
1002 LWT_ELEMID lwt_GetNodeByPoint(LWT_TOPOLOGY *topo, LWPOINT *pt, double tol);
1003 
1015 LWT_ELEMID lwt_GetEdgeByPoint(LWT_TOPOLOGY *topo, LWPOINT *pt, double tol);
1016 
1029 LWT_ELEMID lwt_GetFaceByPoint(LWT_TOPOLOGY *topo, LWPOINT *pt, double tol);
1030 
1031 
1032 /*******************************************************************
1033  *
1034  * Topology population (non-ISO)
1035  *
1036  *******************************************************************/
1037 
1051 LWT_ELEMID lwt_AddPoint(LWT_TOPOLOGY* topo, LWPOINT* point, double tol);
1052 
1070 LWT_ELEMID* lwt_AddLine(LWT_TOPOLOGY* topo, LWLINE* line, double tol,
1071  int* nedges);
1072 
1094 LWT_ELEMID* lwt_AddLineNoFace(LWT_TOPOLOGY* topo, LWLINE* line, double tol,
1095  int* nedges);
1096 
1097 /*
1098  * Determine and register all topology faces:
1099  *
1100  * - Determines which faces are generated by existing
1101  * edges.
1102  * - Creates face records with correct mbr
1103  * - Update edge left/right face attributes
1104  *
1105  * Precondition:
1106  * - the topology edges are correctly linked
1107  * - there are no faces registered in the topology
1108  *
1109  * Postconditions:
1110  * - all left/right face attributes of edges
1111  * reference faces with correct mbr.
1112  *
1113  * Notes:
1114  * - does not attempt to assign isolated nodes to their
1115  * containing faces
1116  * - does not remove existing face records
1117  * - loads in memory all the topology edges
1118  *
1119  * @param topo the topology to operate on
1120  *
1121  * @return 0 on success, -1 on error
1122  * (librtgeom error handler will be invoked with error
1123  * message)
1124  */
1125 int lwt_Polygonize(LWT_TOPOLOGY* topo);
1126 
1145 LWT_ELEMID* lwt_AddPolygon(LWT_TOPOLOGY* topo, LWPOLY* poly, double tol,
1146  int* nfaces);
1147 
1148 /*******************************************************************
1149  *
1150  * ISO signatures here
1151  *
1152  *******************************************************************/
1153 
1163 void lwt_CreateTopoGeo(LWT_TOPOLOGY* topo, LWGEOM *geom);
1164 
1182  LWPOINT* pt, int skipChecks);
1183 
1196 int lwt_MoveIsoNode(LWT_TOPOLOGY* topo,
1197  LWT_ELEMID node, LWPOINT* pt);
1198 
1210 int lwt_RemoveIsoNode(LWT_TOPOLOGY* topo, LWT_ELEMID node);
1211 
1223 int lwt_RemIsoEdge(LWT_TOPOLOGY* topo, LWT_ELEMID edge);
1224 
1239  LWT_ELEMID startNode, LWT_ELEMID endNode,
1240  const LWLINE *geom);
1241 
1264  LWT_ELEMID start_node, LWT_ELEMID end_node,
1265  LWLINE *geom, int skipChecks);
1266 
1285  LWT_ELEMID start_node, LWT_ELEMID end_node,
1286  LWLINE *geom, int skipChecks);
1287 
1300 
1317 
1329 int lwt_ChangeEdgeGeom(LWT_TOPOLOGY* topo, LWT_ELEMID edge, LWLINE* curve);
1330 
1345 LWT_ELEMID lwt_ModEdgeSplit(LWT_TOPOLOGY* topo, LWT_ELEMID edge, LWPOINT* pt, int skipChecks);
1346 
1360 LWT_ELEMID lwt_NewEdgesSplit(LWT_TOPOLOGY* topo, LWT_ELEMID edge, LWPOINT* pt, int skipChecks);
1361 
1375 
1389 
1403 int lwt_GetFaceEdges(LWT_TOPOLOGY* topo, LWT_ELEMID face, LWT_ELEMID **edges);
1404 
1417 
1418 #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:585
void lwt_FreeBackendIface(LWT_BE_IFACE *iface)
Release memory associated with an LWT_BE_IFACE.
Definition: lwgeom_topo.c:66
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:4159
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:1018
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:4661
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:52
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:482
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:769
LWGEOM * lwt_GetFaceGeometry(LWT_TOPOLOGY *topo, LWT_ELEMID face)
Return the geometry of a face.
Definition: lwgeom_topo.c:2777
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:1175
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:4626
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:3170
LWT_ELEMID lwt_AddPoint(LWT_TOPOLOGY *topo, LWPOINT *point, double tol)
Adds a point to the topology.
Definition: lwgeom_topo.c:5199
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:6673
enum LWT_SPATIALTYPE_T LWT_SPATIALTYPE
int lwt_RemIsoEdge(LWT_TOPOLOGY *topo, LWT_ELEMID edge)
Remove an isolated edge.
Definition: lwgeom_topo.c:3612
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:2714
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:2722
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:3540
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:5772
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:4620
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:4717
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:4614
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:5766
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:3581
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:3006
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:60
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:4153
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:5778
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:504
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.