root / branches / v2_0_0_prep / libraries / libFMap_dalfile / src / org / gvsig / fmap / dal / store / dbf / DBFFeatureData.java @ 25789
History | View | Annotate | Download (1.31 KB)
1 |
package org.gvsig.fmap.dal.store.dbf; |
---|---|
2 |
|
3 |
import org.gvsig.fmap.dal.exception.DataException; |
4 |
import org.gvsig.fmap.dal.exception.ReadRuntimeException; |
5 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureType; |
6 |
import org.gvsig.fmap.dal.feature.spi.DefaultFeatureData; |
7 |
import org.gvsig.fmap.geom.Geometry; |
8 |
import org.gvsig.fmap.geom.primitive.Envelope; |
9 |
|
10 |
public class DBFFeatureData extends DefaultFeatureData { |
11 |
protected DBFStoreProvider store;
|
12 |
protected boolean loading; |
13 |
|
14 |
public DBFFeatureData(DBFStoreProvider store, DefaultFeatureType type) {
|
15 |
super(type);
|
16 |
this.store = store;
|
17 |
loading = false;
|
18 |
} |
19 |
|
20 |
protected void load() { |
21 |
if (loading || this.isNew()) { |
22 |
return;
|
23 |
} |
24 |
loading = true;
|
25 |
try {
|
26 |
this.store.loadFeatureDataByIndex(this); |
27 |
} catch (DataException e) {
|
28 |
throw new ReadRuntimeException("DBFFeatureData.load", e); |
29 |
} finally {
|
30 |
loading = false;
|
31 |
} |
32 |
} |
33 |
|
34 |
public void set(int i, Object value) { |
35 |
this.load();
|
36 |
super.set(i, value);
|
37 |
} |
38 |
|
39 |
public void set(String name, Object value) { |
40 |
this.load();
|
41 |
super.set(featureType.getIndex(name), value);
|
42 |
} |
43 |
|
44 |
public Object get(int i) { |
45 |
this.load();
|
46 |
return super.get(i); |
47 |
} |
48 |
|
49 |
public Object get(String name) { |
50 |
this.load();
|
51 |
return super.get(name); |
52 |
} |
53 |
|
54 |
public Geometry getDefaultGeometry() {
|
55 |
return null; |
56 |
} |
57 |
|
58 |
public Envelope getDefaultEnvelope() {
|
59 |
return null; |
60 |
} |
61 |
|
62 |
|
63 |
} |