Revision 7271
org.gvsig.raster.wms/trunk/org.gvsig.raster.wms/org.gvsig.raster.wms.app.wmsclient/src/main/java/org/gvsig/raster/wms/app/wmsclient/infobypoint/MainInfoByPointDialog.java | ||
---|---|---|
2 | 2 |
* |
3 | 3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
4 | 4 |
* of the Valencian Government (CIT) |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
8 | 8 |
* as published by the Free Software Foundation; either version 2 |
9 | 9 |
* of the License, or (at your option) any later version. |
10 |
*
|
|
10 |
* |
|
11 | 11 |
* This program is distributed in the hope that it will be useful, |
12 | 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | 14 |
* GNU General Public License for more details. |
15 |
*
|
|
15 |
* |
|
16 | 16 |
* You should have received a copy of the GNU General Public License |
17 | 17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 | 19 |
* MA 02110-1301, USA. |
20 |
*
|
|
20 |
* |
|
21 | 21 |
*/ |
22 | 22 |
package org.gvsig.raster.wms.app.wmsclient.infobypoint; |
23 | 23 |
|
... | ... | |
69 | 69 |
private JScrollPane scroll = null; |
70 | 70 |
private JPanel wmsInfo = null; |
71 | 71 |
private JEditorPane jeditor = null; |
72 |
private XMLViewer dlgXML = null;
|
|
72 |
private XMLViewer dlgXML = null; |
|
73 | 73 |
private XMLItem item = null; |
74 | 74 |
private XMLContent xmlContent = null; |
75 |
|
|
75 |
|
|
76 | 76 |
public class StringXMLItem extends TextXMLContent implements XMLItem { |
77 | 77 |
FLayer layer; |
78 |
|
|
78 |
|
|
79 | 79 |
public StringXMLItem(String text, FLayer lyr) { |
80 | 80 |
super(text); |
81 | 81 |
this.layer = lyr; |
82 | 82 |
} |
83 |
|
|
83 |
|
|
84 | 84 |
public FLayer getLayer(){ |
85 | 85 |
return this.layer; |
86 | 86 |
} |
... | ... | |
141 | 141 |
} |
142 | 142 |
} |
143 | 143 |
} |
144 |
|
|
144 |
|
|
145 | 145 |
public MainInfoByPointDialog() { |
146 | 146 |
setLayout(new BorderLayout()); |
147 | 147 |
add((Component)getMainPanel(), BorderLayout.WEST); |
148 | 148 |
add((Component)getWMSInfoPanel(), BorderLayout.CENTER); |
149 | 149 |
} |
150 |
|
|
150 |
|
|
151 | 151 |
public MainInfoByPointPanel getMainPanel() { |
152 |
if(mainPanel == null) {
|
|
152 |
if(mainPanel == null) { |
|
153 | 153 |
HashMap<String, String> translations = new HashMap<String, String>(); |
154 | 154 |
translations.put("info", PluginServices.getText(this, "info")); |
155 | 155 |
translations.put("view", PluginServices.getText(this, "view")); |
... | ... | |
188 | 188 |
} |
189 | 189 |
return wmsInfo; |
190 | 190 |
} |
191 |
|
|
191 |
|
|
192 | 192 |
private JPanel getWMSXMLInfoPanel(String text) throws SAXException { |
193 | 193 |
if(wmsInfo == null) { |
194 | 194 |
wmsInfo = new JPanel(); |
... | ... | |
218 | 218 |
TreePath path = new TreePath(treeModel.getPathToRoot(n)); |
219 | 219 |
dlgXML.getXmlTree().expandPath(path); |
220 | 220 |
//dlgXML.getXmlTree().setSelectionPath(path); |
221 |
|
|
221 |
|
|
222 | 222 |
wmsInfo.add(scroll, BorderLayout.CENTER); |
223 | 223 |
} |
224 | 224 |
return wmsInfo; |
... | ... | |
234 | 234 |
} |
235 | 235 |
HTMLEditorKit kit = new HTMLEditorKit(); |
236 | 236 |
jeditor.setEditorKit(kit); |
237 |
|
|
237 |
|
|
238 | 238 |
text = removeLabelBlock(text, "style"); |
239 | 239 |
text = removeLabelBlock(text, "meta"); |
240 |
|
|
240 |
|
|
241 | 241 |
StyleSheet s = kit.getStyleSheet(); |
242 | 242 |
s.addRule("body {font-family:verdana; margin: 15px; }"); |
243 | 243 |
s.addRule("caption {background-color:#FBFFE1;font-style:normal;color:black}"); |
... | ... | |
261 | 261 |
} catch (SAXException e) { |
262 | 262 |
LoggerFactory.getLogger(MainInfoByPointDialog.class).debug("", e); |
263 | 263 |
} |
264 |
} else { //if(type.equals("text/plain")) { |
|
265 |
if(jeditor == null) { |
|
266 |
wmsInfo = null; |
|
267 |
dlgXML = null; |
|
268 |
remove(1); |
|
269 |
add((Component)getWMSInfoPanel(), BorderLayout.CENTER); |
|
270 |
} |
|
271 |
jeditor.setText(text); |
|
264 | 272 |
} |
265 | 273 |
} |
266 |
|
|
274 |
|
|
267 | 275 |
/** |
268 | 276 |
* Removes a label from the text |
269 | 277 |
* @param text |
... | ... | |
278 | 286 |
} |
279 | 287 |
return text; |
280 | 288 |
} |
281 |
|
|
289 |
|
|
282 | 290 |
public WindowInfo getWindowInfo() { |
283 | 291 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODELESSDIALOG | WindowInfo.RESIZABLE); |
284 | 292 |
m_viewinfo.setTitle(PluginServices.getText(this, "WMS InfoByPoint")); |
... | ... | |
286 | 294 |
m_viewinfo.setWidth(700); |
287 | 295 |
return m_viewinfo; |
288 | 296 |
} |
289 |
|
|
297 |
|
|
290 | 298 |
public void windowClosed() { |
291 | 299 |
CompoundBehavior.setAllControlsBehavior(InfoByWMSPointExtension.oldBehavior); |
292 | 300 |
} |
293 |
|
|
301 |
|
|
294 | 302 |
public Object getWindowProfile() { |
295 | 303 |
return WindowInfo.PROPERTIES_PROFILE; |
296 | 304 |
} |
... | ... | |
298 | 306 |
public InfoByPointDataModel getInfoByPointDataModel() { |
299 | 307 |
return getMainPanel().getInfoByPointDataModel(); |
300 | 308 |
} |
301 |
|
|
309 |
|
|
302 | 310 |
public PixelInspector getPixelInspector() { |
303 | 311 |
return getMainPanel().getPixelInspectorPanel(); |
304 | 312 |
} |
org.gvsig.raster.wms/trunk/org.gvsig.raster.wms/org.gvsig.raster.wms.app.wmsclient/src/main/java/org/gvsig/raster/wms/app/wmsclient/infobypoint/viewtool/InfoByPixelPointViewTool.java | ||
---|---|---|
2 | 2 |
* |
3 | 3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
4 | 4 |
* of the Valencian Government (CIT) |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
8 | 8 |
* as published by the Free Software Foundation; either version 2 |
9 | 9 |
* of the License, or (at your option) any later version. |
10 |
*
|
|
10 |
* |
|
11 | 11 |
* This program is distributed in the hope that it will be useful, |
12 | 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | 14 |
* GNU General Public License for more details. |
15 |
*
|
|
15 |
* |
|
16 | 16 |
* You should have received a copy of the GNU General Public License |
17 | 17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 | 19 |
* MA 02110-1301, USA. |
20 |
*
|
|
20 |
* |
|
21 | 21 |
*/ |
22 | 22 |
package org.gvsig.raster.wms.app.wmsclient.infobypoint.viewtool; |
23 | 23 |
|
... | ... | |
51 | 51 |
/** |
52 | 52 |
* Extensi?n de la clase SelectImageListenerImple de FMap. Esta clase permite |
53 | 53 |
* capturar el evento de la selecci?n de un punto RGB sobre la vista |
54 |
*
|
|
54 |
* |
|
55 | 55 |
* 22/02/2008 |
56 | 56 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
57 | 57 |
*/ |
... | ... | |
63 | 63 |
private FLayers layers = null; |
64 | 64 |
private List<String> list = null; |
65 | 65 |
private MainInfoByPointDialog dialog = null; |
66 |
|
|
66 |
|
|
67 | 67 |
/** |
68 | 68 |
* Reference to the <code>MapControl</code> object that uses. |
69 | 69 |
*/ |
70 | 70 |
protected MapControl mapCtrl; |
71 | 71 |
|
72 | 72 |
/** |
73 |
* World equivalent coordinates of the point 2D
|
|
73 |
* World equivalent coordinates of the point 2D |
|
74 | 74 |
*/ |
75 | 75 |
protected Point2D wcPoint = null; |
76 |
|
|
76 |
|
|
77 | 77 |
/** |
78 | 78 |
* Contructor |
79 | 79 |
* @param mapCtrl |
80 | 80 |
*/ |
81 | 81 |
public InfoByPixelPointViewTool( |
82 |
MapControl mapCtrl,
|
|
82 |
MapControl mapCtrl, |
|
83 | 83 |
InfoByPointDataModel model, |
84 | 84 |
MainInfoByPointDialog dialog) { |
85 | 85 |
this.mapCtrl = mapCtrl; |
... | ... | |
100 | 100 |
int r = (value >> 16) & 0xff; |
101 | 101 |
int g = (value >> 8) & 0xff; |
102 | 102 |
int b = value & 0xff; |
103 |
|
|
103 |
|
|
104 | 104 |
double[] cmyk = conv.RGBtoCMYK(r & 0xff, g & 0xff, b & 0xff, 1D); |
105 |
|
|
105 |
|
|
106 | 106 |
double[] hsl = conv.RGBtoHSL(r & 0xff, g & 0xff, b & 0xff); |
107 | 107 |
hsl[0] = (int)(255.0 * hsl[0] / 360.0 + 0.5); |
108 | 108 |
hsl[2] = (int) (hsl[2] * 255. + 0.5); |
109 | 109 |
hsl[1] = (int) (hsl[1] * 255. + 0.5); |
110 |
|
|
110 |
|
|
111 | 111 |
Point2D mapPoint = viewPort.toMapPoint(point2D); |
112 |
|
|
112 |
|
|
113 | 113 |
model.setARGB(r, g, b); |
114 | 114 |
model.setCMYK(cmyk); |
115 | 115 |
model.setHSL(hsl[0], hsl[1], hsl[2]); |
116 | 116 |
model.setViewPoint(point2D.getX(), point2D.getY()); |
117 | 117 |
model.setWorldPoint(mapPoint.getX(), mapPoint.getY()); |
118 |
|
|
118 |
|
|
119 | 119 |
//Raster dependent |
120 |
|
|
120 |
|
|
121 | 121 |
list.clear(); |
122 | 122 |
FLyrWMS selected = null; |
123 | 123 |
for (int i = layers.getLayersCount() - 1; i >= 0; i--) { |
... | ... | |
131 | 131 |
} |
132 | 132 |
} |
133 | 133 |
} |
134 |
|
|
134 |
|
|
135 | 135 |
if(selected != null) { |
136 | 136 |
Point2D rasterPoint = selected.getDataStore().worldToRaster(mapPoint); |
137 | 137 |
model.setNumberOfBands(selected.getDataStore().getBandCount()); |
138 | 138 |
model.setBandValues(getBandValues(selected.getDataStore(), rasterPoint)); |
139 | 139 |
model.setPixelPoint(rasterPoint.getX(), rasterPoint.getY()); |
140 |
|
|
141 |
Point p = new Point(); |
|
142 |
p.setLocation(point2D.getX(), point2D.getY()); |
|
143 |
try { |
|
144 |
DynObjectSetWMSInfo dos = (DynObjectSetWMSInfo)selected.getInfo(p, 0D, null, true); |
|
145 |
String txt = dos.getInfoElement(); |
|
146 |
if(dos.getTypeInfo().compareTo("text/plain") == 0) |
|
147 |
dialog.setWMSInfoText(txt, dos.getTypeInfo()); |
|
148 |
else if(dos.getTypeInfo().compareTo("text/html") == 0) { |
|
149 |
int beginIndex = txt.indexOf("<html"); |
|
150 |
if(beginIndex > 0) |
|
151 |
txt = txt.substring(beginIndex, txt.length()); |
|
152 |
dialog.setWMSInfoText(txt, "text/html"); |
|
153 |
} else if(dos.getTypeInfo().endsWith("vnd.ogc.gml") || dos.getTypeInfo().compareTo("text/xml") == 0) { |
|
154 |
dialog.setWMSInfoText(txt, "text/xml"); |
|
155 |
}else |
|
156 |
dialog.setWMSInfoText(txt, "text/html"); |
|
157 |
|
|
158 |
} catch (LoadLayerException e) { |
|
159 |
e.printStackTrace(); |
|
160 |
} catch (DataException e) { |
|
161 |
e.printStackTrace(); |
|
162 |
} |
|
140 | 163 |
} else { |
141 | 164 |
list.clear(); |
142 | 165 |
list.add("..."); |
... | ... | |
145 | 168 |
model.setPixelPoint(-1, -1); |
146 | 169 |
} |
147 | 170 |
model.setLayerList(list); |
148 |
|
|
149 |
Point p = new Point(); |
|
150 |
p.setLocation(point2D.getX(), point2D.getY()); |
|
151 |
try { |
|
152 |
DynObjectSetWMSInfo dos = (DynObjectSetWMSInfo)selected.getInfo(p, 0D, null, true); |
|
153 |
String txt = dos.getInfoElement(); |
|
154 |
if(dos.getTypeInfo().compareTo("text/plain") == 0) |
|
155 |
dialog.setWMSInfoText(txt, dos.getTypeInfo()); |
|
156 |
else if(dos.getTypeInfo().compareTo("text/html") == 0) { |
|
157 |
int beginIndex = txt.indexOf("<html"); |
|
158 |
if(beginIndex > 0) |
|
159 |
txt = txt.substring(beginIndex, txt.length()); |
|
160 |
dialog.setWMSInfoText(txt, "text/html"); |
|
161 |
} else if(dos.getTypeInfo().endsWith("vnd.ogc.gml") || dos.getTypeInfo().compareTo("text/xml") == 0) { |
|
162 |
dialog.setWMSInfoText(txt, "text/xml"); |
|
163 |
}else |
|
164 |
dialog.setWMSInfoText(txt, "text/html"); |
|
165 |
|
|
166 |
} catch (LoadLayerException e) { |
|
167 |
e.printStackTrace(); |
|
168 |
} catch (DataException e) { |
|
169 |
e.printStackTrace(); |
|
170 |
} |
|
171 |
|
|
171 | 172 |
model.notifyObservers(); |
172 | 173 |
} |
173 |
|
|
174 |
|
|
174 | 175 |
/** |
175 | 176 |
* Loads the values of a pixel point |
176 | 177 |
* @param dataStore |
... | ... | |
209 | 210 |
for (int i = 0; i < dataStore.getBandCount(); i++) { |
210 | 211 |
res[i] = Double.NaN; |
211 | 212 |
} |
212 |
}
|
|
213 |
} |
|
213 | 214 |
return res; |
214 | 215 |
} |
215 | 216 |
|
org.gvsig.raster.wms/trunk/org.gvsig.raster.wms/org.gvsig.raster.wms.remoteclient/src/main/java/org/gvsig/remoteclient/wms/wms_1_3_0/WMSProtocolHandler1_3_0.java | ||
---|---|---|
61 | 61 |
* </p> |
62 | 62 |
*/ |
63 | 63 |
public class WMSProtocolHandler1_3_0 extends org.gvsig.remoteclient.wms.WMSProtocolHandler { |
64 |
|
|
64 |
|
|
65 | 65 |
private static final Logger logger = LoggerFactory.getLogger(WMSProtocolHandler1_3_0.class); |
66 | 66 |
private WMSLayer1_3_0 fakeRootLayer; |
67 |
|
|
67 |
|
|
68 | 68 |
public WMSProtocolHandler1_3_0() |
69 | 69 |
{ |
70 | 70 |
this.version = "1.3.0"; |
71 | 71 |
this.name = "WMS1.3.0"; |
72 |
this.serviceInfo = new WMSServiceInformation();
|
|
73 |
this.layers = new TreeMap();
|
|
72 |
this.serviceInfo = new WMSServiceInformation(); |
|
73 |
this.layers = new TreeMap(); |
|
74 | 74 |
} |
75 |
|
|
75 |
|
|
76 | 76 |
//------------------------------------------------------------------------------ |
77 |
// Parsing methods....
|
|
78 |
//------------------------------------------------------------------------------
|
|
77 |
// Parsing methods.... |
|
78 |
//------------------------------------------------------------------------------ |
|
79 | 79 |
|
80 | 80 |
@Override |
81 | 81 |
public void getCapabilities(WMSStatus status, boolean override, |
... | ... | |
89 | 89 |
processLayer(rootLayer); |
90 | 90 |
} |
91 | 91 |
} |
92 |
|
|
92 |
|
|
93 | 93 |
/** |
94 | 94 |
* WMSLayer parser gets no information about the user preferences regarding |
95 | 95 |
* axis order, so the bboxes should be should be post-processed here, |
... | ... | |
98 | 98 |
* @param layer |
99 | 99 |
*/ |
100 | 100 |
protected void processLayer(WMSLayer layer) { |
101 |
if (layer.getBboxes()!=null) { |
|
102 |
Collection<BoundaryBox> col = (Collection<BoundaryBox>) layer.getBboxes().values(); |
|
103 |
for (BoundaryBox bbox: col) { |
|
104 |
if (!CrsAxisOrder.isXyAxisOrder(bbox.getSrs())) { |
|
105 |
bbox.setXmin(bbox.getYmin()); |
|
106 |
bbox.setYmin(bbox.getXmin()); |
|
107 |
bbox.setXmax(bbox.getYmax()); |
|
108 |
bbox.setYmax(bbox.getXmax()); |
|
109 |
} |
|
110 |
} |
|
111 |
} |
|
112 |
ArrayList children = layer.getChildren(); |
|
113 |
if (children!=null) { |
|
114 |
for (int i=0; i<children.size(); i++) { |
|
115 |
WMSLayer child = (WMSLayer) children.get(i); |
|
116 |
processLayer(child); |
|
117 |
} |
|
118 |
} |
|
119 |
} |
|
120 |
|
|
101 |
if (layer.getBboxes()!=null) { |
|
102 |
Collection<BoundaryBox> col = (Collection<BoundaryBox>) layer.getBboxes().values(); |
|
103 |
for (BoundaryBox bbox: col) { |
|
104 |
if (!CrsAxisOrder.isXyAxisOrder(bbox.getSrs())) { |
|
105 |
double auxX = bbox.getXmin(); |
|
106 |
double auxY = bbox.getYmin(); |
|
107 |
bbox.setXmin(auxY); |
|
108 |
bbox.setYmin(auxX); |
|
109 |
auxX = bbox.getXmax(); |
|
110 |
auxY = bbox.getYmax(); |
|
111 |
bbox.setXmax(auxY); |
|
112 |
bbox.setYmax(auxX); |
|
113 |
} |
|
114 |
} |
|
115 |
} |
|
116 |
ArrayList children = layer.getChildren(); |
|
117 |
if (children!=null) { |
|
118 |
for (int i=0; i<children.size(); i++) { |
|
119 |
WMSLayer child = (WMSLayer) children.get(i); |
|
120 |
processLayer(child); |
|
121 |
} |
|
122 |
} |
|
123 |
} |
|
124 |
|
|
121 | 125 |
public boolean parseCapabilities(File f) |
122 |
{
|
|
126 |
{ |
|
123 | 127 |
rootLayer = null; |
124 |
|
|
128 |
|
|
125 | 129 |
int tag; |
126 | 130 |
EncodingXMLParser kxmlParser = null; |
127 | 131 |
kxmlParser = new EncodingXMLParser(); |
... | ... | |
129 | 133 |
{ |
130 | 134 |
kxmlParser.setInput(f); |
131 | 135 |
kxmlParser.nextTag(); |
132 |
if ( kxmlParser.getEventType() != KXmlParser.END_DOCUMENT )
|
|
133 |
{
|
|
134 |
kxmlParser.require(KXmlParser.START_TAG, null, CapabilitiesTags.CAPABILITIES_ROOT1_3_0);
|
|
136 |
if ( kxmlParser.getEventType() != KXmlParser.END_DOCUMENT ) |
|
137 |
{ |
|
138 |
kxmlParser.require(KXmlParser.START_TAG, null, CapabilitiesTags.CAPABILITIES_ROOT1_3_0); |
|
135 | 139 |
tag = kxmlParser.nextTag(); |
136 | 140 |
while(tag != KXmlParser.END_DOCUMENT) |
137 | 141 |
{ |
138 | 142 |
switch(tag) |
139 |
{
|
|
143 |
{ |
|
140 | 144 |
case KXmlParser.START_TAG: |
141 | 145 |
if (kxmlParser.getName().compareTo(CapabilitiesTags.SERVICE )==0) |
142 | 146 |
{ |
143 | 147 |
parseServiceTag(kxmlParser); |
144 |
}
|
|
148 |
} |
|
145 | 149 |
else if (kxmlParser.getName().compareTo(CapabilitiesTags.CAPABILITY)==0) |
146 | 150 |
{ |
147 | 151 |
parseCapabilityTag(kxmlParser); |
148 | 152 |
} |
149 | 153 |
break; |
150 |
case KXmlParser.END_TAG:
|
|
154 |
case KXmlParser.END_TAG: |
|
151 | 155 |
break; |
152 | 156 |
case KXmlParser.TEXT: |
153 |
//System.out.println("[TEXT]["+kxmlParser.getText()+"]");
|
|
157 |
//System.out.println("[TEXT]["+kxmlParser.getText()+"]"); |
|
154 | 158 |
break; |
155 | 159 |
} |
156 | 160 |
tag = kxmlParser.next(); |
157 | 161 |
}//while !END_DOCUMENT |
158 | 162 |
} |
159 | 163 |
} |
160 |
catch(XmlPullParserException parser_ex){
|
|
164 |
catch(XmlPullParserException parser_ex){ |
|
161 | 165 |
logger.warn("Error parsing capabilites.",parser_ex); |
162 | 166 |
return false; |
163 | 167 |
} |
164 |
catch (IOException ioe) {
|
|
168 |
catch (IOException ioe) { |
|
165 | 169 |
logger.warn("Error parsing capabilites.",ioe); |
166 | 170 |
return false; |
167 | 171 |
} finally { |
168 | 172 |
return true; |
169 | 173 |
} |
170 |
// In the parsing process the layer has been filled
|
|
171 |
}
|
|
172 |
|
|
174 |
// In the parsing process the layer has been filled |
|
175 |
} |
|
176 |
|
|
173 | 177 |
/** |
174 | 178 |
* <p>Parses the Service Information </p> |
175 |
*/
|
|
176 |
private void parseServiceTag(KXmlParser parser) throws IOException, XmlPullParserException
|
|
179 |
*/ |
|
180 |
private void parseServiceTag(KXmlParser parser) throws IOException, XmlPullParserException |
|
177 | 181 |
{ |
178 | 182 |
int currentTag; |
179 | 183 |
boolean end = false; |
180 |
|
|
184 |
|
|
181 | 185 |
parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.SERVICE); |
182 | 186 |
currentTag = parser.next(); |
183 |
|
|
184 |
while (!end)
|
|
187 |
|
|
188 |
while (!end) |
|
185 | 189 |
{ |
186 | 190 |
switch(currentTag) |
187 | 191 |
{ |
188 | 192 |
case KXmlParser.START_TAG: |
189 | 193 |
if (parser.getName().compareTo(CapabilitiesTags.NAME)==0) |
190 | 194 |
{ |
191 |
serviceInfo.name = parser.nextText();
|
|
192 |
}
|
|
195 |
serviceInfo.name = parser.nextText(); |
|
196 |
} |
|
193 | 197 |
else if (parser.getName().compareTo(CapabilitiesTags.TITLE)==0) |
194 | 198 |
{ |
195 |
serviceInfo.title = parser.nextText();
|
|
199 |
serviceInfo.title = parser.nextText(); |
|
196 | 200 |
} |
197 | 201 |
else if (parser.getName().compareTo(CapabilitiesTags.ABSTRACT)==0) |
198 | 202 |
{ |
199 |
serviceInfo.abstr = parser.nextText();
|
|
203 |
serviceInfo.abstr = parser.nextText(); |
|
200 | 204 |
} |
201 | 205 |
else if (parser.getName().compareTo(CapabilitiesTags.ONLINERESOURCE)==0) |
202 | 206 |
{ |
... | ... | |
205 | 209 |
if (value != null){ |
206 | 210 |
serviceInfo.online_resource = value; |
207 | 211 |
} |
208 |
}
|
|
212 |
} |
|
209 | 213 |
else if ((parser.getName().compareTo(CapabilitiesTags.KEYWORDLIST)==0) || |
210 | 214 |
(parser.getName().compareTo(CapabilitiesTags.CONTACTINFORMATION)==0)) |
211 | 215 |
{ |
212 | 216 |
parser.skipSubTree(); |
213 |
}
|
|
217 |
} |
|
214 | 218 |
break; |
215 | 219 |
case KXmlParser.END_TAG: |
216 | 220 |
if (parser.getName().compareTo(CapabilitiesTags.SERVICE) == 0) |
217 | 221 |
end = true; |
218 | 222 |
break; |
219 |
case KXmlParser.TEXT:
|
|
223 |
case KXmlParser.TEXT: |
|
220 | 224 |
break; |
221 | 225 |
} |
222 | 226 |
if (!end) |
... | ... | |
224 | 228 |
} |
225 | 229 |
parser.require(KXmlParser.END_TAG, null, CapabilitiesTags.SERVICE); |
226 | 230 |
} |
227 |
|
|
231 |
|
|
228 | 232 |
/** |
229 | 233 |
* <p>Parses the Capability Tag </p> |
230 |
*/
|
|
234 |
*/ |
|
231 | 235 |
private void parseCapabilityTag(KXmlParser parser) throws IOException, XmlPullParserException |
232 |
{
|
|
236 |
{ |
|
233 | 237 |
int currentTag; |
234 | 238 |
boolean end = false; |
235 |
|
|
239 |
|
|
236 | 240 |
parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.CAPABILITY); |
237 | 241 |
currentTag = parser.next(); |
238 |
|
|
239 |
while (!end)
|
|
242 |
|
|
243 |
while (!end) |
|
240 | 244 |
{ |
241 | 245 |
switch(currentTag) |
242 | 246 |
{ |
243 | 247 |
case KXmlParser.START_TAG: |
244 | 248 |
if (parser.getName().compareTo(CapabilitiesTags.REQUEST)==0) |
245 | 249 |
{ |
246 |
parseRequestTag(parser);
|
|
247 |
}
|
|
250 |
parseRequestTag(parser); |
|
251 |
} |
|
248 | 252 |
else if (parser.getName().compareTo(CapabilitiesTags.EXCEPTION)==0) |
249 | 253 |
{ |
250 | 254 |
//TODO: |
... | ... | |
266 | 270 |
rootLayer.getChildren().add(lyr); |
267 | 271 |
} |
268 | 272 |
lyr.parse(parser, layers); |
269 |
|
|
273 |
|
|
270 | 274 |
if (lyr.getName()!=null) |
271 |
layers.put(lyr.getName(), lyr);
|
|
275 |
layers.put(lyr.getName(), lyr); |
|
272 | 276 |
} |
273 | 277 |
else if ((parser.getName().compareTo(CapabilitiesTags.VENDORSPECIFICCAPABILITIES)==0) || |
274 |
(parser.getName().compareTo(CapabilitiesTags.USERDEFINEDSYMBOLIZATION )==0))
|
|
278 |
(parser.getName().compareTo(CapabilitiesTags.USERDEFINEDSYMBOLIZATION )==0)) |
|
275 | 279 |
{ |
276 | 280 |
parser.skipSubTree(); |
277 |
}
|
|
281 |
} |
|
278 | 282 |
break; |
279 | 283 |
case KXmlParser.END_TAG: |
280 | 284 |
if (parser.getName().compareTo(CapabilitiesTags.CAPABILITY) == 0) |
281 | 285 |
end = true; |
282 | 286 |
break; |
283 |
case KXmlParser.TEXT:
|
|
287 |
case KXmlParser.TEXT: |
|
284 | 288 |
break; |
285 | 289 |
} |
286 | 290 |
if (!end) |
287 | 291 |
currentTag = parser.next(); |
288 | 292 |
} |
289 |
//parser.require(KXmlParser.END_TAG, null, CapabilitiesTags.CAPABILITY);
|
|
290 |
}
|
|
291 |
|
|
293 |
//parser.require(KXmlParser.END_TAG, null, CapabilitiesTags.CAPABILITY); |
|
294 |
} |
|
295 |
|
|
292 | 296 |
private WMSLayer1_3_0 getFakeRootLayer(){ |
293 | 297 |
if (fakeRootLayer == null){ |
294 | 298 |
fakeRootLayer = new WMSLayer1_3_0(); |
... | ... | |
306 | 310 |
KXmlParser kxmlParser = new KXmlParser(); |
307 | 311 |
try |
308 | 312 |
{ |
309 |
kxmlParser.setInput(new ByteArrayInputStream(data), encoding);
|
|
313 |
kxmlParser.setInput(new ByteArrayInputStream(data), encoding); |
|
310 | 314 |
kxmlParser.nextTag(); |
311 | 315 |
int tag; |
312 |
if ( kxmlParser.getEventType() != KXmlParser.END_DOCUMENT )
|
|
313 |
{
|
|
314 |
kxmlParser.require(KXmlParser.START_TAG, null, ExceptionTags.EXCEPTION_ROOT);
|
|
316 |
if ( kxmlParser.getEventType() != KXmlParser.END_DOCUMENT ) |
|
317 |
{ |
|
318 |
kxmlParser.require(KXmlParser.START_TAG, null, ExceptionTags.EXCEPTION_ROOT); |
|
315 | 319 |
tag = kxmlParser.nextTag(); |
316 | 320 |
while(tag != KXmlParser.END_DOCUMENT) |
317 | 321 |
{ |
... | ... | |
325 | 329 |
errors.add(errorCode+errorMessage); |
326 | 330 |
} |
327 | 331 |
break; |
328 |
case KXmlParser.END_TAG:
|
|
332 |
case KXmlParser.END_TAG: |
|
329 | 333 |
break; |
330 |
|
|
334 |
|
|
331 | 335 |
} |
332 | 336 |
tag = kxmlParser.nextTag(); |
333 | 337 |
} |
... | ... | |
337 | 341 |
catch(XmlPullParserException parser_ex){ |
338 | 342 |
logger.warn("",parser_ex); |
339 | 343 |
} |
340 |
catch (IOException ioe) {
|
|
341 |
logger.warn("",ioe);
|
|
344 |
catch (IOException ioe) { |
|
345 |
logger.warn("",ioe); |
|
342 | 346 |
} |
343 | 347 |
String message = errors.size()>0? "" : null; |
344 | 348 |
for (int i = 0; i < errors.size(); i++) { |
345 | 349 |
message += (String) errors.get(i)+"\n"; |
346 | 350 |
} |
347 | 351 |
return message; |
348 |
}
|
|
349 |
|
|
352 |
} |
|
353 |
|
|
350 | 354 |
/* |
351 | 355 |
* (non-Javadoc) |
352 | 356 |
* @see org.gvsig.remoteClient.wms.WMSProtocolHandler#createGetFeatureInfoRequest(org.gvsig.remoteClient.wms.WMSStatus, int, int) |
... | ... | |
372 | 376 |
WMSStatus status, String layerName) { |
373 | 377 |
return new WMSGetLegendGraphicRequest1_1_3(status, this, layerName); |
374 | 378 |
} |
375 |
|
|
376 | 379 |
|
380 |
|
|
377 | 381 |
/* (non-Javadoc) |
378 | 382 |
* @see org.gvsig.remoteclient.wms.WMSProtocolHandler#createGetCapabilitiesRequest(org.gvsig.remoteclient.wms.WMSStatus) |
379 |
*/
|
|
383 |
*/ |
|
380 | 384 |
protected WMSGetCapabilitiesRequest createGetCapabilitiesRequest( |
381 | 385 |
WMSStatus status) { |
382 | 386 |
return new WMSGetCapabilitiesRequest1_3_0(status, this); |
org.gvsig.raster.wms/trunk/org.gvsig.raster.wms/pom.xml | ||
---|---|---|
11 | 11 |
<parent> |
12 | 12 |
<groupId>org.gvsig</groupId> |
13 | 13 |
<artifactId>org.gvsig.desktop</artifactId> |
14 |
<version>2.0.189</version>
|
|
14 |
<version>2.0.191</version>
|
|
15 | 15 |
</parent> |
16 | 16 |
|
17 | 17 |
<properties> |
Also available in: Unified diff