gvsig-raster / org.gvsig.raster.wmts / trunk / org.gvsig.raster.wmts / org.gvsig.raster.wmts.app.wmtsclient / src / test / java / org / gvsig / raster / wmts / io / TestWMTSDriver.java @ 2611
History | View | Annotate | Download (3.35 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
package org.gvsig.raster.wmts.io; |
23 |
|
24 |
import java.net.MalformedURLException; |
25 |
import java.net.URL; |
26 |
|
27 |
import org.gvsig.fmap.dal.coverage.exception.ConnectException; |
28 |
import org.gvsig.fmap.dal.exception.InitializeException; |
29 |
import org.gvsig.raster.wmts.ogc.struct.WMTSServiceIdentification; |
30 |
import org.gvsig.raster.wmts.ogc.struct.WMTSServiceProvider; |
31 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
32 |
|
33 |
/**
|
34 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
35 |
*/
|
36 |
public class TestWMTSDriver extends AbstractLibraryAutoInitTestCase { |
37 |
|
38 |
protected void doSetUp() throws Exception { |
39 |
System.err.println("TestWMTSDriver running..."); |
40 |
} |
41 |
|
42 |
public void testStack() { |
43 |
|
44 |
URL url = null; |
45 |
try {
|
46 |
url = new URL("http://v2.suite.opengeo.org/geoserver/gwc/service/wmts/"); |
47 |
|
48 |
//Crea el manejador para la versi?n del servidor y devuelve la versi?n
|
49 |
//WMTSConnector conn = WMTSDriver.getConnectorFromURL(url);
|
50 |
//String version = conn.getVersion();
|
51 |
|
52 |
//Creamos un explorer para obtener los datos del servidor
|
53 |
WMTSServerExplorerParameters.registerDynClass(); |
54 |
WMTSServerExplorerParameters param = new WMTSServerExplorerParameters();
|
55 |
param.setHost(url.toString()); |
56 |
WMTSServerExplorer explorer = new WMTSServerExplorer(param, null); |
57 |
explorer.connect(null);
|
58 |
|
59 |
WMTSServiceIdentification id = explorer.getOGCClient().getServiceIdentification(); |
60 |
String title = id.getTitle();
|
61 |
String version = id.getServiceTypeVersion();
|
62 |
String type = id.getServiceType();
|
63 |
|
64 |
WMTSServiceProvider prov = explorer.getOGCClient().getServiceProvider(); |
65 |
String pN = prov.getProviderName();
|
66 |
String pS = prov.getProviderSite();
|
67 |
String pC = prov.getServiceContact();
|
68 |
|
69 |
//WMTSThemes themes = explorer.getThemes();
|
70 |
System.out.println("Title: " + title); |
71 |
System.out.println("Version: " + version); |
72 |
System.out.println("Type: " + type); |
73 |
System.out.println("Provider Name: " + pN); |
74 |
System.out.println("Provider Site: " + pS); |
75 |
System.out.println("Service Contact: " + pC); |
76 |
|
77 |
//En este caso solo hay una lista de temas con una capa por cada uno
|
78 |
//pero en un caso corriente seria un ?rbol de themas con una capa asociada a cada uno
|
79 |
/*for (int i = 0; i < themes.size(); i++) {
|
80 |
WMTSLayer layer = ((WMTSTheme)themes.get(i)).getLayer();
|
81 |
if(layer != null)
|
82 |
layer.print();
|
83 |
}*/
|
84 |
|
85 |
} catch (MalformedURLException e) { |
86 |
e.printStackTrace(); |
87 |
} catch (InitializeException e) {
|
88 |
e.printStackTrace(); |
89 |
} catch (ConnectException e) { |
90 |
e.printStackTrace(); |
91 |
} |
92 |
|
93 |
} |
94 |
} |