root / trunk / extensions / extWFS2 / src / com / iver / cit / gvsig / gui / wizards / WFSWizardData.java @ 4911
History | View | Annotate | Download (4.1 KB)
1 | 4886 | jorpiell | package com.iver.cit.gvsig.gui.wizards; |
---|---|---|---|
2 | |||
3 | import java.awt.Component; |
||
4 | import java.io.IOException; |
||
5 | import java.net.ConnectException; |
||
6 | import java.net.URL; |
||
7 | import java.util.Vector; |
||
8 | |||
9 | import javax.swing.JOptionPane; |
||
10 | |||
11 | import com.iver.andami.PluginServices; |
||
12 | import com.iver.cit.gvsig.fmap.DriverException; |
||
13 | import com.iver.cit.gvsig.fmap.drivers.wfs.FMapWFSDriver; |
||
14 | |||
15 | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
||
16 | *
|
||
17 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
18 | *
|
||
19 | * This program is free software; you can redistribute it and/or
|
||
20 | * modify it under the terms of the GNU General Public License
|
||
21 | * as published by the Free Software Foundation; either version 2
|
||
22 | * of the License, or (at your option) any later version.
|
||
23 | *
|
||
24 | * This program is distributed in the hope that it will be useful,
|
||
25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
27 | * GNU General Public License for more details.
|
||
28 | *
|
||
29 | * You should have received a copy of the GNU General Public License
|
||
30 | * along with this program; if not, write to the Free Software
|
||
31 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
32 | *
|
||
33 | * For more information, contact:
|
||
34 | *
|
||
35 | * Generalitat Valenciana
|
||
36 | * Conselleria d'Infraestructures i Transport
|
||
37 | * Av. Blasco Ib??ez, 50
|
||
38 | * 46010 VALENCIA
|
||
39 | * SPAIN
|
||
40 | *
|
||
41 | * +34 963862235
|
||
42 | * gvsig@gva.es
|
||
43 | * www.gvsig.gva.es
|
||
44 | *
|
||
45 | * or
|
||
46 | *
|
||
47 | * IVER T.I. S.A
|
||
48 | * Salamanca 50
|
||
49 | * 46005 Valencia
|
||
50 | * Spain
|
||
51 | *
|
||
52 | * +34 963163400
|
||
53 | * dac@iver.es
|
||
54 | */
|
||
55 | /* CVS MESSAGES:
|
||
56 | *
|
||
57 | * $Id$
|
||
58 | * $Log$
|
||
59 | 4911 | jorpiell | * Revision 1.2 2006-04-20 16:38:24 jorpiell
|
60 | * Ahora mismo ya se puede hacer un getCapabilities y un getDescribeType de la capa seleccionada para ver los atributos a dibujar. Queda implementar el panel de opciones y hacer el getFeature().
|
||
61 | *
|
||
62 | * Revision 1.1 2006/04/19 12:50:16 jorpiell
|
||
63 | 4886 | jorpiell | * Primer commit de la aplicaci?n. Se puede hacer un getCapabilities y ver el mensaje de vienvenida del servidor
|
64 | *
|
||
65 | *
|
||
66 | */
|
||
67 | /**
|
||
68 | * @author Jorge Piera Llodr? (piera_jor@gva.es)
|
||
69 | */
|
||
70 | public class WFSWizardData { |
||
71 | private FMapWFSDriver driver = null; |
||
72 | private String title = null; |
||
73 | private String _abstract = null; |
||
74 | private String serverVersion = null; |
||
75 | |||
76 | /**
|
||
77 | *
|
||
78 | * @return The host name
|
||
79 | */
|
||
80 | public String getHost(){ |
||
81 | return driver.getHost();
|
||
82 | } |
||
83 | |||
84 | /**
|
||
85 | * Create the WFSClient and try to connect
|
||
86 | * @param host
|
||
87 | * Server name
|
||
88 | * @throws DriverException
|
||
89 | */
|
||
90 | public void setHost(URL host) throws DriverException{ |
||
91 | driver = new FMapWFSDriver();
|
||
92 | try {
|
||
93 | driver.createClient(host); |
||
94 | |||
95 | if (!driver.connect()){
|
||
96 | throw new DriverException(PluginServices.getText(this, "cant_connect") + host.toString()); |
||
97 | } |
||
98 | |||
99 | } catch (ConnectException e) { |
||
100 | JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this,"server_timeout")); |
||
101 | e.printStackTrace(); |
||
102 | return;
|
||
103 | } catch (IOException e) { |
||
104 | JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this, "cant_connect")); |
||
105 | e.printStackTrace(); |
||
106 | return;
|
||
107 | } |
||
108 | } |
||
109 | |||
110 | /**
|
||
111 | * Server's title (not used in gvSIG)
|
||
112 | *
|
||
113 | * T?tulo del servidor (no se usa en gvSIG)
|
||
114 | *
|
||
115 | * @return
|
||
116 | */
|
||
117 | public String getTitle() { |
||
118 | title = driver.getServiceTitle(); |
||
119 | if (title == null){ |
||
120 | return "None"; |
||
121 | } |
||
122 | return title;
|
||
123 | } |
||
124 | |||
125 | /**
|
||
126 | * The server description.
|
||
127 | *
|
||
128 | * La descripci?n del servidor
|
||
129 | *
|
||
130 | * @return String
|
||
131 | */
|
||
132 | public String getAbstract() { |
||
133 | _abstract= driver.getServiceAbstract(); |
||
134 | if (_abstract == null){ |
||
135 | return "None"; |
||
136 | } |
||
137 | return _abstract;
|
||
138 | } |
||
139 | |||
140 | /**
|
||
141 | * @return Returns the driver.
|
||
142 | */
|
||
143 | public FMapWFSDriver getDriver() {
|
||
144 | return driver;
|
||
145 | } |
||
146 | |||
147 | /**
|
||
148 | *
|
||
149 | * @return Features vector
|
||
150 | */
|
||
151 | 4911 | jorpiell | public Object[] getFeatures(){ |
152 | return driver.getLayerList();
|
||
153 | 4886 | jorpiell | } |
154 | |||
155 | /**
|
||
156 | 4911 | jorpiell | * Return the feature info
|
157 | * @param featureName
|
||
158 | * @return
|
||
159 | */
|
||
160 | public Object getFeatureInfo(String featureName){ |
||
161 | return driver.getLayerInfo(featureName);
|
||
162 | } |
||
163 | |||
164 | /**
|
||
165 | 4886 | jorpiell | *
|
166 | * @return server type
|
||
167 | */
|
||
168 | public String getServerType() { |
||
169 | serverVersion = driver.getVersion(); |
||
170 | if (serverVersion==null){ |
||
171 | return "WFS"; |
||
172 | } |
||
173 | return "WFS "+ serverVersion; |
||
174 | } |
||
175 | |||
176 | |||
177 | |||
178 | } |