26 #ifndef LIBLWGEOM_TOPO_H
27 #define LIBLWGEOM_TOPO_H 1
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
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
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
161 const char* name,
int srid,
double precision,
int hasZ
204 const LWT_ELEMID* ids,
int* numelems,
int fields
230 const LWPOINT* pt,
double dist,
int* numelems,
231 int fields,
int limit
272 const LWT_ELEMID* ids,
int* numelems,
int fields
297 const LWPOINT* pt,
double dist,
int* numelems,
298 int fields,
int limit
378 const LWT_ELEMID* ids,
int* numelems,
int fields
457 int* numelems,
int fields,
int limit
482 int* numelems,
int fields,
int limit
505 const LWT_ELEMID* ids,
int* numelems,
int fields
664 const LWT_ELEMID* ids,
int* numelems,
int fields,
689 const LWT_ELEMID* faces,
int* numelems,
int fields,
878 int* numelems,
int fields,
int limit
966 int srid,
double prec,
int hasz);
1265 LWLINE *geom,
int skipChecks);
1286 LWLINE *geom,
int skipChecks);
This library is the generic geometry handling section of PostGIS.
LWT_ELEMID lwt_AddPoint(LWT_TOPOLOGY *topo, LWPOINT *point, double tol)
Adds a point to the topology.
struct LWT_BE_CALLBACKS_T LWT_BE_CALLBACKS
Structure containing base backend callbacks.
int lwt_RemoveIsoNode(LWT_TOPOLOGY *topo, LWT_ELEMID node)
Remove an isolated node.
LWT_INT64 LWT_ELEMID
Identifier of topology element.
struct LWT_BE_TOPOLOGY_T LWT_BE_TOPOLOGY
Topology handler.
void lwt_BackendIfaceRegisterCallbacks(LWT_BE_IFACE *iface, const LWT_BE_CALLBACKS *cb)
Register backend callbacks into the opaque iface handler.
LWT_BE_IFACE * lwt_CreateBackendIface(const LWT_BE_DATA *data)
Create a new backend interface.
LWT_ELEMID lwt_AddIsoNode(LWT_TOPOLOGY *topo, LWT_ELEMID face, LWPOINT *pt, int skipChecks)
Add an isolated node.
enum LWT_TOPOERR_TYPE_T LWT_TOPOERR_TYPE
Topology errors type.
void lwt_FreeBackendIface(LWT_BE_IFACE *iface)
Release memory associated with an LWT_BE_IFACE.
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.
LWT_ELEMID lwt_GetEdgeByPoint(LWT_TOPOLOGY *topo, LWPOINT *pt, double tol)
Find the edge-id of an edge that intersects a given point.
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)
LWT_ELEMID lwt_RemEdgeModFace(LWT_TOPOLOGY *topo, LWT_ELEMID edge)
Remove an edge, possibly merging two faces (replacing one with the other)
LWGEOM * lwt_GetFaceGeometry(LWT_TOPOLOGY *topo, LWT_ELEMID face)
Return the geometry of a face.
int lwt_RemIsoEdge(LWT_TOPOLOGY *topo, LWT_ELEMID edge)
Remove an isolated edge.
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.
LWT_TOPOERR_TYPE_T
Topology errors type.
@ LWT_TOPOERR_EDGE_STARTNODE_MISMATCH
@ LWT_TOPOERR_FACE_OVERLAPS_FACE
@ LWT_TOPOERR_EDGE_CROSSES_NODE
@ LWT_TOPOERR_EDGE_ENDNODE_MISMATCH
@ LWT_TOPOERR_EDGE_INVALID
@ LWT_TOPOERR_FACE_WITHIN_FACE
@ LWT_TOPOERR_EDGE_CROSSES_EDGE
@ LWT_TOPOERR_EDGE_NOT_SIMPLE
@ LWT_TOPOERR_FACE_HAS_NO_RINGS
@ LWT_TOPOERR_FACE_WITHOUT_EDGES
LWT_ELEMID * lwt_AddLine(LWT_TOPOLOGY *topo, LWLINE *line, double tol, int *nedges)
Adds a linestring to the topology.
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.
void lwt_iso_node_release(LWT_ISO_NODE *node)
LWT_ELEMID lwt_RemEdgeNewFace(LWT_TOPOLOGY *topo, LWT_ELEMID edge)
Remove an edge, possibly merging two faces (replacing both with a new one)
int lwt_MoveIsoNode(LWT_TOPOLOGY *topo, LWT_ELEMID node, LWPOINT *pt)
Move an isolated node.
int lwt_Polygonize(LWT_TOPOLOGY *topo)
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)
LWT_TOPOLOGY * lwt_LoadTopology(LWT_BE_IFACE *iface, const char *name)
Loads an existing topology by name from the database.
LWT_TOPOLOGY * lwt_CreateTopology(LWT_BE_IFACE *iface, const char *name, int srid, double prec, int hasz)
Initializes a new topology.
LWT_ELEMID * lwt_AddPolygon(LWT_TOPOLOGY *topo, LWPOLY *poly, double tol, int *nfaces)
Adds a polygon to the topology.
LWT_ELEMID * lwt_AddLineNoFace(LWT_TOPOLOGY *topo, LWLINE *line, double tol, int *nedges)
Adds a linestring to the topology without determining generated faces.
struct LWT_TOPOERR_T LWT_TOPOERR
Topology error.
LWT_ELEMID lwt_ModEdgeHeal(LWT_TOPOLOGY *topo, LWT_ELEMID e1, LWT_ELEMID e2)
Merge two edges, modifying the first and deleting the second.
void lwt_CreateTopoGeo(LWT_TOPOLOGY *topo, LWGEOM *geom)
Populate an empty topology with data from a simple geometry.
enum LWT_SPATIALTYPE_T LWT_SPATIALTYPE
void lwt_FreeTopology(LWT_TOPOLOGY *topo)
Release memory associated with an LWT_TOPOLOGY.
LWT_ELEMID lwt_NewEdgeHeal(LWT_TOPOLOGY *topo, LWT_ELEMID e1, LWT_ELEMID e2)
Merge two edges, replacing both with a new one.
struct LWT_BE_DATA_T LWT_BE_DATA
Backend private data pointer.
void lwt_DropTopology(LWT_TOPOLOGY *topo)
Drop a topology and all its associated objects from the database.
LWT_ELEMID lwt_GetNodeByPoint(LWT_TOPOLOGY *topo, LWPOINT *pt, double tol)
Retrieve the id of a node at a point location.
int lwt_GetFaceEdges(LWT_TOPOLOGY *topo, LWT_ELEMID face, LWT_ELEMID **edges)
Return the list of directed edges bounding a face.
LWT_ELEMID lwt_GetFaceByPoint(LWT_TOPOLOGY *topo, LWPOINT *pt, double tol)
Find the face-id of a face containing a given point.
int lwt_ChangeEdgeGeom(LWT_TOPOLOGY *topo, LWT_ELEMID edge, LWLINE *curve)
Changes the shape of an edge without affecting the topology structure.
int(* updateTopoGeomFaceHeal)(const LWT_BE_TOPOLOGY *topo, LWT_ELEMID face1, LWT_ELEMID face2, LWT_ELEMID newface)
Update TopoGeometry objects after healing two faces.
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(* getFaceContainingPoint)(const LWT_BE_TOPOLOGY *topo, const LWPOINT *pt)
Get face containing point.
int(* updateNodesById)(const LWT_BE_TOPOLOGY *topo, const LWT_ISO_NODE *nodes, int numnodes, int upd_fields)
Update nodes by id.
int(* updateEdgesById)(const LWT_BE_TOPOLOGY *topo, const LWT_ISO_EDGE *edges, int numedges, int upd_fields)
Update edges by id.
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.
int(* insertNodes)(const LWT_BE_TOPOLOGY *topo, LWT_ISO_NODE *nodes, int numelems)
Insert nodes.
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.
int(* updateFacesById)(const LWT_BE_TOPOLOGY *topo, const LWT_ISO_FACE *faces, int numfaces)
Update faces by id.
int(* deleteFacesById)(const LWT_BE_TOPOLOGY *topo, const LWT_ELEMID *ids, int numelems)
Delete faces by id.
int(* topoGetSRID)(const LWT_BE_TOPOLOGY *topo)
Get topology SRID.
int(* insertEdges)(const LWT_BE_TOPOLOGY *topo, LWT_ISO_EDGE *edges, int numelems)
Insert edges.
double(* topoGetPrecision)(const LWT_BE_TOPOLOGY *topo)
Get topology precision.
LWT_ELEMID(* getNextEdgeId)(const LWT_BE_TOPOLOGY *topo)
Get next available edge identifier.
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(* 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.
int(* freeTopology)(LWT_BE_TOPOLOGY *topo)
Release memory associated to a backend topology.
int(* updateTopoGeomEdgeHeal)(const LWT_BE_TOPOLOGY *topo, LWT_ELEMID edge1, LWT_ELEMID edge2, LWT_ELEMID newedge)
Update TopoGeometry objects after healing two edges.
int(* insertFaces)(const LWT_BE_TOPOLOGY *topo, LWT_ISO_FACE *faces, int numelems)
Insert faces.
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.
int(* topoHasZ)(const LWT_BE_TOPOLOGY *topo)
Get topology Z flag.
int(* deleteEdges)(const LWT_BE_TOPOLOGY *topo, const LWT_ISO_EDGE *sel_edge, int sel_fields)
Delete edges.
int(* deleteNodesById)(const LWT_BE_TOPOLOGY *topo, const LWT_ELEMID *ids, int numelems)
Delete nodes by id.
Structure containing base backend callbacks.
LWT_ELEMID containing_face
LWT_ELEMID elem1
Identifier of first affected element.
LWT_TOPOERR_TYPE err
Type of error.
LWT_ELEMID elem2
Identifier of second affected element (0 if inapplicable)