Revision 23303 branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLayers.java

View differences:

FLayers.java
57 57
import org.apache.log4j.Logger;
58 58
import org.cresques.cts.ICoordTrans;
59 59
import org.cresques.cts.IProjection;
60
import org.gvsig.tools.exception.BaseException;
61 60
import org.gvsig.fmap.data.ReadException;
62 61
import org.gvsig.fmap.geom.primitive.Envelope;
63 62
import org.gvsig.fmap.mapcontext.MapContext;
......
72 71
import org.gvsig.fmap.mapcontext.layers.operations.LayersVisitable;
73 72
import org.gvsig.fmap.mapcontext.layers.operations.LayersVisitor;
74 73
import org.gvsig.fmap.mapcontext.layers.operations.XMLItem;
74
import org.gvsig.tools.exception.BaseException;
75 75
import org.gvsig.tools.visitor.NotSupportedOperationException;
76 76
import org.gvsig.tools.visitor.Visitor;
77 77

  
......
981 981
		for (int i = 0; i < layers.size(); i++) {
982 982
			try {
983 983
				XMLEntity xmlLayer=((FLayer) layers.get(i)).getXMLEntity();
984
				xmlLayer.putProperty("tagName","layer"+i);
984
				xmlLayer.putProperty("tagName", "layer");
985 985
				xml.addChild(xmlLayer);
986 986
			}catch (XMLException e) {
987 987
				e.printStackTrace();
......
1018 1018
		// try {
1019 1019
		fmap.clearErrors();
1020 1020
		int numLayers=xml.getIntProperty("numLayers");
1021
		for (int i = 0; i < numLayers; i++) {
1022
			XMLEntity xmlLayer=xml.firstChild("tagName","layer"+i);
1021
		Iterator iter = xml.findChildren("tagName","layer");
1022
		XMLEntity xmlLayer;
1023
		while (iter.hasNext()) {
1024
			xmlLayer=(XMLEntity) iter.next();
1023 1025
			try {
1024
				this.addLayerFromXML(xmlLayer,s[i]);
1026
				this.addLayerFromXML(xmlLayer, null);
1025 1027
			} catch (LoadLayerException e) {
1026 1028
				throw new XMLLayerException(getName(),e);
1027 1029
			}
1028

  
1029

  
1030 1030
		}
1031
		if (numLayers != this.layers.size()) {
1032
			logger.warn(this.getName() + ": layer count no match");
1033
		}
1031 1034
	}
1032 1035
	/*
1033 1036
	 * (non-Javadoc)
......
1235 1238
	FLayer layer = null;
1236 1239

  
1237 1240
	try {
1238
		if (name == null) name = xml.getName();
1241
		if (name == null) {
1242
			name = xml.getName();
1243
		}
1239 1244

  
1240 1245

  
1241 1246
		String className = xml.getStringProperty("className");
......
1386 1391
		// Comprobar que la proyecci?n es la misma que la de FMap
1387 1392
		// Si no lo es, es una capa que est? reproyectada al vuelo
1388 1393
		IProjection proj = layer.getProjection();
1389
		if ((proj != null))
1394
		if ((proj != null)) {
1390 1395
			if (!proj.getFullCode().equals(getMapContext().getProjection().getFullCode()))
1391 1396
			{
1392 1397
				ICoordTrans ct = proj.getCT(getMapContext().getProjection());
......
1396 1401

  
1397 1402
				layer.setCoordTrans(ct);
1398 1403
			}
1404
		}
1399 1405
	} catch (XMLException e) {
1400 1406
		fmap.addLayerError(xml.getStringProperty("name"));
1401 1407
		throw new LoadLayerException(name,e);

Also available in: Unified diff