Revision 20469

View differences:

trunk/libraries/libDataSource/src/org/gvsig/data/commands/implementation/InsertFeatureCommand.java
43 43
package org.gvsig.data.commands.implementation;
44 44

  
45 45
import org.gvsig.data.commands.ICommand;
46
import org.gvsig.data.vectorial.FeatureManager;
46 47
import org.gvsig.data.vectorial.IFeature;
47 48
import org.gvsig.data.vectorial.SpatialManager;
48
import org.gvsig.data.vectorial.expansionadapter.FeatureManager;
49 49

  
50 50

  
51 51
/**
trunk/libraries/libDataSource/src/org/gvsig/data/commands/implementation/DeleteAttributeCommand.java
1 1
package org.gvsig.data.commands.implementation;
2 2

  
3 3
import org.gvsig.data.commands.ICommand;
4
import org.gvsig.data.vectorial.AttributeManager;
4 5
import org.gvsig.data.vectorial.IFeatureAttributeDescriptor;
5
import org.gvsig.data.vectorial.expansionadapter.AttributeManager;
6 6

  
7 7
public class DeleteAttributeCommand extends AbstractAttributeCommand{
8 8

  
trunk/libraries/libDataSource/src/org/gvsig/data/commands/implementation/UpdateAttributeCommand.java
1 1
package org.gvsig.data.commands.implementation;
2 2

  
3 3
import org.gvsig.data.commands.ICommand;
4
import org.gvsig.data.vectorial.AttributeManager;
4 5
import org.gvsig.data.vectorial.IFeatureAttributeDescriptor;
5
import org.gvsig.data.vectorial.expansionadapter.AttributeManager;
6 6

  
7 7
public class UpdateAttributeCommand extends AbstractAttributeCommand{
8 8
	private IFeatureAttributeDescriptor oldAttributeDescriptor;
9 9

  
10
	public UpdateAttributeCommand(AttributeManager attributeManager, IFeatureAttributeDescriptor attributeDescriptor, IFeatureAttributeDescriptor oldAttributributeDescriptor) {
10
	public UpdateAttributeCommand(AttributeManager attributeManager, IFeatureAttributeDescriptor attributeDescriptor, IFeatureAttributeDescriptor oldAttributeDescriptor) {
11 11
		super(attributeManager,attributeDescriptor);
12 12
		this.oldAttributeDescriptor=oldAttributeDescriptor;
13 13
	}
14 14

  
15
	public UpdateAttributeCommand(AttributeManager attributeManager, IFeatureAttributeDescriptor attributeDescriptor,IFeatureAttributeDescriptor oldAttributributeDescriptor, String description) {
15
	public UpdateAttributeCommand(AttributeManager attributeManager, IFeatureAttributeDescriptor attributeDescriptor,IFeatureAttributeDescriptor oldAttributeDescriptor, String description) {
16 16
		super(attributeManager,attributeDescriptor, description);
17 17
		this.oldAttributeDescriptor=oldAttributeDescriptor;
18 18
	}
trunk/libraries/libDataSource/src/org/gvsig/data/commands/implementation/AbstractAttributeCommand.java
43 43
package org.gvsig.data.commands.implementation;
44 44

  
45 45
import org.gvsig.data.commands.AbstractCommand;
46
import org.gvsig.data.vectorial.AttributeManager;
46 47
import org.gvsig.data.vectorial.IFeatureAttributeDescriptor;
47
import org.gvsig.data.vectorial.expansionadapter.AttributeManager;
48 48

  
49 49

  
50 50
/**
trunk/libraries/libDataSource/src/org/gvsig/data/commands/implementation/InsertAttributeCommand.java
1 1
package org.gvsig.data.commands.implementation;
2 2

  
3 3
import org.gvsig.data.commands.ICommand;
4
import org.gvsig.data.vectorial.AttributeManager;
4 5
import org.gvsig.data.vectorial.IFeatureAttributeDescriptor;
5
import org.gvsig.data.vectorial.expansionadapter.AttributeManager;
6 6

  
7 7
public class InsertAttributeCommand extends AbstractAttributeCommand{
8 8

  
trunk/libraries/libDataSource/src/org/gvsig/data/commands/implementation/FeatureCommandsRecord.java
2 2

  
3 3
import org.gvsig.data.commands.AbstractCommandsRecord;
4 4
import org.gvsig.data.commands.ICommand;
5
import org.gvsig.data.vectorial.AttributeManager;
6
import org.gvsig.data.vectorial.FeatureManager;
5 7
import org.gvsig.data.vectorial.IFeature;
6 8
import org.gvsig.data.vectorial.IFeatureAttributeDescriptor;
7 9
import org.gvsig.data.vectorial.SpatialManager;
8
import org.gvsig.data.vectorial.expansionadapter.AttributeManager;
9
import org.gvsig.data.vectorial.expansionadapter.FeatureManager;
10 10

  
11 11
/**
12 12
 * Clase en memoria para registrar y gestionar los comandos que vamos
trunk/libraries/libDataSource/src/org/gvsig/data/commands/implementation/DeleteFeatureCommand.java
43 43
package org.gvsig.data.commands.implementation;
44 44

  
45 45
import org.gvsig.data.commands.ICommand;
46
import org.gvsig.data.vectorial.FeatureManager;
46 47
import org.gvsig.data.vectorial.IFeature;
47 48
import org.gvsig.data.vectorial.SpatialManager;
48
import org.gvsig.data.vectorial.expansionadapter.FeatureManager;
49 49

  
50 50

  
51 51
/**
trunk/libraries/libDataSource/src/org/gvsig/data/commands/implementation/UpdateFeatureCommand.java
86 86

  
87 87
import org.gvsig.data.commands.ICommand;
88 88
import org.gvsig.data.vectorial.Feature;
89
import org.gvsig.data.vectorial.FeatureManager;
89 90
import org.gvsig.data.vectorial.IFeature;
90 91
import org.gvsig.data.vectorial.SpatialManager;
91
import org.gvsig.data.vectorial.expansionadapter.FeatureManager;
92 92

  
93 93

  
94 94
/**
trunk/libraries/libDataSource/src/org/gvsig/data/commands/implementation/AbstractFeatureCommand.java
43 43
package org.gvsig.data.commands.implementation;
44 44

  
45 45
import org.gvsig.data.commands.AbstractCommand;
46
import org.gvsig.data.vectorial.FeatureManager;
46 47
import org.gvsig.data.vectorial.IFeature;
47 48
import org.gvsig.data.vectorial.SpatialManager;
48
import org.gvsig.data.vectorial.expansionadapter.FeatureManager;
49 49

  
50 50

  
51 51
/**
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/Feature.java
9 9
	protected Object defaultGeometry;
10 10
	protected Object object;
11 11
	private boolean editing = false;
12
//	private HashMap originalValues=new HashMap();
13 12
	private boolean loading = false;
14 13
	private IFeature oldFeature;
15 14

  
......
20 19
		while(iterator.hasNext()){
21 20
			IFeatureAttributeDescriptor featureAttribute=(IFeatureAttributeDescriptor)iterator.next();
22 21
			int i=featureAttribute.ordinal();
22
			if (featureType.getCount()>i){
23 23
			String attributeType=featureAttribute.getDataType();
24 24
			if (attributeType.equals(IFeatureAttributeDescriptor.TYPE_BYTE)){
25 25
				set(i,this.getByte(i));
......
43 43
			}else if (attributeType.equals(IFeatureAttributeDescriptor.TYPE_STRING)){
44 44
				set(i,getString(i));
45 45
			}
46
			i++;
46
			}else{
47
				//FeatureType modificado
48
//				IFeatureAttributeDescriptor fad=(IFeatureAttributeDescriptor)featureType.get(featureAttribute.getName());
49
//				Object obj=fad.getDefaultValue();
50
//				set(i,obj);
51
			}
47 52
		}
48 53
		this.stopLoading();
49 54
		return mfeature;
50 55
	}
51 56

  
52 57
	public Feature(IFeatureType featureType){
53
		super(featureType.size());
58
		super(featureType.getCount());
54 59
		this.featureType=featureType;
55
		for (int i = 0; i < featureType.size(); i++) {
60
		for (int i = 0; i < featureType.getCount()+1; i++) {
56 61
			add(null);
57 62
		}
58 63
	}
......
175 180
		return (Date)super.get(i);
176 181
	}
177 182
	public void set(String name, Object value) throws IsNotFeatureSettingException {
178
		if (!editing && !loading)
179
			throw new IsNotFeatureSettingException("setObject");
180 183
		int i=featureType.getFieldIndex(name);
184
		canSetValue(i);
181 185
		super.set(i,value);
182
//		put(name,value);
183 186
	}
184 187

  
185 188
	public void set(String name, int value) throws IsNotFeatureSettingException {
186
		if (!editing && !loading)
187
			throw new IsNotFeatureSettingException("setInt");
188 189
		int i=featureType.getFieldIndex(name);
189
//		if (editing)
190
//			oldFeature.set(name,value);
190
		canSetValue(i);
191 191
		super.set(i,new Integer(value));
192
//		put(name,new Integer(value));
193

  
194 192
	}
195 193

  
196 194
	public void set(String name, boolean value) throws IsNotFeatureSettingException {
197
		if (!editing && !loading)
198
			throw new IsNotFeatureSettingException("setBoolean");
199 195
		int i=featureType.getFieldIndex(name);
200
//		if (editing)
201
//			oldFeature.set(i,value);
196
		canSetValue(i);
202 197
		super.set(i,new Boolean(value));
203
//		put(name,new Boolean(value));
204 198
	}
205 199

  
206 200
	public void set(String name, long value) throws IsNotFeatureSettingException {
207
		if (!editing && !loading)
208
			throw new IsNotFeatureSettingException("setLong");
209 201
		int i=featureType.getFieldIndex(name);
210
//		if (editing)
211
//			oldFeature.set(i,value);
202
		canSetValue(i);
212 203
		super.set(i,new Long(value));
213
//		put(name,new Long(value));
214 204
	}
215 205

  
216 206
	public void set(String name, float value) throws IsNotFeatureSettingException {
217
		if (!editing && !loading)
218
			throw new IsNotFeatureSettingException("setFloat");
219 207
		int i=featureType.getFieldIndex(name);
220
//		if (editing)
221
//			oldFeature.set(i,value);
208
		canSetValue(i);
222 209
		super.set(i,new Float(value));
223
//		put(name,new Float(value));
224 210
	}
225 211

  
226 212
	public void set(String name, double value) throws IsNotFeatureSettingException {
227
		if (!editing && !loading)
228
			throw new IsNotFeatureSettingException("setDouble");
229 213
		int i=featureType.getFieldIndex(name);
230
//		if (editing)
231
//			oldFeature.set(i,value);
214
		canSetValue(i);
232 215
		super.set(i,new Double(value));
233
//		put(name,new Double(value));
234 216
	}
235 217

  
236 218
	public void setObject(int index, Object value) throws IsNotFeatureSettingException {
237
		if (!editing && !loading)
238
			throw new IsNotFeatureSettingException("setObject");
239
//		if (editing){
240
//			//TODO falta comprobar que tipo y guardarlo en el originalValues
241
//		}
219
		canSetValue(index);
242 220
		super.set(index,value);
243
//		String name=((IFeatureAttributeDescriptor)featureType.get(index)).getName();
244
//
245
//		put(name,value);
246 221
	}
247 222

  
248 223
	public void set(int index, int value) throws IsNotFeatureSettingException {
249
		if (!editing && !loading)
250
			throw new IsNotFeatureSettingException("setInt");
251
//		if (editing)
252
//			oldFeature.set(index,value);
224
		canSetValue(index);
253 225
		super.set(index,new Integer(value));
254
//		String name=((IFeatureAttributeDescriptor)featureType.get(index)).getName();
255
//		put(name,new Integer(value));
256 226
	}
257 227

  
258 228
	public void set(int index, boolean value) throws IsNotFeatureSettingException {
259
		if (!editing && !loading)
260
			throw new IsNotFeatureSettingException("setBoolean");
261
//		if (editing)
262
//			oldFeature.set(index,value);
229
		canSetValue(index);
263 230
		super.set(index,new Boolean(value));
264
//		String name=((IFeatureAttributeDescriptor)featureType.get(index)).getName();
265
//		put(name,new Boolean(value));
266 231
	}
267 232

  
268 233
	public void set(int index, long value) throws IsNotFeatureSettingException {
269
		if (!editing && !loading)
270
			throw new IsNotFeatureSettingException("setLong");
271
//		if (editing)
272
//			oldFeature.set(index,value);
234
		canSetValue(index);
273 235
		super.set(index,new Long(value));
274
//		String name=((IFeatureAttributeDescriptor)featureType.get(index)).getName();
275
//		put(name,new Long(value));
276 236
	}
277 237

  
278 238
	public void set(int index, float value) throws IsNotFeatureSettingException {
279
		if (!editing && !loading)
280
			throw new IsNotFeatureSettingException("setFloat");
281
//		if (editing)
282
//			oldFeature.set(index,value);
239
		canSetValue(index);
283 240
		super.set(index,new Float(value));
284
//		String name=((IFeatureAttributeDescriptor)featureType.get(index)).getName();
285
//		put(name,new Float(value));
286 241
	}
287 242

  
288 243
	public void set(int index, double value) throws IsNotFeatureSettingException {
289
		if (!editing && !loading)
290
			throw new IsNotFeatureSettingException("setDouble");
291
//		if (editing)
292
//			oldFeature.set(index,value);
244
		canSetValue(index);
293 245
		super.set(index,new Double(value));
294
//		String name=((IFeatureAttributeDescriptor)featureType.get(index)).getName();
295
//		put(name,new Double(value));
296 246
	}
297 247

  
298 248
	public void validateEnd(IFeatureStore featureStore) {
......
312 262
		return (IFeature)super.get(i);
313 263
	}
314 264
	public Object getGeometry(int index) {
315
//		String name=((IFeatureAttributeDescriptor)featureType.get(index)).getName();
316 265
		return super.get(index);
317 266
	}
318 267
	public Object getGeometry(String name) {
......
320 269
		return super.get(i);
321 270
	}
322 271
	public byte getByte(int index) {
323
//		String name=((IFeatureAttributeDescriptor)featureType.get(index)).getName();
324 272
		Byte value=(Byte)super.get(index);
325 273
		if (value==null)
326 274
			return 0;
......
334 282
		return value.byteValue();
335 283
	}
336 284
	public void set(int index, byte value) throws IsNotFeatureSettingException {
337
		if (!editing && !loading)
338
			throw new IsNotFeatureSettingException("setByte");
339
//		if (editing)
340
//			oldFeature.set(index,value);
285
		canSetValue(index);
341 286
		super.set(index,new Byte(value));
342
//		String name=((IFeatureAttributeDescriptor)featureType.get(index)).getName();
343
//		put(name,new Byte(value));
344 287
	}
345 288
	public void set(int index, String value) throws IsNotFeatureSettingException {
346
		if (!editing && !loading)
347
			throw new IsNotFeatureSettingException("setString");
348
//		if (editing)
349
//			oldFeature.set(index,value);
289
		canSetValue(index);
350 290
		super.set(index,value);
351
//		String name=((IFeatureAttributeDescriptor)featureType.get(index)).getName();
352
//		put(name,new Byte(value));
353 291
	}
354 292
	public void set(String name, byte value) throws IsNotFeatureSettingException {
355
		if (!editing && !loading)
356
			throw new IsNotFeatureSettingException("setByte");
357 293
		int i=featureType.getFieldIndex(name);
358
//		if (editing)
359
//			oldFeature.set(i,value);
294
		canSetValue(i);
360 295
		set(i,new Byte(value));
361 296
	}
362 297
	public void setGeometry(String name,Object geometry) throws IsNotFeatureSettingException {
363
		if (!editing && !loading)
364
			throw new IsNotFeatureSettingException("setGeometry");
365 298
		int i=featureType.getFieldIndex(name);
366
//		if (editing){
367
//			//TODO falta poder clonar la geometr?a
368
////			originalValues.put(new Integer(i),getGeometry(i).clone());
369
//		}
299
		canSetValue(i);
370 300
		set(i,geometry);
371 301
		if (featureType.getDefaultGeometry().equals(name)){
372 302
			defaultGeometry=geometry;
373 303
		}
374 304
	}
375 305
	public void setGeometry(int index,Object geometry) throws IsNotFeatureSettingException {
376
		if (!editing && !loading)
377
			throw new IsNotFeatureSettingException("setGeometry");
378
		if (editing){
379
			//TODO falta poder clonar la geometr?a
380
//			originalValues.put(new Integer(index),getGeometry(index).clone());
381
		}
306
		canSetValue(index);
382 307
		super.set(index,geometry);
383
//		String name=((IFeatureAttributeDescriptor)featureType.get(index)).getName();
384
//		put(name,geometry);
385 308
		Iterator iterator=featureType.iterator();
386 309
		while (iterator.hasNext()) {
387 310
			IFeatureAttributeDescriptor fad = (IFeatureAttributeDescriptor) iterator.next();
......
390 313
			}
391 314
		}
392 315
	}
316
	protected void canSetValue(int i) throws IsNotFeatureSettingException {
317
		if (!editing && !loading){
318
			throw new IsNotFeatureSettingException("set");
319
		}
320
		IFeatureAttributeDescriptor fad=(IFeatureAttributeDescriptor)featureType.getByOrder(i);
321
		if (fad.isReadOnly()){
322
			//TODO Construir la clase adecuada para esta excepci?n
323
			throw new IsNotFeatureSettingException(" Read only field: " +fad.getName());
324
		}
325
	}
393 326
	public void cancelEditing() {
394 327
		editing=false;
395 328
		oldFeature=null;
396
//		originalValues.clear();
397

  
398 329
	}
399 330
	public void editing() throws IsNotFeatureSettingException {
400 331
		editing=true;
401 332
		oldFeature=this.cloneFeature();
402
//		originalValues.addAll(this);
403 333
	}
404 334
	public IFeature getOldFeature() {
405 335
		return oldFeature;
......
411 341
		loading=false;
412 342
	}
413 343
	protected void stopEditing(){
414

  
344
		editing=false;
415 345
	}
416 346
	protected void refreshEvaluatedFields(IFeatureStore store){
417 347
		Iterator iter = this.featureType.iterator();
......
427 357
				}
428 358
			}
429 359
		}
430

  
431 360
	}
432 361

  
433 362
}
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/DefaultFeatureType.java
1 1
package org.gvsig.data.vectorial;
2 2

  
3
import java.lang.reflect.Array;
4 3
import java.text.DateFormat;
5 4
import java.util.ArrayList;
6 5
import java.util.Iterator;
......
133 132
		return super.add(arg0);
134 133
	}
135 134

  
135
	public boolean addWithoutOrdinal(Object arg0) {
136
		int max=((IFeatureAttributeDescriptor)arg0).ordinal();
137
		if (count<max){
138
			count=max;
139
		}
140
		return super.add(arg0);
141
	}
142

  
136 143
	public IFeatureType cloneFeatureType() {
137 144
		DefaultFeatureType newFType = (DefaultFeatureType) this.newFeatureType();
138 145
		if (this.allSRS != null){
......
153 160
		}
154 161
		Iterator iter = this.iterator();
155 162
		while (iter.hasNext()){
156
			newFType.add(((IFeatureAttributeDescriptor)iter.next()).cloneAttribute());
163
			newFType.addWithoutOrdinal(((IFeatureAttributeDescriptor)iter.next()).cloneAttribute());
157 164
		}
158 165
		newFType.count=this.count;
159 166
		return newFType;
......
167 174
	public Object get(String name){
168 175
		return this.get(this.getFieldIndex(name));
169 176
	}
177
	public int getCount() {
178
		return count;
179
	}
180
	public IFeatureAttributeDescriptor getByOrder(int i) {
181
		Iterator iterator=this.iterator();
182
		while (iterator.hasNext()) {
183
			IFeatureAttributeDescriptor fad = (IFeatureAttributeDescriptor) iterator.next();
184
			if (i==fad.ordinal()){
185
				return fad;
186
			}
187
		}
188
		return null;
189
	}
170 190
}
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/IFeatureType.java
36 36
		public int getFieldIndex(String name);
37 37

  
38 38
		public Object get(String name);
39
		public int getCount();
40
		public IFeatureAttributeDescriptor getByOrder(int i);
39 41

  
40 42
}
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/expansionadapter/FeatureManager.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
 *
4
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 *  Generalitat Valenciana
23
 *   Conselleria d'Infraestructures i Transport
24
 *   Av. Blasco Ib??ez, 50
25
 *   46010 VALENCIA
26
 *   SPAIN
27
 *
28
 *      +34 963862235
29
 *   gvsig@gva.es
30
 *      www.gvsig.gva.es
31
 *
32
 *    or
33
 *
34
 *   IVER T.I. S.A
35
 *   Salamanca 50
36
 *   46005 Valencia
37
 *   Spain
38
 *
39
 *   +34 963163400
40
 *   dac@iver.es
41
 */
