Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/GFIServiceImpl.java @ 5800:397ff862b417
WOutProcessor: Renaming, doc.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 24 Apr 2013 08:24:56 +0200 |
parents | af2aa716152f |
children | a4ff4167be1e |
rev | line source |
---|---|
1400
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server; |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.io.InputStream; |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import java.io.IOException; |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import java.net.URL; |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import java.net.URLConnection; |
1402
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
7 import java.util.ArrayList; |
1400
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import java.util.List; |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
1402
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
10 import org.w3c.dom.Document; |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
11 import org.w3c.dom.Node; |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
12 import org.w3c.dom.NodeList; |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
13 |
1400
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import org.apache.log4j.Logger; |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import com.google.gwt.user.server.rpc.RemoteServiceServlet; |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
1402
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
18 import de.intevation.artifacts.common.utils.XMLUtils; |
1400
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.flys.client.shared.exceptions.ServerException; |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.flys.client.shared.model.AttributedTheme; |
1402
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
22 import de.intevation.flys.client.shared.model.FeatureInfo; |
1400
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.flys.client.shared.model.Theme; |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 import de.intevation.flys.client.client.services.GFIService; |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 /** |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 */ |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 public class GFIServiceImpl |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 extends RemoteServiceServlet |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 implements GFIService |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 { |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 public static final String ERR_NO_VALID_GFI_URL = |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 "error_no_valid_gfi_url"; |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 public static final String ERR_GFI_REQUEST_FAILED = |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 "error_gfi_req_failed"; |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 public static final String ERR_PARSING_RESPONSE_FAILED = |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 "error_gfi_parsing_failed"; |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 private static final Logger logger = |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 Logger.getLogger(GFIServiceImpl.class); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 /** |
5794
af2aa716152f
Fix issue1254, make GetFeatureInfo work reliably
Andre Heinecke <aheinecke@intevation.de>
parents:
2448
diff
changeset
|
50 * @param theme |
1400
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 * @param format |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 * @param bbox |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 * @param height |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 * @param width |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 * @param x |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 * @param y |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 * |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 * @return |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 */ |
1402
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
60 public List<FeatureInfo> query( |
5794
af2aa716152f
Fix issue1254, make GetFeatureInfo work reliably
Andre Heinecke <aheinecke@intevation.de>
parents:
2448
diff
changeset
|
61 Theme theme, |
1400
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 String format, |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 String bbox, |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 String projection, |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 int height, |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 int width, |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 int x, |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 int y |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 ) throws ServerException |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 { |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 logger.info("GFIServiceImpl.query"); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 String path = createGetFeautureInfoURL( |
5794
af2aa716152f
Fix issue1254, make GetFeatureInfo work reliably
Andre Heinecke <aheinecke@intevation.de>
parents:
2448
diff
changeset
|
74 theme, format, bbox, projection, height, width, x, y); |
1402
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
75 |
1400
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 logger.debug("URL=" + path); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 try { |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 URL url = new URL(path); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 URLConnection conn = url.openConnection(); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 conn.connect(); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 InputStream is = conn.getInputStream(); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 |
1402
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
86 return parseResponse(is); |
1400
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 } |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 catch (IOException ioe) { |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 logger.warn(ioe, ioe); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 } |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 throw new ServerException(ERR_GFI_REQUEST_FAILED); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 } |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 /** |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 * @param map |
5794
af2aa716152f
Fix issue1254, make GetFeatureInfo work reliably
Andre Heinecke <aheinecke@intevation.de>
parents:
2448
diff
changeset
|
99 * @param theme |
1400
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 * @param format |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 * @param x |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 * @param y |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 * |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 * @return |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 */ |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 protected String createGetFeautureInfoURL( |
5794
af2aa716152f
Fix issue1254, make GetFeatureInfo work reliably
Andre Heinecke <aheinecke@intevation.de>
parents:
2448
diff
changeset
|
107 Theme theme, |
1400
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 String infoFormat, |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 String bbox, |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 String projection, |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 int height, |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 int width, |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 int x, |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 int y |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 ) throws ServerException |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 { |
5794
af2aa716152f
Fix issue1254, make GetFeatureInfo work reliably
Andre Heinecke <aheinecke@intevation.de>
parents:
2448
diff
changeset
|
117 String url = getUrl(theme); |
1400
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 if (url == null || url.length() == 0) { |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 throw new ServerException(ERR_NO_VALID_GFI_URL); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 } |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 |
5794
af2aa716152f
Fix issue1254, make GetFeatureInfo work reliably
Andre Heinecke <aheinecke@intevation.de>
parents:
2448
diff
changeset
|
123 String layers = ((AttributedTheme)theme).getAttr("layers"); |
1400
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 StringBuilder sb = new StringBuilder(); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 sb.append(url); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 if (url.indexOf("?") < 0) { |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 sb.append("?SERVICE=WMS"); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 } |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 else { |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 sb.append("&SERVICE=WMS"); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 } |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 sb.append("&VERSION=1.1.1"); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 sb.append("&REQUEST=GetFeatureInfo"); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 sb.append("&LAYERS=" + layers); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 sb.append("&QUERY_LAYERS=" + layers); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 sb.append("&BBOX=" + bbox); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 sb.append("&HEIGHT=" + height); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 sb.append("&WIDTH=" + width); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 sb.append("&FORMAT=image/png"); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 sb.append("&INFO_FORMAT=" + infoFormat); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 sb.append("&SRS=" + projection); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 sb.append("&X=" + String.valueOf(x)); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 sb.append("&Y=" + String.valueOf(y)); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 return sb.toString(); |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 } |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 |
5794
af2aa716152f
Fix issue1254, make GetFeatureInfo work reliably
Andre Heinecke <aheinecke@intevation.de>
parents:
2448
diff
changeset
|
152 protected String getUrl(Theme theme) { |
af2aa716152f
Fix issue1254, make GetFeatureInfo work reliably
Andre Heinecke <aheinecke@intevation.de>
parents:
2448
diff
changeset
|
153 AttributedTheme attr = (AttributedTheme) theme; |
1400
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 |
5794
af2aa716152f
Fix issue1254, make GetFeatureInfo work reliably
Andre Heinecke <aheinecke@intevation.de>
parents:
2448
diff
changeset
|
155 if (attr.getAttrAsBoolean("queryable")) { |
af2aa716152f
Fix issue1254, make GetFeatureInfo work reliably
Andre Heinecke <aheinecke@intevation.de>
parents:
2448
diff
changeset
|
156 return attr.getAttr("url"); |
1400
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
157 } |
5794
af2aa716152f
Fix issue1254, make GetFeatureInfo work reliably
Andre Heinecke <aheinecke@intevation.de>
parents:
2448
diff
changeset
|
158 return null; |
1400
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 } |
1402
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
160 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
161 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
162 protected List<FeatureInfo> parseResponse(InputStream is) { |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
163 logger.debug("GFIServiceImpl.parseResponse"); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
164 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
165 Document response = XMLUtils.parseDocument(is); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
166 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
167 List<FeatureInfo> features = new ArrayList<FeatureInfo>(); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
168 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
169 parseFeatureInfos(response, features); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
170 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
171 return features; |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
172 } |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
173 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
174 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
175 protected void parseFeatureInfos(Node node, List<FeatureInfo> features) { |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
176 logger.debug("GFIServiceImpl.parseFeatureInfos"); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
177 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
178 String name = node.getNodeName(); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
179 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
180 if (name.endsWith("_layer")) { |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
181 features.add(parseFeature(node)); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
182 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
183 return; |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
184 } |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
185 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
186 NodeList children = node.getChildNodes(); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
187 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
188 if (children != null && children.getLength() > 0) { |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
189 for (int i = 0, n = children.getLength(); i < n; i++) { |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
190 parseFeatureInfos(children.item(i), features); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
191 } |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
192 } |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
193 } |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
194 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
195 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
196 protected FeatureInfo parseFeature(Node node) { |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
197 logger.debug("GFIServiceImpl.parseFeature"); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
198 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
199 String layername = node.getNodeName(); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
200 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
201 FeatureInfo f = new FeatureInfo(layername); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
202 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
203 NodeList children = node.getChildNodes(); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
204 int numChildren = children != null ? children.getLength() : 0; |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
205 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
206 logger.debug("Feature '" + layername + "' has " + numChildren + " nodes."); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
207 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
208 for (int i = 0; i < numChildren; i++) { |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
209 Node tmp = children.item(i); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
210 String nodeName = tmp.getNodeName(); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
211 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
212 logger.debug(" node name: '" + nodeName + "'"); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
213 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
214 if (nodeName.equals("gml:name")) { |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
215 logger.debug("NAME node has child: " + tmp.getFirstChild().getNodeValue()); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
216 f.setLayername(tmp.getFirstChild().getNodeValue()); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
217 } |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
218 else if (nodeName.endsWith("_feature")) { |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
219 parseFeatureAttributes(tmp, f); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
220 } |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
221 } |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
222 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
223 return f; |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
224 } |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
225 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
226 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
227 protected void parseFeatureAttributes(Node node, FeatureInfo f) { |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
228 logger.debug("GFIServiceImpl.parseFeatureAttributes"); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
229 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
230 NodeList children = node.getChildNodes(); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
231 int numChildren = children != null ? children.getLength() : 0; |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
232 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
233 logger.debug("Has " + numChildren + " attributes."); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
234 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
235 for (int i = 0; i < numChildren; i++) { |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
236 Node tmp = children.item(i); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
237 String name = tmp.getNodeName(); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
238 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
239 logger.debug(" tmp attribute name: '" + name + "'"); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
240 |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
241 if (name.equals("gml:boundedBy")) { |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
242 // TODO |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
243 } |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
244 else { |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
245 Node child = tmp.getFirstChild(); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
246 if (child != null) { |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
247 f.addAttr(name, child.getNodeValue()); |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
248 } |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
249 } |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
250 } |
15ef3d3081b7
Parse GetFeatureInfo response on our own and display resulting FeatureInfo objects in the GetFeatureInfoWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
251 } |
1400
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
252 } |
96708d81eaf6
Added an initial GetFeatureInfo tool to get information about points in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
253 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |