[GRASS-SVN] r56678 - grass/branches/releasebranch_6_4/vector/v.in.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jun 10 12:57:29 PDT 2013


Author: mmetz
Date: 2013-06-10 12:57:29 -0700 (Mon, 10 Jun 2013)
New Revision: 56678

Modified:
   grass/branches/releasebranch_6_4/vector/v.in.ogr/main.c
Log:
v.in.ogr: use frexp, ldexp instead of log2, pow

Modified: grass/branches/releasebranch_6_4/vector/v.in.ogr/main.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.in.ogr/main.c	2013-06-10 19:56:53 UTC (rev 56677)
+++ grass/branches/releasebranch_6_4/vector/v.in.ogr/main.c	2013-06-10 19:57:29 UTC (rev 56678)
@@ -1183,13 +1183,14 @@
 
     Vect_build(&Map);
 
-    if (n_polygons) {
+    if (n_polygons && nlayers == 1) {
 	ncentr = Vect_get_num_primitives(&Map, GV_CENTROID);
 	/* this test is not perfect:
 	 * small gaps (areas without centroid) are not detected
 	 * because they may be true gaps */
 	if (ncentr != n_polygons || n_overlaps) {
 	    double new_snap;
+	    int exp;
 
 	    Vect_get_map_box(&Map, &box);
 	    
@@ -1205,8 +1206,9 @@
 	    if (xmax < ymax)
 		xmax = ymax;
 
-	    new_snap = log2(xmax) - 52;
-	    new_snap = pow(2, new_snap);
+	    new_snap = frexp(xmax, &exp);
+	    exp -= 52;
+	    new_snap = ldexp(new_snap, exp);
 	    new_snap = log10(new_snap);
 	    if (new_snap < 0)
 		new_snap = (int)new_snap;



More information about the grass-commit mailing list