[postgis-tickets] r15881 - Move many internal signatures into liblwgeom_internal.h (Closes #3873)

Paul Ramsey pramsey at cleverelephant.ca
Tue Oct 3 12:10:14 PDT 2017


Author: pramsey
Date: 2017-10-03 12:10:14 -0700 (Tue, 03 Oct 2017)
New Revision: 15881

Modified:
   trunk/liblwgeom/liblwgeom.h.in
   trunk/liblwgeom/liblwgeom_internal.h
   trunk/liblwgeom/lwgeom_topo.c
   trunk/postgis/lwgeom_functions_basic.c
   trunk/postgis/lwgeom_functions_lrs.c
Log:
Move many internal signatures into liblwgeom_internal.h (Closes #3873)


Modified: trunk/liblwgeom/liblwgeom.h.in
===================================================================
--- trunk/liblwgeom/liblwgeom.h.in	2017-10-03 18:39:41 UTC (rev 15880)
+++ trunk/liblwgeom/liblwgeom.h.in	2017-10-03 19:10:14 UTC (rev 15881)
@@ -962,9 +962,6 @@
 extern int ptarray_is_closed_2d(const POINTARRAY *pa);
 extern int ptarray_is_closed_3d(const POINTARRAY *pa);
 extern int ptarray_is_closed_z(const POINTARRAY *pa);
-extern void ptarray_longitude_shift(POINTARRAY *pa);
-extern int ptarray_isccw(const POINTARRAY *pa);
-extern void ptarray_reverse(POINTARRAY *pa);
 extern POINTARRAY* ptarray_flip_coordinates(POINTARRAY *pa);
 
 /**
@@ -1210,19 +1207,12 @@
 extern LWPOINT* lwcompound_get_endpoint(const LWCOMPOUND *lwcmp);
 extern LWPOINT* lwcompound_get_lwpoint(const LWCOMPOUND *lwcmp, int where);
 
-
 extern double ptarray_length_2d(const POINTARRAY *pts);
-extern double ptarray_length(const POINTARRAY *pts);
-extern double ptarray_arc_length_2d(const POINTARRAY *pts);
-
-
 extern int pt_in_ring_2d(const POINT2D *p, const POINTARRAY *ring);
 extern int azimuth_pt_pt(const POINT2D *p1, const POINT2D *p2, double *ret);
 extern int lwpoint_inside_circle(const LWPOINT *p, double cx, double cy, double rad);
+
 extern void lwgeom_reverse(LWGEOM *lwgeom);
-extern void lwline_reverse(LWLINE *line);
-extern void lwpoly_reverse(LWPOLY *poly);
-extern void lwtriangle_reverse(LWTRIANGLE *triangle);
 extern char* lwgeom_summary(const LWGEOM *lwgeom, int offset);
 extern char* lwpoint_to_latlon(const LWPOINT *p, const char *format);
 extern int lwgeom_startpoint(const LWGEOM* lwgeom, POINT4D* pt);
@@ -1232,16 +1222,11 @@
 * are counter-clockwise.
 */
 extern void lwgeom_force_clockwise(LWGEOM *lwgeom);
-extern void lwpoly_force_clockwise(LWPOLY *poly);
-extern void lwtriangle_force_clockwise(LWTRIANGLE *triangle);
-
 extern int lwgeom_is_clockwise(LWGEOM *lwgeom);
-extern int lwpoly_is_clockwise(LWPOLY *poly);
-extern int lwtriangle_is_clockwise(LWTRIANGLE *triangle);
 
 extern void interpolate_point4d(POINT4D *A, POINT4D *B, POINT4D *I, double F);
 
-void lwgeom_longitude_shift(LWGEOM *lwgeom);
+extern void lwgeom_longitude_shift(LWGEOM *lwgeom);
 
 /**
  * @brief wrap geometry on given cut x value
@@ -1304,14 +1289,7 @@
 extern int lwgeom_dimensionality(LWGEOM *geom);
 
 /* Is lwgeom1 geometrically equal to lwgeom2 ? */
-char lwgeom_same(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2);
-char ptarray_same(const POINTARRAY *pa1, const POINTARRAY *pa2);
-char lwpoint_same(const LWPOINT *p1, const LWPOINT *p2);
-char lwline_same(const LWLINE *p1, const LWLINE *p2);
-char lwpoly_same(const LWPOLY *p1, const LWPOLY *p2);
-char lwtriangle_same(const LWTRIANGLE *p1, const LWTRIANGLE *p2);
-char lwcollection_same(const LWCOLLECTION *p1, const LWCOLLECTION *p2);
-char lwcircstring_same(const LWCIRCSTRING *p1, const LWCIRCSTRING *p2);
+extern char lwgeom_same(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2);
 
 
 /**
@@ -1327,12 +1305,9 @@
 * Deep clone an LWGEOM, everything is copied
 */
 extern LWGEOM *lwgeom_clone_deep(const LWGEOM *lwgeom);
+extern POINTARRAY *ptarray_clone_deep(const POINTARRAY *ptarray);
 
-/* TODO Move to Internal */
-LWPOINT *lwpoint_clone(const LWPOINT *lwgeom);
-POINTARRAY *ptarray_clone_deep(const POINTARRAY *ptarray);
 
-
 /*
 * Geometry constructors. These constructors to not copy the point arrays
 * passed to them, they just take references, so do not free them out

Modified: trunk/liblwgeom/liblwgeom_internal.h
===================================================================
--- trunk/liblwgeom/liblwgeom_internal.h	2017-10-03 18:39:41 UTC (rev 15880)
+++ trunk/liblwgeom/liblwgeom_internal.h	2017-10-03 19:10:14 UTC (rev 15881)
@@ -278,7 +278,7 @@
 * Pull a #GBOX from the header of a #GSERIALIZED, if one is available. If
 * it is not, return LW_FAILURE.
 */
-extern int gserialized_read_gbox_p(const GSERIALIZED *g, GBOX *gbox);
+int gserialized_read_gbox_p(const GSERIALIZED *g, GBOX *gbox);
 
 /*
 * Length calculations
@@ -320,8 +320,15 @@
 double ptarray_signed_area(const POINTARRAY *pa);
 
 /*
+* Length
+*/
+double ptarray_length(const POINTARRAY *pts);
+double ptarray_arc_length_2d(const POINTARRAY *pts);
+
+/*
 * Clone support
 */
+LWPOINT *lwpoint_clone(const LWPOINT *lwgeom);
 LWLINE *lwline_clone(const LWLINE *lwgeom);
 LWPOLY *lwpoly_clone(const LWPOLY *lwgeom);
 LWTRIANGLE *lwtriangle_clone(const LWTRIANGLE *lwgeom);
@@ -335,11 +342,40 @@
 GBOX *gbox_clone(const GBOX *gbox);
 
 /*
- * Reverse
- */
-extern void lwcircstring_reverse(LWCIRCSTRING *curve);
+* Clockwise
+*/
+void lwpoly_force_clockwise(LWPOLY *poly);
+void lwtriangle_force_clockwise(LWTRIANGLE *triangle);
+int lwpoly_is_clockwise(LWPOLY *poly);
+int lwtriangle_is_clockwise(LWTRIANGLE *triangle);
+int ptarray_isccw(const POINTARRAY *pa);
 
 /*
+* Same
+*/
+char ptarray_same(const POINTARRAY *pa1, const POINTARRAY *pa2);
+char lwpoint_same(const LWPOINT *p1, const LWPOINT *p2);
+char lwline_same(const LWLINE *p1, const LWLINE *p2);
+char lwpoly_same(const LWPOLY *p1, const LWPOLY *p2);
+char lwtriangle_same(const LWTRIANGLE *p1, const LWTRIANGLE *p2);
+char lwcollection_same(const LWCOLLECTION *p1, const LWCOLLECTION *p2);
+char lwcircstring_same(const LWCIRCSTRING *p1, const LWCIRCSTRING *p2);
+
+/*
+* Shift
+*/
+void ptarray_longitude_shift(POINTARRAY *pa);
+
+/*
+* Reverse
+*/
+void lwcircstring_reverse(LWCIRCSTRING *curve);
+void ptarray_reverse(POINTARRAY *pa);
+void lwline_reverse(LWLINE *line);
+void lwpoly_reverse(LWPOLY *poly);
+void lwtriangle_reverse(LWTRIANGLE *triangle);
+
+/*
 * Startpoint
 */
 int lwpoly_startpoint(const LWPOLY* lwpoly, POINT4D* pt);
@@ -437,7 +473,7 @@
 void lwcollection_reserve(LWCOLLECTION *col, int ngeoms);
 
 /** Check if subtype is allowed in collectiontype */
-extern int lwcollection_allows_subtype(int collectiontype, int subtype);
+int lwcollection_allows_subtype(int collectiontype, int subtype);
 
 /** GBOX utility functions to figure out coverage/location on the globe */
 double gbox_angular_height(const GBOX* gbox);
@@ -445,7 +481,7 @@
 int gbox_centroid(const GBOX* gbox, POINT2D* out);
 
 /* Utilities */
-extern void trim_trailing_zeros(char *num);
+void trim_trailing_zeros(char *num);
 
 extern uint8_t MULTITYPE[NUMTYPES];
 

Modified: trunk/liblwgeom/lwgeom_topo.c
===================================================================
--- trunk/liblwgeom/lwgeom_topo.c	2017-10-03 18:39:41 UTC (rev 15880)
+++ trunk/liblwgeom/lwgeom_topo.c	2017-10-03 19:10:14 UTC (rev 15881)
@@ -6608,7 +6608,6 @@
                             LWT_ELEMID *registered)
 {
   const LWT_BE_IFACE *iface = topo->be_iface;
-  int sedge = edge->edge_id * side;
   /* this is arbitrary, could be taken as parameter */
   static const int placeholder_faceid = LWT_HOLES_FACE_PLACEHOLDER;
   LWT_EDGERING *ring;
@@ -6626,7 +6625,7 @@
     /* Create new face */
     LWT_ISO_FACE newface;
 
-    LWDEBUGF(1, "Ring of edge %d is a shell (shell %d)", sedge, shells->size);
+    LWDEBUGF(1, "Ring of edge %d is a shell (shell %d)", edge->edge_id * side, shells->size);
 
     newface.mbr = _lwt_EdgeRingGetBbox(ring);
 
@@ -6660,7 +6659,7 @@
   }
   else /* cw, so is an hole */
   {
-    LWDEBUGF(1, "Ring of edge %d is a hole (hole %d)", sedge, holes->size);
+    LWDEBUGF(1, "Ring of edge %d is a hole (hole %d)", edge->edge_id * side, holes->size);
     *registered = placeholder_faceid;
     LWT_EDGERING_ARRAY_PUSH(holes, ring);
   }

Modified: trunk/postgis/lwgeom_functions_basic.c
===================================================================
--- trunk/postgis/lwgeom_functions_basic.c	2017-10-03 18:39:41 UTC (rev 15880)
+++ trunk/postgis/lwgeom_functions_basic.c	2017-10-03 19:10:14 UTC (rev 15881)
@@ -2046,7 +2046,7 @@
 	/* invoke appropriate function */
 	result = lwgeom_same(lwg1, lwg2);
 
-	/* Relase memory */
+	/* Release memory */
 	lwgeom_free(lwg1);
 	lwgeom_free(lwg2);
 	PG_FREE_IF_COPY(g1, 0);

Modified: trunk/postgis/lwgeom_functions_lrs.c
===================================================================
--- trunk/postgis/lwgeom_functions_lrs.c	2017-10-03 18:39:41 UTC (rev 15880)
+++ trunk/postgis/lwgeom_functions_lrs.c	2017-10-03 19:10:14 UTC (rev 15881)
@@ -527,7 +527,7 @@
 	{
 		POSTGIS_DEBUG(3, " lwpoint... returning a clone of input");
 
-		return (LWGEOM *)lwpoint_clone(lwpoint);
+		return lwgeom_clone((LWGEOM *)lwpoint);
 	}
 	else
 	{



More information about the postgis-tickets mailing list