Revision 47476 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/impl/MultiShapeSymbol.java
MultiShapeSymbol.java | ||
---|---|---|
28 | 28 |
import java.awt.Rectangle; |
29 | 29 |
import java.awt.geom.AffineTransform; |
30 | 30 |
import java.awt.geom.Point2D; |
31 |
import org.gvsig.compat.print.PrintAttributes; |
|
32 | 31 |
import org.gvsig.fmap.dal.feature.Feature; |
33 | 32 |
import org.gvsig.fmap.geom.Geometry; |
34 | 33 |
import org.gvsig.fmap.geom.aggregate.Aggregate; |
35 | 34 |
import org.gvsig.fmap.geom.type.GeometryType; |
36 | 35 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
37 | 36 |
import org.gvsig.fmap.mapcontext.ViewPort; |
37 |
import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport; |
|
38 | 38 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
39 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException;
|
|
39 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol_v2;
|
|
40 | 40 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager; |
41 | 41 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.IMultiShapeSymbol; |
42 | 42 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.IFillSymbol; |
43 | 43 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.ILineSymbol; |
44 | 44 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.IMarkerSymbol; |
45 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.IMarkerSymbol_v2; |
|
45 | 46 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.ILineStyle; |
46 | 47 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.IMask; |
47 | 48 |
import org.gvsig.tools.ToolsLocator; |
... | ... | |
63 | 64 |
* @author 2005-2008 jaume dominguez faus - jaume.dominguez@iver.es |
64 | 65 |
* @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team |
65 | 66 |
*/ |
66 |
public class MultiShapeSymbol implements ILineSymbol, IMarkerSymbol, IFillSymbol, IMultiShapeSymbol { |
|
67 |
public class MultiShapeSymbol extends AbstractSymbol implements ILineSymbol, IMarkerSymbol, IFillSymbol, IMultiShapeSymbol {
|
|
67 | 68 |
|
68 | 69 |
private static final Logger LOG = LoggerFactory.getLogger(MultiShapeSymbol.class); |
69 | 70 |
|
... | ... | |
74 | 75 |
private static final String FIELD_FILL = "fill"; |
75 | 76 |
private static final String FIELD_DESCRIPTION = "description"; |
76 | 77 |
|
78 |
@SuppressWarnings("FieldNameHidesFieldInSuperclass") |
|
77 | 79 |
public static final String SYMBOL_NAME = "multiShape"; |
78 | 80 |
|
79 |
private SymbolManager manager = MapContextLocator.getSymbolManager(); |
|
80 |
|
|
81 | 81 |
private IMarkerSymbol marker; |
82 | 82 |
private ILineSymbol line; |
83 | 83 |
private IFillSymbol fill; |
84 | 84 |
private IMask mask; |
85 |
private String desc; |
|
86 | 85 |
private int referenceSystem; |
87 | 86 |
private MultiShapeSymbol symSelect; |
88 | 87 |
|
... | ... | |
94 | 93 |
} |
95 | 94 |
|
96 | 95 |
private ISymbol createSymbol(String symbolName) { |
96 |
SymbolManager manager = MapContextLocator.getSymbolManager(); |
|
97 | 97 |
return manager.createSymbol(symbolName); |
98 | 98 |
} |
99 | 99 |
|
... | ... | |
101 | 101 |
return line.getColor(); |
102 | 102 |
} |
103 | 103 |
|
104 |
@Override |
|
104 | 105 |
public void setLineColor(Color color) { |
105 | 106 |
line.setLineColor(color); |
106 | 107 |
} |
107 | 108 |
|
109 |
@Override |
|
108 | 110 |
public ILineStyle getLineStyle() { |
109 | 111 |
return line.getLineStyle(); |
110 | 112 |
} |
111 | 113 |
|
114 |
@Override |
|
112 | 115 |
public void setLineStyle(ILineStyle lineStyle) { |
113 | 116 |
line.setLineStyle(lineStyle); |
114 | 117 |
} |
115 | 118 |
|
119 |
@Override |
|
116 | 120 |
public void setLineWidth(double width) { |
117 | 121 |
line.setLineWidth(width); |
118 | 122 |
} |
119 | 123 |
|
124 |
@Override |
|
120 | 125 |
public double getLineWidth() { |
121 | 126 |
return line.getLineWidth(); |
122 | 127 |
} |
123 | 128 |
|
129 |
@Override |
|
124 | 130 |
public int getAlpha() { |
125 | 131 |
return line.getAlpha(); |
126 | 132 |
} |
127 | 133 |
|
134 |
@Override |
|
128 | 135 |
public void setAlpha(int outlineAlpha) { |
129 | 136 |
line.setAlpha(outlineAlpha); |
130 | 137 |
} |
131 | 138 |
|
139 |
@Override |
|
132 | 140 |
public ISymbol getSymbolForSelection() { |
133 | 141 |
if (symSelect == null) { |
134 | 142 |
symSelect = new MultiShapeSymbol(); |
... | ... | |
146 | 154 |
symSelect.setFillSymbol((IFillSymbol) fill.getSymbolForSelection()); |
147 | 155 |
} |
148 | 156 |
|
157 |
if (symSelect instanceof CartographicSupport) { |
|
158 |
((CartographicSupport) symSelect).setUnit(this.getUnit()); |
|
159 |
} |
|
149 | 160 |
return symSelect; |
150 | 161 |
|
151 | 162 |
} |
152 | 163 |
|
153 |
public void draw(Graphics2D g, AffineTransform affineTransform,
|
|
154 |
Geometry geom, Feature feature, Cancellable cancel) {
|
|
164 |
@Override
|
|
165 |
public void draw(Graphics2D g, AffineTransform affineTransform, Geometry geom, Feature f, Cancellable cancel, Rectangle r) {
|
|
155 | 166 |
GeometryType geometryType = geom.getGeometryType(); |
156 | 167 |
if (geometryType.isTypeOf(Geometry.TYPES.POINT)){ |
157 | 168 |
if (marker != null) { |
158 |
marker.draw(g, affineTransform, geom, feature, cancel); |
|
169 |
if(marker instanceof CartographicSupport){ |
|
170 |
marker.setCartographicContext(this.getCartographicContext()); |
|
171 |
} |
|
172 |
if(marker instanceof IMarkerSymbol_v2){ |
|
173 |
((IMarkerSymbol_v2)marker).draw(g, affineTransform, geom, f, cancel, r); |
|
174 |
} else { |
|
175 |
marker.draw(g, affineTransform, geom, f, cancel); |
|
176 |
} |
|
159 | 177 |
} |
160 | 178 |
}else if (geometryType.isTypeOf(Geometry.TYPES.CURVE)){ |
161 | 179 |
if (line != null) { |
162 |
line.draw(g, affineTransform, geom, feature, cancel); |
|
180 |
if(line instanceof CartographicSupport){ |
|
181 |
line.setCartographicContext(this.getCartographicContext()); |
|
182 |
} |
|
183 |
if(line instanceof ISymbol_v2){ |
|
184 |
((ISymbol_v2)line).draw(g, affineTransform, geom, f, cancel, r); |
|
185 |
} else { |
|
186 |
line.draw(g, affineTransform, geom, f, cancel); |
|
187 |
} |
|
163 | 188 |
} |
164 | 189 |
}else if (geometryType.isTypeOf(Geometry.TYPES.SURFACE)){ |
165 | 190 |
if (fill != null) { |
166 |
fill.draw(g, affineTransform, geom, feature, cancel); |
|
191 |
if(fill instanceof CartographicSupport){ |
|
192 |
fill.setCartographicContext(this.getCartographicContext()); |
|
193 |
} |
|
194 |
if(fill instanceof ISymbol_v2){ |
|
195 |
((ISymbol_v2)fill).draw(g, affineTransform, geom, f, cancel, r); |
|
196 |
} else { |
|
197 |
fill.draw(g, affineTransform, geom, f, cancel); |
|
198 |
} |
|
167 | 199 |
} |
168 | 200 |
}else if (geometryType.isTypeOf(Geometry.TYPES.AGGREGATE)){ |
169 | 201 |
Aggregate aggregate = (Aggregate)geom; |
170 | 202 |
for (int i=0 ; i<aggregate.getPrimitivesNumber() ; i++){ |
171 |
draw(g, affineTransform, aggregate.getPrimitiveAt(i), feature, cancel);
|
|
203 |
draw(g, affineTransform, aggregate.getPrimitiveAt(i), f, cancel, r);
|
|
172 | 204 |
} |
173 | 205 |
} |
174 | 206 |
} |
175 | 207 |
|
176 |
@Override |
|
177 |
public boolean isOneDotOrPixel(Geometry geom, |
|
178 |
double[] positionOfDotOrPixel, ViewPort viewPort, int dpi) { |
|
179 |
|
|
180 |
GeometryType geomType = geom.getGeometryType(); |
|
181 |
if( geomType.isSubTypeOf(Geometry.TYPES.POINT) ) { |
|
182 |
if (marker != null) { |
|
183 |
return marker.isOneDotOrPixel(geom, positionOfDotOrPixel, viewPort, dpi); |
|
184 |
} |
|
208 |
// @Override |
|
209 |
// public boolean isOneDotOrPixel(Geometry geom, |
|
210 |
// double[] positionOfDotOrPixel, ViewPort viewPort, int dpi) { |
|
211 |
// |
|
212 |
// GeometryType geomType = geom.getGeometryType(); |
|
213 |
// if( geomType.isSubTypeOf(Geometry.TYPES.POINT) ) { |
|
214 |
// if (marker != null) { |
|
215 |
// return marker.isOneDotOrPixel(geom, positionOfDotOrPixel, viewPort, dpi); |
|
216 |
// } |
|
217 |
// |
|
218 |
// } else if( geomType.isSubTypeOf(Geometry.TYPES.CURVE) ) { |
|
219 |
// if (line != null) { |
|
220 |
// return line.isOneDotOrPixel(geom, positionOfDotOrPixel, viewPort, dpi); |
|
221 |
// } |
|
222 |
// |
|
223 |
// } else if( geomType.isSubTypeOf(Geometry.TYPES.SURFACE) ) { |
|
224 |
// if (fill != null) { |
|
225 |
// return fill.isOneDotOrPixel(geom, positionOfDotOrPixel, viewPort, dpi); |
|
226 |
// } |
|
227 |
// |
|
228 |
// } |
|
229 |
// if (!geom.isSimple()){ |
|
230 |
// Aggregate aggregate = (Aggregate)geom; |
|
231 |
// for (int i=0 ; i<aggregate.getPrimitivesNumber() ; i++){ |
|
232 |
// if (!isOneDotOrPixel(aggregate.getPrimitiveAt(i), positionOfDotOrPixel, viewPort, dpi)){ |
|
233 |
// return false; |
|
234 |
// } |
|
235 |
// } |
|
236 |
// return true; |
|
237 |
// } |
|
238 |
// return true; |
|
239 |
// } |
|
185 | 240 |
|
186 |
} else if( geomType.isSubTypeOf(Geometry.TYPES.CURVE) ) { |
|
187 |
if (line != null) { |
|
188 |
return line.isOneDotOrPixel(geom, positionOfDotOrPixel, viewPort, dpi); |
|
189 |
} |
|
190 |
|
|
191 |
} else if( geomType.isSubTypeOf(Geometry.TYPES.SURFACE) ) { |
|
192 |
if (fill != null) { |
|
193 |
return fill.isOneDotOrPixel(geom, positionOfDotOrPixel, viewPort, dpi); |
|
194 |
} |
|
195 |
|
|
196 |
} |
|
197 |
if (!geom.isSimple()){ |
|
198 |
Aggregate aggregate = (Aggregate)geom; |
|
199 |
for (int i=0 ; i<aggregate.getPrimitivesNumber() ; i++){ |
|
200 |
if (!isOneDotOrPixel(aggregate.getPrimitiveAt(i), positionOfDotOrPixel, viewPort, dpi)){ |
|
201 |
return false; |
|
202 |
} |
|
203 |
} |
|
204 |
return true; |
|
205 |
} |
|
206 |
return true; |
|
207 |
} |
|
241 |
// @Override |
|
242 |
// public void getPixExtentPlus(Geometry geom, float[] distances, |
|
243 |
// ViewPort viewPort, int dpi) { |
|
244 |
// // TODO Implement it |
|
245 |
// throw new Error("Not yet implemented!"); |
|
246 |
// |
|
247 |
// } |
|
208 | 248 |
|
209 |
public void getPixExtentPlus(Geometry geom, float[] distances, |
|
210 |
ViewPort viewPort, int dpi) { |
|
211 |
// TODO Implement it |
|
212 |
throw new Error("Not yet implemented!"); |
|
249 |
// @Override |
|
250 |
// public int getOnePointRgb() { |
|
251 |
// // will return a mixture of all symbol's getOnePointRgb() value |
|
252 |
// |
|
253 |
// int rMarker = 0; |
|
254 |
// int gMarker = 0; |
|
255 |
// int bMarker = 0; |
|
256 |
// int aMarker = 0; |
|
257 |
// |
|
258 |
// if (marker!=null && marker.getColor() != null) { |
|
259 |
// rMarker = marker.getColor().getRed(); |
|
260 |
// gMarker = marker.getColor().getGreen(); |
|
261 |
// bMarker = marker.getColor().getBlue(); |
|
262 |
// aMarker = marker.getColor().getAlpha(); |
|
263 |
// } |
|
264 |
// |
|
265 |
// int rLine = 0; |
|
266 |
// int gLine = 0; |
|
267 |
// int bLine = 0; |
|
268 |
// int aLine = 0; |
|
269 |
// |
|
270 |
// if (line != null && line.getColor() != null) { |
|
271 |
// rLine = line.getColor().getRed(); |
|
272 |
// gLine = line.getColor().getGreen(); |
|
273 |
// bLine = line.getColor().getBlue(); |
|
274 |
// aLine = line.getColor().getAlpha(); |
|
275 |
// } |
|
276 |
// |
|
277 |
// int rFill = 0; |
|
278 |
// int gFill = 0; |
|
279 |
// int bFill = 0; |
|
280 |
// int aFill = 0; |
|
281 |
// |
|
282 |
// if (fill != null ) { |
|
283 |
// Color colorOfFill = null; |
|
284 |
// if (fill.getOutline()!=null) { |
|
285 |
// colorOfFill = fill.getOutline().getColor(); |
|
286 |
// } else if (fill.getFillColor()!=null) { |
|
287 |
// colorOfFill = fill.getFillColor(); |
|
288 |
// } |
|
289 |
// if (colorOfFill != null) { |
|
290 |
// rFill = colorOfFill.getRed(); |
|
291 |
// gFill = colorOfFill.getGreen(); |
|
292 |
// bFill = colorOfFill.getBlue(); |
|
293 |
// aFill = colorOfFill.getAlpha(); |
|
294 |
// |
|
295 |
// } |
|
296 |
// } |
|
297 |
// |
|
298 |
// int red = (rMarker + rLine + rFill) / 3; |
|
299 |
// int green = (gMarker + gLine + gFill) / 3; |
|
300 |
// int blue = (bMarker + bLine + bFill) / 3; |
|
301 |
// int alpha = (aMarker + aLine + aFill) / 3; |
|
302 |
// |
|
303 |
// return (alpha) << 24 + (red << 16) + (green << 8) + blue; |
|
304 |
// } |
|
213 | 305 |
|
214 |
} |
|
215 |
|
|
216 |
public int getOnePointRgb() { |
|
217 |
// will return a mixture of all symbol's getOnePointRgb() value |
|
218 |
|
|
219 |
int rMarker = 0; |
|
220 |
int gMarker = 0; |
|
221 |
int bMarker = 0; |
|
222 |
int aMarker = 0; |
|
223 |
|
|
224 |
if (marker!=null && marker.getColor() != null) { |
|
225 |
rMarker = marker.getColor().getRed(); |
|
226 |
gMarker = marker.getColor().getGreen(); |
|
227 |
bMarker = marker.getColor().getBlue(); |
|
228 |
aMarker = marker.getColor().getAlpha(); |
|
229 |
} |
|
230 |
|
|
231 |
int rLine = 0; |
|
232 |
int gLine = 0; |
|
233 |
int bLine = 0; |
|
234 |
int aLine = 0; |
|
235 |
|
|
236 |
if (line != null && line.getColor() != null) { |
|
237 |
rLine = line.getColor().getRed(); |
|
238 |
gLine = line.getColor().getGreen(); |
|
239 |
bLine = line.getColor().getBlue(); |
|
240 |
aLine = line.getColor().getAlpha(); |
|
241 |
} |
|
242 |
|
|
243 |
int rFill = 0; |
|
244 |
int gFill = 0; |
|
245 |
int bFill = 0; |
|
246 |
int aFill = 0; |
|
247 |
|
|
248 |
if (fill != null ) { |
|
249 |
Color colorOfFill = null; |
|
250 |
if (fill.getOutline()!=null) { |
|
251 |
colorOfFill = fill.getOutline().getColor(); |
|
252 |
} else if (fill.getFillColor()!=null) { |
|
253 |
colorOfFill = fill.getFillColor(); |
|
254 |
} |
|
255 |
if (colorOfFill != null) { |
|
256 |
rFill = colorOfFill.getRed(); |
|
257 |
gFill = colorOfFill.getGreen(); |
|
258 |
bFill = colorOfFill.getBlue(); |
|
259 |
aFill = colorOfFill.getAlpha(); |
|
260 |
|
|
261 |
} |
|
262 |
} |
|
263 |
|
|
264 |
int red = (rMarker + rLine + rFill) / 3; |
|
265 |
int green = (gMarker + gLine + gFill) / 3; |
|
266 |
int blue = (bMarker + bLine + bFill) / 3; |
|
267 |
int alpha = (aMarker + aLine + aFill) / 3; |
|
268 |
|
|
269 |
return (alpha) << 24 + (red << 16) + (green << 8) + blue; |
|
270 |
} |
|
271 |
|
|
272 |
public String getDescription() { |
|
273 |
return desc; |
|
274 |
} |
|
275 |
|
|
306 |
@Override |
|
276 | 307 |
public boolean isShapeVisible() { |
277 | 308 |
if (marker!=null) { |
278 | 309 |
return marker.isShapeVisible(); |
... | ... | |
289 | 320 |
return false; |
290 | 321 |
} |
291 | 322 |
|
292 |
public void setDescription(String desc) { |
|
293 |
this.desc = desc ; |
|
294 |
} |
|
295 |
|
|
323 |
@Override |
|
296 | 324 |
public int getSymbolType() { |
297 | 325 |
return Geometry.TYPES.GEOMETRY; |
298 | 326 |
} |
299 | 327 |
|
328 |
@Override |
|
300 | 329 |
public boolean isSuitableFor(Geometry geom) { |
301 | 330 |
// suitable for everything (why else does it exist?) |
302 | 331 |
return true; |
303 | 332 |
} |
304 | 333 |
|
305 |
public void drawInsideRectangle(Graphics2D g, |
|
306 |
AffineTransform scaleInstance, Rectangle r, PrintAttributes properties) throws SymbolDrawingException { |
|
307 |
double myWidth = (r.getWidth()/3); |
|
308 |
|
|
309 |
Rectangle rect = new Rectangle(0, 0, (int) myWidth, r.height); |
|
310 |
|
|
311 |
if (marker != null) { |
|
312 |
g.translate(r.x, r.y); |
|
313 |
marker.drawInsideRectangle(g, scaleInstance, rect, properties); |
|
314 |
g.translate(-(r.x), -(r.y)); |
|
315 |
} |
|
316 |
|
|
317 |
if (line != null) { |
|
318 |
g.translate(r.x+myWidth, r.y); |
|
319 |
line.drawInsideRectangle(g, scaleInstance, rect, properties); |
|
320 |
g.translate(-(r.x+myWidth), -(r.y)); |
|
321 |
} |
|
322 |
|
|
323 |
if (fill != null) { |
|
324 |
g.translate(r.x+myWidth+myWidth, r.y); |
|
325 |
fill.drawInsideRectangle(g, scaleInstance, rect, properties); |
|
326 |
g.translate(-(r.x+myWidth+myWidth), -(r.y)); |
|
327 |
|
|
328 |
} |
|
329 |
} |
|
330 |
|
|
331 | 334 |
@Override |
332 |
public void print(Graphics2D g, AffineTransform at, Geometry geom, PrintAttributes properties) { |
|
333 |
GeometryType geomType = geom.getGeometryType(); |
|
334 |
if( geomType.isTypeOf(Geometry.TYPES.POINT) ) { |
|
335 |
if (marker != null) { |
|
336 |
marker.print(g, at, geom, properties); |
|
337 |
} |
|
338 |
|
|
339 |
} else if( geomType.isTypeOf(Geometry.TYPES.CURVE) ) { |
|
340 |
if (line != null) { |
|
341 |
line.print(g, at, geom, properties); |
|
342 |
} |
|
343 |
|
|
344 |
} else if( geomType.isTypeOf(Geometry.TYPES.SURFACE) ) { |
|
345 |
if (fill != null) { |
|
346 |
fill.print(g, at, geom, properties); |
|
347 |
} |
|
348 |
|
|
349 |
} |
|
350 |
} |
|
351 |
|
|
352 |
@Override |
|
353 | 335 |
public double getRotation() { |
354 | 336 |
if (marker != null) { |
355 | 337 |
return marker.getRotation(); |
... | ... | |
357 | 339 |
return 0; |
358 | 340 |
} |
359 | 341 |
|
342 |
@Override |
|
360 | 343 |
public void setRotation(double rotation) { |
361 | 344 |
if (marker != null) { |
362 | 345 |
marker.setRotation(rotation); |
363 | 346 |
} |
364 | 347 |
} |
365 | 348 |
|
349 |
@Override |
|
366 | 350 |
public Point2D getOffset() { |
367 | 351 |
if (marker != null) { |
368 | 352 |
return marker.getOffset(); |
... | ... | |
370 | 354 |
return new Point2D.Double(); |
371 | 355 |
} |
372 | 356 |
|
357 |
@Override |
|
373 | 358 |
public void setOffset(Point2D offset) { |
374 | 359 |
if (marker != null) { |
375 | 360 |
marker.setOffset(offset); |
376 | 361 |
} |
377 | 362 |
} |
378 | 363 |
|
364 |
@Override |
|
379 | 365 |
public double getSize() { |
380 | 366 |
if (marker != null) { |
381 | 367 |
return marker.getSize(); |
... | ... | |
383 | 369 |
return 0; |
384 | 370 |
} |
385 | 371 |
|
372 |
@Override |
|
386 | 373 |
public void setSize(double size) { |
387 | 374 |
if (marker != null) { |
388 | 375 |
marker.setSize(size); |
... | ... | |
390 | 377 |
|
391 | 378 |
} |
392 | 379 |
|
380 |
@Override |
|
393 | 381 |
public Color getColor() { |
394 | 382 |
if (marker != null) { |
395 | 383 |
return marker.getColor(); |
... | ... | |
397 | 385 |
return null; |
398 | 386 |
} |
399 | 387 |
|
388 |
@Override |
|
400 | 389 |
public void setColor(Color color) { |
401 | 390 |
if (marker != null) { |
402 | 391 |
marker.setColor(color); |
403 | 392 |
} |
404 | 393 |
} |
405 | 394 |
|
395 |
@Override |
|
406 | 396 |
public void setFillColor(Color color) { |
407 | 397 |
if (fill != null) { |
408 | 398 |
fill.setFillColor(color); |
409 | 399 |
} |
410 | 400 |
} |
411 | 401 |
|
402 |
@Override |
|
412 | 403 |
public void setOutline(ILineSymbol outline) { |
413 | 404 |
if (fill != null) { |
414 | 405 |
fill.setOutline(outline); |
415 | 406 |
} |
416 | 407 |
} |
417 | 408 |
|
409 |
@Override |
|
418 | 410 |
public Color getFillColor() { |
419 | 411 |
if (fill != null) { |
420 | 412 |
return fill.getFillColor(); |
... | ... | |
422 | 414 |
return null; |
423 | 415 |
} |
424 | 416 |
|
417 |
@Override |
|
425 | 418 |
public ILineSymbol getOutline() { |
426 | 419 |
if (fill != null) { |
427 | 420 |
return fill.getOutline(); |
... | ... | |
429 | 422 |
return null; |
430 | 423 |
} |
431 | 424 |
|
425 |
@Override |
|
432 | 426 |
public int getFillAlpha() { |
433 | 427 |
if (fill != null) { |
434 | 428 |
return fill.getFillAlpha(); |
... | ... | |
436 | 430 |
return 255; |
437 | 431 |
} |
438 | 432 |
|
433 |
@Override |
|
439 | 434 |
public IMask getMask() { |
440 | 435 |
return mask; |
441 | 436 |
} |
442 | 437 |
|
438 |
@Override |
|
443 | 439 |
public void setUnit(int unitIndex) { |
444 | 440 |
if (marker != null) { |
445 | 441 |
marker.setUnit(unitIndex); |
... | ... | |
478 | 474 |
} |
479 | 475 |
|
480 | 476 |
@Override |
481 |
public double toCartographicSize(ViewPort viewPort, double dpi, Geometry geom) { |
|
482 |
GeometryType geomType = geom.getGeometryType(); |
|
483 |
if( geomType.isTypeOf(Geometry.TYPES.POINT) ) { |
|
484 |
if (marker != null) { |
|
485 |
return marker.toCartographicSize(viewPort, dpi, geom); |
|
486 |
} |
|
487 |
|
|
488 |
} else if( geomType.isTypeOf(Geometry.TYPES.CURVE) ) { |
|
489 |
if (line != null) { |
|
490 |
return line.toCartographicSize(viewPort, dpi, geom); |
|
491 |
} |
|
492 |
|
|
493 |
} else if( geomType.isTypeOf(Geometry.TYPES.SURFACE) ) { |
|
494 |
LOG.warn("Cartographic size does not have any sense for fill symbols"); |
|
495 |
|
|
496 |
} |
|
497 |
return -1; |
|
498 |
} |
|
499 |
|
|
500 |
@Override |
|
501 |
public void setCartographicSize(double cartographicSize, Geometry geom) { |
|
502 |
GeometryType geomType = geom.getGeometryType(); |
|
503 |
if( geomType.isTypeOf(Geometry.TYPES.POINT) ) { |
|
504 |
if (marker != null) { |
|
505 |
marker.setCartographicSize(cartographicSize, null); |
|
506 |
} |
|
507 |
|
|
508 |
} else if( geomType.isTypeOf(Geometry.TYPES.CURVE) ) { |
|
509 |
if (line != null) { |
|
510 |
line.setCartographicSize(cartographicSize, null); |
|
511 |
} |
|
512 |
|
|
513 |
} else if( geomType.isTypeOf(Geometry.TYPES.SURFACE) ) { |
|
514 |
LOG.warn("Cartographic size does not have any sense for fill symbols"); |
|
515 |
|
|
516 |
} |
|
517 |
} |
|
518 |
|
|
519 |
|
|
520 |
@Override |
|
521 |
public double getCartographicSize(ViewPort viewPort, double dpi, Geometry geom) { |
|
522 |
GeometryType geomType = geom.getGeometryType(); |
|
523 |
if( geomType.isTypeOf(Geometry.TYPES.POINT) ) { |
|
524 |
return CartographicSupportToolkit.getCartographicLength( |
|
525 |
marker, getSize(), viewPort, dpi |
|
526 |
); |
|
527 |
|
|
528 |
} else if( geomType.isTypeOf(Geometry.TYPES.CURVE) ) { |
|
529 |
return CartographicSupportToolkit.getCartographicLength( |
|
530 |
line, getSize(), viewPort, dpi |
|
531 |
); |
|
532 |
|
|
533 |
} else if( geomType.isTypeOf(Geometry.TYPES.SURFACE) ) { |
|
534 |
LOG.warn("Cartographic size does not have any sense for fill symbols"); |
|
535 |
|
|
536 |
} |
|
537 |
return -1; |
|
538 |
} |
|
539 |
|
|
540 |
@Override |
|
541 | 477 |
public IMarkerSymbol getMarkerSymbol() { |
542 | 478 |
return marker; |
543 | 479 |
} |
... | ... | |
636 | 572 |
state.set(FIELD_LINE, getLineSymbol()); |
637 | 573 |
} |
638 | 574 |
|
639 |
// @Override |
|
640 |
// public String getOffsetXExpression() { |
|
641 |
// return marker.getOffsetXExpression(); |
|
642 |
// } |
|
643 |
// |
|
644 |
// @Override |
|
645 |
// public void setOffsetXExpression(String offsetXExpression) { |
|
646 |
// marker.setOffsetXExpression(offsetXExpression); |
|
647 |
// } |
|
648 |
// |
|
649 |
// @Override |
|
650 |
// public String getOffsetYExpression() { |
|
651 |
// return marker.getOffsetYExpression(); |
|
652 |
// } |
|
653 |
// |
|
654 |
// @Override |
|
655 |
// public void setOffsetYExpression(String offsetYExpression) { |
|
656 |
// marker.setOffsetYExpression(offsetYExpression); |
|
657 |
// } |
|
658 |
// |
|
659 |
// @Override |
|
660 |
// public String getRotationExpression() { |
|
661 |
// return marker.getRotationExpression(); |
|
662 |
// } |
|
663 |
// |
|
664 |
// @Override |
|
665 |
// public void setRotationExpression(String rotationExpression) { |
|
666 |
// marker.setRotationExpression(rotationExpression); |
|
667 |
// } |
|
668 |
// |
|
669 |
// @Override |
|
670 |
// public Color getLineToOffsetColor() { |
|
671 |
// return marker.getLineToOffsetColor(); |
|
672 |
// } |
|
673 |
// |
|
674 |
// @Override |
|
675 |
// public Color getLineToOffsetColor(Feature f) { |
|
676 |
// return marker.getLineToOffsetColor(f); |
|
677 |
// } |
|
678 |
// |
|
679 |
// @Override |
|
680 |
// public String getLineToOffsetColorExpression() { |
|
681 |
// return marker.getLineToOffsetColorExpression(); |
|
682 |
// } |
|
683 |
// |
|
684 |
// @Override |
|
685 |
// public void setLineToOffsetColorExpression(String lineToOffsetColorExpression) { |
|
686 |
// marker.setLineToOffsetColorExpression(lineToOffsetColorExpression); |
|
687 |
// } |
|
688 |
// |
|
689 |
// @Override |
|
690 |
// public void setLineToOffsetColor(Color lineToOffsetColor) { |
|
691 |
// marker.setLineToOffsetColor(lineToOffsetColor); |
|
692 |
// } |
|
693 |
// |
|
694 |
// @Override |
|
695 |
// public boolean isDrawLineToOffset() { |
|
696 |
// return marker.isDrawLineToOffset(); |
|
697 |
// } |
|
698 |
// |
|
699 |
// @Override |
|
700 |
// public boolean isDrawLineToOffset(Feature f) { |
|
701 |
// return marker.isDrawLineToOffset(f); |
|
702 |
// } |
|
703 |
// |
|
704 |
// @Override |
|
705 |
// public void setDrawLineToOffset(boolean drawLineToOffset) { |
|
706 |
// marker.setDrawLineToOffset(drawLineToOffset); |
|
707 |
// } |
|
708 |
|
|
709 | 575 |
public static class RegisterPersistence implements Callable { |
710 | 576 |
|
711 | 577 |
@Override |
... | ... | |
747 | 613 |
); |
748 | 614 |
return Boolean.TRUE; |
749 | 615 |
} |
750 |
|
|
751 | 616 |
} |
752 |
|
|
753 | 617 |
} |
Also available in: Unified diff