]> granicus.if.org Git - postgis/commitdiff
#2018, Remove old bruteforce function and replace with new one.
authorPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 29 Mar 2013 20:38:14 +0000 (20:38 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 29 Mar 2013 20:38:14 +0000 (20:38 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@11227 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/measures.c
liblwgeom/measures.h

index 00021fa8280988a23d66accf2e8a3f2c758d5b21..1e31a5c3bb399dc4e7fbf604b0ac6818be872cd7 100644 (file)
@@ -316,7 +316,7 @@ int lw_dist2d_recursive(const LWGEOM *lwg1, const LWGEOM *lwg2, DISTPTS *dl)
                        }
                        else
                        {
-                               if (!lw_dist2d_distribute_bruteforce2(g1, g2, dl)) return LW_FALSE;
+                               if (!lw_dist2d_distribute_bruteforce(g1, g2, dl)) return LW_FALSE;
                                if (dl->distance<=dl->tolerance && dl->mode == DIST_MIN) return LW_TRUE; /*just a check if  the answer is already given*/                               
                        }
                }
@@ -326,7 +326,7 @@ int lw_dist2d_recursive(const LWGEOM *lwg1, const LWGEOM *lwg2, DISTPTS *dl)
 
 
 int
-lw_dist2d_distribute_bruteforce2(LWGEOM *lwg1, LWGEOM *lwg2, DISTPTS *dl)
+lw_dist2d_distribute_bruteforce(LWGEOM *lwg1, LWGEOM *lwg2, DISTPTS *dl)
 {
 
        int     t1 = lwg1->type;
@@ -448,97 +448,6 @@ lw_dist2d_distribute_bruteforce2(LWGEOM *lwg1, LWGEOM *lwg2, DISTPTS *dl)
 
 
 
-/**
-This function distributes the "old-type" brut-force tasks depending on type
-*/
-int
-lw_dist2d_distribute_bruteforce(LWGEOM *lwg1, LWGEOM *lwg2, DISTPTS *dl)
-{
-
-       int     t1 = lwg1->type;
-       int     t2 = lwg2->type;
-
-       LWDEBUGF(2, "lw_dist2d_distribute_bruteforce is called with typ1=%d, type2=%d", lwg1->type, lwg2->type);
-
-       if  ( t1 == POINTTYPE )
-       {
-               if  ( t2 == POINTTYPE )
-               {
-                       dl->twisted=1;
-                       return lw_dist2d_point_point((LWPOINT *)lwg1, (LWPOINT *)lwg2, dl);
-               }
-               else if  ( t2 == LINETYPE )
-               {
-                       dl->twisted=1;
-                       return lw_dist2d_point_line((LWPOINT *)lwg1, (LWLINE *)lwg2, dl);
-               }
-               else if  ( t2 == POLYGONTYPE )
-               {
-                       dl->twisted=1;
-                       return lw_dist2d_point_poly((LWPOINT *)lwg1, (LWPOLY *)lwg2,dl);
-               }
-               else
-               {
-                       lwerror("Unsupported geometry type: %s", lwtype_name(t2));
-                       return LW_FALSE;
-               }
-       }
-       else if ( t1 == LINETYPE )
-       {
-               if ( t2 == POINTTYPE )
-               {
-                       dl->twisted=(-1);
-                       return lw_dist2d_point_line((LWPOINT *)lwg2,(LWLINE *)lwg1,dl);
-               }
-               else if ( t2 == LINETYPE )
-               {
-                       dl->twisted=1;
-                       /*lwnotice("start line");*/
-                       return lw_dist2d_line_line((LWLINE *)lwg1,(LWLINE *)lwg2,dl);
-               }
-               else if ( t2 == POLYGONTYPE )
-               {
-                       dl->twisted=1;
-                       return lw_dist2d_line_poly((LWLINE *)lwg1,(LWPOLY *)lwg2,dl);
-               }
-               else
-               {
-                       lwerror("Unsupported geometry type: %s", lwtype_name(t2));
-                       return LW_FALSE;
-               }
-       }
-       else if ( t1 == POLYGONTYPE )
-       {
-               if ( t2 == POLYGONTYPE )
-               {
-                       dl->twisted=(1);
-                       return lw_dist2d_poly_poly((LWPOLY *)lwg1,(LWPOLY *)lwg2,dl);
-               }
-               else if ( t2 == POINTTYPE )
-               {
-                       dl->twisted=(-1);
-                       return lw_dist2d_point_poly((LWPOINT *)lwg2,  (LWPOLY *)lwg1, dl);
-               }
-               else if ( t2 == LINETYPE )
-               {
-                       dl->twisted=(-1);
-                       return lw_dist2d_line_poly((LWLINE *)lwg2,(LWPOLY *)lwg1,dl);
-               }
-               else
-               {
-                       lwerror("Unsupported geometry type: %s", lwtype_name(t2));
-                       return LW_FALSE;
-               }
-       }
-       else
-       {
-               lwerror("Unsupported geometry type: %s", lwtype_name(t1));
-               return LW_FALSE;
-       }
-       /*You shouldn't being able to get here*/
-       lwerror("unspecified error in function lw_dist2d_distribute_bruteforce");
-       return LW_FALSE;
-}
 
 /**
 
index a61f11e95c8ed9e754fb3fe58cf27320b1c0a74c..5ed834ae8be2dfeb94d46e1e4ad355c46400f127 100644 (file)
@@ -40,7 +40,6 @@ 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_distribute_bruteforce2(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_distribute_fast(LWGEOM *lwg1, LWGEOM *lwg2, DISTPTS *dl);