42

  
43
package org.gvsig.data.vectorial.expansionadapter;
44

  
45
import java.util.ArrayList;
46
import java.util.HashMap;
47

  
48
import org.gvsig.data.vectorial.IFeature;
49
import org.gvsig.data.vectorial.IFeatureID;
50

  
51

  
52
/**
53
 * DOCUMENT ME!
54
 *
55
 * @author Vicente Caballero Navarro
56
 */
57
public class FeatureManager {
58
    protected HashMap relations = new HashMap();//<IFeatureID,Integer>
59
    protected IExpansionAdapter expansionAdapter;
60
    protected ArrayList deletedFeatures = new ArrayList();//<IFeatureID>
61
    protected int num=0;
62
    public FeatureManager(IExpansionAdapter expansionAdapter){
63
    	this.expansionAdapter=expansionAdapter;
64
    }
65

  
66
    public void deleteFeature(IFeatureID id) {
67
        deletedFeatures.add(id);
68
        num--;
69
    }
70

  
71
    /**
72
     * DOCUMENT ME!
73
     *
74
     * @param feature DOCUMENT ME!
75
     */
76
    public void addFeature(IFeature feature) {
77
        int pos = expansionAdapter.addObject(feature);
78
        relations.put(feature.getID(), new Integer(pos));
79
        num++;
80
    }
81

  
82
    /**
83
     * DOCUMENT ME!
84
     *
85
     * @param id DOCUMENT ME!
86
     */
87
    public void deleteLastFeature(IFeatureID id) {
88
        expansionAdapter.deleteLastObject();
89
        relations.remove(id);
90
        num--;
91
    }
92

  
93
    /**
94
     * DOCUMENT ME!
95
     *
96
     * @param id DOCUMENT ME!
97
     *
98
     * @return DOCUMENT ME!
99
     */
100
    public boolean contains(IFeatureID id) {
101
        return relations.containsKey(id);
102
    }
103

  
104
    /**
105
     * DOCUMENT ME!
106
     *
107
     * @param id DOCUMENT ME!
108
     *
109
     * @return DOCUMENT ME!
110
     */
111
    public IFeature getFeature(IFeatureID id) {
112
        int num = ((Integer) relations.get(id)).intValue();
113

  
114
        return (IFeature)expansionAdapter.getObject(num);
115
    }
116

  
117
    /**
118
     * DOCUMENT ME!
119
     *
120
     * @param feature DOCUMENT ME!
121
     * @param oldFeature DOCUMENT ME!
122
     */
123
    public void updateFeature(IFeature feature, IFeature oldFeature) {
124
        deletedFeatures.add(oldFeature.getID());
125

  
126
        int num = expansionAdapter.updateObject(feature);
127

  
128
        /*
129
         * Actualiza la relaci?n del ?ndice de la geometr?a al ?ndice en el
130
         * fichero de expansi?n.
131
         */
132
        relations.put(feature.getID(), new Integer(num));
133
    }
134

  
135
    /**
136
     * DOCUMENT ME!
137
     *
138
     * @param id DOCUMENT ME!
139
     */
140
    public void restoreFeature(IFeatureID id) {
141
        deletedFeatures.remove(id);
142
        num++;
143
    }
144
    public int getNum(){
145
    	return num;
146
    }
147

  
148
    public IFeature getFeature(int i){
149
    	return (IFeature)expansionAdapter.getObject(i);
150
    }
151
    public boolean isDeleted(IFeature feature){
152
    	return deletedFeatures.contains(feature.getID());
153
    }
154

  
155
	public void clear() {
156
		relations.clear();//<IFeatureID,Integer>
157
	    expansionAdapter.close();
158
	    deletedFeatures.clear();//<IFeatureID>
159
	    num=0;
160
	}
161

  
162

  
163
//	public IFeatureCollection getDataCollection(IDataCollection originalCollection, IFeatureType type, String filter, String order) {
164
//		MemoryFeatureCollection memoryCollection=new MemoryFeatureCollection();
165
////		TODO Filtrar y ordenar, quedar? tambi?n pendiente el IFeatureType que se pasa como
166
//		//par?metro ya que aqu? lo ?nico que introducimos al DataCollection son IFeatureID,
167
//		//todav?a no creamos IFeatures
168
//		for (int i=0;i<relations.size();i++){
169
//			IFeature feature=(IFeature)expansionAdapter.getObject(i);
170
//			if (!deletedFeatures.contains(feature.getID())){
171
//				memoryCollection.add(feature);
172
//			}
173
//		}
174
//		Iterator iter=originalCollection.iterator();
175
//		int i=0;
176
//		featureStore.open();
177
//		while (iter.hasNext()) {
178
//			IFeature feature = (IFeature) iter.next();
179
//			if (!deletedFeatures.contains(feature.getID())){
180
//				memoryCollection.add(feature);
181
//			}
182
//			i++;
183
//		}
184
//
185
//		//TODO en el filtro de las features originales hay que a?adir, que no muestre las que est?n el el HashMap deletedFeatures
186
////		IFeatureCollection featureCollection=(IFeatureCollection)featureStore.getDataCollection(type,filter,order);
187
//
188
//
189
//		EditingFeatureCollection collection=new EditingFeatureCollection(originalCollection, memoryCollection,type);
190
////		collection.
191
////		MemoryFeatureCollection collection=new MemoryFeatureCollection();
192
//		//TODO Filtrar y ordenar, quedar? tambi?n pendiente el IFeatureType que se pasa como
193
//		//par?metro ya que aqu? lo ?nico que introducimos al DataCollection son IFeatureID,
194
//		//todav?a no creamos IFeatures
195
////		featureStore.createDefaultFeature()
196
////		for (int i=0;i<driver.getFeatureCount();i++){
197
////			MemoryFeatureID id=new MemoryFeatureID(driver.getFeatureByPosition(type,i));
198
////			collection.add(id);
199
////		}
200
//		return collection;
201
//
202
//	}
203

  
204
}
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/expansionadapter/AttributeManager.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
 *
