Revision 18621 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/AbstractFillSymbol.java

View differences:

AbstractFillSymbol.java
100 100

  
101 101
import java.awt.Color;
102 102

  
103
import com.iver.cit.gvsig.fmap.ViewPort;
104
import com.iver.cit.gvsig.fmap.core.CartographicSupportToolkit;
103 105
import com.iver.cit.gvsig.fmap.core.FShape;
104 106
import com.iver.cit.gvsig.fmap.core.IGeometry;
105 107

  
......
111 113
 *
112 114
 */
113 115
public abstract class AbstractFillSymbol extends AbstractSymbol implements IFillSymbol {
116
	private boolean hasFill = true;
117
	private boolean hasOutline = true;
114 118
	private Color color = null;
115 119
	private ILineSymbol outline;
116 120

  
......
128 132
		return rgb;
129 133
	}
130 134

  
135
	public void getPixExtentPlus(FShape shp, float[] distances, ViewPort viewPort, int dpi) {
136
		if (getOutline() != null) {
137
			getOutline().getPixExtentPlus(shp, distances, viewPort, dpi);
138
		} else {
139
			distances[0] = 0;
140
			distances[1] = 0;
141
		}
142
	}
143

  
131 144
	public void setFillColor(Color color) {
132 145
		this.color = color;
133 146
	}
......
145 158
	}
146 159

  
147 160
	public int getFillAlpha() {
161
		// TODO debatir si es correcto o no (por ejemplo cuando hablamos de LineFillSymbol's
162
		if (color == null) return 255;
148 163
		return color.getAlpha();
149 164
	}
165
	
166
	public void setCartographicSize(double cartographicSize, FShape shp) {
167
		if (getOutline() != null) {
168
			getOutline().setLineWidth(cartographicSize);
169
		}
170
	}
171

  
172
	public double toCartographicSize(ViewPort viewPort, double dpi, FShape shp) {
173
		if (getOutline() != null) {
174
			double oldSize = getOutline().getLineWidth();
175
			setCartographicSize(getCartographicSize(
176
					viewPort,
177
					dpi,
178
					shp),
179
					shp);
180
			return oldSize;
181
		}
182
		return 0;
183
	}
184

  
185
	public boolean hasFill() {
186
		return hasFill;
187
	}
188

  
189
	public void setHasFill(boolean hasFill) {
190
		this.hasFill = hasFill;
191
	}
192
	
193
	
194
	public boolean hasOutline() {
195
		return hasOutline;
196
	}
197

  
198
	public void setHasOutline(boolean hasOutline) {
199
		this.hasOutline = hasOutline;
200
	}
201
	
202
	
203
	public double getCartographicSize(ViewPort viewPort, double dpi, FShape shp) {
204
		if (getOutline() != null) {
205
			return CartographicSupportToolkit.
206
						getCartographicLength(this,
207
							getOutline().getLineWidth(),
208
							viewPort,
209
							dpi);
210
		}
211
		return 0;
212
	}
213

  
214
	@Override
215
	public void setUnit(int unitIndex) {
216
		super.setUnit(unitIndex);
217
		if (getOutline() != null) {
218
			getOutline().setUnit(unitIndex);
219
		}
220
	}
150 221
}

Also available in: Unified diff