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

View differences:

FLyrVect.java
55 55

  
56 56
import org.apache.log4j.Logger;
57 57
import org.cresques.cts.ICoordTrans;
58
import org.gvsig.tools.exception.BaseException;
59 58
import org.gvsig.fmap.data.DataManager;
60 59
import org.gvsig.fmap.data.DataStore;
61 60
import org.gvsig.fmap.data.ReadException;
......
107 106
import org.gvsig.fmap.mapcontext.rendering.symbols.FSymbol;
108 107
import org.gvsig.fmap.mapcontext.rendering.symbols.IMultiLayerSymbol;
109 108
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
109
import org.gvsig.tools.exception.BaseException;
110 110

  
111 111
import com.iver.utiles.NotExistInXMLEntity;
112 112
import com.iver.utiles.XMLEntity;
......
266 266
			} catch (DataStoreOperationException e) {
267 267
				throw new LoadLayerException(this.getName(), e);
268 268
			}
269
			if (legend != null) {
270
				this.setLegend((IVectorLegend) legend);
271
			} else {
272
				try {
273
					this.setLegend(LegendFactory.createSingleSymbolLegend(this
274
							.getShapeType()));
275
				} catch (ReadException e) {
276
					throw new LoadLayerException(this.getName(), e);
277
				}
269 278

  
270
        	this.setLegend((IVectorLegend) legend);
279
			}
280

  
281

  
271 282
		} else {
272 283
			try {
273 284
				this.setLegend(LegendFactory.createSingleSymbolLegend(this
......
905 916
     */
906 917
    public int getShapeType() throws ReadException {
907 918
        if (typeShape == -1) {
908
            typeShape = ((FeatureType)((FeatureStore)getDataStore()).getDefaultFeatureType()).getGeometryTypes()[0];
919
            typeShape = (((FeatureStore)getDataStore()).getDefaultFeatureType()).getGeometryTypes()[0];
909 920
        }
910 921
        return typeShape;
911 922
    }
......
932 943
        xml.putProperty("isLabeled", isLabeled);
933 944
        if (strategy != null) {
934 945
            XMLEntity strategyXML = strategy.getXMLEntity();
935
            strategyXML.putProperty("tagName", "strategy");
946
            strategyXML.putProperty("tagName", "labelingStrategy");
936 947
            xml.addChild(strategy.getXMLEntity());
937 948
        }
938 949
        xml.addChild(getLinkProperties().getXMLEntity());
......
973 984
    				throw new XMLLegendException(e);
974 985
    			}
975 986
    		// set properties for ILabelable
976
    		XMLEntity labelingXML = xml.firstChild("id", "LabelingStrategy");
977
    		if (labelingXML!= null) {
978
    			isLabeled = true;
979
    			try {
980
    				this.strategy = LabelingFactory.createStrategyFromXML(labelingXML, this);
981
    			} catch (NotExistInXMLEntity neXMLEX) {
982
    				// no strategy was set, just continue;
983
    				logger.warn("Reached what should be unreachable code");
987

  
988
    		if (xml.contains("isLabeled")
989
					&& xml.getBooleanProperty(("isLabeled"))) {
990
    			XMLEntity labelingXML = xml.firstChild("tagName", "labelingStrategy");
991
    			if (labelingXML != null){
992

  
993
	    			isLabeled = true;
994
	    			try {
995
	    				this.strategy = LabelingFactory.createStrategyFromXML(labelingXML, this);
996
	    			} catch (NotExistInXMLEntity neXMLEX) {
997
	    				// no strategy was set, just continue;
998
	    				logger.warn("Reached what should be unreachable code");
999
	    			}
1000
    			} else {
1001
					isLabeled = false;
984 1002
    			}
985 1003
    		} else {
986 1004
    			isLabeled = false;

Also available in: Unified diff