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 / comparison / IsBetweenComparisonElement.java @ 40794
History | View | Annotate | Download (2.33 KB)
1 |
package org.gvsig.sldsupport.impl.sld1_0_0.parsing.filteroperator.comparison; |
---|---|
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.sld1_0_0.parsing.filteroperator.spatial.EnvelopeElement; |
8 |
import org.gvsig.sldsupport.impl.util.SLDUtils; |
9 |
import org.gvsig.sldsupport.sld.filter.FilterTags; |
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.filter.operator.comparison.SLDIsBetweenOperator; |
13 |
import org.gvsig.sldsupport.sld.filter.operator.comparison.SLDIsLikeOperator; |
14 |
import org.gvsig.sldsupport.sld.filter.operator.spatial.GMLEnvelope; |
15 |
import org.gvsig.sldsupport.sld.filter.operator.spatial.SLDBBoxOperator; |
16 |
import org.kxml2.io.KXmlParser; |
17 |
import org.xmlpull.v1.XmlPullParser; |
18 |
import org.xmlpull.v1.XmlPullParserException; |
19 |
|
20 |
public class IsBetweenComparisonElement { |
21 |
|
22 |
public static SLDIsBetweenOperator parse(XmlPullParser parser , String version) |
23 |
throws XmlPullParserException, IOException, SLDReadException { |
24 |
|
25 |
parser.require(KXmlParser.START_TAG, null, FilterTags.PROPERTYISBETWEEN);
|
26 |
int tag = 0; |
27 |
|
28 |
SLDIsBetweenOperator resp = new SLDIsBetweenOperator();
|
29 |
|
30 |
tag = parser.next(); |
31 |
String name = parser.getName();
|
32 |
SLDExpression expre = null;
|
33 |
|
34 |
String txt = null; |
35 |
while (!(SLDUtils.isStr(name, FilterTags.PROPERTYISBETWEEN)
|
36 |
&& tag == KXmlParser.END_TAG)) { |
37 |
|
38 |
switch (tag) {
|
39 |
case KXmlParser.START_TAG:
|
40 |
if (SLDUtils.isStr(name, FilterTags.LOWER_BOUNDARY)) {
|
41 |
parser.next(); |
42 |
expre = ExpressionElement.parse(parser, version); |
43 |
resp.setLowerBoundary(expre); |
44 |
break;
|
45 |
} |
46 |
if (SLDUtils.isStr(name, FilterTags.UPPER_BOUNDARY)) {
|
47 |
parser.next(); |
48 |
expre = ExpressionElement.parse(parser, version); |
49 |
resp.setUpperBoundary(expre); |
50 |
break;
|
51 |
} |
52 |
/*
|
53 |
* Not lower or upper, it has to be an expression
|
54 |
*/
|
55 |
expre = ExpressionElement.parse(parser, version); |
56 |
resp.setExpression(expre); |
57 |
|
58 |
break;
|
59 |
case KXmlParser.END_TAG:
|
60 |
break;
|
61 |
case KXmlParser.TEXT:
|
62 |
break;
|
63 |
} |
64 |
tag = parser.next(); |
65 |
name = parser.getName(); |
66 |
} |
67 |
|
68 |
parser.next(); |
69 |
return resp;
|
70 |
} |
71 |
} |