Statistics
| Revision:

root / branches / Mobile_Compatible_Hito_1 / libFMap_mobile_shp_driver / src-file / org / gvsig / data / datastores / vectorial / file / shp_util / NewShpFeatureID.java @ 22037

History | View | Annotate | Download (1.41 KB)

1
package org.gvsig.data.datastores.vectorial.file.shp_util;
2

    
3
import java.util.HashMap;
4

    
5
import org.gvsig.data.ReadException;
6
import org.gvsig.data.datastores.vectorial.file.shp_jni.JNISHPStore;
7
import org.gvsig.data.vectorial.Feature;
8
import org.gvsig.data.vectorial.FeatureID;
9
import org.gvsig.data.vectorial.FeatureType;
10

    
11
/**
12
 * This class implements the FeatureID and needs in the constructor an instance that
13
 * implements IGeometricDataStore for reusability.
14
 * 
15
 * @see org.gvsig.data.vectorial.FeatureID
16
 * @see org.gvsig.data.datastores.vectorial.file.shp_util.IGeometricDataStore
17
 * 
18
 * @author jldominguez
19
 *
20
 */
21
public class NewShpFeatureID implements FeatureID {
22
        
23
        private int featIndex = 0;
24
        private IGeometricDataStore store;
25
        
26
        /**
27
         * 
28
         * @param _store the data store to be used
29
         * @param findex the feature index
30
         */
31
        public NewShpFeatureID(IGeometricDataStore _store, int findex) {
32
                featIndex = findex;
33
                store = _store;
34
        }
35

    
36
        public Feature getFeature(FeatureType featureType) throws ReadException {
37
                Feature resp =store.getFeatureByID(this, featureType);
38
                return resp; 
39
        }
40

    
41
        public HashMap toHashMap() {
42
                HashMap result = new HashMap();
43
                result.put("featureIndex", new Long(featIndex));
44
                return result;
45
        }
46
        
47
        public int getIndex() {
48
                return featIndex;
49
        }
50
        
51
        public boolean equals(Object obj) {
52
                if (obj instanceof NewShpFeatureID)
53
                        return ((NewShpFeatureID) obj).getIndex() == featIndex;
54
                return false;
55
        }        
56

    
57

    
58
}