Revision 42166 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.shape/src/main/java/org/gvsig/exportto/swing/prov/shape/ExporttoShapeService.java

View differences:

ExporttoShapeService.java
57 57
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
58 58
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
59 59
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters;
60
import org.gvsig.fmap.geom.DataTypes;
60 61
import org.gvsig.fmap.geom.Geometry;
61 62
import org.gvsig.fmap.geom.GeometryLocator;
62 63
import org.gvsig.fmap.geom.GeometryManager;
......
124 125
    	Map<String, String> resp = new HashMap<String, String>();
125 126
    	FeatureAttributeDescriptor[] atts = ft.getAttributeDescriptors();
126 127
    	for (int i=0; i<atts.length; i++) {
127
    		if (atts[i].getName().length() > MAX_FIELD_NAME_LENGTH) {
128
    		//if (atts[i].getName().length() > MAX_FIELD_NAME_LENGTH) {
128 129
    			String new_name = getNewName(atts[i].getName(), resp.values());
129 130
    			resp.put(atts[i].getName(), new_name);
130
    		}
131
    		//}
131 132
    	}
132 133
		return resp;
133 134
	}
......
141 142
			 */
142 143
			return name;
143 144
		}
145
		
146
		String resp = null;
144 147
		/*
145 148
		 * Composes a new name with start and end of old name and an index
146 149
		 * THISISAVERYLONGNAME => THISI_AME_1, THISI_AME_2 ... THISI_AME_9
147 150
		 */
148 151
		/*
149 152
		String pref = name.substring(0, 6) + "_" + name.substring(len - 2) + "_";
150
		String resp = null;
151 153
		for (int i=0; i<10; i++) {
152 154
			resp = pref + i;
153 155
			if (!values.contains(resp)) {
......
160 162
		 * THISISAVERYLONGNAME => THISISA_1, THISISA_2 ... THISISA_999
161 163
		 */
162 164
		/*
163
		pref = name.substring(0, 7) + "_";
165
		String pref = name.substring(0, 7) + "_";
164 166
		for (int i=0; i<1000; i++) {
165 167
			resp = pref + i;
166 168
			if (!values.contains(resp)) {
......
174 176
		 * THISISAV10 ... THISISAV99, THISISA100 ... THISISA255
175 177
		 * (255 = max number of fields in a SHP)
176 178
		 */
177
		String resp = null;
179
		//String resp = null;
178 180
		for (int i=0; i<255; i++) {
179 181
		    if (i==0)
180 182
		    	resp = name.substring(0, 10);
......
290 292
    	String msg = Messages.getText("_Some_field_names_too_long_automatically_changed");
291 293
    	msg = msg + ":\n";
292 294
    	String k, v;
295
    	boolean hasModifiedNames = false;
293 296
    	while (iter.hasNext()) {
294 297
    		k = iter.next();
295 298
    		v = map.get(k);
296
    		msg = msg + "\n" + k + " > " + v;
299
    		if(!k.equalsIgnoreCase(v)){
300
    			msg = msg + "\n" + k + " > " + v;
301
    			hasModifiedNames = true;
302
    		}
297 303
    	}
298 304
    	
299
    	JOptionPane.showMessageDialog(
305
    	if(hasModifiedNames){
306
    		JOptionPane.showMessageDialog(
300 307
    			this.filePanel,
301 308
    			msg,
302 309
    			Messages.getText("export_progress"),
303 310
    			JOptionPane.WARNING_MESSAGE);
311
    	}
304 312
	}
305 313

  
306 314
	private void initializeParams(
......
377 385
            }
378 386
            
379 387
            efad.setGeometryType(gty);
380
            
388
            efad.setName(origNameToDbfName.get(fad.getName()));
381 389
            efad.setPrecision(fad.getPrecision());
382
            type.setDefaultGeometryAttributeName(fad.getName());
383 390
            
384 391
            // ==========================
385 392
            fixNames(type);
386 393
            // ==========================
387 394
            
395
            type.setDefaultGeometryAttributeName(efad.getName());
396
            
388 397
            params.setDefaultFeatureType(type);
389
            
390 398
            params.setDynValue("geometryType", null);
391 399

  
392 400
            DataManager manager = DALLocator.getDataManager();
......
511 519
    			eft.remove(atts[i].getName());
512 520
    			efad = eft.add(new_name, atts[i].getType(), atts[i].getSize());
513 521
    			efad.setPrecision(atts[i].getPrecision());
522
    			if(atts[i].getDataType().getType() == DataTypes.GEOMETRY){
523
    				efad.setGeometryType(atts[i].getGeomType());
524
    			}
514 525
    		}
515 526
    	}
516 527
	}

Also available in: Unified diff