4
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 *  Generalitat Valenciana
23
 *   Conselleria d'Infraestructures i Transport
24
 *   Av. Blasco Ib??ez, 50
25
 *   46010 VALENCIA
26
 *   SPAIN
27
 *
28
 *      +34 963862235
29
 *   gvsig@gva.es
30
 *      www.gvsig.gva.es
31
 *
32
 *    or
33
 *
34
 *   IVER T.I. S.A
35
 *   Salamanca 50
36
 *   46005 Valencia
37
 *   Spain
38
 *
39
 *   +34 963163400
40
 *   dac@iver.es
41
 */
42

  
43
package org.gvsig.data.vectorial.expansionadapter;
44

  
45
import java.util.ArrayList;
46
import java.util.HashMap;
47
import java.util.Iterator;
48

  
49
import org.gvsig.data.vectorial.IFeatureAttributeDescriptor;
50
import org.gvsig.data.vectorial.IFeatureType;
51

  
52

  
53
/**
54
 * DOCUMENT ME!
55
 *
56
 * @author Vicente Caballero Navarro
57
 */
58
public class AttributeManager {
59
    protected HashMap relations = new HashMap();//<String,Integer>
60
    protected IExpansionAdapter expansionAdapter;
61
    protected ArrayList deletedAttributes = new ArrayList();//<String>
62
    protected int num=0;
63

  
64
    public AttributeManager(IExpansionAdapter expansionAdapter){
65
    	this.expansionAdapter=expansionAdapter;
66
    }
67

  
68
    public void deleteAttribute(Integer id) {
69
        deletedAttributes.add(id);
70
        num--;
71
    }
72

  
73
    /**
74
     * DOCUMENT ME!
75
     *
76
     * @param feature DOCUMENT ME!
77
     */
78
    public void addAttribute(IFeatureAttributeDescriptor attributeDescriptor) {
79
        int pos = expansionAdapter.addObject(attributeDescriptor);
80
        relations.put(new Integer(attributeDescriptor.ordinal()), new Integer(pos));
81
        num++;
82
    }
83

  
84
    /**
85
     * DOCUMENT ME!
86
     *
87
     * @param id DOCUMENT ME!
88
     */
89
    public void deleteLastAttribute(Integer id) {
90
        expansionAdapter.deleteLastObject();
91
        relations.remove(id);
92
        num--;
93
    }
94

  
95
    /**
96
     * DOCUMENT ME!
97
     *
98
     * @param id DOCUMENT ME!
99
     *
100
     * @return DOCUMENT ME!
101
     */
102
    public boolean contains(Integer id) {
103
        return relations.containsKey(id);
104
    }
105

  
106
    /**
107
     * DOCUMENT ME!
108
     *
109
     * @param id DOCUMENT ME!
110
     *
111
     * @return DOCUMENT ME!
112
     */
113
    public IFeatureAttributeDescriptor getAttribute(Integer id) {
114
        int num = ((Integer) relations.get(id)).intValue();
115

  
116
        return (IFeatureAttributeDescriptor)expansionAdapter.getObject(num);
117
    }
118

  
119
    /**
120
     * DOCUMENT ME!
121
     *
122
     * @param feature DOCUMENT ME!
123
     * @param oldFeature DOCUMENT ME!
124
     */
125
    public void updateAttribute(IFeatureAttributeDescriptor attributeDescriptor) {
126
        deletedAttributes.add(new Integer(attributeDescriptor.ordinal()));
127

  
128
        int num = expansionAdapter.updateObject(attributeDescriptor);
129

  
130
        /*
131
         * Actualiza la relaci?n del ?ndice de la geometr?a al ?ndice en el
132
         * fichero de expansi?n.
133
         */
134
        relations.put(new Integer(attributeDescriptor.ordinal()), new Integer(num));
135
    }
136

  
137
    /**
138
     * DOCUMENT ME!
139
     *
140
     * @param id DOCUMENT ME!
141
     */
142
    public void restoreAttribute(Integer id) {
143
        deletedAttributes.remove(id);
144
        num++;
145
    }
146
    public int getNum(){
147
    	return num;
148
    }
149
	public IFeatureType getFeatureType(IFeatureType featureType) {
150
		IFeatureType ft=featureType.cloneFeatureType();
151
		ft.clear();
152
		Iterator iter=featureType.iterator();
153
		while (iter.hasNext()) {
154
			IFeatureAttributeDescriptor descriptor= (IFeatureAttributeDescriptor) iter.next();
155
			if (!deletedAttributes.contains(descriptor)){
156
				ft.add(descriptor);
157
			}
158
		}
159
		for (int i=0;i<relations.size();i++){
160
			IFeatureAttributeDescriptor descriptor=(IFeatureAttributeDescriptor)expansionAdapter.getObject(i);
161
			if (!deletedAttributes.contains(descriptor)){
162
				ft.add(descriptor);
163
			}
164
		}
165
		return ft;
166
	}
167

  
168
	public void clear() {
169
		relations.clear();//<String,Integer>
170
	    expansionAdapter.close();
171
	    deletedAttributes.clear();//<String>
172
	    num=0;
173
	}
174
}
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/FeatureManager.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
 *
