Revision 23534

View differences:

branches/v2_0_0_prep/libraries/libFMap_dataFile/src/org/gvsig/fmap/data/feature/file/dxf/DXFStore.java
6 6
import java.util.Collection;
7 7
import java.util.Comparator;
8 8
import java.util.Iterator;
9
import java.util.List;
10 9
import java.util.TreeSet;
11 10

  
12 11
import org.gvsig.fmap.data.CloseException;
......
42 41

  
43 42
public class DXFStore extends FileStore {
44 43
	public static String DATASTORE_NAME = "DXFStore";
45
	private List featureTypes = new ArrayList();
46 44
	protected IMetadata metadata;
47 45

  
48 46

  
......
69 67

  
70 68
		try {
71 69
			this.defaultFeatureType = this.dxf.getFeatureType();
70
			this.featureTypes = new ArrayList();
71
			this.featureTypes.add(defaultFeatureType);
72

  
72 73
		} catch (ReadException e) {
73 74
			throw new InitializeException(this.getName(),e);
74 75
		}
......
256 257
		return id.getFeature(featureType);
257 258
	}
258 259

  
259
	public List getFeatureTypes() {
260
		featureTypes.clear();
261
		featureTypes.add(getDefaultFeatureType());
262
		return featureTypes;
263
	}
264

  
265 260
	public boolean isWithDefaultLegend() {
266 261
		return false;
267 262
	}
branches/v2_0_0_prep/libraries/libFMap_dataFile/src/org/gvsig/fmap/data/feature/file/dgn/DGNStore.java
6 6
import java.util.Collection;
7 7
import java.util.Comparator;
8 8
import java.util.Iterator;
9
import java.util.List;
10 9
import java.util.TreeSet;
11 10

  
12 11
import org.gvsig.fmap.data.CloseException;
......
42 41
public class DGNStore extends FileStore{
43 42
	public static String DATASTORE_NAME = "DGNStore";
44 43

  
45
	private List featureTypes = new ArrayList();//<FeatureType>
46 44
	protected IMetadata metadata;
47 45
	private DGNStoreParameters dgnParameters=null;
48 46

  
......
52 50

  
53 51
		dgnParameters=(DGNStoreParameters)parameters;
54 52
		try {
55
		DGNResource tmpResource = new DGNResource(dgnParameters);
56
		ResourceManager resMan = ResourceManager.getResourceManager();
53
			DGNResource tmpResource = new DGNResource(dgnParameters);
54
			ResourceManager resMan = ResourceManager.getResourceManager();
57 55

  
58
		try {
59
			this.dgn = (DGNResource) resMan.addResource(tmpResource, this);
60
		} catch (DataException e1) {
61
			throw new InitializeException(this.getName(),e1);
62
		}
56
			try {
57
				this.dgn = (DGNResource) resMan.addResource(tmpResource, this);
58
			} catch (DataException e1) {
59
				throw new InitializeException(this.getName(), e1);
60
			}
63 61

  
64
		super.init(parameters,this.dgn);
62
			super.init(parameters, this.dgn);
65 63

  
66 64

  
67 65
			this.defaultFeatureType = this.dgn.getFeatureType();
66
			this.featureTypes = new ArrayList();
67
			this.featureTypes.add(defaultFeatureType);
68

  
68 69
		} catch (ReadException e) {
69 70
			throw new InitializeException(this.getName(),e);
70 71
		} catch (DataException e) {
......
242 243
		return id.getFeature(featureType);
243 244
	}
244 245

  
245
	public List getFeatureTypes() {
246
		featureTypes.clear();
247
		featureTypes.add(getDefaultFeatureType());
248
		return featureTypes;
249
	}
250

  
251 246
	public Object getDefaultLegend() throws ReadException {
252 247
		return this.dgn.getDefaultLegend();
253 248
	}
branches/v2_0_0_prep/libraries/libFMap_dataFile/src/org/gvsig/fmap/data/feature/file/dbf/DBFStore.java
5 5
import java.util.ArrayList;
6 6
import java.util.Collection;
7 7
import java.util.Iterator;
8
import java.util.List;
9 8

  
10 9
import org.gvsig.fmap.data.CloseException;
11 10
import org.gvsig.fmap.data.DataCollection;
......
39 38
public class DBFStore extends FileStore {
40 39
	public static String DATASTORE_NAME = "DBFStore";
41 40
	private DBFResource dbf= null;
42
	protected List featureTypes = new ArrayList();//<FeatureType>
43 41
	protected IMetadata metadata;
44 42
	private DBFStoreParameters dbfParameters=null;
45 43

  
......
64 62
	 }
65 63

  
66 64
	 private void initFeatureType() throws InitializeException{
67
	    	int fieldCount = -1;
68
	    	try{
69
	    		fieldCount =dbf.getFieldCount();
70
	    	} catch (DataException e) {
71
	    		throw new InitializeException(this.getName(),e);
65
		 int fieldCount = -1;
66
		 try {
67
			 fieldCount = dbf.getFieldCount();
68
		} catch (DataException e) {
69
			throw new InitializeException(this.getName(), e);
70
		}
71

  
72
		 defaultFeatureType = new DefaultFeatureType();
73
		 for (int i = 0; i < fieldCount; i++) {
74
			 FeatureAttributeDescriptor fad;
75
			try {
76
				fad = createFeatureAttribute(
77
						(DefaultFeatureType) defaultFeatureType, i);
78
			} catch (IsNotAttributeSettingException e) {
79
				throw new InitializeException(this.getName(), e);
80
			} catch (ReadException e) {
81
				// TODO Auto-generated catch block
82
				throw new InitializeException(this.getName(), e);
72 83
			}
84
			defaultFeatureType.add(fad);
85
		}
73 86

  
74
	    	defaultFeatureType=new DefaultFeatureType();
75
			    for (int i = 0; i < fieldCount; i++) {
76
			    	FeatureAttributeDescriptor fad;
77
					try {
78
						fad = createFeatureAttribute((DefaultFeatureType)defaultFeatureType, i);
79
					} catch (IsNotAttributeSettingException e) {
80
						throw new InitializeException(this.getName(),e);
81
					} catch (ReadException e) {
82
						// TODO Auto-generated catch block
83
						throw new InitializeException(this.getName(),e);
84
					}
85
	                defaultFeatureType.add(fad);
86
	            }
87
		 this.featureTypes = new ArrayList();
88
		 this.featureTypes.add(defaultFeatureType);
87 89

  
88 90
	 }
89 91

  
......
207 209
		return this.getFeatureByIndex(index, this.getDefaultFeatureType());
208 210
	}
209 211

  
210
	public List getFeatureTypes() {
211
		featureTypes.add(0,getDefaultFeatureType());
212
        return featureTypes;
213
	}
214

  
215 212
	public boolean canAlterFeatureType() {
216 213
		return true;
217 214
	}

Also available in: Unified diff