svn-gvsig-desktop / branches / v02_desarrollo / libraries / sld / temp / org.gvsig.sldconverter / org.gvsig.sldconverter.lib / org.gvsig.sldconverter.lib.impl / src / main / java / org / gvsig / sldconverter / impl / symbol / LineSymbolUtils.java @ 40864
History | View | Annotate | Download (1.44 KB)
1 |
package org.gvsig.sldconverter.impl.symbol; |
---|---|
2 |
|
3 |
import java.awt.Color; |
4 |
|
5 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
6 |
import org.gvsig.sldconverter.exception.UnsupportedSymbolException; |
7 |
import org.gvsig.sldconverter.impl.util.BasicUtils; |
8 |
import org.gvsig.sldsupport.exception.UnsupportedSLDObjectException; |
9 |
import org.gvsig.sldsupport.sld.filter.expression.operator.SLDLiteral; |
10 |
import org.gvsig.sldsupport.sld.symbol.SLDLineSymbol; |
11 |
import org.gvsig.sldsupport.sld.symbol.misc.SLDStroke; |
12 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.ILineSymbol; |
13 |
|
14 |
public class LineSymbolUtils { |
15 |
|
16 |
public static ISymbol toLineSymbol(SLDLineSymbol sym) |
17 |
throws UnsupportedSLDObjectException {
|
18 |
|
19 |
ILineSymbol resp = BasicUtils.symMan().createSimpleLineSymbol(); |
20 |
SLDStroke stro = sym.getStroke(); |
21 |
|
22 |
Color col = BasicUtils.toColor(stro.getColor());
|
23 |
if (col != null) { |
24 |
resp.setColor(col); |
25 |
} |
26 |
Double wi = BasicUtils.toDouble(stro.getWidth());
|
27 |
if (wi != null) { |
28 |
resp.setLineWidth(wi); |
29 |
} |
30 |
return resp;
|
31 |
} |
32 |
|
33 |
|
34 |
public static SLDLineSymbol toSLDLineSymbol(ILineSymbol sym) |
35 |
throws UnsupportedSymbolException {
|
36 |
|
37 |
Color bcolor = sym.getColor();
|
38 |
double bw = sym.getLineWidth();
|
39 |
|
40 |
SLDStroke stro = new SLDStroke();
|
41 |
stro.setColor(bcolor); |
42 |
stro.setWidth(new SLDLiteral(BasicUtils.df.format(bw)));
|
43 |
|
44 |
SLDLineSymbol resp = new SLDLineSymbol();
|
45 |
resp.setStroke(stro); |
46 |
return resp;
|
47 |
} |
48 |
|
49 |
|
50 |
} |