root / branches / v2_0_0_prep / libraries / libFMap_dataFile / src / org / gvsig / fmap / data / feature / file / shp / ShpFeature.java @ 23754
History | View | Annotate | Download (2.39 KB)
1 |
package org.gvsig.fmap.data.feature.file.shp; |
---|---|
2 |
|
3 |
import java.util.List; |
4 |
import java.util.Locale; |
5 |
|
6 |
import org.gvsig.fmap.data.exceptions.DataException; |
7 |
import org.gvsig.fmap.data.exceptions.ReadException; |
8 |
import org.gvsig.fmap.data.feature.AttributeDescriptor; |
9 |
import org.gvsig.fmap.data.feature.Feature; |
10 |
import org.gvsig.fmap.data.feature.FeatureAttributeDescriptor; |
11 |
import org.gvsig.fmap.data.feature.FeatureID; |
12 |
import org.gvsig.fmap.data.feature.FeatureType; |
13 |
import org.gvsig.fmap.data.feature.exceptions.IsNotFeatureSettingException; |
14 |
import org.gvsig.fmap.data.feature.file.dbf.DBFFeature; |
15 |
import org.gvsig.fmap.geom.Geometry; |
16 |
import org.gvsig.fmap.geom.primitive.Envelope; |
17 |
|
18 |
|
19 |
|
20 |
public class ShpFeature extends DBFFeature{ |
21 |
protected static Locale ukLocale = new Locale("en", "UK"); |
22 |
protected Envelope extent=null; |
23 |
// private SHPStore store;
|
24 |
// private long featureIndex;
|
25 |
|
26 |
ShpFeature(FeatureType featureType, SHPStore store,long featureIndex) throws ReadException { |
27 |
super(featureType,store,featureIndex);
|
28 |
this.extent = (store).getBoundingBox(featureIndex);
|
29 |
|
30 |
} |
31 |
|
32 |
|
33 |
protected void loadValue(FeatureAttributeDescriptor descriptor) throws ReadException, IsNotFeatureSettingException { |
34 |
if (descriptor.getDataType().equals(FeatureAttributeDescriptor.GEOMETRY)){
|
35 |
this.setGeometry(((AttributeDescriptor)descriptor).originalPosition(), ((SHPStore)store).getGeometry(featureIndex) );
|
36 |
} else {
|
37 |
super.loadValue(descriptor);
|
38 |
} |
39 |
} |
40 |
|
41 |
|
42 |
|
43 |
public FeatureID getID() {
|
44 |
try {
|
45 |
this.load();
|
46 |
} catch (ReadException e) {
|
47 |
throw new RuntimeException(e); |
48 |
} |
49 |
return new ShpFeatureID((SHPStore)this.store,featureIndex); |
50 |
} |
51 |
|
52 |
public Envelope getDefaultExtent(){
|
53 |
return this.extent; |
54 |
} |
55 |
|
56 |
public List getSRSs() { |
57 |
try {
|
58 |
this.load();
|
59 |
} catch (ReadException e) {
|
60 |
throw new RuntimeException(e); |
61 |
} |
62 |
|
63 |
return null; |
64 |
} |
65 |
|
66 |
public String getDefaultSRS() { |
67 |
// TODO Auto-generated method stub
|
68 |
return null; |
69 |
} |
70 |
|
71 |
public int[] getGeometryTypes() { |
72 |
Geometry geometry= (Geometry)getDefaultGeometry(); |
73 |
if (geometry!=null) { |
74 |
return new int[]{geometry.getType()}; |
75 |
} |
76 |
return null; |
77 |
} |
78 |
|
79 |
|
80 |
|
81 |
protected Feature cloneFeature() throws DataException { |
82 |
this.load();
|
83 |
|
84 |
try {
|
85 |
return new ShpFeature(this.featureType,(SHPStore)this.store,this.featureIndex); |
86 |
} catch (ReadException e) {
|
87 |
throw new IsNotFeatureSettingException("Clone"); |
88 |
} |
89 |
} |
90 |
|
91 |
|
92 |
|
93 |
|
94 |
} |