Revision 5020 trunk/extensions/extMeasureGeometry/src/com/iver/gvsig/AreaExtension.java
AreaExtension.java | ||
---|---|---|
1 | 1 |
package com.iver.gvsig; |
2 | 2 |
|
3 | 3 |
import java.io.File; |
4 |
import java.io.IOException; |
|
4 | 5 |
|
5 | 6 |
import com.hardcode.gdbms.engine.values.Value; |
6 | 7 |
import com.hardcode.gdbms.engine.values.ValueFactory; |
... | ... | |
74 | 75 |
IFeature feat=adapter.getFeature(i); |
75 | 76 |
IGeometry geom=feat.getGeometry().cloneGeometry(); |
76 | 77 |
Value[] values=feat.getAttributes(); |
77 |
Value[] newValues=new Value[values.length+2];
|
|
78 |
for (int j=0;j<values.length;j++){ |
|
78 |
Value[] newValues=new Value[values.length+1];
|
|
79 |
for (int j=0;j<values.length-1;j++){
|
|
79 | 80 |
newValues[j]=values[j]; |
80 | 81 |
} |
81 | 82 |
|
82 | 83 |
double area=operations.getArea(geom); |
83 |
newValues[values.length]=ValueFactory.createValue(area); |
|
84 |
newValues[values.length-1]=ValueFactory.createValue(area);
|
|
84 | 85 |
double perimeter=operations.getPerimeter(geom,vp); |
85 |
newValues[values.length+1]=ValueFactory.createValue(perimeter);
|
|
86 |
newValues[values.length]=ValueFactory.createValue(perimeter); |
|
86 | 87 |
DefaultFeature df=new DefaultFeature(geom,newValues); |
87 | 88 |
IRowEdited edRow = new DefaultRowEdited(df, IRowEdited.STATUS_ADDED, i); |
88 | 89 |
writer.process(edRow); |
89 | 90 |
} |
90 | 91 |
writer.postProcess(); |
92 |
adapter.getDriver().reLoad(); |
|
91 | 93 |
} catch (EditionException e) { |
92 | 94 |
e.printStackTrace(); |
93 | 95 |
} catch (DriverException e1) { |
... | ... | |
96 | 98 |
e1.printStackTrace(); |
97 | 99 |
} catch (DriverIOException e) { |
98 | 100 |
e.printStackTrace(); |
101 |
} catch (IOException e) { |
|
102 |
e.printStackTrace(); |
|
99 | 103 |
} |
100 | 104 |
} |
101 | 105 |
|
Also available in: Unified diff