[GRASS-SVN] r43311 - grass/trunk/vector/v.in.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Aug 27 14:09:52 EDT 2010


Author: mmetz
Date: 2010-08-27 18:09:52 +0000 (Fri, 27 Aug 2010)
New Revision: 43311

Modified:
   grass/trunk/vector/v.in.ogr/main.c
Log:
count features only when needed

Modified: grass/trunk/vector/v.in.ogr/main.c
===================================================================
--- grass/trunk/vector/v.in.ogr/main.c	2010-08-27 17:03:55 UTC (rev 43310)
+++ grass/trunk/vector/v.in.ogr/main.c	2010-08-27 18:09:52 UTC (rev 43311)
@@ -827,20 +827,22 @@
 
 	/* estimate distance for boundary splitting --> */
 
-	/* count polygons and isles */
-	G_message(_("Counting polygons for %d features..."), n_features);
-	while ((Ogr_feature = OGR_L_GetNextFeature(Ogr_layer)) != NULL) {
-	    G_percent(feature_count++, n_features, 1);	/* show something happens */
-	    /* Geometry */
-	    Ogr_geometry = OGR_F_GetGeometryRef(Ogr_feature);
-	    if (Ogr_geometry != NULL) {
-		poly_count(Ogr_geometry);
+	if (split_distance > -0.5) {
+	    /* count polygons and isles */
+	    G_message(_("Counting polygons for %d features..."), n_features);
+	    while ((Ogr_feature = OGR_L_GetNextFeature(Ogr_layer)) != NULL) {
+		G_percent(feature_count++, n_features, 1);	/* show something happens */
+		/* Geometry */
+		Ogr_geometry = OGR_F_GetGeometryRef(Ogr_feature);
+		if (Ogr_geometry != NULL) {
+		    poly_count(Ogr_geometry);
+		}
+		OGR_F_Destroy(Ogr_feature);
 	    }
-	    OGR_F_Destroy(Ogr_feature);
+	    /* rewind layer */
+	    OGR_L_ResetReading(Ogr_layer);
+	    feature_count = 0;
 	}
-	/* rewind layer */
-	OGR_L_ResetReading(Ogr_layer);
-	feature_count = 0;
 
 	G_debug(1, "n polygon boundaries: %d", n_polygon_boundaries);
 	if (split_distance > -0.5 && n_polygon_boundaries > 50) {



More information about the grass-commit mailing list