]> granicus.if.org Git - postgis/commitdiff
Revisison per MCA and (c) headers.
authorPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 17 Dec 2008 05:28:54 +0000 (05:28 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 17 Dec 2008 05:28:54 +0000 (05:28 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@3428 b70326c6-7e19-0410-871a-916f4a2858ee

cunit/cu_algorithm.c
cunit/cu_algorithm.h
cunit/cu_tester.c
liblwgeom/lwalgorithm.c
liblwgeom/lwalgorithm.h
lwgeom/lwgeom_functions_analytic.c

index ba65e6617e25d06591f5241ca9b3d1b756b89ee7..fd94b59432bf60619f6e0d74f72ba119958c103c 100644 (file)
@@ -1,3 +1,14 @@
+/**********************************************************************
+ * $Id$
+ *
+ * PostGIS - Spatial Types for PostgreSQL
+ * http://postgis.refractions.net
+ * Copyright 2008 Paul Ramsey
+ *
+ * This is free software; you can redistribute and/or modify it under
+ * the terms of the GNU General Public Licence. See the COPYING file.
+ * 
+ **********************************************************************/
 
 #include "cu_algorithm.h"
 
index fbac994b49a67b8b6781c1fc2524ea197af192c2..66b19691c085cb1e1dcb44ca174b62516c1eb872 100644 (file)
@@ -1,3 +1,15 @@
+/**********************************************************************
+ * $Id$
+ *
+ * PostGIS - Spatial Types for PostgreSQL
+ * http://postgis.refractions.net
+ * Copyright 2008 Paul Ramsey
+ *
+ * This is free software; you can redistribute and/or modify it under
+ * the terms of the GNU General Public Licence. See the COPYING file.
+ * 
+ **********************************************************************/
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 21e7854e659ed580aec244dc2febfaf5ec883b4f..f74b6ce94678d25f2487ae21b0fc23003925e475 100644 (file)
@@ -1,3 +1,14 @@
+/**********************************************************************
+ * $Id$
+ *
+ * PostGIS - Spatial Types for PostgreSQL
+ * http://postgis.refractions.net
+ * Copyright 2008 Paul Ramsey
+ *
+ * This is free software; you can redistribute and/or modify it under
+ * the terms of the GNU General Public Licence. See the COPYING file.
+ * 
+ **********************************************************************/
 
 #include <stdio.h>
 #include <string.h>
@@ -19,12 +30,8 @@ void cunit_lwnotice(const char *fmt, va_list ap) {
 }
 
 void lwgeom_init_allocators(void) {
-        /* liblwgeom callback - install PostgreSQL handlers */
-        lwalloc_var = malloc;
-        lwrealloc_var = realloc;
-        lwfree_var = free;
-        lwerror_var = default_errorreporter;
-        lwnotice_var = default_noticereporter;
+        /* liblwgeom callback - install default handlers */
+        lwgeom_install_default_allocators();
 }
 
 /*
index 07181b4c883597909f8af5692e2e909795331789..c980401783cb6f0437e3758b10c9e13f02dfe20c 100644 (file)
@@ -1,3 +1,15 @@
+/**********************************************************************
+ * $Id$
+ *
+ * PostGIS - Spatial Types for PostgreSQL
+ * http://postgis.refractions.net
+ * Copyright 2008 Paul Ramsey
+ *
+ * This is free software; you can redistribute and/or modify it under
+ * the terms of the GNU General Public Licence. See the COPYING file.
+ * 
+ **********************************************************************/
+
 #include "lwalgorithm.h"
 
 /*
 ** Return > 0.0 if point Q is right of segment P
 ** Return = 0.0 if point Q in on segment P
 */
-double segmentSide(POINT2D *p1, POINT2D *p2, POINT2D *q)
+double lw_segment_side(POINT2D *p1, POINT2D *p2, POINT2D *q)
 {
        return ( (q->x - p1->x) * (p2->y - p1->y) - (p2->x - p1->x) * (q->y - p1->y) );
 }
 
-int segmentEnvelopeIntersects(POINT2D *p1, POINT2D *p2, POINT2D *q1, POINT2D *q2) {
+int lw_segment_envelope_intersects(POINT2D *p1, POINT2D *p2, POINT2D *q1, POINT2D *q2) {
        double minq=LW_MIN(q1->x,q2->x);
        double maxq=LW_MAX(q1->x,q2->x);
        double minp=LW_MIN(p1->x,p2->x);
@@ -44,7 +56,7 @@ int segmentEnvelopeIntersects(POINT2D *p1, POINT2D *p2, POINT2D *q1, POINT2D *q2
 **     SEG_TOUCH_LEFT = 4, 
 **     SEG_TOUCH_RIGHT = 5
 */
-int segmentIntersects(POINT2D *p1, POINT2D *p2, POINT2D *q1, POINT2D *q2) {
+int lw_segment_intersects(POINT2D *p1, POINT2D *p2, POINT2D *q1, POINT2D *q2) {
        
        double pq1, pq2, qp1, qp2;
        
@@ -115,7 +127,7 @@ int segmentIntersects(POINT2D *p1, POINT2D *p2, POINT2D *q1, POINT2D *q2) {
 **   LINE_TOUCH_RIGHT = 4
 **
 */
-int lineCrossingDirection(LWLINE *l1, LWLINE *l2) {
+int lwline_crossing_direction(LWLINE *l1, LWLINE *l2) {
        
        int i = 0, j = 0, rv = 0;
        POINT2D *p1;
@@ -144,8 +156,8 @@ int lineCrossingDirection(LWLINE *l1, LWLINE *l2) {
        if( pa1->npoints < 2 || pa2->npoints < 2 ) 
                return LINE_NO_CROSS;
 
-       LWDEBUGF(5, "lineCrossingDirection: l1 = %s", lwgeom_to_ewkt((LWGEOM*)l1,0));
-       LWDEBUGF(5, "lineCrossingDirection: l2 = %s", lwgeom_to_ewkt((LWGEOM*)l2,0));
+       LWDEBUGF(4, "lineCrossingDirection: l1 = %s", lwgeom_to_ewkt((LWGEOM*)l1,0));
+       LWDEBUGF(4, "lineCrossingDirection: l2 = %s", lwgeom_to_ewkt((LWGEOM*)l2,0));
 
        for ( i = 1; i < pa2->npoints; i++ ) {
                
@@ -157,7 +169,7 @@ int lineCrossingDirection(LWLINE *l1, LWLINE *l2) {
                        rv = getPoint2d_p(pa1, j-1, p1);
                        rv = getPoint2d_p(pa1, j, p2);
                        
-                       LWDEBUGF(5, "lineCrossingDirection: i=%d, j=%d", i, j);
+                       LWDEBUGF(4, "lineCrossingDirection: i=%d, j=%d", i, j);
                        
                        this_cross = segmentIntersects(p1, p2, q1, q2);
                
@@ -220,13 +232,13 @@ int lineCrossingDirection(LWLINE *l1, LWLINE *l2) {
                        ** TODO Handle co-linear cases. 
                        */
 
-                       LWDEBUGF(5, "lineCrossingDirection: this_cross=%d, vertex_touch=%d, vertex_touch_type=%d", this_cross, vertex_touch, vertex_touch_type);
+                       LWDEBUGF(4, "lineCrossingDirection: this_cross=%d, vertex_touch=%d, vertex_touch_type=%d", this_cross, vertex_touch, vertex_touch_type);
                                
                }
                
        }
 
-       LWDEBUGF(5, "first_cross=%d, final_cross=%d, cross_left=%d, cross_right=%d", first_cross, final_cross, cross_left, cross_right);
+       LWDEBUGF(4, "first_cross=%d, final_cross=%d, cross_left=%d, cross_right=%d", first_cross, final_cross, cross_left, cross_right);
 
        lwfree(p1);
        lwfree(p2);
index cadd17d98b695d06652279eba49a28ce28c6289a..638fd853e34000ff3a03b05f08091d1dc86bb829 100644 (file)
@@ -1,3 +1,15 @@
+/**********************************************************************
+ * $Id$
+ *
+ * PostGIS - Spatial Types for PostgreSQL
+ * http://postgis.refractions.net
+ * Copyright 2008 Paul Ramsey
+ *
+ * This is free software; you can redistribute and/or modify it under
+ * the terms of the GNU General Public Licence. See the COPYING file.
+ * 
+ **********************************************************************/
+
 #include "liblwgeom.h"
 
 enum CG_SEGMENT_INTERSECTION_TYPE { 
@@ -10,9 +22,9 @@ enum CG_SEGMENT_INTERSECTION_TYPE {
        SEG_TOUCH_RIGHT = 5
 };
 
-double segmentSide(POINT2D *p1, POINT2D *p2, POINT2D *q);
-int segmentIntersects(POINT2D *p1, POINT2D *p2, POINT2D *q1, POINT2D *q2);
-int segmentEnvelopeIntersects(POINT2D *p1, POINT2D *p2, POINT2D *q1, POINT2D *q2);
+double lw_segment_side(POINT2D *p1, POINT2D *p2, POINT2D *q);
+int lw_segment_intersects(POINT2D *p1, POINT2D *p2, POINT2D *q1, POINT2D *q2);
+int lw_segment_envelope_intersects(POINT2D *p1, POINT2D *p2, POINT2D *q1, POINT2D *q2);
 
 
 enum CG_LINE_CROSS_TYPE {
@@ -25,4 +37,4 @@ enum CG_LINE_CROSS_TYPE {
        LINE_MULTICROSS_END_SAME_FIRST_RIGHT = 3
 };
 
-int lineCrossingDirection(LWLINE *l1, LWLINE *l2);
+int lwline_crossing_direction(LWLINE *l1, LWLINE *l2);
index 85c23a9633a88eb95860b8ade94e90ca4374f4a1..7fc0606226cbb52f58df74992fe877013af9dab5 100644 (file)
@@ -984,7 +984,7 @@ Datum crossingDirection(PG_FUNCTION_ARGS)
        l1 = lwline_deserialize(SERIALIZED_FORM(geom1));
        l2 = lwline_deserialize(SERIALIZED_FORM(geom2));
 
-       rv = lineCrossingDirection(l1, l2);
+       rv = lw_line_crossing_direction(l1, l2);
        
        PG_FREE_IF_COPY(geom1, 0);
        PG_FREE_IF_COPY(geom2, 0);