4
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 *  Generalitat Valenciana
23
 *   Conselleria d'Infraestructures i Transport
24
 *   Av. Blasco Ib??ez, 50
25
 *   46010 VALENCIA
26
 *   SPAIN
27
 *
28
 *      +34 963862235
29
 *   gvsig@gva.es
30
 *      www.gvsig.gva.es
31
 *
32
 *    or
33
 *
34
 *   IVER T.I. S.A
35
 *   Salamanca 50
36
 *   46005 Valencia
37
 *   Spain
38
 *
39
 *   +34 963163400
40
 *   dac@iver.es
41
 */
42

  
43
package org.gvsig.data.vectorial;
44

  
45
import java.util.ArrayList;
46
import java.util.HashMap;
47
import java.util.Iterator;
48

  
49
import org.gvsig.data.vectorial.expansionadapter.IExpansionAdapter;
50

  
51

  
52
/**
53
 * DOCUMENT ME!
54
 *
55
 * @author Vicente Caballero Navarro
56
 */
57
public class FeatureManager {
58
    protected HashMap relations = new HashMap();//<IFeatureID,Integer>
59
    protected IExpansionAdapter expansionAdapter;
60
    protected ArrayList deletedFeatures = new ArrayList();//<IFeatureID>
61
    protected int num=0;
62
    public FeatureManager(IExpansionAdapter expansionAdapter){
63
    	this.expansionAdapter=expansionAdapter;
64
    }
65

  
66
    public void deleteFeature(IFeatureID id) {
67
        deletedFeatures.add(id);
68
        num--;
69
    }
70

  
71
    /**
72
     * DOCUMENT ME!
73
     *
74
     * @param feature DOCUMENT ME!
75
     */
76
    public void addFeature(IFeature feature) {
77
        int pos = expansionAdapter.addObject(feature);
78
        relations.put(feature.getID(), new Integer(pos));
79
        num++;
80
    }
81

  
82
    /**
83
     * DOCUMENT ME!
84
     *
85
     * @param id DOCUMENT ME!
86
     */
87
    public void deleteLastFeature(IFeatureID id) {
88
        expansionAdapter.deleteLastObject();
89
        relations.remove(id);
90
        num--;
91
    }
92

  
93
    /**
94
     * DOCUMENT ME!
95
     *
96
     * @param id DOCUMENT ME!
97
     *
98
     * @return DOCUMENT ME!
99
     */
100
    public boolean contains(IFeatureID id) {
101
        return relations.containsKey(id);
102
    }
103

  
104
    /**
105
     * DOCUMENT ME!
106
     *
107
     * @param id DOCUMENT ME!
108
     *
109
     * @return DOCUMENT ME!
110
     * @throws IsNotFeatureSettingException
111
     */
112
    public IFeature getFeature(IFeatureID id,IFeatureStore store) throws IsNotFeatureSettingException {
113
        int num = ((Integer) relations.get(id)).intValue();
114

  
115
        IFeature feature=(IFeature)expansionAdapter.getObject(num);
116
       	return getCorrectFeature(feature, store);
117
    }
118

  
119
    private IFeature getCorrectFeature(IFeature feature,IFeatureStore store) throws IsNotFeatureSettingException {
120
    	 Iterator iterator=store.getDefaultFeatureType().iterator();
121
         IFeature newFeature=store.createFeature(store.getDefaultFeatureType());
122
         ((Feature)newFeature).loading();
123
         while (iterator.hasNext()) {
124
 			IFeatureAttributeDescriptor fad = (IFeatureAttributeDescriptor) iterator.next();
125
 			int i=fad.ordinal();
126
 			if (i<feature.size()){
127
 				newFeature.set(i,feature.get(i));
128
 			}else{
129
 				newFeature.set(i,fad.getDefaultValue());
130
 			}
131
 		}
132
         ((Feature)newFeature).stopLoading();
133
         return newFeature;
134
	}
135

  
136
	/**
137
     * DOCUMENT ME!
138
     *
139
     * @param feature DOCUMENT ME!
140
     * @param oldFeature DOCUMENT ME!
141
     */
142
    public void updateFeature(IFeature feature, IFeature oldFeature) {
143
        deletedFeatures.add(oldFeature.getID());
144

  
145
        int num = expansionAdapter.updateObject(feature);
146

  
147
        /*
148
         * Actualiza la relaci?n del ?ndice de la geometr?a al ?ndice en el
149
         * fichero de expansi?n.
150
         */
151
        relations.put(feature.getID(), new Integer(num));
152
    }
153

  
154
    /**
155
     * DOCUMENT ME!
156
     *
157
     * @param id DOCUMENT ME!
158
     */
159
    public void restoreFeature(IFeatureID id) {
160
        deletedFeatures.remove(id);
161
        num++;
162
    }
163
    public int getNum(){
164
    	return num;
165
    }
166

  
167
    public IFeature getFeature(int i,IFeatureStore store) throws IsNotFeatureSettingException{
168
    	IFeature feature=(IFeature)expansionAdapter.getObject(i);
169
    	return getCorrectFeature(feature,store);
170
    }
171
    public boolean isDeleted(IFeature feature){
172
    	return deletedFeatures.contains(feature.getID());
173
    }
174

  
175
	public void clear() {
176
		relations.clear();//<IFeatureID,Integer>
177
	    expansionAdapter.close();
178
	    deletedFeatures.clear();//<IFeatureID>
179
	    num=0;
180
	}
181

  
182

  
183
//	public IFeatureCollection getDataCollection(IDataCollection originalCollection, IFeatureType type, String filter, String order) {
184
//		MemoryFeatureCollection memoryCollection=new MemoryFeatureCollection();
185
////		TODO Filtrar y ordenar, quedar? tambi?n pendiente el IFeatureType que se pasa como
186
//		//par?metro ya que aqu? lo ?nico que introducimos al DataCollection son IFeatureID,
187
//		//todav?a no creamos IFeatures
188
//		for (int i=0;i<relations.size();i++){
189
//			IFeature feature=(IFeature)expansionAdapter.getObject(i);
190
//			if (!deletedFeatures.contains(feature.getID())){
191
//				memoryCollection.add(feature);
192
//			}
193
//		}
194
//		Iterator iter=originalCollection.iterator();
195
//		int i=0;
196
//		featureStore.open();
197
//		while (iter.hasNext()) {
198
//			IFeature feature = (IFeature) iter.next();
199
//			if (!deletedFeatures.contains(feature.getID())){
200
//				memoryCollection.add(feature);
201
//			}
202
//			i++;
203
//		}
204
//
205
//		//TODO en el filtro de las features originales hay que a?adir, que no muestre las que est?n el el HashMap deletedFeatures
206
////		IFeatureCollection featureCollection=(IFeatureCollection)featureStore.getDataCollection(type,filter,order);
207
//
208
//
209
//		EditingFeatureCollection collection=new EditingFeatureCollection(originalCollection, memoryCollection,type);
210
////		collection.
211
////		MemoryFeatureCollection collection=new MemoryFeatureCollection();
212
//		//TODO Filtrar y ordenar, quedar? tambi?n pendiente el IFeatureType que se pasa como
213
//		//par?metro ya que aqu? lo ?nico que introducimos al DataCollection son IFeatureID,
214
//		//todav?a no creamos IFeatures
215
////		featureStore.createDefaultFeature()
216
////		for (int i=0;i<driver.getFeatureCount();i++){
217
////			MemoryFeatureID id=new MemoryFeatureID(driver.getFeatureByPosition(type,i));
218
////			collection.add(id);
219
////		}
220
//		return collection;
221
//
222
//	}
223

  
224
}
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/AbstractFeatureStore.java
15 15
import org.gvsig.data.exception.OpenException;
16 16
import org.gvsig.data.exception.ReadException;
17 17
import org.gvsig.data.exception.WriteException;
18
import org.gvsig.data.vectorial.expansionadapter.AttributeManager;
19
import org.gvsig.data.vectorial.expansionadapter.FeatureManager;
20 18
import org.gvsig.data.vectorial.expansionadapter.IExpansionAdapter;
21 19
import org.gvsig.data.vectorial.expansionadapter.MemoryExpansionAdapter;
22 20

  
......
46 44

  
47 45
	protected void initAttributeManager() {
48 46
		IExpansionAdapter expansionAttributeAdapter=new MemoryExpansionAdapter();
49
		attributeManager=new AttributeManager(expansionAttributeAdapter);
47
		attributeManager=new AttributeManager(expansionAttributeAdapter,getDefaultFeatureType());
50 48

  
51 49
	}
