Revision 10935 branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrAnnotation.java

View differences:

FLyrAnnotation.java
42 42
import com.iver.cit.gvsig.fmap.operations.strategies.Strategy;
43 43
import com.iver.cit.gvsig.fmap.operations.strategies.StrategyManager;
44 44
import com.iver.cit.gvsig.fmap.operations.strategies.VisitException;
45
import com.iver.cit.gvsig.fmap.rendering.VectorialLegend;
45 46
import com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend;
46 47
import com.iver.cit.gvsig.fmap.spatialindex.QuadtreeJts;
47 48
import com.iver.utiles.XMLEntity;
......
248 249
	 * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#setXMLEntity(com.iver.utiles.XMLEntity)
249 250
	 */
250 251
	public void setXMLEntity(XMLEntity xml) throws XMLException {
251
		mapping = MappingAnnotation.createFromXML(xml.getChild(2));//getIntArrayProperty("mapping");
252
		mapping = MappingAnnotation.createFromXML(xml.getChild(3));//getIntArrayProperty("mapping");
252 253
		setInPixels(xml.getBooleanProperty("isInPixels"));
253 254

  
254 255
		IProjection proj = null;
......
257 258
			proj = CRSFactory.getCRS(xml.getStringProperty("proj"));
258 259
		}
259 260

  
260
		VectorialFileAdapter adapter = new VectorialFileAdapter(new File(xml
261
				.getStringProperty("file")));
262
		Driver d;
261
//		VectorialAdapter adapter=null;
262
//		if (xml.contains("file")){
263
//			adapter = new VectorialFileAdapter(new File(xml
264
//					.getStringProperty("file")));
265
//		}else if (xml.contains("db")){
266
//			adapter = new VectorialDBAdapter();
267
//		}
268
//		Driver d;
269
//
270
//		try {
271
//			d = LayerFactory.getDM().getDriver(
272
//					xml.getStringProperty("driverName"));
273
//		} catch (DriverLoadException e1) {
274
//			throw new XMLException(e1);
275
//		}
276
//
277
//		adapter.setDriver((VectorialDriver) d);
278
//		// TODO Meter esto dentro de la comprobaci?n de si hay memoria
279
//		if (false) {
280
//		} else {
281
//			setSource(adapter);
282
//			setProjection(proj);
283
//		}
263 284

  
264
		try {
265
			d = LayerFactory.getDM().getDriver(
266
					xml.getStringProperty("driverName"));
267
		} catch (DriverLoadException e1) {
268
			throw new XMLException(e1);
269
		}
270

  
271
		adapter.setDriver((VectorialDriver) d);
272
		// TODO Meter esto dentro de la comprobaci?n de si hay memoria
273
		if (false) {
274
		} else {
275
			setSource(adapter);
276
			setProjection(proj);
277
		}
278

  
279 285
		// Le asignamos tambi?n una legenda por defecto acorde con
280 286
		// el tipo de shape que tenga. Tampoco s? si es aqu? el
281 287
		// sitio adecuado, pero en fin....
......
569 575
		super.setEditing(b);
570 576
		deleteSpatialIndex();
571 577
	}
578

  
579
	public static FLayer createLayerFromVect(FLyrVect layer) throws DriverException, FieldNotFoundException {
580
		FLyrAnnotation la=new FLyrAnnotation();
581
		la.setSource(layer.getSource());
582
		la.setRecordset(layer.getRecordset());
583
		la.setProjection(layer.getProjection());
584
		la.setLegend((VectorialLegend)layer.getLegend());
585
		return la;
586
	}
572 587
}

Also available in: Unified diff