Revision 41228

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.shp/src/main/java/org/gvsig/fmap/dal/store/shp/SHPStoreProvider.java
214 214
					fType.remove(attrTmp.getName());
215 215
				} else {
216 216
					attr = attrTmp;
217
					attr.setName(GEOMETRY_ATTIBUTE_NAME);
217
					// attr.setName(GEOMETRY_ATTIBUTE_NAME);
218 218
				}
219 219
			}
220 220
		}
221 221

  
222 222

  
223 223
		if (attr == null){
224
			attr = fType.add(
225
					GEOMETRY_ATTIBUTE_NAME, DataTypes.GEOMETRY);
224
		    
225
		    String geofield = createGeometryFieldName(fType);
226
			attr = fType.add(geofield, DataTypes.GEOMETRY);
226 227
			try {
227 228
				attr.setDefaultValue(geomManager
228 229
						.createNullGeometry(SUBTYPES.GEOM2D));
......
237 238

  
238 239
	}
239 240

  
240
	protected static FeatureType removeGeometryColumn(
241
	private static String createGeometryFieldName(FeatureType ft) {
242
	    
243
	    if (ft.getAttributeDescriptor(GEOMETRY_ATTIBUTE_NAME) == null) {
244
	        return GEOMETRY_ATTIBUTE_NAME;
245
	    }
246

  
247
	    int i = 0;
248
	    String candidate = GEOMETRY_ATTIBUTE_NAME + i;
249
	    while (ft.getAttributeDescriptor(candidate) != null) {
250
	        i++;
251
	        candidate = GEOMETRY_ATTIBUTE_NAME + i;
252
	    }
253
        return candidate;
254
    }
255

  
256
    protected static FeatureType removeGeometryColumn(
241 257
			EditableFeatureType fType) {
242 258
		Iterator iter = fType.iterator();
243 259
		FeatureAttributeDescriptor attr;

Also available in: Unified diff