Revision 4036
branches/v05/libraries/libRemoteServices/src/org/gvsig/remoteClient/wms/WMSClient.java | ||
---|---|---|
169 | 169 |
return handler.getServiceInformation().formats; |
170 | 170 |
} |
171 | 171 |
|
172 |
public boolean isQueryable() |
|
173 |
{ |
|
174 |
return handler.getServiceInformation().isQueryable(); |
|
175 |
} |
|
176 |
|
|
172 | 177 |
public void close() { |
173 | 178 |
// your code here |
174 | 179 |
} |
branches/v05/libraries/libRemoteServices/src/org/gvsig/remoteClient/wms/wms_1_1_0/WMSProtocolHandler1_1_0.java | ||
---|---|---|
10 | 10 |
import java.io.Reader; |
11 | 11 |
import java.util.ArrayList; |
12 | 12 |
import java.util.TreeMap; |
13 |
|
|
14 | 13 |
import org.gvsig.remoteClient.utils.CapabilitiesTags; |
15 | 14 |
import org.gvsig.remoteClient.utils.ExceptionTags; |
16 |
import org.gvsig.remoteClient.wms.WMSProtocolHandler; |
|
17 | 15 |
import org.kxml2.io.KXmlParser; |
18 | 16 |
import org.xmlpull.v1.XmlPullParserException; |
19 | 17 |
|
... | ... | |
22 | 20 |
* Describes the handler to comunicate to a WMS 1.1.0 |
23 | 21 |
* </p> |
24 | 22 |
*/ |
25 |
public class WMSProtocolHandler1_1_0 extends org.gvsig.remoteClient.wms.WMSProtocolHandler { |
|
23 |
public class WMSProtocolHandler1_1_0 extends org.gvsig.remoteClient.wms.WMSProtocolHandler |
|
24 |
{ |
|
26 | 25 |
private WMSLayer1_1_0 fakeRootLayer; |
27 | 26 |
|
28 | 27 |
public WMSProtocolHandler1_1_0() |
... | ... | |
31 | 30 |
this.name = "WMS1.1.0"; |
32 | 31 |
this.serviceInfo = new ServiceInformation(); |
33 | 32 |
this.layers = new TreeMap(); |
34 |
//this.srs = new Vector(); |
|
35 |
|
|
36 | 33 |
} |
37 | 34 |
|
38 | 35 |
//------------------------------------------------------------------------------ |
... | ... | |
82 | 79 |
case KXmlParser.END_TAG: |
83 | 80 |
break; |
84 | 81 |
case KXmlParser.TEXT: |
85 |
//System.out.println("[TEXT]["+kxmlParser.getText()+"]"); |
|
82 |
|
|
86 | 83 |
break; |
87 | 84 |
} |
88 | 85 |
tag = kxmlParser.next(); |
89 | 86 |
} |
90 |
// while (kxmlParser.nextTag() != KXmlParser.END_DOCUMENT) { |
|
91 |
// //readXMLData(kxmlParser); |
|
92 |
// } |
|
93 |
//kxmlParser.require(KXmlParser.END_TAG, null, CapabilitiesTags.CAPABILITIES_ROOT); |
|
94 |
//kxmlParser.next(); |
|
87 |
|
|
95 | 88 |
kxmlParser.require(KXmlParser.END_DOCUMENT, null, null); |
96 | 89 |
} |
97 | 90 |
} |
98 | 91 |
catch(XmlPullParserException parser_ex){ |
99 |
System.out.println(parser_ex.getMessage()); |
|
100 | 92 |
parser_ex.printStackTrace(); |
101 |
// TODO: Implement logic to handle the exceptions |
|
102 | 93 |
} |
103 | 94 |
catch (IOException ioe) { |
104 | 95 |
ioe.printStackTrace(); |
105 |
// TODO: Implement logic to handle the exceptions |
|
106 | 96 |
} finally { |
107 | 97 |
|
108 | 98 |
} |
109 |
// In the parsing process the layer has been filled |
|
110 | 99 |
} |
111 | 100 |
|
112 | 101 |
/** |
... | ... | |
185 | 174 |
} |
186 | 175 |
else if (parser.getName().compareTo(CapabilitiesTags.EXCEPTION)==0) |
187 | 176 |
{ |
188 |
//Parse exception tags... |
|
177 |
// TODO: |
|
178 |
// add the exception formats supported. |
|
189 | 179 |
} |
190 | 180 |
else if (parser.getName().compareTo(CapabilitiesTags.LAYER)==0) |
191 | 181 |
{ |
... | ... | |
205 | 195 |
lyr.parse(parser, layers); |
206 | 196 |
|
207 | 197 |
if (lyr.getName()!=null) |
208 |
layers.put(lyr.getName(), lyr); |
|
209 |
//Add all the SRS that the layer supports to the WMSProtocolHandler if they dont exist already |
|
210 |
// for (i=0;i<lyr.getAllSrs().size();i++) |
|
211 |
// { |
|
212 |
// if (!this.srs.contains(lyr.getAllSrs().elementAt(i))) |
|
213 |
// { |
|
214 |
// this.srs.add( lyr.getAllSrs().elementAt(i)); |
|
215 |
// } |
|
216 |
// } |
|
198 |
layers.put(lyr.getName(), lyr); |
|
217 | 199 |
} |
218 | 200 |
else if ((parser.getName().compareTo(CapabilitiesTags.VENDORSPECIFICCAPABILITIES)==0) || |
219 | 201 |
(parser.getName().compareTo(CapabilitiesTags.USERDEFINEDSYMBOLIZATION )==0)) |
... | ... | |
252 | 234 |
case KXmlParser.START_TAG: |
253 | 235 |
if (parser.getName().compareTo(CapabilitiesTags.GETCAPABILITIES)==0) |
254 | 236 |
{ |
255 |
serviceInfo.operations.put(WMSProtocolHandler.STR_GETCAPABILITIES, null);
|
|
237 |
serviceInfo.operations.put(CapabilitiesTags.GETCAPABILITIES , null);
|
|
256 | 238 |
} |
257 | 239 |
else if (parser.getName().compareTo(CapabilitiesTags.GETMAP)==0) |
258 |
{ |
|
259 |
// serviceInfo.operations.add(new Integer(WMSProtocolHandler.GETMAP_OPERATION)); |
|
260 |
// currentTag = parser.nextTag(); |
|
261 |
// parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.FORMAT); |
|
262 |
// while ((currentTag == KXmlParser.START_TAG) && |
|
263 |
// (parser.getName().compareTo(CapabilitiesTags.FORMAT)==0)) |
|
264 |
// { |
|
265 |
// parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.FORMAT); |
|
266 |
// serviceInfo.formats.add(parser.nextText()); |
|
267 |
// parser.nextTag(); |
|
268 |
// } |
|
269 |
serviceInfo.operations.put(WMSProtocolHandler.STR_GETMAP, null); |
|
240 |
{ |
|
241 |
serviceInfo.operations.put(CapabilitiesTags.GETMAP, null); |
|
270 | 242 |
parseGetMapTag(parser); |
271 | 243 |
} |
272 | 244 |
else if (parser.getName().compareTo(CapabilitiesTags.GETFEATUREINFO)==0) |
273 | 245 |
{ |
274 |
serviceInfo.operations.put(WMSProtocolHandler.STR_GETFEATUREINFO, null);
|
|
246 |
serviceInfo.operations.put(CapabilitiesTags.GETFEATUREINFO, null);
|
|
275 | 247 |
parseGetFeatureInfoTag(parser); |
276 | 248 |
} |
277 | 249 |
else if (parser.getName().compareTo(CapabilitiesTags.DESCRIBELAYER)==0) |
278 | 250 |
{ |
279 |
serviceInfo.operations.put(WMSProtocolHandler.STR_DESCRIBELAYER, null);
|
|
251 |
serviceInfo.operations.put(CapabilitiesTags.DESCRIBELAYER, null);
|
|
280 | 252 |
} |
281 | 253 |
break; |
282 | 254 |
case KXmlParser.END_TAG: |
... | ... | |
326 | 298 |
String value = new String(); |
327 | 299 |
value = parser.getAttributeValue("", CapabilitiesTags.XLINK_HREF); |
328 | 300 |
if (value != null){ |
329 |
serviceInfo.operations.put(WMSProtocolHandler.STR_GETMAP, value);
|
|
301 |
serviceInfo.operations.put(CapabilitiesTags.GETMAP, value);
|
|
330 | 302 |
} |
331 | 303 |
} |
332 | 304 |
} |
branches/v05/libraries/libRemoteServices/src/org/gvsig/remoteClient/wms/WMSProtocolHandler.java | ||
---|---|---|
35 | 35 |
*/ |
36 | 36 |
public abstract class WMSProtocolHandler { |
37 | 37 |
|
38 |
public static final int GETCAPABILITIES_OPERATION = 0; |
|
39 |
public static final int GETMAP_OPERATION = 1; |
|
40 |
public static final int GETFEATUREINFO_OPERATION = 2; |
|
41 |
public static final int DESCRIBELAYER_OPERATION = 3; |
|
42 |
public static final int GETLEGENDGRAPHIC_OPERATION = 4; // this is only for sld-enabled WMS |
|
43 |
public static final String STR_GETCAPABILITIES = "GetCapabilities"; |
|
44 |
public static final String STR_GETMAP = "GetMap"; |
|
45 |
public static final String STR_GETFEATUREINFO = "GetFeatureInfo"; |
|
46 |
public static final String STR_DESCRIBELAYER = "DescribeLayer"; |
|
47 |
public static final String STR_GETLEGENDGRAPHIC = "GetLegendGraphic"; |
|
48 |
|
|
49 |
|
|
50 | 38 |
/** |
51 | 39 |
* procotol handler name |
52 | 40 |
*/ |
branches/v05/libraries/libRemoteServices/src/org/gvsig/remoteClient/wms/wms_1_1_1/WMSProtocolHandler1_1_1.java | ||
---|---|---|
13 | 13 |
|
14 | 14 |
import org.gvsig.remoteClient.utils.CapabilitiesTags; |
15 | 15 |
import org.gvsig.remoteClient.utils.ExceptionTags; |
16 |
import org.gvsig.remoteClient.wms.WMSProtocolHandler; |
|
17 | 16 |
import org.kxml2.io.KXmlParser; |
18 | 17 |
import org.xmlpull.v1.XmlPullParserException; |
19 | 18 |
|
... | ... | |
31 | 30 |
this.name = "WMS1.1.1"; |
32 | 31 |
this.serviceInfo = new ServiceInformation(); |
33 | 32 |
this.layers = new TreeMap(); |
34 |
//this.srs = new Vector(); |
|
35 |
|
|
36 | 33 |
} |
37 | 34 |
|
38 | 35 |
//------------------------------------------------------------------------------ |
... | ... | |
87 | 84 |
} |
88 | 85 |
tag = kxmlParser.next(); |
89 | 86 |
} |
90 |
// while (kxmlParser.nextTag() != KXmlParser.END_DOCUMENT) { |
|
91 |
// //readXMLData(kxmlParser); |
|
92 |
// } |
|
93 |
//kxmlParser.require(KXmlParser.END_TAG, null, CapabilitiesTags.CAPABILITIES_ROOT); |
|
94 |
//kxmlParser.next(); |
|
95 | 87 |
kxmlParser.require(KXmlParser.END_DOCUMENT, null, null); |
96 | 88 |
} |
97 | 89 |
} |
98 | 90 |
catch(XmlPullParserException parser_ex){ |
99 |
System.out.println(parser_ex.getMessage()); |
|
100 | 91 |
parser_ex.printStackTrace(); |
101 |
// TODO: Implement logic to handle the exceptions |
|
102 | 92 |
} |
103 | 93 |
catch (IOException ioe) { |
104 | 94 |
ioe.printStackTrace(); |
105 |
// TODO: Implement logic to handle the exceptions |
|
106 | 95 |
} finally { |
107 | 96 |
|
108 | 97 |
} |
... | ... | |
170 | 159 |
{ |
171 | 160 |
int currentTag; |
172 | 161 |
boolean end = false; |
173 |
//int counter = 0; |
|
162 |
|
|
174 | 163 |
parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.CAPABILITY); |
175 | 164 |
currentTag = parser.next(); |
176 | 165 |
|
... | ... | |
185 | 174 |
} |
186 | 175 |
else if (parser.getName().compareTo(CapabilitiesTags.EXCEPTION)==0) |
187 | 176 |
{ |
188 |
//Parse exception tags... |
|
177 |
//TODO: |
|
178 |
//Add to serviceInfo the supported formats for the exceptions???? |
|
189 | 179 |
} |
190 | 180 |
else if (parser.getName().compareTo(CapabilitiesTags.LAYER)==0) |
191 | 181 |
{ |
... | ... | |
205 | 195 |
rootLayer.getChildren().add(lyr); |
206 | 196 |
} |
207 | 197 |
|
208 |
//System.out.println("counter: " +counter++ ); |
|
209 | 198 |
if (lyr.getName()!=null) |
210 | 199 |
layers.put(lyr.getName(), lyr); |
211 | 200 |
|
... | ... | |
261 | 250 |
case KXmlParser.START_TAG: |
262 | 251 |
if (parser.getName().compareTo(CapabilitiesTags.GETCAPABILITIES)==0) |
263 | 252 |
{ |
264 |
serviceInfo.operations.put(WMSProtocolHandler.STR_GETCAPABILITIES, null);
|
|
253 |
serviceInfo.operations.put(CapabilitiesTags.GETCAPABILITIES, null);
|
|
265 | 254 |
} |
266 | 255 |
else if (parser.getName().compareTo(CapabilitiesTags.GETMAP)==0) |
267 | 256 |
{ |
268 |
serviceInfo.operations.put(WMSProtocolHandler.STR_GETMAP, null); |
|
269 |
// currentTag = parser.nextTag(); |
|
270 |
// parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.FORMAT); |
|
271 |
// while ((currentTag == KXmlParser.START_TAG) && |
|
272 |
// (parser.getName().compareTo(CapabilitiesTags.FORMAT)==0)) |
|
273 |
// { |
|
274 |
// parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.FORMAT); |
|
275 |
// serviceInfo.formats.add(parser.nextText()); |
|
276 |
// parser.nextTag(); |
|
277 |
// } |
|
257 |
// put a null to this key? |
|
258 |
// or leave it like it was with a CODE in a vector specifying this operation. |
|
259 |
// WMSProtocolHandler.GETMAP_OPERATION |
|
260 |
serviceInfo.operations.put(CapabilitiesTags.GETMAP, null); |
|
278 | 261 |
parseGetMapTag(parser); |
279 | 262 |
} |
280 | 263 |
else if (parser.getName().compareTo(CapabilitiesTags.GETFEATUREINFO)==0) |
281 | 264 |
{ |
282 |
serviceInfo.operations.put(WMSProtocolHandler.STR_GETFEATUREINFO, null); |
|
265 |
//serviceInfo.operations.put(WMSProtocolHandler.GETFEATUREINFO_OPERATION) |
|
266 |
serviceInfo.operations.put(CapabilitiesTags.GETFEATUREINFO, null); |
|
283 | 267 |
parseGetFeatureInfoTag(parser); |
284 | 268 |
} |
285 | 269 |
else if (parser.getName().compareTo(CapabilitiesTags.DESCRIBELAYER)==0) |
286 | 270 |
{ |
287 |
serviceInfo.operations.put(WMSProtocolHandler.STR_DESCRIBELAYER, null); |
|
271 |
//serviceInfo.operations.put(WMSProtocolHandler.DESCRIBELAYER_OPERATION) |
|
272 |
serviceInfo.operations.put(CapabilitiesTags.DESCRIBELAYER, null); |
|
288 | 273 |
} |
289 | 274 |
break; |
290 | 275 |
case KXmlParser.END_TAG: |
... | ... | |
334 | 319 |
String value = new String(); |
335 | 320 |
value = parser.getAttributeValue("", CapabilitiesTags.XLINK_HREF); |
336 | 321 |
if (value != null){ |
337 |
serviceInfo.operations.put(WMSProtocolHandler.STR_GETMAP, value);
|
|
322 |
serviceInfo.operations.put(CapabilitiesTags.GETMAP, value);
|
|
338 | 323 |
} |
339 | 324 |
} |
340 | 325 |
} |
... | ... | |
388 | 373 |
String value = new String(); |
389 | 374 |
value = parser.getAttributeValue("", CapabilitiesTags.XLINK_HREF); |
390 | 375 |
if (value != null){ |
391 |
serviceInfo.online_resource = value;
|
|
376 |
serviceInfo.operations.put(CapabilitiesTags.GETMAP, value);
|
|
392 | 377 |
} |
393 | 378 |
} |
394 | 379 |
} |
branches/v05/libraries/libRemoteServices/src/org/gvsig/remoteClient/wms/wms_1_3_0/WMSProtocolHandler1_3_0.java | ||
---|---|---|
10 | 10 |
import java.io.Reader; |
11 | 11 |
import java.util.ArrayList; |
12 | 12 |
import java.util.TreeMap; |
13 |
|
|
14 | 13 |
import org.gvsig.remoteClient.utils.CapabilitiesTags; |
15 | 14 |
import org.gvsig.remoteClient.utils.ExceptionTags; |
16 |
import org.gvsig.remoteClient.wms.WMSProtocolHandler; |
|
17 | 15 |
import org.kxml2.io.KXmlParser; |
18 | 16 |
import org.xmlpull.v1.XmlPullParserException; |
19 | 17 |
|
... | ... | |
65 | 63 |
while(tag != KXmlParser.END_DOCUMENT) |
66 | 64 |
{ |
67 | 65 |
switch(tag) |
68 |
{ |
|
69 |
|
|
66 |
{ |
|
70 | 67 |
case KXmlParser.START_TAG: |
71 | 68 |
if (kxmlParser.getName().compareTo(CapabilitiesTags.SERVICE )==0) |
72 | 69 |
{ |
... | ... | |
80 | 77 |
case KXmlParser.END_TAG: |
81 | 78 |
break; |
82 | 79 |
case KXmlParser.TEXT: |
83 |
System.out.println("[TEXT]["+kxmlParser.getText()+"]"); |
|
80 |
//System.out.println("[TEXT]["+kxmlParser.getText()+"]");
|
|
84 | 81 |
break; |
85 | 82 |
} |
86 | 83 |
tag = kxmlParser.next(); |
87 | 84 |
}//while !END_DOCUMENT |
88 | 85 |
} |
89 | 86 |
} |
90 |
catch(XmlPullParserException parser_ex){ |
|
91 |
System.out.println(parser_ex.getMessage()); |
|
87 |
catch(XmlPullParserException parser_ex){ |
|
92 | 88 |
parser_ex.printStackTrace(); |
93 |
// TODO: Implement logic to handle the exceptions |
|
94 | 89 |
} |
95 | 90 |
catch (IOException ioe) { |
96 | 91 |
ioe.printStackTrace(); |
97 |
// TODO: Implement logic to handle the exceptions |
|
98 |
} finally { |
|
92 |
} finally { |
|
99 | 93 |
|
100 | 94 |
} |
101 | 95 |
// In the parsing process the layer has been filled |
... | ... | |
155 | 149 |
} |
156 | 150 |
parser.require(KXmlParser.END_TAG, null, CapabilitiesTags.SERVICE); |
157 | 151 |
} |
152 |
|
|
158 | 153 |
/** |
159 | 154 |
* <p>Parses the Capability Tag </p> |
160 | 155 |
*/ |
... | ... | |
177 | 172 |
} |
178 | 173 |
else if (parser.getName().compareTo(CapabilitiesTags.EXCEPTION)==0) |
179 | 174 |
{ |
180 |
//Parse exception tags... |
|
175 |
//TODO: |
|
176 |
//Add to serviceInformation the supported exception formats. |
|
181 | 177 |
} |
182 | 178 |
else if (parser.getName().compareTo(CapabilitiesTags.LAYER)==0) |
183 | 179 |
{ |
... | ... | |
197 | 193 |
lyr.parse(parser, layers); |
198 | 194 |
|
199 | 195 |
if (lyr.getName()!=null) |
200 |
layers.put(lyr.getName(), lyr); |
|
201 |
//Add all the SRS that the layer supports to the WMSProtocolHandler if they dont exist already |
|
202 |
// for (i=0;i<lyr.getAllSrs().size();i++) |
|
203 |
// { |
|
204 |
// if (!this.srs.contains(lyr.getAllSrs().elementAt(i))) |
|
205 |
// { |
|
206 |
// this.srs.add( lyr.getAllSrs().elementAt(i)); |
|
207 |
// } |
|
208 |
// } |
|
196 |
layers.put(lyr.getName(), lyr); |
|
209 | 197 |
} |
210 | 198 |
else if ((parser.getName().compareTo(CapabilitiesTags.VENDORSPECIFICCAPABILITIES)==0) || |
211 |
(parser.getName().compareTo(CapabilitiesTags.USERDEFINEDSYMBOLIZATION )==0)) |
|
212 |
|
|
199 |
(parser.getName().compareTo(CapabilitiesTags.USERDEFINEDSYMBOLIZATION )==0)) |
|
213 | 200 |
{ |
214 | 201 |
parser.skipSubTree(); |
215 | 202 |
} |
... | ... | |
244 | 231 |
case KXmlParser.START_TAG: |
245 | 232 |
if (parser.getName().compareTo(CapabilitiesTags.GETCAPABILITIES)==0) |
246 | 233 |
{ |
234 |
//we could parse here the info of Capabilities request, but we actually never use it. |
|
247 | 235 |
} |
248 | 236 |
else if (parser.getName().compareTo(CapabilitiesTags.GETMAP)==0) |
249 |
{ |
|
250 |
|
|
251 |
// currentTag = parser.nextTag(); |
|
252 |
// parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.FORMAT); |
|
253 |
// while ((currentTag == KXmlParser.START_TAG) && |
|
254 |
// (parser.getName().compareTo(CapabilitiesTags.FORMAT)==0)) |
|
255 |
// { |
|
256 |
// parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.FORMAT); |
|
257 |
// serviceInfo.formats.add(parser.nextText()); |
|
258 |
// parser.nextTag(); |
|
259 |
// } |
|
260 |
serviceInfo.operations.put(WMSProtocolHandler.STR_GETMAP, null); |
|
237 |
{ |
|
238 |
serviceInfo.operations.put(CapabilitiesTags.GETMAP, null); |
|
261 | 239 |
parseGetMapTag(parser); |
262 | 240 |
} |
263 | 241 |
else if (parser.getName().compareTo(CapabilitiesTags.GETFEATUREINFO)==0) |
264 | 242 |
{ |
265 |
serviceInfo.operations.put(WMSProtocolHandler.STR_GETFEATUREINFO, null);
|
|
243 |
serviceInfo.operations.put(CapabilitiesTags.GETFEATUREINFO, null);
|
|
266 | 244 |
parseGetFeatureInfoTag(parser); |
267 | 245 |
} |
268 | 246 |
break; |
... | ... | |
313 | 291 |
String value = new String(); |
314 | 292 |
value = parser.getAttributeValue("", CapabilitiesTags.XLINK_HREF); |
315 | 293 |
if (value != null){ |
316 |
serviceInfo.online_resource = value;
|
|
317 |
} |
|
294 |
serviceInfo.operations.put(CapabilitiesTags.GETMAP, value);
|
|
295 |
}
|
|
318 | 296 |
} |
319 | 297 |
} |
320 | 298 |
} |
Also available in: Unified diff