Revision 45529 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/marker/impl/AbstractMarkerSymbol.java
AbstractMarkerSymbol.java | ||
---|---|---|
97 | 97 |
private String lineToOffsetColorExpression; |
98 | 98 |
|
99 | 99 |
private transient org.gvsig.fmap.geom.primitive.Point point; |
100 |
private transient ViewPort viewPort; |
|
101 |
private transient double dpi; |
|
100 | 102 |
|
101 | 103 |
public AbstractMarkerSymbol() { |
102 | 104 |
super(); |
... | ... | |
231 | 233 |
if( f == null ) { |
232 | 234 |
f = this.getFeature(); |
233 | 235 |
} |
236 |
Point2D p; |
|
234 | 237 |
if( f==null || StringUtils.isBlank(this.offsetXExpression) || StringUtils.isBlank(this.offsetYExpression) ) { |
235 |
return this.getOffset(); |
|
238 |
p = this.getOffset(); |
|
239 |
p = new Point2D.Double( |
|
240 |
toCartographicUnits(p.getX()), |
|
241 |
toCartographicUnits(p.getY()) |
|
242 |
); |
|
243 |
} else { |
|
244 |
double offsetX = toCartographicUnits(ExpressionUtils.parseDouble( |
|
245 |
this.getSymbolTable(f), |
|
246 |
offsetXExpression, |
|
247 |
(int) this.getOffset().getX() |
|
248 |
)); |
|
249 |
double offsetY = toCartographicUnits(ExpressionUtils.parseDouble( |
|
250 |
this.getSymbolTable(f), |
|
251 |
offsetYExpression, |
|
252 |
(int) this.getOffset().getY() |
|
253 |
)); |
|
254 |
p = new Point2D.Double(offsetX, offsetY); |
|
236 | 255 |
} |
237 |
int offsetX = ExpressionUtils.parseInt( |
|
238 |
this.getSymbolTable(f), |
|
239 |
offsetXExpression, |
|
240 |
(int) this.getOffset().getX() |
|
241 |
); |
|
242 |
int offsetY = ExpressionUtils.parseInt( |
|
243 |
this.getSymbolTable(f), |
|
244 |
offsetYExpression, |
|
245 |
(int) this.getOffset().getY() |
|
246 |
); |
|
247 |
Point p = new Point(offsetX, offsetY); |
|
248 | 256 |
return p; |
249 | 257 |
} |
250 | 258 |
|
... | ... | |
303 | 311 |
double sz = ExpressionUtils.parseDouble( |
304 | 312 |
this.getSymbolTable(f), |
305 | 313 |
this.sizeExpression, |
306 |
this.getSize()
|
|
314 |
-1
|
|
307 | 315 |
); |
308 |
return sz; |
|
316 |
if(sz<0){ |
|
317 |
return this.getSize(); |
|
318 |
} |
|
319 |
return toCartographicUnits(sz); |
|
309 | 320 |
} |
310 | 321 |
|
311 | 322 |
@Override |
... | ... | |
422 | 433 |
} |
423 | 434 |
|
424 | 435 |
} catch (Exception e) { |
425 |
throw new SymbolDrawingException(TYPES.POINT); |
|
436 |
SymbolDrawingException sde = new SymbolDrawingException(TYPES.POINT); |
|
437 |
sde.initCause(e); |
|
438 |
throw sde; |
|
426 | 439 |
} |
427 | 440 |
} |
428 | 441 |
|
... | ... | |
438 | 451 |
|
439 | 452 |
@Override |
440 | 453 |
public double toCartographicSize(ViewPort viewPort, double dpi, Geometry geom) { |
441 |
double oldSize = getEfectiveSize(getFeature()); |
|
454 |
this.viewPort = viewPort; |
|
455 |
this.dpi = dpi; |
|
456 |
|
|
457 |
double oldSize = getSize(); |
|
442 | 458 |
setCartographicSize(getCartographicSize( |
443 | 459 |
viewPort, |
444 | 460 |
dpi, |
... | ... | |
455 | 471 |
viewPort, |
456 | 472 |
dpi); |
457 | 473 |
} |
474 |
|
|
475 |
private double toCartographicUnits(double value){ |
|
476 |
if(viewPort == null){ |
|
477 |
return value; |
|
478 |
} |
|
479 |
return CartographicSupportToolkit. |
|
480 |
getCartographicLength(this, |
|
481 |
value, |
|
482 |
viewPort, |
|
483 |
dpi); |
|
484 |
} |
|
458 | 485 |
|
459 | 486 |
@Override |
460 | 487 |
public Object clone() throws CloneNotSupportedException { |
Also available in: Unified diff