svn-gvsig-desktop / branches / v02_desarrollo / libraries / sld / temp / org.gvsig.sldsupport.lib.impl / src / main / java / org / gvsig / sldsupport / impl / sld1_0_0 / parsing / symbol / PointSymbolElement.java @ 40794
History | View | Annotate | Download (1.83 KB)
1 |
package org.gvsig.sldsupport.impl.sld1_0_0.parsing.symbol; |
---|---|
2 |
|
3 |
import java.io.IOException; |
4 |
|
5 |
import org.gvsig.sldsupport.exception.SLDReadException; |
6 |
import org.gvsig.sldsupport.impl.sld1_0_0.parsing.expression.ExpressionElement; |
7 |
import org.gvsig.sldsupport.impl.util.SLDUtils; |
8 |
import org.gvsig.sldsupport.sld.SLDTags; |
9 |
import org.gvsig.sldsupport.sld.extent.SLDExtent; |
10 |
import org.gvsig.sldsupport.sld.filter.expression.SLDExpression; |
11 |
import org.gvsig.sldsupport.sld.filter.expression.operator.SLDLiteral; |
12 |
import org.gvsig.sldsupport.sld.symbol.misc.SLDParameterValue; |
13 |
import org.gvsig.sldsupport.sld.symbol.misc.SLDSvgCssParameter; |
14 |
import org.kxml2.io.KXmlParser; |
15 |
import org.xmlpull.v1.XmlPullParser; |
16 |
import org.xmlpull.v1.XmlPullParserException; |
17 |
|
18 |
/**
|
19 |
* Used to parse a parameter value inside another entity
|
20 |
*
|
21 |
* @author jldominguez
|
22 |
*
|
23 |
*/
|
24 |
public class PointSymbolElement { |
25 |
|
26 |
public static SLDParameterValue parse(XmlPullParser parser , String version) |
27 |
throws XmlPullParserException, IOException, SLDReadException { |
28 |
|
29 |
String ent_name = parser.getName();
|
30 |
SLDParameterValue resp = new SLDParameterValue();
|
31 |
|
32 |
int tag = 0; |
33 |
tag = parser.next(); |
34 |
if (tag == KXmlParser.TEXT) {
|
35 |
SLDLiteral lit = new SLDLiteral();
|
36 |
lit.setValue(parser.getText()); |
37 |
parser.next(); // move to closing tag
|
38 |
parser.next(); // move to next entity
|
39 |
resp.setExpression(lit); |
40 |
return resp;
|
41 |
} |
42 |
|
43 |
/*
|
44 |
* If not raw literal, parse the expression
|
45 |
*/
|
46 |
|
47 |
SLDExpression expre = null;
|
48 |
String name = parser.getName();
|
49 |
while (!(SLDUtils.isStr(name, ent_name) && tag == KXmlParser.END_TAG)) {
|
50 |
expre = ExpressionElement.parse(parser, version); |
51 |
resp.setExpression(expre); |
52 |
// =========== Get current values
|
53 |
tag = parser.getEventType(); |
54 |
name = parser.getName(); |
55 |
} |
56 |
parser.next(); |
57 |
return resp;
|
58 |
} |
59 |
} |