Переглянути джерело

add flag to allow reusing imported table as attribute table

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@52078 15284696-431f-4ddb-bdfa-cd5b030d7da7
Moritz Lennert 13 роки тому
батько
коміт
bbe9adf43a
1 змінених файлів з 11 додано та 2 видалено
  1. 11 2
      vector/v.in.db/main.c

+ 11 - 2
vector/v.in.db/main.c

@@ -34,6 +34,7 @@ int main(int argc, char *argv[])
     struct Option *driver_opt, *database_opt, *table_opt;
     struct Option *xcol_opt, *ycol_opt, *zcol_opt, *keycol_opt, *where_opt,
 	*outvect;
+    struct Flag *same_table_flag;
     struct GModule *module;
     struct Map_info Map;
     struct line_pnts *Points;
@@ -93,6 +94,11 @@ int main(int argc, char *argv[])
 
     outvect = G_define_standard_option(G_OPT_V_OUTPUT);
 
+    same_table_flag = G_define_flag();
+    same_table_flag->key = 't';
+    same_table_flag->guisection = _("Connection");
+    same_table_flag->description = _("Use imported table as attribute table for new map");
+
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
@@ -213,7 +219,8 @@ int main(int argc, char *argv[])
 
     /* Copy table */
     G_message(_("Copying attributes..."));
-    if (where_opt->answer)
+    if (!same_table_flag->answer) {
+        if (where_opt->answer)
 	ret =
 	    db_copy_table_where(driver_opt->answer, database_opt->answer,
 				table_opt->answer, fi->driver, fi->database,
@@ -223,7 +230,6 @@ int main(int argc, char *argv[])
 	    db_copy_table(driver_opt->answer, database_opt->answer,
 			  table_opt->answer, fi->driver, fi->database,
 			  fi->table);
-
     if (ret == DB_FAILED) {
 	G_warning(_("Unable to copy table"));
     }
@@ -231,6 +237,9 @@ int main(int argc, char *argv[])
 	Vect_map_add_dblink(&Map, 1, NULL, fi->table, keycol_opt->answer,
 			    fi->database, fi->driver);
     }
+    } else {
+        Vect_map_add_dblink(&Map, 1, NULL, table_opt->answer, keycol_opt->answer, database_opt->answer, driver_opt->answer);
+    }
 
     Vect_build(&Map);
     Vect_close(&Map);