Statistics
| Revision:

gvsig-raster / org.gvsig.raster / trunk / org.gvsig.raster / org.gvsig.raster.main / src / test / java / org / gvsig / fmap / dal / coverage / dataset / io / wmts / TestWMTSDriver.java @ 220

History | View | Annotate | Download (3.81 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.fmap.dal.coverage.dataset.io.wmts;
23

    
24
import java.net.MalformedURLException;
25
import java.net.URL;
26

    
27
import org.gvsig.fmap.dal.coverage.BaseTestCase;
28
import org.gvsig.fmap.dal.coverage.dataset.io.server.DefaultWMSServerExplorerParameters;
29
import org.gvsig.fmap.dal.coverage.dataset.io.server.DefaultWMTSServerExplorerParameters;
30
import org.gvsig.fmap.dal.coverage.dataset.io.server.WMTSServerExplorerImpl;
31
import org.gvsig.fmap.dal.coverage.explorer.WMTSServerExplorer;
32
import org.gvsig.fmap.dal.coverage.explorer.WMTSServerExplorerParameters;
33
import org.gvsig.fmap.dal.exception.InitializeException;
34
import org.gvsig.remoteclient.wmts.exception.WMTSException;
35
import org.gvsig.remoteclient.wmts.struct.WMTSServiceIdentification;
36
import org.gvsig.remoteclient.wmts.struct.WMTSServiceProvider;
37
import org.gvsig.remoteclient.wmts.struct.WMTSThemes;
38

    
39
/**
40
 * @author Nacho Brodin (nachobrodin@gmail.com)
41
 */
42
public class TestWMTSDriver extends BaseTestCase {
43
        
44
        public void setUp() {
45
                System.err.println("TestWMTSDriver running...");
46
        }
47
        
48
        public void testStack() {
49
                try {
50
                        super.doSetUp();
51
                } catch (Exception e) {
52
                        e.printStackTrace();
53
                }
54
                URL url = null;
55
                try {
56
                        url = new URL("http://scolab.es:9090/geoserver/gwc/service/wmts");
57
                        
58
                        //Crea el manejador para la versi?n del servidor y devuelve la versi?n 
59
                        //WMTSConnector conn = WMTSDriver.getConnectorFromURL(url);
60
                        //String version = conn.getVersion();
61
                        
62
                        //Creamos un explorer para obtener los datos del servidor
63
                        DefaultWMSServerExplorerParameters.registerDynClass();
64
                        WMTSServerExplorerParameters param = new DefaultWMTSServerExplorerParameters();
65
                        param.setHost(url.toString());
66
                        WMTSServerExplorer explorer = new WMTSServerExplorerImpl(param, null);
67
                        explorer.connect(null);
68
                        
69
                        WMTSServiceIdentification id = explorer.getServiceIdentification();
70
                        String title = id.getTitle();
71
                        String version = id.getServiceTypeVersion();
72
                        String type = id.getServiceType();
73
                        
74
                        WMTSServiceProvider prov = explorer.getServiceProvider();
75
                        String pN = prov.getProviderName();
76
                        String pS = prov.getProviderSite();
77
                        String pC = prov.getServiceContact();
78
                        
79
                        WMTSThemes themes = explorer.getThemes();
80
                        System.out.println("Title: " + title);
81
                        System.out.println("Version: " + version);
82
                        System.out.println("Type: " + type);
83
                        System.out.println("Provider Name: " + pN);
84
                        System.out.println("Provider Site: " + pS);
85
                        System.out.println("Service Contact: " + pC);
86
                        
87
                        //En este caso solo hay una lista de temas con una capa por cada uno
88
                        //pero en un caso corriente seria un ?rbol de themas con una capa asociada a cada uno
89
                        /*for (int i = 0; i < themes.size(); i++) {
90
                                WMTSLayer layer = ((WMTSTheme)themes.get(i)).getLayer();
91
                                if(layer != null)
92
                                        layer.print();
93
                        }*/
94
                        
95
                } catch (MalformedURLException e) {
96
                        e.printStackTrace();
97
                } catch (InitializeException e) {
98
                        e.printStackTrace();
99
                } catch (WMTSException e) {
100
                        e.printStackTrace();
101
                }
102
                
103
        }
104
}