52 50

  
......
187 185
				new AttributeStoreNotification(this,AttributeStoreNotification.BEFORE_UPDATE_ATTRIBUTE,attributeDescriptor)
188 186
			);
189 187
		commands.update(attributeDescriptor,((DefaultAttributeDescriptor)attributeDescriptor).getOldAttributeDescriptor());
190
		((Feature)attributeDescriptor).stopEditing();
188
		((DefaultAttributeDescriptor)attributeDescriptor).stopEditing();
191 189
		this.observable.notifyObservers(
192 190
				new AttributeStoreNotification(this,AttributeStoreNotification.AFTER_UPDATE_ATTRIBUTE,attributeDescriptor)
193 191
			);
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/AttributeManager.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
 *
4
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 *  Generalitat Valenciana
23
 *   Conselleria d'Infraestructures i Transport
24
 *   Av. Blasco Ib??ez, 50
25
 *   46010 VALENCIA
26
 *   SPAIN
27
 *
28
 *      +34 963862235
29
 *   gvsig@gva.es
30
 *      www.gvsig.gva.es
31
 *
32
 *    or
33
 *
34
 *   IVER T.I. S.A
35
 *   Salamanca 50
36
 *   46005 Valencia
37
 *   Spain
38
 *
39
 *   +34 963163400
