Revision 19419 branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/legends/SingleSymbolLegendInfo.java

View differences:

SingleSymbolLegendInfo.java
43 43
import org.gvsig.publish.infoproject.ISymbolInfo;
44 44
import org.gvsig.publish.infoproject.symbols.SymbolInfoFactory;
45 45

  
46
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
46 47
import com.iver.cit.gvsig.fmap.rendering.Legend;
47 48
import com.iver.cit.gvsig.fmap.rendering.SingleSymbolLegend;
48 49

  
49 50
public class SingleSymbolLegendInfo implements ISingleSymbolLegendInfo{
50 51
	private Legend legend = null;
52
	private FLyrVect layer = null;
53
	/**
54
	 * default constructor
55
	 * @param legend
56
	 * @deprecated
57
	 */
51 58
	public SingleSymbolLegendInfo(SingleSymbolLegend legend) {
52 59
		this.legend = legend;
53 60
	}
54

  
61
	/**
62
	 * Constructor from FLayer. I need the layer's name in order to build the SLD
63
	 */
64
	public SingleSymbolLegendInfo(FLyrVect lyrVect) {
65
		this.layer = lyrVect;
66
		this.legend = (SingleSymbolLegend)lyrVect.getLegend();
67
	}
55 68
	public ISymbolInfo getSymbolInfo() {
56 69
		return SymbolInfoFactory.getInstance(this.legend.getDefaultSymbol());
57 70
	}
58
	
59 71

  
72
	public String getSLDString() {
73
		if (layer != null){
74
			return legend.getSLDString(layer.getName());
75
		}else{
76
			return legend.getSLDString("default");
77
		}
78
				
79
	}
80

  
60 81
}

Also available in: Unified diff