]> granicus.if.org Git - postgis/commitdiff
rewritten split_extent to be more datatype-conservative
authorSandro Santilli <strk@keybit.net>
Fri, 5 Mar 2004 16:40:30 +0000 (16:40 +0000)
committerSandro Santilli <strk@keybit.net>
Fri, 5 Mar 2004 16:40:30 +0000 (16:40 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@467 b70326c6-7e19-0410-871a-916f4a2858ee

utils/test_estimation.pl

index 6a3e2ad6a6127e9422f60f61a2770aa78a1d6c65..7bf80c8e9980ab9e00d8e179fe54321d358a793c 100755 (executable)
@@ -122,7 +122,7 @@ print "  bps\test\treal\tdelta\tmatch_factor\n";
 print "----------------------------------------------------------\n";
 for ($bps=1; $bps<=$BPS; $bps*=2)
 {
-       split_extent($ext, $bps, \@extents);
+       @extents = split_extent($ext, $bps);
 
 
        $best_match_factor=10000;
@@ -185,10 +185,10 @@ sub split_extent
 {
        local($ext) = shift;
        local($bps) = shift;
-       local($stack) = shift;
 
        local($width, $height, $cell_width, $cell_height);
        local($x,$y);
+       local(@stack);
 
        $width = $ext->{'xmax'} - $ext->{'xmin'};
        $height = $ext->{'ymax'} - $ext->{'ymin'};
@@ -201,23 +201,21 @@ sub split_extent
                print "cell_h: $cell_height\n";
        }
 
-       @$stack = ();
-       for ($x=$ext->{'xmin'}; $x<$ext->{'xmax'}; $x += $cell_width)
+       @stack = ();
+       for ($x=0; $x<$bps; $x++)
        {
-               for ($y=$ext->{'ymin'}; $y<$ext->{'ymax'}; $y += $cell_height)
+               for($y=0; $y<$bps; $y++)
                {
                        local(%cell);
-                       $cell{'xmin'} = $x;
-                       $cell{'ymin'} = $y;
-                       $cell{'xmax'} = $x+$cell_width;
-                       $cell{'ymax'} = $y+$cell_height;
-                       #print "PUSH\n";
-
+                       $cell{'xmin'} = $ext->{'xmin'}+$x*$cell_width;
+                       $cell{'ymin'} = $ext->{'ymin'}+$y*$cell_height;
+                       $cell{'xmax'} = $ext->{'xmin'}+($x+1)*$cell_width;
+                       $cell{'ymax'} = $ext->{'ymin'}+($y+1)*$cell_height;
                        print "cell: ".print_extent(\%cell)."\n" if ($VERBOSE);
-                       #print "Y: $y\n" if ($VERBOSE);
-                       push(@$stack, \%cell);
+                       push(@stack, \%cell);
                }
        }
+       return @stack;
 }
 
 sub test_extent
@@ -248,6 +246,9 @@ sub test_extent
 
 # 
 # $Log$
+# Revision 1.4  2004/03/05 16:40:30  strk
+# rewritten split_extent to be more datatype-conservative
+#
 # Revision 1.3  2004/03/05 16:01:02  strk
 # added -bps switch to set maximun query level. reworked command line parsing
 #