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 / filteroperator / spatial / BinarySpatialOperatorElement.java @ 40794
History | View | Annotate | Download (1.69 KB)
1 |
package org.gvsig.sldsupport.impl.sld1_0_0.parsing.filteroperator.spatial; |
---|---|
2 |
|
3 |
import java.io.IOException; |
4 |
|
5 |
import org.gvsig.sldsupport.exception.SLDReadException; |
6 |
import org.gvsig.sldsupport.impl.util.SLDUtils; |
7 |
import org.gvsig.sldsupport.sld.filter.FilterTags; |
8 |
import org.gvsig.sldsupport.sld.filter.operator.spatial.GMLEnvelope; |
9 |
import org.gvsig.sldsupport.sld.filter.operator.spatial.SLDBinarySpatialOperator; |
10 |
import org.kxml2.io.KXmlParser; |
11 |
import org.xmlpull.v1.XmlPullParser; |
12 |
import org.xmlpull.v1.XmlPullParserException; |
13 |
|
14 |
public class BinarySpatialOperatorElement { |
15 |
|
16 |
public static SLDBinarySpatialOperator parse(XmlPullParser parser , String version) |
17 |
throws XmlPullParserException, IOException, SLDReadException { |
18 |
|
19 |
SLDBinarySpatialOperator resp = new SLDBinarySpatialOperator();
|
20 |
String txt = parser.getName();
|
21 |
resp.setOperatorName(txt); |
22 |
|
23 |
int tag = 0; |
24 |
tag = parser.next(); |
25 |
String name = parser.getName();
|
26 |
|
27 |
while (!(SLDUtils.isStr(name, resp.getOperatorName()) &&
|
28 |
tag == KXmlParser.END_TAG)) { |
29 |
|
30 |
switch (tag) {
|
31 |
case KXmlParser.START_TAG:
|
32 |
if (SLDUtils.isStr(name, FilterTags.PROPERTYNAME)) {
|
33 |
txt = parser.nextText(); |
34 |
resp.setPropertyName(txt); |
35 |
break;
|
36 |
} |
37 |
if (SLDUtils.isStr(name, FilterTags.ENVELOPE)) {
|
38 |
GMLEnvelope env = EnvelopeElement.parse(parser, version); |
39 |
resp.setIsGeometry(false);
|
40 |
resp.setLiteral(env.getWKT()); |
41 |
break;
|
42 |
} |
43 |
/*
|
44 |
* TODO GML geometries not supported, only envelope
|
45 |
*/
|
46 |
break;
|
47 |
case KXmlParser.END_TAG:
|
48 |
break;
|
49 |
case KXmlParser.TEXT:
|
50 |
break;
|
51 |
} |
52 |
tag = parser.next(); |
53 |
} |
54 |
|
55 |
parser.next(); |
56 |
name = parser.getName(); |
57 |
return resp;
|
58 |
} |
59 |
} |