]> granicus.if.org Git - postgis/commitdiff
Remove many references to liblwgeom_internal.h outside liblwgeom,
authorPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 17 Sep 2014 21:46:37 +0000 (21:46 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 17 Sep 2014 21:46:37 +0000 (21:46 +0000)
and quiet some nagging warnings.

git-svn-id: http://svn.osgeo.org/postgis/trunk@12985 b70326c6-7e19-0410-871a-916f4a2858ee

14 files changed:
configure.ac
liblwgeom/cunit/cu_in_geojson.c
liblwgeom/liblwgeom.h.in
liblwgeom/liblwgeom_internal.h
liblwgeom/measures.c
liblwgeom/measures.h
liblwgeom/measures3d.c
liblwgeom/measures3d.h
postgis/lwgeom_box.c
postgis/lwgeom_box3d.c
postgis/lwgeom_functions_analytic.c
postgis/lwgeom_functions_basic.c
postgis/lwgeom_geos.c
postgis/lwgeom_geos_clean.c

index 256e0dfba2f7306ad3cf7bc0a60f5c8b808e9306..f381763f2f18732d1c66882e733d135f8349539c 100644 (file)
@@ -34,7 +34,7 @@ dnl SQL Preprocessor
 dnl
 AC_PATH_PROG([CPPBIN], [cpp], [])
 if test "x$CPPBIN" != "x"; then
-  SQLPP="${CPPBIN} -traditional-cpp -P"
+  SQLPP="${CPPBIN} -traditional-cpp -w -P"
 else
   AC_PATH_PROG([GPP], [gpp_], [])
   if test "x$GPP" != "x"; then
index d37137bc235fd74a1582c799423034419d50170e..b9531d00a6eb4417290767a14e437d2cc0a8eae3 100644 (file)
@@ -26,8 +26,6 @@ static void do_geojson_test(const char * exp, char * in, char * exp_srs, int pre
   char * srs = NULL;
   size_t size;
 
-  has_bbox = has_bbox; /* unused */
-
        g = lwgeom_from_geojson(in, &srs);
   if ( ! g ) {
                fprintf(stderr, "\nIn:   %s\nExp:  %s\nObt: %s\n", in, exp, cu_error_msg);
index 5d6ac29bab41abdd2b43db4efb3e87841aeb9809..2566beecb854e3cb4b5052736c84467e1ff4f69d 100644 (file)
 */
 extern int clamp_srid(int srid);
 
+/* Raise an lwerror if srids do not match */
+void error_if_srid_mismatch(int srid1, int srid2);
 
 /**
  * Global functions for memory/logging handlers.
@@ -1068,22 +1070,27 @@ extern float  next_float_up(double d);
 extern double next_double_down(float d);
 extern double next_double_up(float d);
 
-/* general utilities
-       2D*/
-extern double distance2d_pt_pt(const POINT2D *p1, const POINT2D *p2);
-extern double distance2d_pt_seg(const POINT2D *p, const POINT2D *A, const POINT2D *B);
-extern LWGEOM *lw_dist2d_distancepoint(LWGEOM *lw1, LWGEOM *lw2,int srid,int mode);
-extern LWGEOM *lw_dist2d_distanceline(LWGEOM *lw1, LWGEOM *lw2,int srid,int mode);
-extern double lwgeom_mindistance2d(LWGEOM *lw1, LWGEOM *lw2);
-extern double lwgeom_mindistance2d_tolerance(LWGEOM *lw1, LWGEOM *lw2, double tolerance);
-extern double lwgeom_maxdistance2d(LWGEOM *lw1, LWGEOM *lw2);
-extern double lwgeom_maxdistance2d_tolerance(LWGEOM *lw1, LWGEOM *lw2, double tolerance);
-/*
-       3D*/
+/* general utilities 2D */
+extern double  distance2d_pt_pt(const POINT2D *p1, const POINT2D *p2);
+extern double  distance2d_pt_seg(const POINT2D *p, const POINT2D *A, const POINT2D *B);
+extern LWGEOM* lwgeom_closest_line(LWGEOM *lw1, LWGEOM *lw2);
+extern LWGEOM* lwgeom_furthest_line(LWGEOM *lw1, LWGEOM *lw2);
+extern LWGEOM* lwgeom_closest_point(LWGEOM *lw1, LWGEOM *lw2);
+extern LWGEOM* lwgeom_furthest_point(LWGEOM *lw1, LWGEOM *lw2);
+extern double  lwgeom_mindistance2d(LWGEOM *lw1, LWGEOM *lw2);
+extern double  lwgeom_mindistance2d_tolerance(LWGEOM *lw1, LWGEOM *lw2, double tolerance);
+extern double  lwgeom_maxdistance2d(LWGEOM *lw1, LWGEOM *lw2);
+extern double  lwgeom_maxdistance2d_tolerance(LWGEOM *lw1, LWGEOM *lw2, double tolerance);
+
+/* 3D */
 extern double distance3d_pt_pt(const POINT3D *p1, const POINT3D *p2);
 extern double distance3d_pt_seg(const POINT3D *p, const POINT3D *A, const POINT3D *B);
-extern LWGEOM *lw_dist3d_distancepoint(LWGEOM *lw1, LWGEOM *lw2,int srid,int mode);
-extern LWGEOM *lw_dist3d_distanceline(LWGEOM *lw1, LWGEOM *lw2,int srid,int mode);
+
+extern LWGEOM* lwgeom_furthest_line_3d(LWGEOM *lw1, LWGEOM *lw2);
+extern LWGEOM* lwgeom_closest_line_3d(LWGEOM *lw1, LWGEOM *lw2);
+extern LWGEOM* lwgeom_closest_point_3d(LWGEOM *lw1, LWGEOM *lw2);
+
+
 extern double lwgeom_mindistance3d(LWGEOM *lw1, LWGEOM *lw2);
 extern double lwgeom_mindistance3d_tolerance(LWGEOM *lw1, LWGEOM *lw2, double tolerance);
 extern double lwgeom_maxdistance3d(LWGEOM *lw1, LWGEOM *lw2);
index c4289a273ce15892c74ba496510c1210d4d1d802..715ba682d19b02503e2aed7498d66b82a327080a 100644 (file)
 #define MAXFLOAT      3.402823466e+38F
 #endif
 
-/* for the measure functions*/
-#define DIST_MAX               -1
-#define DIST_MIN               1
-
 /*
 * this will change to NaN when I figure out how to
 * get NaN in a platform-independent way
 #define NDR 1 /* little endian */
 extern char getMachineEndian(void);
 
-/* Raise an lwerror if srids do not match */
-void error_if_srid_mismatch(int srid1, int srid2);
-
 
 /*
 * Force dims
index 87220d4787f018231f8804439ecb72c716719215..0bcd6ce2d8be409e2805e891918afafb1b57346d 100644 (file)
@@ -23,6 +23,31 @@ Initializing functions
 The functions starting the distance-calculation processses
 --------------------------------------------------------------------------------------------------------------*/
 
+LWGEOM *
+lwgeom_closest_line(LWGEOM *lw1, LWGEOM *lw2)
+{
+  return lw_dist2d_distanceline(lw1, lw2, lw1->srid, DIST_MIN);
+}
+
+LWGEOM *
+lwgeom_furthest_line(LWGEOM *lw1, LWGEOM *lw2)
+{
+  return lw_dist2d_distanceline(lw1, lw2, lw1->srid, DIST_MAX);
+}
+
+LWGEOM *
+lwgeom_closest_point(LWGEOM *lw1, LWGEOM *lw2)
+{
+  return lw_dist2d_distancepoint(lw1, lw2, lw1->srid, DIST_MIN);  
+}
+
+LWGEOM *
+lwgeom_furthest_point(LWGEOM *lw1, LWGEOM *lw2)
+{
+  return lw_dist2d_distancepoint(lw1, lw2, lw1->srid, DIST_MAX);  
+}
+
+
 void
 lw_dist2d_distpts_init(DISTPTS *dl, int mode)
 {
index 10145f3fe8e4109d8cdaf82c50627d28e5f4157e..9d3f138f7e1825fe6b58a67a69ba52e275b80d7f 100644 (file)
 
 #include "liblwgeom_internal.h"
 
+/* for the measure functions*/
+#define DIST_MAX               -1
+#define DIST_MIN               1
 
-/**
-
-Structure used in distance-calculations
+/** 
+* Structure used in distance-calculations
 */
 typedef struct
 {
@@ -30,8 +32,8 @@ typedef struct
 
 typedef struct
 {
-       double  themeasure;     /*a value calculated to compare distances*/
-       int             pnr;    /*pointnumber. the ordernumber of the point*/
+       double themeasure;      /*a value calculated to compare distances*/
+       int pnr;        /*pointnumber. the ordernumber of the point*/
 } LISTSTRUCT;
 
 
@@ -41,7 +43,7 @@ typedef struct
 int lw_dist2d_comp(LWGEOM *lw1, LWGEOM *lw2, DISTPTS *dl);
 int lw_dist2d_distribute_bruteforce(LWGEOM *lwg1, LWGEOM *lwg2, DISTPTS *dl);
 int lw_dist2d_recursive(const LWGEOM *lwg1, const LWGEOM *lwg2, DISTPTS *dl);
-int lw_dist2d_check_overlap(LWGEOM *lwg1,LWGEOM *lwg2);
+int lw_dist2d_check_overlap(LWGEOM *lwg1, LWGEOM *lwg2);
 int lw_dist2d_distribute_fast(LWGEOM *lwg1, LWGEOM *lwg2, DISTPTS *dl);
 
 /*
@@ -93,3 +95,10 @@ void lw_dist2d_distpts_init(DISTPTS *dl, int mode);
 */
 double lw_arc_length(const POINT2D *A1, const POINT2D *A2, const POINT2D *A3);
 
+/*
+* Geometry returning functions
+*/
+LWGEOM* lw_dist2d_distancepoint(LWGEOM *lw1, LWGEOM *lw2, int srid, int mode);
+LWGEOM* lw_dist2d_distanceline(LWGEOM *lw1, LWGEOM *lw2, int srid, int mode);
+
+
index 82f21e08b040200c0e36d9ffd88e530c335b0e33..ced0806d644616da6e6a6490031148232ed40058 100644 (file)
 #include "lwgeom_log.h"
 
 
-/*------------------------------------------------------------------------------------------------------------
-Initializing functions
-The functions starting the distance-calculation processses
---------------------------------------------------------------------------------------------------------------*/
+
+LWGEOM * 
+lwgeom_closest_line_3d(LWGEOM *lw1, LWGEOM *lw2)
+{
+       return lw_dist3d_distanceline(lw1, lw2, lw1->srid, DIST_MIN);
+}
+
+LWGEOM * 
+lwgeom_furthest_line_3d(LWGEOM *lw1, LWGEOM *lw2)
+{
+       return lw_dist3d_distanceline(lw1, lw2, lw1->srid, DIST_MAX);
+}
+
+LWGEOM * 
+lwgeom_closest_point_3d(LWGEOM *lw1, LWGEOM *lw2)
+{
+       return lw_dist3d_distancepoint(lw1, lw2, lw1->srid, DIST_MIN);
+}
+
 
 /**
 Function initializing 3dshortestline and 3dlongestline calculations.
 */
 LWGEOM *
-lw_dist3d_distanceline(LWGEOM *lw1, LWGEOM *lw2,int srid,int mode)
+lw_dist3d_distanceline(LWGEOM *lw1, LWGEOM *lw2, int srid, int mode)
 {
        double x1,x2,y1,y2, z1, z2;
        double initdistance = ( mode == DIST_MIN ? MAXFLOAT : -1.0);
@@ -76,7 +91,7 @@ lw_dist3d_distanceline(LWGEOM *lw1, LWGEOM *lw2,int srid,int mode)
 Function initializing 3dclosestpoint calculations.
 */
 LWGEOM *
-lw_dist3d_distancepoint(LWGEOM *lw1, LWGEOM *lw2,int srid,int mode)
+lw_dist3d_distancepoint(LWGEOM *lw1, LWGEOM *lw2, int srid, int mode)
 {
        double x,y,z;
        DISTPTS3D thedl;
index a725d155e4dd487ad25ca0412cb302619588eebe..2587125daa63071cd896e608f754ce5f88f291eb 100644 (file)
@@ -11,7 +11,7 @@
  *
  **********************************************************************/
 
-#include "liblwgeom_internal.h"
+#include "measures.h"
 
 #define DOT(u,v)   (u.x * v.x + u.y * v.y + u.z * v.z)
 #define VECTORLENGTH(v)   sqrt((v.x * v.x) + (v.y * v.y) + (v.z * v.z))
@@ -45,6 +45,12 @@ typedef struct
 PLANE3D; 
 
 
+/*
+Geometry returning functions
+*/
+LWGEOM * lw_dist3d_distancepoint(LWGEOM *lw1, LWGEOM *lw2,int srid,int mode);
+LWGEOM * lw_dist3d_distanceline(LWGEOM *lw1, LWGEOM *lw2,int srid,int mode);
+
 /*
 Preprocessing functions
 */
index 8f0bab74aa6d623078de4998c678686a4105ce37..6ecae73b47a262324ddeb79e39838fe58b938a23 100644 (file)
@@ -21,7 +21,6 @@
 #include "../postgis_config.h"
 #include "lwgeom_pg.h"
 #include "liblwgeom.h"
-#include "liblwgeom_internal.h"
 
 #include <math.h>
 #include <float.h>
index 5f816e9d3a0b7a81313655618547378151607e25..8b8cdef8418656b7447dfcff4b9ce4262f58b808 100644 (file)
@@ -12,7 +12,6 @@
 #include "../postgis_config.h"
 #include "lwgeom_pg.h"
 #include "liblwgeom.h"
-#include "liblwgeom_internal.h"
 
 #include <math.h>
 #include <float.h>
index 2816901dd352d62f6373c305add8bc46e009342d..c1f99900185520dff5eae831b3a262fdd92226c3 100644 (file)
@@ -13,7 +13,7 @@
 #include "postgres.h"
 #include "fmgr.h"
 #include "liblwgeom.h"
-#include "liblwgeom_internal.h"
+#include "liblwgeom_internal.h"  /* For FP comparators. */
 #include "lwgeom_pg.h"
 #include "math.h"
 #include "lwgeom_rtree.h"
index 31fdcdd2593eff347178028de217b55b402603c8..94a0406f8a0cae7cbfc4215fa836f8ab21eb27f8 100644 (file)
@@ -16,7 +16,9 @@
 #include "utils/array.h"
 #include "utils/geo_decls.h"
 
-#include "liblwgeom_internal.h"
+#include "../postgis_config.h"
+#include "liblwgeom.h"
+// #include "liblwgeom_internal.h"
 #include "lwgeom_pg.h"
 
 #include <math.h>
@@ -596,7 +598,7 @@ Datum LWGEOM_closestpoint(PG_FUNCTION_ARGS)
                PG_RETURN_NULL();
        }
 
-       point = lw_dist2d_distancepoint(lwgeom1, lwgeom2, lwgeom1->srid, DIST_MIN);
+       point = lwgeom_closest_point(lwgeom1, lwgeom2);
 
        if (lwgeom_is_empty(point))
                PG_RETURN_NULL();
@@ -630,7 +632,7 @@ Datum LWGEOM_shortestline2d(PG_FUNCTION_ARGS)
                PG_RETURN_NULL();
        }
 
-       theline = lw_dist2d_distanceline(lwgeom1, lwgeom2, lwgeom1->srid, DIST_MIN);
+       theline = lwgeom_closest_line(lwgeom1, lwgeom2);
        
        if (lwgeom_is_empty(theline))
                PG_RETURN_NULL();       
@@ -664,7 +666,7 @@ Datum LWGEOM_longestline2d(PG_FUNCTION_ARGS)
                PG_RETURN_NULL();
        }
 
-       theline = lw_dist2d_distanceline(lwgeom1, lwgeom2, lwgeom1->srid, DIST_MAX);
+       theline = lwgeom_furthest_line(lwgeom1, lwgeom2);
        
        if (lwgeom_is_empty(theline))
                PG_RETURN_NULL();
@@ -836,7 +838,8 @@ Datum LWGEOM_closestpoint3d(PG_FUNCTION_ARGS)
                PG_RETURN_NULL();
        }
 
-       point = lw_dist3d_distancepoint(lwgeom1, lwgeom2, lwgeom1->srid, DIST_MIN);
+       point = lwgeom_closest_point_3d(lwgeom1, lwgeom2);
+       // point = lw_dist3d_distancepoint(lwgeom1, lwgeom2, lwgeom1->srid, DIST_MIN);
 
        if (lwgeom_is_empty(point))
                PG_RETURN_NULL();       
@@ -871,7 +874,8 @@ Datum LWGEOM_shortestline3d(PG_FUNCTION_ARGS)
                PG_RETURN_NULL();
        }
 
-       theline = lw_dist3d_distanceline(lwgeom1, lwgeom2, lwgeom1->srid, DIST_MIN);
+       theline = lwgeom_closest_line_3d(lwgeom1, lwgeom2);
+       // theline = lw_dist3d_distanceline(lwgeom1, lwgeom2, lwgeom1->srid, DIST_MIN);
        
        if (lwgeom_is_empty(theline))
                PG_RETURN_NULL();
@@ -906,7 +910,8 @@ Datum LWGEOM_longestline3d(PG_FUNCTION_ARGS)
                PG_RETURN_NULL();
        }
 
-       theline = lw_dist3d_distanceline(lwgeom1, lwgeom2, lwgeom1->srid, DIST_MAX);
+       theline = lwgeom_furthest_line_3d(lwgeom1, lwgeom2);
+       // theline = lw_dist3d_distanceline(lwgeom1, lwgeom2, lwgeom1->srid, DIST_MAX);
        
        if (lwgeom_is_empty(theline))
                PG_RETURN_NULL();
index f79ed6f6c6a9334480a92a375f3efd91e773e478..b1b32e782ffa32b0e09866d8f0de01a001961250 100644 (file)
@@ -34,7 +34,7 @@
 
 #include "lwgeom_functions_analytic.h" /* for point_in_polygon */
 #include "lwgeom_geos.h"
-#include "liblwgeom_internal.h"
+#include "liblwgeom.h"
 #include "lwgeom_rtree.h"
 #include "lwgeom_geos_prepared.h" 
 
index ea2942e4064bda799a2deb39013a2a103b5e7907..ff7cebff95a7f1c95550bf14277035697015f868 100644 (file)
@@ -42,7 +42,6 @@
 #include "../postgis_config.h"
 #include "lwgeom_geos.h"
 #include "liblwgeom.h"
-#include "liblwgeom_internal.h"
 #include "lwgeom_pg.h"
 
 #include <string.h>