[GRASS-SVN] r39803 - in grass/trunk: general/g.list lib/vector/Vlib vector/v.external vector/v.info

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Nov 26 13:08:02 EST 2009


Author: martinl
Date: 2009-11-26 13:08:02 -0500 (Thu, 26 Nov 2009)
New Revision: 39803

Modified:
   grass/trunk/general/g.list/main.c
   grass/trunk/lib/vector/Vlib/build_ogr.c
   grass/trunk/vector/v.external/list.c
   grass/trunk/vector/v.info/main.c
Log:
OGR support: some cosmetics in v.info/v.external
cosmetics in g.list


Modified: grass/trunk/general/g.list/main.c
===================================================================
--- grass/trunk/general/g.list/main.c	2009-11-26 05:13:54 UTC (rev 39802)
+++ grass/trunk/general/g.list/main.c	2009-11-26 18:08:02 UTC (rev 39803)
@@ -5,15 +5,16 @@
  *               
  * AUTHOR(S):    Michael Shapiro,
  *               U.S.Army Construction Engineering Research Laboratory
+ *               Some updates by various authors from GRASS Development Team
  *               
- * PURPOSE:      Lists available GRASS data base files of the
- *               user-specified data type to standard output
+ * PURPOSE:      Lists available GRASS data base elements of the user-specified data type to
+ *               standard output
  *
- * COPYRIGHT:    (C) 1999-2007 by the GRASS Development Team
+ * COPYRIGHT:    (C) 1999-2009 by the GRASS Development Team
  *
- *               This program is free software under the GNU General Public
- *               License (>=v2). Read the file COPYING that comes with GRASS
- *               for details.
+ *               This program is free software under the GNU General
+ *               Public License (>=v2). Read the file COPYING that
+ *               comes with GRASS for details.
  *
  *****************************************************************************/
 
@@ -44,12 +45,11 @@
     G_add_keyword(_("general"));
     G_add_keyword(_("map management"));
     module->description =
-	_("Lists available GRASS data base files "
-	  "of the user-specified data type to standard output.");
+	_("Lists available GIS elements "
+	  "of the user-specified data type.");
 
     element = G_define_option();
     element->key = "type";
-    element->key_desc = "datatype";
     element->type = TYPE_STRING;
     element->required = YES;
     element->multiple = YES;
@@ -74,7 +74,8 @@
     mapset_opt->type = TYPE_STRING;
     mapset_opt->required = NO;
     mapset_opt->multiple = NO;
-    mapset_opt->description = _("Mapset to list (default: current search path)");
+    mapset_opt->label = _("Mapset to list (default: current search path");
+    mapset_opt->description = _("'.' for current mapset");
 
     full = G_define_flag();
     full->key = 'f';


Property changes on: grass/trunk/general/g.list/main.c
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: grass/trunk/lib/vector/Vlib/build_ogr.c
===================================================================
--- grass/trunk/lib/vector/Vlib/build_ogr.c	2009-11-26 05:13:54 UTC (rev 39802)
+++ grass/trunk/lib/vector/Vlib/build_ogr.c	2009-11-26 18:08:02 UTC (rev 39803)
@@ -314,10 +314,10 @@
 }
 
 /*!
-   \brief Build topology 
+   \brief Build pseudo-topology for OGR layer
 
-   \param Map_info vector map
-   \param build build level 
+   \param Map pointer to Map_info structure
+   \param build build level (only GV_BUILD_ALL currently supported)
 
    \return 1 on success
    \return 0 on error
@@ -329,6 +329,9 @@
     OGRFeatureH hFeature;
     OGRGeometryH hGeom;
 
+    G_debug(1, "Vect_build_ogr(): dsn=%s layer=%s",
+	    Map->fInfo.ogr.dsn, Map->fInfo.ogr.layer_name);
+    
     if (build != GV_BUILD_ALL)
 	G_fatal_error(_("Partial build for OGR is not supported"));
 
@@ -344,18 +347,17 @@
 	return 0;
     }
 
+    /* initialize data structures */
     init_parts(&parts);
-
-    /* Note: Do not use OGR_L_GetFeatureCount (it may scan all features)!!! */
-    G_verbose_message(_("Feature: "));
-
+    
+    /* Note: Do not use OGR_L_GetFeatureCount (it may scan all features) */
     OGR_L_ResetReading(Map->fInfo.ogr.layer);
     count = iFeature = 0;
     while ((hFeature = OGR_L_GetNextFeature(Map->fInfo.ogr.layer)) != NULL) {
 	iFeature++;
 	count++;
 
-	G_debug(4, "---- Feature %d ----", iFeature);
+	G_debug(3, "   Feature %d", iFeature);
 
 	hGeom = OGR_F_GetGeometryRef(hFeature);
 	if (hGeom == NULL) {
@@ -363,23 +365,23 @@
 	    OGR_F_Destroy(hFeature);
 	    continue;
 	}
-
+	
 	FID = (int)OGR_F_GetFID(hFeature);
 	if (FID == OGRNullFID) {
-	    G_warning(_("OGR feature without ID ignored"));
+	    G_warning(_("OGR feature %d without ID ignored"), iFeature);
 	    OGR_F_Destroy(hFeature);
 	    continue;
 	}
-	G_debug(3, "FID =  %d", FID);
-
+	G_debug(4, "    FID = %d", FID);
+	
 	reset_parts(&parts);
 	add_part(&parts, FID);
 	add_geometry(Map, hGeom, FID, &parts);
-
+	
 	OGR_F_Destroy(hFeature);
     }				/* while */
     free_parts(&parts);
-
+    
     Map->plus.built = GV_BUILD_ALL;
     return 1;
 }

Modified: grass/trunk/vector/v.external/list.c
===================================================================
--- grass/trunk/vector/v.external/list.c	2009-11-26 05:13:54 UTC (rev 39802)
+++ grass/trunk/vector/v.external/list.c	2009-11-26 18:08:02 UTC (rev 39803)
@@ -46,7 +46,7 @@
 	layer_name = (char *) OGR_FD_GetName(Ogr_featuredefn);
 
 	if (fd)
-	    fprintf(fd, " %s\n", layer_name);
+	    fprintf(fd, "%s\n", layer_name);
 	
 	if (layer)
 	    if (strcmp(layer_name, layer) == 0) {

Modified: grass/trunk/vector/v.info/main.c
===================================================================
--- grass/trunk/vector/v.info/main.c	2009-11-26 05:13:54 UTC (rev 39802)
+++ grass/trunk/vector/v.info/main.c	2009-11-26 18:08:02 UTC (rev 39803)
@@ -53,16 +53,19 @@
     
     if (!level1_flag) {
 	 /* level 2 */
-	if (Vect_open_old_head2(&Map, input_opt, "", field_opt) < 2) {
+	if (Vect_open_old_head2(&Map, input_opt, "", field_opt) < 2 &&
+	    Vect_open_old2(&Map, input_opt, "", field_opt) < 2) {
 	    G_warning(_("Unable to open vector map <%s> on level 2"),
 		      Vect_get_full_name(&Map));
 	    Vect_close(&Map);
 	    level1_flag = 1;
 	}
     }
+    else {
+	Vect_open_old2(&Map, input_opt, "", field_opt);
+    }
 
     if (level1_flag) {
-	Vect_open_old2(&Map, input_opt, "", field_opt);      /* level 1 */
 	level_one_info(&Map);
     }
 



More information about the grass-commit mailing list