root / trunk / extensions / extSymbology / src / org / gvsig / remoteClient / sld / filterEncoding / FIsBetweenOperator.java @ 20768
History | View | Annotate | Download (4.13 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.remoteClient.sld.filterEncoding; |
42 |
|
43 |
import java.io.IOException; |
44 |
|
45 |
import org.gvsig.remoteClient.gml.schemas.XMLSchemaParser; |
46 |
import org.xmlpull.v1.XmlPullParserException; |
47 |
|
48 |
import com.iver.cit.gvsig.fmap.drivers.legend.LegendDriverException; |
49 |
|
50 |
/**
|
51 |
* Implements the main functionalities to parse an PropertyIsBetween element
|
52 |
* of a Filter Encoding expression<br>
|
53 |
*
|
54 |
* The IsBetween property is defined as a compact way of encoding a range
|
55 |
* check
|
56 |
*
|
57 |
* @see http://www.opengeospatial.org/standards/filter
|
58 |
* @author pepe vidal salvador - jose.vidal.salvador@iver.es
|
59 |
*/
|
60 |
public class FIsBetweenOperator { |
61 |
|
62 |
protected FExpression lowerBoundary;
|
63 |
protected FExpression upperBoundary;
|
64 |
protected FExpression insideExpression;
|
65 |
|
66 |
protected String loExpressionStr; |
67 |
protected String upExpressionStr; |
68 |
protected String inExpressionStr; |
69 |
|
70 |
|
71 |
|
72 |
|
73 |
public void parse(XMLSchemaParser parser, int Tag2, String expressionType) throws XmlPullParserException, IOException, LegendDriverException { |
74 |
int currentTag;
|
75 |
boolean end = false; |
76 |
currentTag = Tag2; |
77 |
|
78 |
parser.require(XMLSchemaParser.START_TAG, null, FilterTags.PROPERTYISBETWEEN);
|
79 |
|
80 |
while (!end)
|
81 |
{ |
82 |
switch(currentTag)
|
83 |
{ |
84 |
case XMLSchemaParser.START_TAG:
|
85 |
if (parser.getName().compareTo(FilterTags.LOWER_BOUNDARY)!= 0 && |
86 |
parser.getName().compareTo(FilterTags.UPPER_BOUNDARY)!= 0 &&
|
87 |
end == false) {
|
88 |
insideExpression = new FExpression();
|
89 |
inExpressionStr = "( ";
|
90 |
insideExpression.parse(parser, currentTag, parser.getName()); |
91 |
|
92 |
inExpressionStr += insideExpression.getExpressionStr(); |
93 |
inExpressionStr += ") ";
|
94 |
} |
95 |
if (parser.getName().compareTo(FilterTags.LOWER_BOUNDARY)==0) { |
96 |
lowerBoundary = new FExpression();
|
97 |
loExpressionStr = "( ";
|
98 |
lowerBoundary.parse(parser, currentTag, parser.getName()); |
99 |
|
100 |
loExpressionStr += lowerBoundary.getExpressionStr(); |
101 |
loExpressionStr += ") ";
|
102 |
} |
103 |
else if (parser.getName().compareTo(FilterTags.UPPER_BOUNDARY)==0) { |
104 |
upperBoundary = new FExpression();
|
105 |
upExpressionStr = "( ";
|
106 |
upperBoundary.parse(parser, currentTag, parser.getName()); |
107 |
|
108 |
upExpressionStr += upperBoundary.getExpressionStr(); |
109 |
upExpressionStr += ") ";
|
110 |
} |
111 |
break;
|
112 |
case XMLSchemaParser.END_TAG:
|
113 |
if (parser.getName().compareTo(FilterUtils.remNameSpace(FilterTags.PROPERTYISBETWEEN)) == 0) |
114 |
end = true;
|
115 |
break;
|
116 |
case XMLSchemaParser.TEXT:
|
117 |
break;
|
118 |
} |
119 |
if (!end)
|
120 |
currentTag = parser.next(); |
121 |
} |
122 |
|
123 |
|
124 |
} |
125 |
|
126 |
public FExpression getLowerBoundary() {return lowerBoundary;} |
127 |
public FExpression getUpperBoundary() {return upperBoundary;} |
128 |
public FExpression getInsideExpression() {return insideExpression;} |
129 |
|
130 |
public String getLoExpressionStr() {return loExpressionStr;} |
131 |
public String getUpExpressionStr() {return upExpressionStr;} |
132 |
public String getInExpressionStr() {return inExpressionStr;} |
133 |
|
134 |
} |