Revision 42646 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/line/impl/AbstractLineSymbol.java
AbstractLineSymbol.java | ||
---|---|---|
73 | 73 |
|
74 | 74 |
public static final String LINE_SYMBOL_PERSISTENCE_DEFINITION_NAME = "LineSymbol"; |
75 | 75 |
|
76 |
|
|
76 |
|
|
77 | 77 |
private static final GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
78 | 78 |
private Color color; |
79 | 79 |
private ILineStyle lineStyle = new SimpleLineStyle(); |
... | ... | |
93 | 93 |
public void setLineColor(Color color) { |
94 | 94 |
this.color = color; |
95 | 95 |
} |
96 |
|
|
96 |
|
|
97 | 97 |
public void setColor(Color color) { |
98 | 98 |
setLineColor(color); |
99 | 99 |
} |
... | ... | |
117 | 117 |
switch(geom.getType()) { |
118 | 118 |
case Geometry.TYPES.CURVE: |
119 | 119 |
case Geometry.TYPES.ARC: |
120 |
case Geometry.TYPES.LINE: |
|
120 | 121 |
return true; |
121 | 122 |
} |
122 | 123 |
return false; |
... | ... | |
148 | 149 |
|
149 | 150 |
GeneralPathX gpx = new GeneralPathX(); |
150 | 151 |
gpx.moveTo(r.x + hPos, r.y + r.height-vPos); |
151 |
|
|
152 |
|
|
152 | 153 |
boolean hasDecorator = (getLineStyle().getArrowDecorator() != null); |
153 | 154 |
boolean hasPictureDeco = hasDecorator && |
154 | 155 |
getLineStyle().getArrowDecorator().getMarker() instanceof IPictureMarkerSymbol; |
... | ... | |
164 | 165 |
} else { |
165 | 166 |
gpx.lineTo(r.x + hPos + splitHSize, (swap ? vPos : r.height-vPos) + r.y); |
166 | 167 |
} |
167 |
|
|
168 |
|
|
168 | 169 |
hPos += splitHSize; |
169 | 170 |
} |
170 | 171 |
|
171 |
|
|
172 |
|
|
172 | 173 |
double old_deco_size = 0; |
173 | 174 |
if (hasDecorator) { |
174 | 175 |
old_deco_size = getLineStyle().getArrowDecorator().getMarker().getSize(); |
... | ... | |
186 | 187 |
} catch (Exception e) { |
187 | 188 |
throw new SymbolDrawingException(SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS); |
188 | 189 |
} |
189 |
|
|
190 |
|
|
190 | 191 |
if (hasDecorator) { |
191 | 192 |
getLineStyle().getArrowDecorator().getMarker().setSize(old_deco_size); |
192 | 193 |
} |
... | ... | |
197 | 198 |
|
198 | 199 |
public void setCartographicSize(double cartographicSize, Geometry geom) { |
199 | 200 |
float currw = this.getLineStyle().getLineWidth(); |
200 |
double ratio = cartographicSize / currw;
|
|
201 |
|
|
201 |
double ratio = cartographicSize / currw; |
|
202 |
|
|
202 | 203 |
getLineStyle().setLineWidth((float) cartographicSize); |
203 |
|
|
204 |
|
|
204 | 205 |
if (getLineStyle().getArrowDecorator() != null) { |
205 | 206 |
double marker_size = getLineStyle().getArrowDecorator().getMarker().getSize(); |
206 |
marker_size = marker_size * ratio;
|
|
207 |
marker_size = marker_size * ratio; |
|
207 | 208 |
getLineStyle().getArrowDecorator().getMarker().setSize(marker_size); |
208 | 209 |
} |
209 | 210 |
} |
... | ... | |
366 | 367 |
draw(g,at,geom,null, null); |
367 | 368 |
setLineWidth(originalSize); |
368 | 369 |
} |
369 |
|
|
370 |
|
|
370 | 371 |
public Object clone() throws CloneNotSupportedException { |
371 | 372 |
AbstractLineSymbol copy = (AbstractLineSymbol) super.clone(); |
372 |
|
|
373 |
|
|
373 | 374 |
// Clone the line style |
374 | 375 |
if (lineStyle != null) { |
375 | 376 |
copy.lineStyle = (ILineStyle) lineStyle.clone(); |
376 | 377 |
} |
377 |
|
|
378 |
|
|
378 | 379 |
return copy; |
379 | 380 |
} |
380 | 381 |
|
381 |
|
|
382 |
|
|
382 | 383 |
public void loadFromState(PersistentState state) |
383 | 384 |
throws PersistenceException { |
384 | 385 |
// Set parent symbol properties |
... | ... | |
405 | 406 |
AbstractLineSymbol.class, |
406 | 407 |
LINE_SYMBOL_PERSISTENCE_DEFINITION_NAME, |
407 | 408 |
LINE_SYMBOL_PERSISTENCE_DEFINITION_NAME+" Persistence definition", |
408 |
null,
|
|
409 |
null, |
|
409 | 410 |
null |
410 | 411 |
); |
411 | 412 |
|
... | ... | |
419 | 420 |
} |
420 | 421 |
return Boolean.TRUE; |
421 | 422 |
} |
422 |
|
|
423 |
|
|
423 | 424 |
} |
424 |
|
|
425 |
|
|
425 |
|
|
426 |
|
|
426 | 427 |
} |
Also available in: Unified diff