root / branches / v2_0_0_prep / libraries / libFMap_dalfile / src / org / gvsig / fmap / dal / store / shp / SHPFeatureData.java @ 24498
History | View | Annotate | Download (1.34 KB)
1 |
package org.gvsig.fmap.dal.store.shp; |
---|---|
2 |
|
3 |
import org.gvsig.fmap.dal.exceptions.DataException; |
4 |
import org.gvsig.fmap.dal.exceptions.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 SHPFeatureData extends DefaultFeatureData { |
11 |
protected SHPStoreProvider store;
|
12 |
protected boolean loading; |
13 |
|
14 |
public SHPFeatureData(SHPStoreProvider store, DefaultFeatureType type) {
|
15 |
super(type);
|
16 |
this.store = store;
|
17 |
loading = false;
|
18 |
} |
19 |
|
20 |
protected void load() { |
21 |
if (loading) {
|
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 |
this.load();
|
56 |
return this.defaultGeometry; |
57 |
} |
58 |
|
59 |
public Envelope getDefaultEnvelope() {
|
60 |
return this.envelope; |
61 |
} |
62 |
} |