Revision 34303 branches/v2_0_0_prep/libraries/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/legend/impl/SingleSymbolLegend.java

View differences:

SingleSymbolLegend.java
93 93
	 */
94 94
	public SingleSymbolLegend(ISymbol style) {
95 95
		super();
96
		defaultSymbol = style;
97

  
98
		if (style instanceof MultiShapeSymbol) {
99
			shapeType = Geometry.TYPES.GEOMETRY;
100
		} else if (style instanceof IMarkerSymbol) {
101
			shapeType = Geometry.TYPES.POINT;
102
		} else if (style instanceof ILineSymbol) {
103
			shapeType = Geometry.TYPES.CURVE;
104
		} else if (style instanceof IFillSymbol) {
105
			shapeType = Geometry.TYPES.SURFACE;
106
		}
96
		setDefaultSymbol(style);
107 97
	}
108 98

  
109 99

  
110 100
	public void setDefaultSymbol(ISymbol s) {
111 101
		if (s == null) throw new NullPointerException("Default symbol cannot be null");
112
		setShapeType(s.getSymbolType());
113 102
		ISymbol old = defaultSymbol;
114 103
		defaultSymbol = s;
115 104
		fireDefaultSymbolChangedEvent(new SymbolLegendEvent(old, s));
......
122 111

  
123 112
	public ISymbol getDefaultSymbol() {
124 113
		if(defaultSymbol==null) {
125
			defaultSymbol =
126
					getSymbolManager().createSymbol(IFillSymbol.SYMBOL_NAME);
114
			defaultSymbol = getSymbolManager().createSymbol(shapeType);
127 115
		}
128 116
		return defaultSymbol;
129 117
	}
......
142 130
	}
143 131

  
144 132
    public ISymbol getSymbolByFeature(Feature feat) {
145
        return defaultSymbol;
133
        return getDefaultSymbol();
146 134
    }
147 135

  
148 136
	public void useDefaultSymbol(boolean b) {

Also available in: Unified diff