Revision 3612 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/MemoryExpansionFile.java
MemoryExpansionFile.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package com.iver.cit.gvsig.fmap.edition; |
42 | 42 |
|
43 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
|
43 | 44 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
44 | 45 |
|
45 | 46 |
import java.io.IOException; |
... | ... | |
59 | 60 |
ArrayList geometries = new ArrayList(); |
60 | 61 |
BitSet invalidGeometries = new BitSet(); |
61 | 62 |
/** |
62 |
* @see com.iver.cit.gvsig.fmap.edition.ExpansionFile#addGeometry(com.iver.cit.gvsig.fmap.core.IGeometry)
|
|
63 |
* @see com.iver.cit.gvsig.fmap.edition.ExpansionFile#addFeature(IFeature)
|
|
63 | 64 |
*/ |
64 |
public int addGeometry(IGeometry g) throws IOException {
|
|
65 |
geometries.add(g);
|
|
65 |
public int addFeature(IFeature feat) throws IOException {
|
|
66 |
geometries.add(feat);
|
|
66 | 67 |
|
67 | 68 |
return geometries.size() - 1; |
68 | 69 |
} |
69 | 70 |
|
70 | 71 |
/** |
71 |
* @see com.iver.cit.gvsig.fmap.edition.ExpansionFile#modifyGeometry(int,
|
|
72 |
* com.iver.cit.gvsig.fmap.core.IGeometry)
|
|
72 |
* @see com.iver.cit.gvsig.fmap.edition.ExpansionFile#modifyFeature(int,
|
|
73 |
* IFeature)
|
|
73 | 74 |
*/ |
74 |
public int modifyGeometry(int index, IGeometry g) throws IOException {
|
|
75 |
public int modifyFeature(int index, IFeature feat) throws IOException {
|
|
75 | 76 |
if (invalidGeometries.get(index)) { |
76 | 77 |
throw new RuntimeException( |
77 | 78 |
"Se ha intentado modificar una geometr?a que ha sido borrada anteriormente"); |
78 | 79 |
} |
79 | 80 |
|
80 |
invalidateGeometry(index);
|
|
81 |
geometries.add(g);
|
|
81 |
invalidateFeature(index);
|
|
82 |
geometries.add(feat);
|
|
82 | 83 |
|
83 | 84 |
return geometries.size() - 1; |
84 | 85 |
} |
85 | 86 |
|
86 | 87 |
/** |
87 |
* @see com.iver.cit.gvsig.fmap.edition.ExpansionFile#getGeometry(int)
|
|
88 |
* @see com.iver.cit.gvsig.fmap.edition.ExpansionFile#getFeature(int)
|
|
88 | 89 |
*/ |
89 |
public IGeometry getGeometry(int index) throws IOException {
|
|
90 |
public IFeature getFeature(int index) throws IOException {
|
|
90 | 91 |
if (invalidGeometries.get(index)) { |
91 | 92 |
return null; |
92 | 93 |
} |
... | ... | |
95 | 96 |
} |
96 | 97 |
|
97 | 98 |
/** |
98 |
* @see com.iver.cit.gvsig.fmap.edition.ExpansionFile#invalidateGeometry(int)
|
|
99 |
* @see com.iver.cit.gvsig.fmap.edition.ExpansionFile#invalidateFeature(int)
|
|
99 | 100 |
*/ |
100 |
public void invalidateGeometry(int index) {
|
|
101 |
public void invalidateFeature(int index) {
|
|
101 | 102 |
invalidGeometries.set(index, true); |
102 | 103 |
} |
103 | 104 |
|
... | ... | |
128 | 129 |
} |
129 | 130 |
|
130 | 131 |
/** |
131 |
* @see com.iver.cit.gvsig.fmap.edition.ExpansionFile#getGeometryCount()
|
|
132 |
* @see com.iver.cit.gvsig.fmap.edition.ExpansionFile#getFeatureCount()
|
|
132 | 133 |
*/ |
133 |
public int getGeometryCount() {
|
|
134 |
public int getFeatureCount() {
|
|
134 | 135 |
return geometries.size() - invalidGeometries.cardinality(); |
135 | 136 |
} |
136 | 137 |
} |
Also available in: Unified diff