svn-gvsig-desktop / branches / v02_desarrollo / libraries / sld / using-sld-model / org.gvsig.sldsupport / org.gvsig.sldsupport.lib / org.gvsig.sldsupport.lib.api / src / main / java / org / gvsig / sldsupport / filterencoding / FIsBetweenOperator.java @ 40758
History | View | Annotate | Download (4.08 KB)
1 |
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib��ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package org.gvsig.sldsupport.filterencoding; |
42 |
|
43 |
import java.io.IOException; |
44 |
|
45 |
import org.gvsig.sldsupport.exception.SLDReadException; |
46 |
import org.xmlpull.v1.XmlPullParser; |
47 |
import org.xmlpull.v1.XmlPullParserException; |
48 |
|
49 |
/**
|
50 |
* Implements the main functionalities to parse an PropertyIsBetween element
|
51 |
* of a Filter Encoding expression<br>
|
52 |
*
|
53 |
* The IsBetween property is defined as a compact way of encoding a range
|
54 |
* check
|
55 |
*
|
56 |
* @see http://www.opengeospatial.org/standards/filter
|
57 |
* @author pepe vidal salvador - jose.vidal.salvador@iver.es
|
58 |
*/
|
59 |
public class FIsBetweenOperator { |
60 |
|
61 |
protected FExpression lowerBoundary;
|
62 |
protected FExpression upperBoundary;
|
63 |
protected FExpression insideExpression;
|
64 |
|
65 |
protected String loExpressionStr; |
66 |
protected String upExpressionStr; |
67 |
protected String inExpressionStr; |
68 |
|
69 |
|
70 |
|
71 |
|
72 |
public void parse(XmlPullParser parser, int Tag2, String expressionType) |
73 |
throws XmlPullParserException, IOException, SLDReadException { |
74 |
|
75 |
int currentTag;
|
76 |
boolean end = false; |
77 |
currentTag = Tag2; |
78 |
|
79 |
parser.require(XmlPullParser.START_TAG, null, FilterTags.PROPERTYISBETWEEN);
|
80 |
|
81 |
while (!end)
|
82 |
{ |
83 |
switch(currentTag)
|
84 |
{ |
85 |
case XmlPullParser.START_TAG:
|
86 |
if (parser.getName().compareTo(FilterTags.LOWER_BOUNDARY)!= 0 && |
87 |
parser.getName().compareTo(FilterTags.UPPER_BOUNDARY)!= 0 &&
|
88 |
end == false) {
|
89 |
insideExpression = new FExpression();
|
90 |
inExpressionStr = "( ";
|
91 |
insideExpression.parse(parser, currentTag, parser.getName()); |
92 |
|
93 |
inExpressionStr += insideExpression.getExpressionStr(); |
94 |
inExpressionStr += ") ";
|
95 |
} |
96 |
if (parser.getName().compareTo(FilterTags.LOWER_BOUNDARY)==0) { |
97 |
lowerBoundary = new FExpression();
|
98 |
loExpressionStr = "( ";
|
99 |
lowerBoundary.parse(parser, currentTag, parser.getName()); |
100 |
|
101 |
loExpressionStr += lowerBoundary.getExpressionStr(); |
102 |
loExpressionStr += ") ";
|
103 |
} |
104 |
else if (parser.getName().compareTo(FilterTags.UPPER_BOUNDARY)==0) { |
105 |
upperBoundary = new FExpression();
|
106 |
upExpressionStr = "( ";
|
107 |
upperBoundary.parse(parser, currentTag, parser.getName()); |
108 |
|
109 |
upExpressionStr += upperBoundary.getExpressionStr(); |
110 |
upExpressionStr += ") ";
|
111 |
} |
112 |
break;
|
113 |
case XmlPullParser.END_TAG:
|
114 |
if (parser.getName().compareTo(FilterUtils.remNameSpace(FilterTags.PROPERTYISBETWEEN)) == 0) |
115 |
end = true;
|
116 |
break;
|
117 |
case XmlPullParser.TEXT:
|
118 |
break;
|
119 |
} |
120 |
if (!end)
|
121 |
currentTag = parser.next(); |
122 |
} |
123 |
|
124 |
|
125 |
} |
126 |
|
127 |
public FExpression getLowerBoundary() {return lowerBoundary;} |
128 |
public FExpression getUpperBoundary() {return upperBoundary;} |
129 |
public FExpression getInsideExpression() {return insideExpression;} |
130 |
|
131 |
public String getLoExpressionStr() {return loExpressionStr;} |
132 |
public String getUpExpressionStr() {return upExpressionStr;} |
133 |
public String getInExpressionStr() {return inExpressionStr;} |
134 |
|
135 |
} |