Revision 730
org.gvsig.sld/tags/org.gvsig.sld-2.0.137/org.gvsig.sldsupport/org.gvsig.sldsupport.lib/org.gvsig.sldsupport.lib.impl/src/test/resources/README.txt | ||
---|---|---|
1 |
Put into this folder the resources needed by your test classes. |
|
2 |
|
|
3 |
This folder is added to the Tests classpath, so you can load any resources |
|
4 |
through the ClassLoader. |
|
5 |
|
|
6 |
By default, in this folder you can find an example of log4j configuration, |
|
7 |
prepared to log messages through the console, so logging works when you |
|
8 |
run your tests classes. |
org.gvsig.sld/tags/org.gvsig.sld-2.0.137/org.gvsig.sldsupport/org.gvsig.sldsupport.lib/org.gvsig.sldsupport.lib.impl/src/test/resources/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1" ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2013 gvSIG Association. |
|
7 |
|
|
8 |
This program is free software; you can redistribute it and/or |
|
9 |
modify it under the terms of the GNU General Public License |
|
10 |
as published by the Free Software Foundation; either version 3 |
|
11 |
of the License, or (at your option) any later version. |
|
12 |
|
|
13 |
This program is distributed in the hope that it will be useful, |
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
GNU General Public License for more details. |
|
17 |
|
|
18 |
You should have received a copy of the GNU General Public License |
|
19 |
along with this program; if not, write to the Free Software |
|
20 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
21 |
MA 02110-1301, USA. |
|
22 |
|
|
23 |
For any additional information, do not hesitate to contact us |
|
24 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
25 |
|
|
26 |
--> |
|
27 |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> |
|
28 |
|
|
29 |
<!-- |
|
30 |
Log4J configuration file for unit tests execution. |
|
31 |
--> |
|
32 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
33 |
|
|
34 |
<!-- Appender configuration to show logging messages through the console --> |
|
35 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
36 |
<layout class="org.apache.log4j.PatternLayout"> |
|
37 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n %m%n" /> |
|
38 |
</layout> |
|
39 |
</appender> |
|
40 |
|
|
41 |
<!-- |
|
42 |
Activate logging messages of DEBUG level of higher only for the |
|
43 |
org.gvsig.tools packages. |
|
44 |
You can put full classes names or packages instead, to configure |
|
45 |
logging for all the classes and subpackages of the package. |
|
46 |
--> |
|
47 |
<category name="org.gvsig.tools"> |
|
48 |
<priority value="DEBUG" /> |
|
49 |
</category> |
|
50 |
<category name="org.gvsig.symbology"> |
|
51 |
<priority value="DEBUG" /> |
|
52 |
</category> |
|
53 |
|
|
54 |
<!-- |
|
55 |
By default, show only logging messages of INFO level or higher, |
|
56 |
through the previously configured CONSOLE appender. |
|
57 |
--> |
|
58 |
<root> |
|
59 |
<priority value="INFO" /> |
|
60 |
<appender-ref ref="CONSOLE" /> |
|
61 |
</root> |
|
62 |
</log4j:configuration> |
org.gvsig.sld/tags/org.gvsig.sld-2.0.137/org.gvsig.sldsupport/org.gvsig.sldsupport.lib/org.gvsig.sldsupport.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.sldsupport.impl.SLDSupportDefaultLibrary |
org.gvsig.sld/tags/org.gvsig.sld-2.0.137/org.gvsig.sldsupport/org.gvsig.sldsupport.lib/org.gvsig.sldsupport.lib.impl/src/main/java/org/gvsig/sldsupport/impl/reader/DefaultSLDReaderFactory.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.sldsupport.impl.reader; |
|
27 |
|
|
28 |
import org.gvsig.sldsupport.reader.SLDReader; |
|
29 |
import org.gvsig.sldsupport.reader.SLDReaderFactory; |
|
30 |
|
|
31 |
public class DefaultSLDReaderFactory implements SLDReaderFactory { |
|
32 |
|
|
33 |
private String version = null; |
|
34 |
|
|
35 |
public DefaultSLDReaderFactory(String v) { |
|
36 |
version = v; |
|
37 |
} |
|
38 |
|
|
39 |
public String getVersion() { |
|
40 |
return version; |
|
41 |
} |
|
42 |
|
|
43 |
public SLDReader create() { |
|
44 |
return new DefaultSLDReader(version); |
|
45 |
} |
|
46 |
|
|
47 |
} |
org.gvsig.sld/tags/org.gvsig.sld-2.0.137/org.gvsig.sldsupport/org.gvsig.sldsupport.lib/org.gvsig.sldsupport.lib.impl/src/main/java/org/gvsig/sldsupport/impl/reader/DefaultSLDReader.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.sldsupport.impl.reader; |
|
27 |
|
|
28 |
import java.io.IOException; |
|
29 |
import java.io.InputStream; |
|
30 |
|
|
31 |
import org.xmlpull.v1.XmlPullParserException; |
|
32 |
|
|
33 |
import org.gvsig.sldsupport.exception.SLDException; |
|
34 |
import org.gvsig.sldsupport.exception.SLDReadException; |
|
35 |
import org.gvsig.sldsupport.impl.sld.handler.Handler; |
|
36 |
import org.gvsig.sldsupport.reader.SLDReader; |
|
37 |
import org.gvsig.sldsupport.sld.SLDObject; |
|
38 |
|
|
39 |
public class DefaultSLDReader implements SLDReader { |
|
40 |
|
|
41 |
private String version = null; |
|
42 |
|
|
43 |
public DefaultSLDReader(String v) { |
|
44 |
version = v; |
|
45 |
} |
|
46 |
|
|
47 |
public String getVersion() { |
|
48 |
return version; |
|
49 |
} |
|
50 |
|
|
51 |
public SLDObject read(InputStream is) throws SLDException, IOException { |
|
52 |
|
|
53 |
SLDObject resp = null; |
|
54 |
try { |
|
55 |
resp = Handler.parse(is, "utf-8", version); |
|
56 |
} catch (XmlPullParserException e) { |
|
57 |
throw new SLDReadException(e.getMessage()); |
|
58 |
} |
|
59 |
return resp; |
|
60 |
} |
|
61 |
|
|
62 |
} |
org.gvsig.sld/tags/org.gvsig.sld-2.0.137/org.gvsig.sldsupport/org.gvsig.sldsupport.lib/org.gvsig.sldsupport.lib.impl/src/main/java/org/gvsig/sldsupport/impl/sld/parsing/MarkElement.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.sldsupport.impl.sld.parsing; |
|
27 |
|
|
28 |
import java.io.IOException; |
|
29 |
import java.util.ArrayList; |
|
30 |
import java.util.HashMap; |
|
31 |
import java.util.List; |
|
32 |
import java.util.Map; |
|
33 |
|
|
34 |
import org.xmlpull.v1.XmlPullParser; |
|
35 |
import org.xmlpull.v1.XmlPullParserException; |
|
36 |
|
|
37 |
import org.gvsig.sldsupport.exception.InvalidSLDObjectException; |
|
38 |
import org.gvsig.sldsupport.exception.SLDReadException; |
|
39 |
import org.gvsig.sldsupport.exception.UnsupportedSLDObjectException; |
|
40 |
import org.gvsig.sldsupport.impl.util.SLDUtils; |
|
41 |
import org.gvsig.sldsupport.impl.util.XmlBuilder; |
|
42 |
import org.gvsig.sldsupport.sld.SLDTags; |
|
43 |
import org.gvsig.sldsupport.sld.graphic.SLDMark; |
|
44 |
import org.gvsig.sldsupport.sld.symbol.misc.SLDFill; |
|
45 |
import org.gvsig.sldsupport.sld.symbol.misc.SLDStroke; |
|
46 |
|
|
47 |
public class MarkElement { |
|
48 |
|
|
49 |
public static List<String> WELL_KNOWN_NAMES = null; |
|
50 |
|
|
51 |
static { |
|
52 |
WELL_KNOWN_NAMES = new ArrayList<String>(); |
|
53 |
WELL_KNOWN_NAMES.add("square"); |
|
54 |
WELL_KNOWN_NAMES.add("circle"); |
|
55 |
WELL_KNOWN_NAMES.add("triangle"); |
|
56 |
WELL_KNOWN_NAMES.add("star"); |
|
57 |
WELL_KNOWN_NAMES.add("cross"); |
|
58 |
WELL_KNOWN_NAMES.add("x"); |
|
59 |
} |
|
60 |
|
|
61 |
public static void append(SLDMark obj, XmlBuilder xb, String version) |
|
62 |
throws InvalidSLDObjectException, UnsupportedSLDObjectException { |
|
63 |
|
|
64 |
xb.openTag(SLDTags.MARK); |
|
65 |
// =============================================================== |
|
66 |
if ((version != null) |
|
67 |
&& (version.compareToIgnoreCase(SLDUtils.VERSION_1_1_0) == 0)) { |
|
68 |
appendMarkTypev110(obj, xb); |
|
69 |
} else { |
|
70 |
appendMarkTypev100(obj, xb); |
|
71 |
} |
|
72 |
// =============== fill, stroke |
|
73 |
if (obj.getFill() != null) { |
|
74 |
FillElement.append(obj.getFill(), xb, version); |
|
75 |
} |
|
76 |
// ===== |
|
77 |
if (obj.getStroke() != null) { |
|
78 |
StrokeElement.append(obj.getStroke(), xb, version); |
|
79 |
} |
|
80 |
// =============================================================== |
|
81 |
xb.closeTag(); |
|
82 |
|
|
83 |
} |
|
84 |
|
|
85 |
private static void appendMarkTypev100(SLDMark obj, XmlBuilder xb) |
|
86 |
throws InvalidSLDObjectException, UnsupportedSLDObjectException { |
|
87 |
|
|
88 |
if (obj.getMarkType() == SLDMark.MARK_TYPE_WELL_KNOWN_NAME) { |
|
89 |
if (obj.getWellKnownName() == null) { |
|
90 |
throw new InvalidSLDObjectException(SLDTags.MARK, |
|
91 |
"No well-known name found"); |
|
92 |
} |
|
93 |
checkWellKnownName(obj.getWellKnownName()); |
|
94 |
xb.writeTag(SLDTags.WELLKNOWNNAME, obj.getWellKnownName()); |
|
95 |
} |
|
96 |
} |
|
97 |
|
|
98 |
private static void checkWellKnownName(String name) |
|
99 |
throws UnsupportedSLDObjectException { |
|
100 |
|
|
101 |
if (!WELL_KNOWN_NAMES.contains(name.toLowerCase())) { |
|
102 |
throw new UnsupportedSLDObjectException(SLDTags.MARK, |
|
103 |
"Unsupported well-known name for mark: " + name); |
|
104 |
} |
|
105 |
} |
|
106 |
|
|
107 |
private static void appendMarkTypev110(SLDMark obj, XmlBuilder xb) |
|
108 |
throws InvalidSLDObjectException, UnsupportedSLDObjectException { |
|
109 |
|
|
110 |
boolean online_inlne = false; |
|
111 |
switch (obj.getMarkType()) { |
|
112 |
case SLDMark.MARK_TYPE_WELL_KNOWN_NAME: |
|
113 |
if (obj.getWellKnownName() == null) { |
|
114 |
throw new InvalidSLDObjectException(SLDTags.MARK, |
|
115 |
"No well-known name found"); |
|
116 |
} |
|
117 |
checkWellKnownName(obj.getWellKnownName()); |
|
118 |
xb.writeTag(SLDTags.WELLKNOWNNAME, obj.getWellKnownName()); |
|
119 |
break; |
|
120 |
case SLDMark.MARK_TYPE_INLINE_CONTENT: |
|
121 |
online_inlne = true; |
|
122 |
if (obj.getInlineContent() == null) { |
|
123 |
throw new InvalidSLDObjectException(SLDTags.MARK, |
|
124 |
"No inline content found"); |
|
125 |
} |
|
126 |
xb.openTag(SLDTags.INLINE_CONTENT); |
|
127 |
xb.writeRaw(new String(obj.getInlineContent())); |
|
128 |
xb.closeTag(); |
|
129 |
break; |
|
130 |
case SLDMark.MARK_TYPE_ONLINE_RESOURCE: |
|
131 |
online_inlne = true; |
|
132 |
if (obj.getOnlineResource() == null) { |
|
133 |
throw new InvalidSLDObjectException(SLDTags.MARK, |
|
134 |
"No online resource URL found"); |
|
135 |
} |
|
136 |
Map<String, String> atts = new HashMap<String, String>(); |
|
137 |
atts.put(SLDTags.XLINK_HREF, obj.getOnlineResource()); |
|
138 |
xb.writeTag(SLDTags.ONLINE_RESOURCE, atts); |
|
139 |
break; |
|
140 |
default: |
|
141 |
// Simple, nothing to do |
|
142 |
break; |
|
143 |
} |
|
144 |
// ===================== |
|
145 |
if (online_inlne) { |
|
146 |
if (obj.getFormat() == null) { |
|
147 |
throw new InvalidSLDObjectException(SLDTags.MARK, |
|
148 |
"Format entity is mandatory in this case"); |
|
149 |
} |
|
150 |
xb.writeTag(SLDTags.FORMAT, obj.getFormat()); |
|
151 |
// ========= |
|
152 |
if (obj.getMarkIndex() != -1) { |
|
153 |
xb.writeTag(SLDTags.MARK_INDEX, |
|
154 |
Integer.toString(obj.getMarkIndex())); |
|
155 |
} |
|
156 |
} |
|
157 |
} |
|
158 |
|
|
159 |
public static SLDMark parse(XmlPullParser parser, String version) |
|
160 |
throws XmlPullParserException, IOException, SLDReadException { |
|
161 |
|
|
162 |
parser.require(XmlPullParser.START_TAG, null, SLDTags.MARK); |
|
163 |
int tag = 0; |
|
164 |
|
|
165 |
/* |
|
166 |
* Default type is SLDMark.MARK_TYPE_SIMPLE |
|
167 |
*/ |
|
168 |
SLDMark resp = new SLDMark(); |
|
169 |
|
|
170 |
tag = parser.nextTag(); |
|
171 |
String name = parser.getName(); |
|
172 |
String txt = null; |
|
173 |
while (!(SLDUtils.isStr(name, SLDTags.MARK) && (tag == XmlPullParser.END_TAG))) { |
|
174 |
|
|
175 |
switch (tag) { |
|
176 |
case XmlPullParser.START_TAG: |
|
177 |
if (SLDUtils.isStr(name, SLDTags.WELLKNOWNNAME)) { |
|
178 |
txt = parser.nextText(); |
|
179 |
resp.setMarkType(SLDMark.MARK_TYPE_WELL_KNOWN_NAME); |
|
180 |
resp.setWellKnownName(txt); |
|
181 |
parser.nextTag(); |
|
182 |
break; |
|
183 |
} |
|
184 |
if (SLDUtils.isStr(name, SLDTags.ONLINE_RESOURCE)) { |
|
185 |
// xlink:href="http://somesite.com/something.xml" |
|
186 |
txt = parser.getAttributeValue(null, SLDTags.XLINK_HREF); |
|
187 |
if (txt == null) { |
|
188 |
throw new SLDReadException( |
|
189 |
"URL not found (xlink:href att is missing) in online resource entity"); |
|
190 |
} |
|
191 |
resp.setOnlineResource(txt); |
|
192 |
resp.setMarkType(SLDMark.MARK_TYPE_ONLINE_RESOURCE); |
|
193 |
resp.setOnlineResource(txt); |
|
194 |
parser.nextTag(); |
|
195 |
parser.nextTag(); |
|
196 |
break; |
|
197 |
} |
|
198 |
if (SLDUtils.isStr(name, SLDTags.INLINE_CONTENT)) { |
|
199 |
/* |
|
200 |
* This is unlikely to work if content is binary |
|
201 |
*/ |
|
202 |
txt = parser.nextText(); |
|
203 |
resp.setMarkType(SLDMark.MARK_TYPE_INLINE_CONTENT); |
|
204 |
resp.setInlineContent(txt.getBytes()); |
|
205 |
parser.nextTag(); |
|
206 |
break; |
|
207 |
} |
|
208 |
if (SLDUtils.isStr(name, SLDTags.FORMAT)) { |
|
209 |
txt = parser.nextText(); |
|
210 |
resp.setFormat(txt); |
|
211 |
parser.nextTag(); |
|
212 |
break; |
|
213 |
} |
|
214 |
if (SLDUtils.isStr(name, SLDTags.MARK_INDEX)) { |
|
215 |
txt = parser.nextText(); |
|
216 |
int ind = SLDUtils.parseInteger(txt); |
|
217 |
resp.setMarkIndex(ind); |
|
218 |
parser.nextTag(); |
|
219 |
break; |
|
220 |
} |
|
221 |
// ============================================= |
|
222 |
if (SLDUtils.isStr(name, SLDTags.FILL)) { |
|
223 |
SLDFill fil = FillElement.parse(parser, version); |
|
224 |
resp.setFill(fil); |
|
225 |
break; |
|
226 |
} |
|
227 |
if (SLDUtils.isStr(name, SLDTags.STROKE)) { |
|
228 |
SLDStroke stro = StrokeElement.parse(parser, version); |
|
229 |
resp.setStroke(stro); |
|
230 |
break; |
|
231 |
} |
|
232 |
/* |
|
233 |
* Any other entity causes parsing error |
|
234 |
*/ |
|
235 |
throw new SLDReadException( |
|
236 |
"Bad SLD file. Unexpected entity in Mark: " + name); |
|
237 |
case XmlPullParser.END_TAG: |
|
238 |
break; |
|
239 |
case XmlPullParser.TEXT: |
|
240 |
break; |
|
241 |
} |
|
242 |
tag = parser.getEventType(); |
|
243 |
name = parser.getName(); |
|
244 |
} |
|
245 |
|
|
246 |
parser.nextTag(); |
|
247 |
return resp; |
|
248 |
} |
|
249 |
} |
org.gvsig.sld/tags/org.gvsig.sld-2.0.137/org.gvsig.sldsupport/org.gvsig.sldsupport.lib/org.gvsig.sldsupport.lib.impl/src/main/java/org/gvsig/sldsupport/impl/sld/parsing/GeometryElement.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.sldsupport.impl.sld.parsing; |
|
27 |
|
|
28 |
import java.io.IOException; |
|
29 |
|
|
30 |
import org.xmlpull.v1.XmlPullParser; |
|
31 |
import org.xmlpull.v1.XmlPullParserException; |
|
32 |
|
|
33 |
import org.gvsig.sldsupport.exception.InvalidSLDObjectException; |
|
34 |
import org.gvsig.sldsupport.exception.SLDReadException; |
|
35 |
import org.gvsig.sldsupport.exception.UnsupportedSLDObjectException; |
|
36 |
import org.gvsig.sldsupport.impl.util.SLDUtils; |
|
37 |
import org.gvsig.sldsupport.impl.util.XmlBuilder; |
|
38 |
import org.gvsig.sldsupport.sld.SLDTags; |
|
39 |
import org.gvsig.sldsupport.sld.symbol.misc.SLDGeometry; |
|
40 |
|
|
41 |
public class GeometryElement { |
|
42 |
|
|
43 |
public static void append(SLDGeometry obj, XmlBuilder xb, String version) |
|
44 |
throws InvalidSLDObjectException, UnsupportedSLDObjectException { |
|
45 |
|
|
46 |
xb.openTag(SLDTags.GEOMETRY); |
|
47 |
// ================================ |
|
48 |
if (obj.getPropertyName() == null) { |
|
49 |
throw new InvalidSLDObjectException(SLDTags.GEOMETRY, |
|
50 |
"No property name found."); |
|
51 |
} else { |
|
52 |
xb.writeTag(SLDTags.PROPERTY_NAME, obj.getPropertyName()); |
|
53 |
} |
|
54 |
// ================================ |
|
55 |
xb.closeTag(); |
|
56 |
} |
|
57 |
|
|
58 |
public static SLDGeometry parse(XmlPullParser parser, String version) |
|
59 |
throws XmlPullParserException, IOException, SLDReadException { |
|
60 |
|
|
61 |
parser.require(XmlPullParser.START_TAG, null, SLDTags.GEOMETRY); |
|
62 |
int tag = 0; |
|
63 |
|
|
64 |
SLDGeometry resp = new SLDGeometry(); |
|
65 |
|
|
66 |
tag = parser.nextTag(); |
|
67 |
String name = parser.getName(); |
|
68 |
String txt = null; |
|
69 |
while (!(SLDUtils.isStr(name, SLDTags.GEOMETRY) && (tag == XmlPullParser.END_TAG))) { |
|
70 |
|
|
71 |
switch (tag) { |
|
72 |
case XmlPullParser.START_TAG: |
|
73 |
if (SLDUtils.isStr(name, SLDTags.PROPERTY_NAME)) { |
|
74 |
txt = parser.nextText(); |
|
75 |
resp.setPropertyName(txt); |
|
76 |
parser.nextTag(); |
|
77 |
break; |
|
78 |
} |
|
79 |
/* |
|
80 |
* Any other entity causes parsing error |
|
81 |
*/ |
|
82 |
throw new SLDReadException( |
|
83 |
"Bad SLD file. Unexpected entity in geometry element: " |
|
84 |
+ name); |
|
85 |
case XmlPullParser.END_TAG: |
|
86 |
break; |
|
87 |
case XmlPullParser.TEXT: |
|
88 |
break; |
|
89 |
} |
|
90 |
tag = parser.getEventType(); |
|
91 |
name = parser.getName(); |
|
92 |
} |
|
93 |
|
|
94 |
parser.nextTag(); |
|
95 |
return resp; |
|
96 |
} |
|
97 |
} |
org.gvsig.sld/tags/org.gvsig.sld-2.0.137/org.gvsig.sldsupport/org.gvsig.sldsupport.lib/org.gvsig.sldsupport.lib.impl/src/main/java/org/gvsig/sldsupport/impl/sld/parsing/LegendGraphicElement.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.sldsupport.impl.sld.parsing; |
|
27 |
|
|
28 |
import java.io.IOException; |
|
29 |
|
|
30 |
import org.xmlpull.v1.XmlPullParser; |
|
31 |
import org.xmlpull.v1.XmlPullParserException; |
|
32 |
|
|
33 |
import org.gvsig.sldsupport.exception.InvalidSLDObjectException; |
|
34 |
import org.gvsig.sldsupport.exception.SLDReadException; |
|
35 |
import org.gvsig.sldsupport.exception.UnsupportedSLDObjectException; |
|
36 |
import org.gvsig.sldsupport.impl.util.SLDUtils; |
|
37 |
import org.gvsig.sldsupport.impl.util.XmlBuilder; |
|
38 |
import org.gvsig.sldsupport.sld.SLDTags; |
|
39 |
import org.gvsig.sldsupport.sld.graphic.SLDGraphic; |
|
40 |
import org.gvsig.sldsupport.sld.graphic.SLDLegendGraphic; |
|
41 |
|
|
42 |
public class LegendGraphicElement { |
|
43 |
|
|
44 |
public static void append(SLDLegendGraphic obj, XmlBuilder xb, |
|
45 |
String version) throws InvalidSLDObjectException, |
|
46 |
UnsupportedSLDObjectException { |
|
47 |
|
|
48 |
if (obj.getGraphic() == null) { |
|
49 |
throw new InvalidSLDObjectException(SLDTags.LEGENDGRAPHIC, |
|
50 |
"No Graphic found"); |
|
51 |
} |
|
52 |
xb.openTag(SLDTags.LEGENDGRAPHIC); |
|
53 |
// ================================== |
|
54 |
GraphicElement.append(obj.getGraphic(), xb, version); |
|
55 |
// ================================== |
|
56 |
xb.closeTag(); |
|
57 |
} |
|
58 |
|
|
59 |
public static SLDLegendGraphic parse(XmlPullParser parser, String version) |
|
60 |
throws XmlPullParserException, IOException, SLDReadException { |
|
61 |
|
|
62 |
parser.require(XmlPullParser.START_TAG, null, SLDTags.LEGENDGRAPHIC); |
|
63 |
int tag = 0; |
|
64 |
|
|
65 |
SLDLegendGraphic resp = new SLDLegendGraphic(); |
|
66 |
|
|
67 |
tag = parser.nextTag(); |
|
68 |
String name = parser.getName(); |
|
69 |
String txt = null; |
|
70 |
while (!(SLDUtils.isStr(name, SLDTags.LEGENDGRAPHIC) && (tag == XmlPullParser.END_TAG))) { |
|
71 |
|
|
72 |
switch (tag) { |
|
73 |
case XmlPullParser.START_TAG: |
|
74 |
if (SLDUtils.isStr(name, SLDTags.GRAPHIC)) { |
|
75 |
SLDGraphic gra = GraphicElement.parse(parser, version); |
|
76 |
resp.setGraphic(gra); |
|
77 |
break; |
|
78 |
} |
|
79 |
/* |
|
80 |
* Any other entity causes parsing error |
|
81 |
*/ |
|
82 |
throw new SLDReadException( |
|
83 |
"Bad SLD file. Unexpected entity in legend graphic: " |
|
84 |
+ name); |
|
85 |
case XmlPullParser.END_TAG: |
|
86 |
break; |
|
87 |
case XmlPullParser.TEXT: |
|
88 |
break; |
|
89 |
} |
|
90 |
tag = parser.getEventType(); |
|
91 |
name = parser.getName(); |
|
92 |
} |
|
93 |
|
|
94 |
parser.nextTag(); |
|
95 |
return resp; |
|
96 |
} |
|
97 |
} |
org.gvsig.sld/tags/org.gvsig.sld-2.0.137/org.gvsig.sldsupport/org.gvsig.sldsupport.lib/org.gvsig.sldsupport.lib.impl/src/main/java/org/gvsig/sldsupport/impl/sld/parsing/UserStyleElement.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.sldsupport.impl.sld.parsing; |
|
27 |
|
|
28 |
import java.io.IOException; |
|
29 |
import java.util.List; |
|
30 |
|
|
31 |
import org.xmlpull.v1.XmlPullParser; |
|
32 |
import org.xmlpull.v1.XmlPullParserException; |
|
33 |
|
|
34 |
import org.gvsig.sldsupport.exception.InvalidSLDObjectException; |
|
35 |
import org.gvsig.sldsupport.exception.SLDReadException; |
|
36 |
import org.gvsig.sldsupport.exception.UnsupportedSLDObjectException; |
|
37 |
import org.gvsig.sldsupport.impl.util.SLDUtils; |
|
38 |
import org.gvsig.sldsupport.impl.util.XmlBuilder; |
|
39 |
import org.gvsig.sldsupport.sld.SLDTags; |
|
40 |
import org.gvsig.sldsupport.sld.style.SLDFeatureStyle; |
|
41 |
import org.gvsig.sldsupport.sld.style.layer.SLDUserStyle; |
|
42 |
|
|
43 |
public class UserStyleElement { |
|
44 |
|
|
45 |
public static void append(SLDUserStyle obj, XmlBuilder xb, String version) |
|
46 |
throws InvalidSLDObjectException, UnsupportedSLDObjectException { |
|
47 |
|
|
48 |
xb.openTag(SLDTags.USERSTYLE); |
|
49 |
// ===================================== |
|
50 |
if (obj.getName() != null) { |
|
51 |
xb.writeTag(SLDTags.NAME, obj.getName()); |
|
52 |
} |
|
53 |
if (obj.getTitle() != null) { |
|
54 |
xb.writeTag(SLDTags.TITLE, obj.getTitle()); |
|
55 |
} |
|
56 |
if (obj.getAbstract() != null) { |
|
57 |
xb.writeTag(SLDTags.ABSTRACT, obj.getAbstract()); |
|
58 |
} |
|
59 |
if (obj.isDefault() != null) { |
|
60 |
xb.writeTag(SLDTags.IS_DEFAULT, obj.isDefault()); |
|
61 |
} |
|
62 |
// ===== |
|
63 |
List<SLDFeatureStyle> fstys = obj.getFeatureStyles(); |
|
64 |
if ((fstys == null) || (fstys.size() == 0)) { |
|
65 |
throw new InvalidSLDObjectException(SLDTags.USERSTYLE, |
|
66 |
"No feature styles found."); |
|
67 |
} else { |
|
68 |
for (int i = 0; i < fstys.size(); i++) { |
|
69 |
FeatureStyleElement.append(fstys.get(i), xb, null); |
|
70 |
} |
|
71 |
} |
|
72 |
// ===================================== |
|
73 |
xb.closeTag(); |
|
74 |
} |
|
75 |
|
|
76 |
public static SLDUserStyle parse(XmlPullParser parser, String version) |
|
77 |
throws XmlPullParserException, IOException, SLDReadException { |
|
78 |
|
|
79 |
parser.require(XmlPullParser.START_TAG, null, SLDTags.USERSTYLE); |
|
80 |
int tag = 0; |
|
81 |
|
|
82 |
SLDUserStyle resp = new SLDUserStyle(); |
|
83 |
tag = parser.nextTag(); |
|
84 |
String name = parser.getName(); |
|
85 |
String txt = null; |
|
86 |
while (!(SLDUtils.isStr(name, SLDTags.USERSTYLE) && (tag == XmlPullParser.END_TAG))) { |
|
87 |
|
|
88 |
switch (tag) { |
|
89 |
case XmlPullParser.START_TAG: |
|
90 |
|
|
91 |
if (SLDUtils.isStr(name, SLDTags.NAME)) { |
|
92 |
txt = parser.nextText(); |
|
93 |
resp.setName(txt); |
|
94 |
parser.nextTag(); |
|
95 |
break; |
|
96 |
} |
|
97 |
|
|
98 |
if (SLDUtils.isStr(name, SLDTags.TITLE)) { |
|
99 |
txt = parser.nextText(); |
|
100 |
resp.setTile(txt); |
|
101 |
parser.nextTag(); |
|
102 |
break; |
|
103 |
} |
|
104 |
|
|
105 |
if (SLDUtils.isStr(name, SLDTags.ABSTRACT) |
|
106 |
|| SLDUtils.isStr(name, SLDTags.DESCRIPTION)) { |
|
107 |
txt = parser.nextText(); |
|
108 |
resp.setAbstract(txt); |
|
109 |
parser.nextTag(); |
|
110 |
break; |
|
111 |
} |
|
112 |
|
|
113 |
if (SLDUtils.isStr(name, SLDTags.IS_DEFAULT)) { |
|
114 |
txt = parser.nextText(); |
|
115 |
resp.setIsDefault(txt); |
|
116 |
parser.nextTag(); |
|
117 |
break; |
|
118 |
} |
|
119 |
|
|
120 |
if (SLDUtils.isStr(name, SLDTags.FEATURETYPESTYLE) // 1.0.0 |
|
121 |
|| SLDUtils.isStr(name, SLDTags.FEATURESTYLE)) { // 1.1.0 |
|
122 |
|
|
123 |
SLDFeatureStyle fsty = |
|
124 |
FeatureStyleElement.parse(parser, version); |
|
125 |
resp.getFeatureStyles().add(fsty); |
|
126 |
break; |
|
127 |
} |
|
128 |
|
|
129 |
/* |
|
130 |
* Any other entity causes parsing error |
|
131 |
*/ |
|
132 |
throw new SLDReadException( |
|
133 |
"Bad SLD file. Unexpected entity in user style: " + name); |
|
134 |
case XmlPullParser.END_TAG: |
|
135 |
break; |
|
136 |
case XmlPullParser.TEXT: |
|
137 |
break; |
|
138 |
} |
|
139 |
tag = parser.getEventType(); |
|
140 |
name = parser.getName(); |
|
141 |
} |
|
142 |
|
|
143 |
parser.nextTag(); |
|
144 |
return resp; |
|
145 |
} |
|
146 |
} |
org.gvsig.sld/tags/org.gvsig.sld-2.0.137/org.gvsig.sldsupport/org.gvsig.sldsupport.lib/org.gvsig.sldsupport.lib.impl/src/main/java/org/gvsig/sldsupport/impl/sld/parsing/FeatureTypeConstraintElement.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.sldsupport.impl.sld.parsing; |
|
27 |
|
|
28 |
import java.io.IOException; |
|
29 |
|
|
30 |
import org.xmlpull.v1.XmlPullParser; |
|
31 |
import org.xmlpull.v1.XmlPullParserException; |
|
32 |
|
|
33 |
import org.gvsig.sldsupport.exception.InvalidSLDObjectException; |
|
34 |
import org.gvsig.sldsupport.exception.SLDReadException; |
|
35 |
import org.gvsig.sldsupport.exception.UnsupportedSLDObjectException; |
|
36 |
import org.gvsig.sldsupport.impl.util.SLDUtils; |
|
37 |
import org.gvsig.sldsupport.impl.util.XmlBuilder; |
|
38 |
import org.gvsig.sldsupport.sld.SLDTags; |
|
39 |
import org.gvsig.sldsupport.sld.constraints.SLDFeatureTypeConstraint; |
|
40 |
import org.gvsig.sldsupport.sld.extent.SLDExtent; |
|
41 |
|
|
42 |
public class FeatureTypeConstraintElement { |
|
43 |
|
|
44 |
public static void append(SLDFeatureTypeConstraint obj, XmlBuilder xb, |
|
45 |
String version) throws InvalidSLDObjectException, |
|
46 |
UnsupportedSLDObjectException { |
|
47 |
|
|
48 |
xb.openTag(SLDTags.FEATURETYPECONSTRAINT); |
|
49 |
// ======================== |
|
50 |
if (obj.getFeatureTypeName() != null) { |
|
51 |
xb.writeTag(SLDTags.FEATURETYPENAME, obj.getFeatureTypeName()); |
|
52 |
} |
|
53 |
// ========= |
|
54 |
if (obj.getFilter() != null) { |
|
55 |
// 0 or 1 filters |
|
56 |
FilterElement.append(obj.getFilter(), xb, version); |
|
57 |
} |
|
58 |
// ========= |
|
59 |
for (int i = 0; i < obj.getExtents().size(); i++) { |
|
60 |
ExtentElement.append(obj.getExtents().get(i), xb, version); |
|
61 |
} |
|
62 |
// ======================== |
|
63 |
xb.closeTag(); |
|
64 |
} |
|
65 |
|
|
66 |
public static SLDFeatureTypeConstraint parse(XmlPullParser parser, |
|
67 |
String version) throws XmlPullParserException, IOException, |
|
68 |
SLDReadException { |
|
69 |
|
|
70 |
parser.require(XmlPullParser.START_TAG, null, |
|
71 |
SLDTags.FEATURETYPECONSTRAINT); |
|
72 |
int tag = 0; |
|
73 |
|
|
74 |
SLDFeatureTypeConstraint resp = new SLDFeatureTypeConstraint(); |
|
75 |
|
|
76 |
tag = parser.nextTag(); |
|
77 |
String name = parser.getName(); |
|
78 |
String txt = null; |
|
79 |
while (!(SLDUtils.isStr(name, SLDTags.FEATURETYPECONSTRAINT) && (tag == XmlPullParser.END_TAG))) { |
|
80 |
|
|
81 |
switch (tag) { |
|
82 |
case XmlPullParser.START_TAG: |
|
83 |
if (SLDUtils.isStr(name, SLDTags.FEATURETYPENAME)) { |
|
84 |
txt = parser.nextText(); |
|
85 |
resp.setFeatureTypeName(txt); |
|
86 |
parser.nextTag(); |
|
87 |
break; |
|
88 |
} |
|
89 |
if (SLDUtils.isStr(name, SLDTags.FILTER)) { |
|
90 |
txt = parser.nextText(); |
|
91 |
resp.setFeatureTypeName(txt); |
|
92 |
parser.nextTag(); |
|
93 |
break; |
|
94 |
} |
|
95 |
if (SLDUtils.isStr(name, SLDTags.EXTENT)) { |
|
96 |
SLDExtent ext = ExtentElement.parse(parser, version); |
|
97 |
resp.getExtents().add(ext); |
|
98 |
break; |
|
99 |
} |
|
100 |
/* |
|
101 |
* Any other entity causes parsing error |
|
102 |
*/ |
|
103 |
throw new SLDReadException( |
|
104 |
"Bad SLD file. Unexpected entity in featuretype constraints: " |
|
105 |
+ name); |
|
106 |
case XmlPullParser.END_TAG: |
|
107 |
break; |
|
108 |
case XmlPullParser.TEXT: |
|
109 |
break; |
|
110 |
} |
|
111 |
tag = parser.getEventType(); |
|
112 |
name = parser.getName(); |
|
113 |
} |
|
114 |
|
|
115 |
parser.nextTag(); |
|
116 |
return resp; |
|
117 |
} |
|
118 |
} |
org.gvsig.sld/tags/org.gvsig.sld-2.0.137/org.gvsig.sldsupport/org.gvsig.sldsupport.lib/org.gvsig.sldsupport.lib.impl/src/main/java/org/gvsig/sldsupport/impl/sld/parsing/expression/ArithmeticElement.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.sldsupport.impl.sld.parsing.expression; |
|
27 |
|
|
28 |
import java.io.IOException; |
|
29 |
|
|
30 |
import org.xmlpull.v1.XmlPullParser; |
|
31 |
import org.xmlpull.v1.XmlPullParserException; |
|
32 |
|
|
33 |
import org.gvsig.sldsupport.exception.InvalidSLDObjectException; |
|
34 |
import org.gvsig.sldsupport.exception.SLDReadException; |
|
35 |
import org.gvsig.sldsupport.exception.UnsupportedSLDObjectException; |
|
36 |
import org.gvsig.sldsupport.impl.util.XmlBuilder; |
|
37 |
import org.gvsig.sldsupport.sld.filter.expression.SLDExpression; |
|
38 |
import org.gvsig.sldsupport.sld.filter.expression.operator.SLDArithmeticOperator; |
|
39 |
|
|
40 |
public class ArithmeticElement { |
|
41 |
|
|
42 |
public static void append(SLDArithmeticOperator obj, XmlBuilder xb, |
|
43 |
String version) throws InvalidSLDObjectException, |
|
44 |
UnsupportedSLDObjectException { |
|
45 |
|
|
46 |
xb.openTag(obj.getOperatorName()); |
|
47 |
ExpressionElement.append(obj.getFirstExpression(), xb, version); |
|
48 |
ExpressionElement.append(obj.getSecondExpression(), xb, version); |
|
49 |
xb.closeTag(); |
|
50 |
} |
|
51 |
|
|
52 |
public static SLDArithmeticOperator parse(XmlPullParser parser, |
|
53 |
String version) throws XmlPullParserException, IOException, |
|
54 |
SLDReadException { |
|
55 |
|
|
56 |
SLDArithmeticOperator resp = new SLDArithmeticOperator(); |
|
57 |
String op_name = parser.getName(); |
|
58 |
resp.setOperatorName(op_name); |
|
59 |
parser.nextTag(); |
|
60 |
|
|
61 |
SLDExpression expre = null; |
|
62 |
expre = ExpressionElement.parse(parser, version); |
|
63 |
resp.setFirstExpression(expre); |
|
64 |
expre = ExpressionElement.parse(parser, version); |
|
65 |
resp.setSecondExpression(expre); |
|
66 |
|
|
67 |
parser.require(XmlPullParser.END_TAG, null, op_name); |
|
68 |
parser.nextTag(); |
|
69 |
return resp; |
|
70 |
} |
|
71 |
} |
org.gvsig.sld/tags/org.gvsig.sld-2.0.137/org.gvsig.sldsupport/org.gvsig.sldsupport.lib/org.gvsig.sldsupport.lib.impl/src/main/java/org/gvsig/sldsupport/impl/sld/parsing/expression/ExpressionElement.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.sldsupport.impl.sld.parsing.expression; |
|
27 |
|
|
28 |
import java.io.IOException; |
|
29 |
|
|
30 |
import org.xmlpull.v1.XmlPullParser; |
|
31 |
import org.xmlpull.v1.XmlPullParserException; |
|
32 |
|
|
33 |
import org.gvsig.sldsupport.exception.InvalidSLDObjectException; |
|
34 |
import org.gvsig.sldsupport.exception.SLDReadException; |
|
35 |
import org.gvsig.sldsupport.exception.UnsupportedSLDObjectException; |
|
36 |
import org.gvsig.sldsupport.impl.util.SLDUtils; |
|
37 |
import org.gvsig.sldsupport.impl.util.XmlBuilder; |
|
38 |
import org.gvsig.sldsupport.sld.SLDTags; |
|
39 |
import org.gvsig.sldsupport.sld.filter.FilterTags; |
|
40 |
import org.gvsig.sldsupport.sld.filter.expression.SLDExpression; |
|
41 |
import org.gvsig.sldsupport.sld.filter.expression.operator.SLDArithmeticOperator; |
|
42 |
import org.gvsig.sldsupport.sld.filter.expression.operator.SLDFunction; |
|
43 |
import org.gvsig.sldsupport.sld.filter.expression.operator.SLDLiteral; |
|
44 |
import org.gvsig.sldsupport.sld.filter.expression.operator.SLDPropertyName; |
|
45 |
|
|
46 |
public class ExpressionElement { |
|
47 |
|
|
48 |
public static void append(SLDExpression obj, XmlBuilder xb, String version) |
|
49 |
throws InvalidSLDObjectException, UnsupportedSLDObjectException { |
|
50 |
|
|
51 |
if (obj instanceof SLDLiteral) { |
|
52 |
SLDLiteral lit = (SLDLiteral) obj; |
|
53 |
xb.writeTag(SLDTags.LITERAL, lit.getValue()); |
|
54 |
} else { |
|
55 |
if (obj instanceof SLDArithmeticOperator) { |
|
56 |
ArithmeticElement.append((SLDArithmeticOperator) obj, xb, |
|
57 |
version); |
|
58 |
} else { |
|
59 |
if (obj instanceof SLDFunction) { |
|
60 |
FunctionElement.append((SLDFunction) obj, xb, version); |
|
61 |
} else { |
|
62 |
if (obj instanceof SLDPropertyName) { |
|
63 |
SLDPropertyName pn = (SLDPropertyName) obj; |
|
64 |
xb.writeTag(SLDTags.PROPERTY_NAME, pn.getPropertyName()); |
|
65 |
} |
|
66 |
} |
|
67 |
} |
|
68 |
} |
|
69 |
|
|
70 |
} |
|
71 |
|
|
72 |
public static SLDExpression parse(XmlPullParser parser, String version) |
|
73 |
throws XmlPullParserException, IOException, SLDReadException { |
|
74 |
|
|
75 |
String name = parser.getName(); |
|
76 |
|
|
77 |
if (SLDUtils.isStr(name, FilterTags.PROPERTYNAME)) { |
|
78 |
SLDPropertyName pn = new SLDPropertyName(); |
|
79 |
String txt = parser.nextText(); |
|
80 |
pn.setPropertyName(txt); |
|
81 |
// Go to next tag |
|
82 |
parser.nextTag(); |
|
83 |
return pn; |
|
84 |
} |
|
85 |
|
|
86 |
if (SLDUtils.isStr(name, FilterTags.LITERAL)) { |
|
87 |
SLDLiteral lit = new SLDLiteral(); |
|
88 |
String txt = parser.nextText(); |
|
89 |
lit.setValue(txt); |
|
90 |
// Go to next tag |
|
91 |
parser.nextTag(); |
|
92 |
return lit; |
|
93 |
} |
|
94 |
|
|
95 |
if (SLDUtils.isStr(name, FilterTags.ADD) |
|
96 |
|| SLDUtils.isStr(name, FilterTags.SUB) |
|
97 |
|| SLDUtils.isStr(name, FilterTags.MUL) |
|
98 |
|| SLDUtils.isStr(name, FilterTags.DIV)) { |
|
99 |
return ArithmeticElement.parse(parser, version); |
|
100 |
} |
|
101 |
|
|
102 |
if (SLDUtils.isStr(name, FilterTags.FUNCTION)) { |
|
103 |
return FunctionElement.parse(parser, version); |
|
104 |
} |
|
105 |
|
|
106 |
throw new SLDReadException("Unexpected entity in expression: " + name); |
|
107 |
|
|
108 |
} |
|
109 |
} |
org.gvsig.sld/tags/org.gvsig.sld-2.0.137/org.gvsig.sldsupport/org.gvsig.sldsupport.lib/org.gvsig.sldsupport.lib.impl/src/main/java/org/gvsig/sldsupport/impl/sld/parsing/expression/FunctionElement.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.sldsupport.impl.sld.parsing.expression; |
|
27 |
|
|
28 |
import java.io.IOException; |
|
29 |
import java.util.HashMap; |
|
30 |
import java.util.Map; |
|
31 |
|
|
32 |
import org.xmlpull.v1.XmlPullParser; |
|
33 |
import org.xmlpull.v1.XmlPullParserException; |
|
34 |
|
|
35 |
import org.gvsig.sldsupport.exception.InvalidSLDObjectException; |
|
36 |
import org.gvsig.sldsupport.exception.SLDReadException; |
|
37 |
import org.gvsig.sldsupport.exception.UnsupportedSLDObjectException; |
|
38 |
import org.gvsig.sldsupport.impl.util.SLDUtils; |
|
39 |
import org.gvsig.sldsupport.impl.util.XmlBuilder; |
|
40 |
import org.gvsig.sldsupport.sld.SLDTags; |
|
41 |
import org.gvsig.sldsupport.sld.filter.FilterTags; |
|
42 |
import org.gvsig.sldsupport.sld.filter.expression.SLDExpression; |
|
43 |
import org.gvsig.sldsupport.sld.filter.expression.operator.SLDFunction; |
|
44 |
|
|
45 |
public class FunctionElement { |
|
46 |
|
|
47 |
public static void append(SLDFunction obj, XmlBuilder xb, String version) |
|
48 |
throws InvalidSLDObjectException, UnsupportedSLDObjectException { |
|
49 |
|
|
50 |
Map<String, String> atts = new HashMap<String, String>(); |
|
51 |
atts.put(SLDTags.NAME_ATTR, obj.getFunctionName()); |
|
52 |
|
|
53 |
xb.openTag(FilterTags.FUNCTION, atts); |
|
54 |
for (int i = 0; i < obj.getArguments().size(); i++) { |
|
55 |
ExpressionElement.append(obj.getArguments().get(i), xb, version); |
|
56 |
} |
|
57 |
xb.closeTag(); |
|
58 |
} |
|
59 |
|
|
60 |
public static SLDFunction parse(XmlPullParser parser, String version) |
|
61 |
throws XmlPullParserException, IOException, SLDReadException { |
|
62 |
|
|
63 |
parser.require(XmlPullParser.START_TAG, null, FilterTags.FUNCTION); |
|
64 |
String fname = parser.getAttributeValue(null, SLDTags.NAME_ATTR); |
|
65 |
if (fname == null) { |
|
66 |
throw new SLDReadException( |
|
67 |
"Attribute 'name' not found in SLD function"); |
|
68 |
} |
|
69 |
SLDFunction resp = new SLDFunction(); |
|
70 |
resp.setFunctionName(fname); |
|
71 |
|
|
72 |
int tag = parser.nextTag(); |
|
73 |
String name = parser.getName(); |
|
74 |
SLDExpression expre = null; |
|
75 |
|
|
76 |
while (!(SLDUtils.isStr(name, SLDTags.FUNCTION) && (tag == XmlPullParser.END_TAG))) { |
|
77 |
expre = ExpressionElement.parse(parser, version); |
|
78 |
resp.getArguments().add(expre); |
|
79 |
// =========== Get current values |
|
80 |
tag = parser.getEventType(); |
|
81 |
name = parser.getName(); |
|
82 |
} |
|
83 |
parser.nextTag(); |
|
84 |
return resp; |
|
85 |
} |
|
86 |
} |
org.gvsig.sld/tags/org.gvsig.sld-2.0.137/org.gvsig.sldsupport/org.gvsig.sldsupport.lib/org.gvsig.sldsupport.lib.impl/src/main/java/org/gvsig/sldsupport/impl/sld/parsing/NamedStyleElement.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.sldsupport.impl.sld.parsing; |
|
27 |
|
|
28 |
import java.io.IOException; |
|
29 |
|
|
30 |
import org.xmlpull.v1.XmlPullParser; |
|
31 |
import org.xmlpull.v1.XmlPullParserException; |
|
32 |
|
|
33 |
import org.gvsig.sldsupport.exception.InvalidSLDObjectException; |
|
34 |
import org.gvsig.sldsupport.exception.SLDReadException; |
|
35 |
import org.gvsig.sldsupport.exception.UnsupportedSLDObjectException; |
|
36 |
import org.gvsig.sldsupport.impl.util.SLDUtils; |
|
37 |
import org.gvsig.sldsupport.impl.util.XmlBuilder; |
|
38 |
import org.gvsig.sldsupport.sld.SLDTags; |
|
39 |
import org.gvsig.sldsupport.sld.style.layer.SLDNamedStyle; |
|
40 |
|
|
41 |
public class NamedStyleElement { |
|
42 |
|
|
43 |
public static void append(SLDNamedStyle obj, XmlBuilder xb, String version) |
|
44 |
throws InvalidSLDObjectException, UnsupportedSLDObjectException { |
|
45 |
|
|
46 |
xb.openTag(SLDTags.NAMEDSTYLE); |
|
47 |
// ================================== |
|
48 |
if (obj.getName() != null) { |
|
49 |
xb.writeTag(SLDTags.NAME, obj.getName()); |
|
50 |
} else { |
|
51 |
throw new InvalidSLDObjectException(SLDTags.NAMEDSTYLE, |
|
52 |
"No name found"); |
|
53 |
} |
|
54 |
// ================================== |
|
55 |
xb.closeTag(); |
|
56 |
} |
|
57 |
|
|
58 |
public static SLDNamedStyle parse(XmlPullParser parser, String version) |
|
59 |
throws XmlPullParserException, IOException, SLDReadException { |
|
60 |
|
|
61 |
parser.require(XmlPullParser.START_TAG, null, SLDTags.NAMEDSTYLE); |
|
62 |
int tag = 0; |
|
63 |
|
|
64 |
SLDNamedStyle resp = new SLDNamedStyle(); |
|
65 |
tag = parser.nextTag(); |
|
66 |
String name = parser.getName(); |
|
67 |
String txt = null; |
|
68 |
while (!(SLDUtils.isStr(name, SLDTags.NAMEDSTYLE) && (tag == XmlPullParser.END_TAG))) { |
|
69 |
|
|
70 |
switch (tag) { |
|
71 |
case XmlPullParser.START_TAG: |
|
72 |
|
|
73 |
if (SLDUtils.isStr(name, SLDTags.NAME)) { |
|
74 |
txt = parser.nextText(); |
|
75 |
resp.setName(txt); |
|
76 |
parser.nextTag(); |
|
77 |
break; |
|
78 |
} |
|
79 |
/* |
|
80 |
* Any other entity causes parsing error |
|
81 |
*/ |
|
82 |
throw new SLDReadException( |
|
83 |
"Bad SLD file. Unexpected entity in named style: " + name); |
|
84 |
case XmlPullParser.END_TAG: |
|
85 |
break; |
|
86 |
case XmlPullParser.TEXT: |
|
87 |
break; |
|
88 |
} |
|
89 |
tag = parser.getEventType(); |
|
90 |
name = parser.getName(); |
|
91 |
} |
|
92 |
|
|
93 |
parser.nextTag(); |
|
94 |
return resp; |
|
95 |
} |
|
96 |
} |
org.gvsig.sld/tags/org.gvsig.sld-2.0.137/org.gvsig.sldsupport/org.gvsig.sldsupport.lib/org.gvsig.sldsupport.lib.impl/src/main/java/org/gvsig/sldsupport/impl/sld/parsing/GraphicStrokeElement.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.sldsupport.impl.sld.parsing; |
|
27 |
|
|
28 |
import java.io.IOException; |
|
29 |
|
|
30 |
import org.xmlpull.v1.XmlPullParser; |
|
31 |
import org.xmlpull.v1.XmlPullParserException; |
|
32 |
|
|
33 |
import org.gvsig.sldsupport.exception.InvalidSLDObjectException; |
|
34 |
import org.gvsig.sldsupport.exception.SLDReadException; |
|
35 |
import org.gvsig.sldsupport.exception.UnsupportedSLDObjectException; |
|
36 |
import org.gvsig.sldsupport.impl.util.SLDUtils; |
|
37 |
import org.gvsig.sldsupport.impl.util.XmlBuilder; |
|
38 |
import org.gvsig.sldsupport.sld.SLDTags; |
|
39 |
import org.gvsig.sldsupport.sld.graphic.SLDGraphic; |
|
40 |
import org.gvsig.sldsupport.sld.graphic.SLDGraphicStroke; |
|
41 |
import org.gvsig.sldsupport.sld.symbol.misc.SLDParameterValue; |
|
42 |
|
|
43 |
public class GraphicStrokeElement { |
|
44 |
|
|
45 |
public static void append(SLDGraphicStroke obj, XmlBuilder xb, |
|
46 |
String version) throws InvalidSLDObjectException, |
|
47 |
UnsupportedSLDObjectException { |
|
48 |
|
|
49 |
xb.openTag(SLDTags.GRAPHICSTROKE); |
|
50 |
// ========================= |
|
51 |
if (obj.getGraphic() == null) { |
|
52 |
throw new InvalidSLDObjectException(SLDTags.GRAPHICSTROKE, |
|
53 |
"No graphic found."); |
|
54 |
} |
|
55 |
GraphicElement.append(obj.getGraphic(), xb, version); |
|
56 |
|
|
57 |
// =============== |
|
58 |
// =============== v. 1.1.0 |
|
59 |
if ((version != null) |
|
60 |
&& (version.compareToIgnoreCase(SLDUtils.VERSION_1_1_0) == 0)) { |
|
61 |
if (obj.getGap() != null) { |
|
62 |
ParameterValueElement.append(SLDTags.GAP, obj.getGap(), xb, |
|
63 |
version); |
|
64 |
} |
|
65 |
// ==== |
|
66 |
if (obj.getInitialGap() != null) { |
|
67 |
ParameterValueElement.append(SLDTags.INITIAL_GAP, |
|
68 |
obj.getInitialGap(), xb, version); |
|
69 |
} |
|
70 |
} |
|
71 |
// =============== |
|
72 |
// =============== |
|
73 |
xb.closeTag(); |
|
74 |
} |
|
75 |
|
|
76 |
public static SLDGraphicStroke parse(XmlPullParser parser, String version) |
|
77 |
throws XmlPullParserException, IOException, SLDReadException { |
|
78 |
|
|
79 |
parser.require(XmlPullParser.START_TAG, null, SLDTags.GRAPHICSTROKE); |
|
80 |
int tag = 0; |
|
81 |
|
|
82 |
SLDGraphicStroke resp = new SLDGraphicStroke(); |
|
83 |
|
|
84 |
tag = parser.nextTag(); |
|
85 |
String name = parser.getName(); |
|
86 |
String txt = null; |
|
87 |
while (!(SLDUtils.isStr(name, SLDTags.GRAPHICSTROKE) && (tag == XmlPullParser.END_TAG))) { |
|
88 |
|
|
89 |
switch (tag) { |
|
90 |
case XmlPullParser.START_TAG: |
|
91 |
if (SLDUtils.isStr(name, SLDTags.GRAPHIC)) { |
|
92 |
SLDGraphic gra = GraphicElement.parse(parser, version); |
|
93 |
resp.setGraphic(gra); |
|
94 |
break; |
|
95 |
} |
|
96 |
if (SLDUtils.isStr(name, SLDTags.GAP)) { |
|
97 |
SLDParameterValue sp = |
|
98 |
ParameterValueElement.parse(parser, version); |
|
99 |
resp.setGap(sp); |
|
100 |
break; |
|
101 |
} |
|
102 |
if (SLDUtils.isStr(name, SLDTags.INITIAL_GAP)) { |
|
103 |
SLDParameterValue sp = |
|
104 |
ParameterValueElement.parse(parser, version); |
|
105 |
resp.setInitialGap(sp); |
|
106 |
break; |
|
107 |
} |
|
108 |
/* |
|
109 |
* Any other entity causes parsing error |
|
110 |
*/ |
|
111 |
throw new SLDReadException( |
|
112 |
"Bad SLD file. Unexpected entity in graphic stroke: " |
|
113 |
+ name); |
|
114 |
case XmlPullParser.END_TAG: |
|
115 |
break; |
|
116 |
case XmlPullParser.TEXT: |
|
117 |
break; |
|
118 |
} |
|
119 |
tag = parser.getEventType(); |
|
120 |
name = parser.getName(); |
|
121 |
} |
|
122 |
|
|
123 |
parser.nextTag(); |
|
124 |
return resp; |
|
125 |
} |
|
126 |
} |
org.gvsig.sld/tags/org.gvsig.sld-2.0.137/org.gvsig.sldsupport/org.gvsig.sldsupport.lib/org.gvsig.sldsupport.lib.impl/src/main/java/org/gvsig/sldsupport/impl/sld/parsing/filteroperator/comparison/IsBetweenComparisonElement.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.sldsupport.impl.sld.parsing.filteroperator.comparison; |
|
27 |
|
|
28 |
import java.io.IOException; |
|
29 |
|
|
30 |
import org.xmlpull.v1.XmlPullParser; |
|
31 |
import org.xmlpull.v1.XmlPullParserException; |
|
32 |
|
|
33 |
import org.gvsig.sldsupport.exception.InvalidSLDObjectException; |
|
34 |
import org.gvsig.sldsupport.exception.SLDReadException; |
|
35 |
import org.gvsig.sldsupport.exception.UnsupportedSLDObjectException; |
|
36 |
import org.gvsig.sldsupport.impl.sld.parsing.ParameterValueElement; |
|
37 |
import org.gvsig.sldsupport.impl.sld.parsing.expression.ExpressionElement; |
|
38 |
import org.gvsig.sldsupport.impl.util.SLDUtils; |
|
39 |
import org.gvsig.sldsupport.impl.util.XmlBuilder; |
|
40 |
import org.gvsig.sldsupport.sld.filter.FilterTags; |
|
41 |
import org.gvsig.sldsupport.sld.filter.expression.SLDExpression; |
|
42 |
import org.gvsig.sldsupport.sld.filter.operator.comparison.SLDIsBetweenOperator; |
|
43 |
import org.gvsig.sldsupport.sld.symbol.misc.SLDParameterValue; |
Also available in: Unified diff