root / branches / FMap_SLD / libraries / libFMap / src / com / iver / cit / gvsig / fmap / layers / FLyrWFS.java @ 2082
History | View | Annotate | Download (5.63 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package com.iver.cit.gvsig.fmap.layers; |
42 |
import com.iver.cit.gvsig.fmap.DriverException; |
43 |
import com.iver.cit.gvsig.fmap.ViewPort; |
44 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
45 |
import com.iver.cit.gvsig.fmap.drivers.WMSException; |
46 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.InfoByPoint; |
47 |
import com.iver.cit.gvsig.fmap.operations.Cancellable; |
48 |
|
49 |
import com.iver.utiles.StringUtilities; |
50 |
import com.iver.utiles.XMLEntity; |
51 |
|
52 |
import com.iver.wmsclient.FeatureInfoQuery; |
53 |
import com.iver.wmsclient.MapQuery; |
54 |
import com.iver.wmsclient.UnsupportedVersionException; |
55 |
import com.iver.wmsclient.WMSClient; |
56 |
import com.iver.wmsclient.WMSClientFactory; |
57 |
|
58 |
import org.exolab.castor.xml.ValidationException; |
59 |
|
60 |
import java.awt.Graphics2D; |
61 |
import java.awt.Point; |
62 |
import java.awt.geom.AffineTransform; |
63 |
import java.awt.geom.NoninvertibleTransformException; |
64 |
import java.awt.geom.Point2D; |
65 |
import java.awt.geom.Rectangle2D; |
66 |
import java.awt.image.BufferedImage; |
67 |
|
68 |
import java.io.ByteArrayInputStream; |
69 |
import java.io.IOException; |
70 |
|
71 |
import java.net.MalformedURLException; |
72 |
import java.net.URL; |
73 |
|
74 |
import javax.imageio.ImageIO; |
75 |
|
76 |
|
77 |
/**
|
78 |
* Capa WFS.
|
79 |
*
|
80 |
* @author Vicente Caballero Navarro
|
81 |
*/
|
82 |
public class FLyrWFS extends FLyrDefault implements InfoByPoint { |
83 |
private String layerQuery; |
84 |
private String infoLayerQuery; |
85 |
private String name; |
86 |
private URL host; |
87 |
private Rectangle2D fullExtent; |
88 |
|
89 |
/**
|
90 |
* Devuelve el XMLEntity con la informaci?n necesaria para reproducir la
|
91 |
* capa.
|
92 |
*
|
93 |
* @return XMLEntity.
|
94 |
* @throws XMLException
|
95 |
*/
|
96 |
public XMLEntity getXMLEntity() throws XMLException { |
97 |
XMLEntity xml = super.getXMLEntity();
|
98 |
|
99 |
xml.putProperty("fullExtent", StringUtilities.rect2String(fullExtent));
|
100 |
xml.putProperty("host", host.toExternalForm());
|
101 |
xml.putProperty("infoLayerQuery", infoLayerQuery);
|
102 |
xml.putProperty("layerQuery", layerQuery);
|
103 |
|
104 |
return xml;
|
105 |
} |
106 |
|
107 |
/**
|
108 |
* A partir del XMLEntity reproduce la capa.
|
109 |
*
|
110 |
* @param xml XMLEntity
|
111 |
*
|
112 |
* @throws XMLException
|
113 |
* @throws DriverException
|
114 |
* @throws DriverIOException
|
115 |
*/
|
116 |
public void setXMLEntity(XMLEntity xml) |
117 |
throws XMLException {
|
118 |
super.setXMLEntity(xml);
|
119 |
fullExtent = StringUtilities.string2Rect(xml.getStringProperty( |
120 |
"fullExtent"));
|
121 |
|
122 |
try {
|
123 |
host = new URL(xml.getStringProperty("host")); |
124 |
} catch (MalformedURLException e) { |
125 |
throw new XMLException(e); |
126 |
} |
127 |
|
128 |
infoLayerQuery = xml.getStringProperty("infoLayerQuery");
|
129 |
layerQuery = xml.getStringProperty("layerQuery");
|
130 |
} |
131 |
|
132 |
/**
|
133 |
* @see com.iver.cit.gvsig.fmap.layers.layerOperations.InfoByPoint#queryByPoint(com.iver.cit.gvsig.fmap.operations.QueriedPoint)
|
134 |
*/
|
135 |
public String queryByPoint(Point p) throws DriverException { |
136 |
return null; |
137 |
} |
138 |
|
139 |
/**
|
140 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#getFullExtent()
|
141 |
*/
|
142 |
public Rectangle2D getFullExtent() throws DriverException { |
143 |
return fullExtent;
|
144 |
} |
145 |
|
146 |
/**
|
147 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#draw(java.awt.image.BufferedImage,
|
148 |
* java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort,
|
149 |
* com.iver.cit.gvsig.fmap.operations.Cancellable)
|
150 |
*/
|
151 |
public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort, |
152 |
Cancellable cancel) throws DriverException {
|
153 |
|
154 |
} |
155 |
|
156 |
/**
|
157 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#print(java.awt.Graphics2D,
|
158 |
* com.iver.cit.gvsig.fmap.ViewPort,
|
159 |
* com.iver.cit.gvsig.fmap.operations.Cancellable)
|
160 |
*/
|
161 |
public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel) |
162 |
throws DriverException {
|
163 |
} |
164 |
|
165 |
public void _print(Graphics2D g, ViewPort viewPort, Cancellable cancel) |
166 |
throws DriverException {
|
167 |
draw(null, g, viewPort, cancel);
|
168 |
} |
169 |
|
170 |
/**
|
171 |
* Devuelve el URL.
|
172 |
*
|
173 |
* @return URL.
|
174 |
*/
|
175 |
public URL getHost() { |
176 |
return host;
|
177 |
} |
178 |
|
179 |
/**
|
180 |
* Inserta el URL.
|
181 |
*
|
182 |
* @param host URL.
|
183 |
*/
|
184 |
public void setHost(URL host) { |
185 |
this.host = host;
|
186 |
} |
187 |
|
188 |
/**
|
189 |
* Devuelve la informaci?n de la consulta.
|
190 |
*
|
191 |
* @return String.
|
192 |
*/
|
193 |
public String getInfoLayerQuery() { |
194 |
return infoLayerQuery;
|
195 |
} |
196 |
|
197 |
/**
|
198 |
* Inserta la informaci?n de la consulta.
|
199 |
*
|
200 |
* @param infoLayerQuery String.
|
201 |
*/
|
202 |
public void setInfoLayerQuery(String infoLayerQuery) { |
203 |
this.infoLayerQuery = infoLayerQuery;
|
204 |
} |
205 |
|
206 |
/**
|
207 |
* Devuelve la consulta.
|
208 |
*
|
209 |
* @return String.
|
210 |
*/
|
211 |
public String getLayerQuery() { |
212 |
return layerQuery;
|
213 |
} |
214 |
|
215 |
/**
|
216 |
* Inserta la consulta.
|
217 |
*
|
218 |
* @param layerQuery consulta.
|
219 |
*/
|
220 |
public void setLayerQuery(String layerQuery) { |
221 |
this.layerQuery = layerQuery;
|
222 |
} |
223 |
|
224 |
/**
|
225 |
* Inserta la extensi?n total de la capa.
|
226 |
*
|
227 |
* @param fullExtent Rect?ngulo.
|
228 |
*/
|
229 |
public void setFullExtent(Rectangle2D fullExtent) { |
230 |
this.fullExtent = fullExtent;
|
231 |
} |
232 |
} |