40
 *   dac@iver.es
41
 */
42

  
43
package org.gvsig.data.vectorial;
44

  
45
import java.util.ArrayList;
46
import java.util.HashMap;
47
import java.util.Iterator;
48

  
49
import org.gvsig.data.vectorial.expansionadapter.IExpansionAdapter;
50

  
51

  
52
/**
53
 * DOCUMENT ME!
54
 *
55
 * @author Vicente Caballero Navarro
56
 */
57
public class AttributeManager {
58
    protected HashMap relations = new HashMap();//<String,Integer>
59
    protected IExpansionAdapter expansionAdapter;
60
    protected ArrayList deletedAttributes = new ArrayList();//<String>
61
    protected int size=0;
62
    protected int count=-1;
63
	private IFeatureType featureType;
64

  
65
    public AttributeManager(IExpansionAdapter expansionAdapter,IFeatureType featureType){
66
    	this.expansionAdapter=expansionAdapter;
67
    	this.featureType=featureType;
68
    }
69

  
70
    public void deleteAttribute(Integer id) {
71
        deletedAttributes.add(id);
72
        size--;
73
    }
74

  
75
    /**
76
     * DOCUMENT ME!
77
     *
78
     * @param feature DOCUMENT ME!
79
     */
80
    public void addAttribute(IFeatureAttributeDescriptor attributeDescriptor) {
81
        count++;
82
        ((DefaultAttributeDescriptor)attributeDescriptor).setOrdinal(count+featureType.size());
83
    	int pos = expansionAdapter.addObject(attributeDescriptor);
84
        relations.put(new Integer(attributeDescriptor.ordinal()), new Integer(pos));
85
        size++;
86
    }
87

  
88
    /**
89
     * DOCUMENT ME!
90
     *
91
     * @param id DOCUMENT ME!
92
     */
93
    public void deleteLastAttribute(Integer id) {
94
        expansionAdapter.deleteLastObject();
95
        relations.remove(id);
96
        size--;
97
    }
98

  
99
    /**
100
     * DOCUMENT ME!
101
     *
102
     * @param id DOCUMENT ME!
103
     *
104
     * @return DOCUMENT ME!
105
     */
106
    public boolean contains(Integer id) {
107
        return relations.containsKey(id);
108
    }
109

  
110
    /**
111
     * DOCUMENT ME!
112
     *
113
     * @param id DOCUMENT ME!
114
     *
115
     * @return DOCUMENT ME!
116
     */
117
    public IFeatureAttributeDescriptor getAttribute(Integer id) {
118
        int num = ((Integer) relations.get(id)).intValue();
119

  
120
        return (IFeatureAttributeDescriptor)expansionAdapter.getObject(num);
121
    }
122

  
123
    /**
124
     * DOCUMENT ME!
125
     *
126
     * @param feature DOCUMENT ME!
127
     * @param oldFeature DOCUMENT ME!
128
     */
129
    public void updateAttribute(IFeatureAttributeDescriptor attributeDescriptor) {
130
        deletedAttributes.add(new Integer(attributeDescriptor.ordinal()));
131

  
132
        int num = expansionAdapter.updateObject(attributeDescriptor);
133

  
134
        /*
135
         * Actualiza la relaci?n del ?ndice de la geometr?a al ?ndice en el
136
         * fichero de expansi?n.
137
         */
138
        relations.put(new Integer(attributeDescriptor.ordinal()), new Integer(num));
139
    }
140

  
141
    /**
142
     * DOCUMENT ME!
143
     *
144
     * @param id DOCUMENT ME!
145
     */
146
    public void restoreAttribute(Integer id) {
147
        deletedAttributes.remove(id);
148
        size++;
149
    }
150
    public int getNum(){
151
    	return size;
152
    }
153
	public IFeatureType getFeatureType() {
154
		DefaultFeatureType dft=(DefaultFeatureType)featureType.cloneFeatureType();
155
		dft.clear();
156
		Iterator iter=featureType.iterator();
157
		while (iter.hasNext()) {
158
			IFeatureAttributeDescriptor descriptor= (IFeatureAttributeDescriptor) iter.next();
159
			if (!deletedAttributes.contains(new Integer(descriptor.ordinal()))){
160
				dft.addWithoutOrdinal(descriptor);
161
			}
162
		}
163
		for (int i=0;i<relations.size();i++){
164
			IFeatureAttributeDescriptor descriptor=(IFeatureAttributeDescriptor)expansionAdapter.getObject(i);
165
			if (!deletedAttributes.contains(new Integer(descriptor.ordinal()))){
166
				dft.addWithoutOrdinal(descriptor);
167
			}
168
		}
169
		return dft;
170
	}
171

  
172
	public void clear() {
173
		relations.clear();//<String,Integer>
174
	    expansionAdapter.close();
175
	    deletedAttributes.clear();//<String>
176
	    size=0;
177
	}
178
}
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/DefaultAttributeDescriptor.java
300 300
	public void setEvalued(){
301 301
		this.evaluated = true;
302 302
	}
303
	protected void stopEditing() {
304
		editing=false;
305

  
306
	}
303 307
}
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/MemoryFeature.java
37 37
		super(type);
38 38
		if (defaultValues){
39 39
			Iterator iterator=type.iterator();
40
			int i=0;
41 40
			this.loading();
42 41
			while(iterator.hasNext()){
43 42
				IFeatureAttributeDescriptor featureAttribute=(IFeatureAttributeDescriptor)iterator.next();
43
				int i=featureAttribute.ordinal();
44 44
				String attributeType=featureAttribute.getDataType();
45 45

  
46 46
				Object defaultValue=featureAttribute.getDefaultValue();
......
72 72
				}else if (attributeType.equals(IFeatureAttributeDescriptor.TYPE_STRING)){
73 73
					set(i,defaultValue);
74 74
				}
75
				i++;
76 75
			}
77 76
			this.stopLoading();
78 77
		}

Also available in: Unified diff