extGeoProcessing_patch_rev.txt

Patch of extGeoProcessing (Merge) - revisited - Antonio Falciano, 01/04/2013 09:45 AM

Download (2.39 KB)

 
1
Index: src/com/iver/cit/gvsig/geoprocess/core/fmap/DefinitionUtils.java
2
===================================================================
3
--- src/com/iver/cit/gvsig/geoprocess/core/fmap/DefinitionUtils.java	(revision 39491)
4
+++ src/com/iver/cit/gvsig/geoprocess/core/fmap/DefinitionUtils.java	(working copy)
5
@@ -110,9 +110,12 @@
6
 		solution.setName(layer.getName());
7
 		solution.setShapeType(layer.getShapeType());
8
 		SelectableDataSource datasource = layer.getRecordset();
9
-		int numFields = datasource.getFieldCount();
10
-		FieldDescription[] fields =
11
-			new FieldDescription[numFields];
12
+		//int numFields = datasource.getFieldCount();
13
+		//FieldDescription[] fields =
14
+		//	new FieldDescription[numFields];
15
+		FieldDescription[] fieldsDescription = null;
16
+		fieldsDescription = datasource.getFieldsDescription();
17
+		/*
18
 		FieldDescription fieldDesc = null;
19
 		for(int i = 0; i < numFields; i++){
20
 			fieldDesc = new FieldDescription();
21
@@ -125,6 +128,8 @@
22
 			fields[i] = fieldDesc;
23
 		}
24
 		solution.setFieldsDesc(fields);
25
+		*/
26
+		solution.setFieldsDesc(fieldsDescription);
27
 		return solution;
28
 	}
29
 
30
Index: src/com/iver/cit/gvsig/geoprocess/impl/merge/fmap/MergeVisitor.java
31
===================================================================
32
--- src/com/iver/cit/gvsig/geoprocess/impl/merge/fmap/MergeVisitor.java	(revision 39491)
33
+++ src/com/iver/cit/gvsig/geoprocess/impl/merge/fmap/MergeVisitor.java	(working copy)
34
@@ -135,6 +135,19 @@
35
 					}else{
36
 						values[i] = recordset.getFieldValue(index, fieldIndex);
37
 					}
38
+					// afalciano: ...but also field length and precision
39
+					int fieldLength = fields[i].getFieldLength();
40
+					int fieldDecimalCount = fields[i].getFieldDecimalCount();
41
+					FieldDescription[] recordsetFieldsDescription = recordset.getFieldsDescription();
42
+					int recordsetLength = recordsetFieldsDescription[fieldIndex].getFieldLength();
43
+					int recordsetDecimalCount = recordsetFieldsDescription[fieldIndex].getFieldDecimalCount();
44
+					if(fieldLength != recordsetLength){
45
+						fields[i].setFieldLength(recordsetLength);
46
+					}
47
+					if(fieldDecimalCount != recordsetDecimalCount){
48
+						fields[i].setFieldDecimalCount(recordsetDecimalCount);
49
+					}
50
+					
51
 				}
52
 			} catch (ReadDriverException e) {
53
 				throw new ProcessVisitorException(recordset.getName(),e,"Error en merge al tratar de leer el atributo de un feature de una de las capas");