[GRASS-SVN] r69352 - grass/trunk/vector/v.overlay
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Sep 3 06:58:18 PDT 2016
Author: mmetz
Date: 2016-09-03 06:58:18 -0700 (Sat, 03 Sep 2016)
New Revision: 69352
Modified:
grass/trunk/vector/v.overlay/main.c
Log:
v.overlay: use GV_MTABLE for multiple output layers
Modified: grass/trunk/vector/v.overlay/main.c
===================================================================
--- grass/trunk/vector/v.overlay/main.c 2016-09-02 22:17:08 UTC (rev 69351)
+++ grass/trunk/vector/v.overlay/main.c 2016-09-03 13:58:18 UTC (rev 69352)
@@ -31,7 +31,7 @@
#include "local.h"
-void copy_table(struct Map_info *, struct Map_info *, int, int);
+void copy_table(struct Map_info *, struct Map_info *, int, int, int);
int main(int argc, char *argv[])
{
@@ -50,6 +50,7 @@
int verbose;
struct field_info *Fi = NULL;
+ int table_type;
char buf[DB_SQL_MAX];
dbString stmt;
dbString sql, value_string, col_defs;
@@ -161,6 +162,10 @@
i++;
}
+ table_type = GV_1TABLE;
+ if ((ofield[0] > 0) + (ofield[1] > 0) + (ofield[2] > 0) > 1)
+ table_type = GV_MTABLE;
+
if (operator_opt->answer[0] == 'a')
operator = OP_AND;
else if (operator_opt->answer[0] == 'o')
@@ -223,7 +228,7 @@
/* Create dblinks */
if (ofield[0] > 0) {
- Fi = Vect_default_field_info(&Out, ofield[0], NULL, GV_1TABLE);
+ Fi = Vect_default_field_info(&Out, ofield[0], NULL, table_type);
}
db_init_string(&sql);
@@ -622,11 +627,11 @@
/* TODO: copy only valid attributes */
/* copy attributes from ainput */
if (ofield[1] > 0 && field[0] > 0) {
- copy_table(&In[0], &Out, field[0], ofield[1]);
+ copy_table(&In[0], &Out, field[0], ofield[1], table_type);
}
/* copy attributes from binput */
if (ofield[2] > 0 && field[1] > 0 && ofield[1] != ofield[2]) {
- copy_table(&In[1], &Out, field[1], ofield[2]);
+ copy_table(&In[1], &Out, field[1], ofield[2], table_type);
}
}
@@ -640,7 +645,7 @@
}
void copy_table(struct Map_info *In, struct Map_info *Out, int infield,
- int outfield)
+ int outfield, int table_type)
{
struct ilist *list;
int findex;
@@ -652,7 +657,7 @@
list = Vect_new_list();
Vect_cidx_get_unique_cats_by_index(Out, findex, list);
Vect_copy_table_by_cats(In, Out, infield, outfield, NULL,
- GV_1TABLE, list->value, list->n_values);
+ table_type, list->value, list->n_values);
Vect_destroy_list(list);
}
More information about the grass-commit
mailing list