root / branches / v10 / extensions / extWFS2 / src / com / iver / cit / gvsig / fmap / layers / FLyrWFSFactory.java @ 11020
History | View | Annotate | Download (3.72 KB)
1 |
package com.iver.cit.gvsig.fmap.layers; |
---|---|
2 |
|
3 |
import java.awt.Component; |
4 |
import java.net.URL; |
5 |
|
6 |
import javax.swing.JOptionPane; |
7 |
|
8 |
import org.apache.log4j.Logger; |
9 |
import org.cresques.cts.IProjection; |
10 |
|
11 |
import com.iver.andami.PluginServices; |
12 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
13 |
import com.iver.cit.gvsig.fmap.drivers.VectorialDriver; |
14 |
import com.iver.cit.gvsig.fmap.drivers.wfs.FMapWFSDriver; |
15 |
import com.iver.cit.gvsig.project.documents.view.gui.BaseView; |
16 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
17 |
|
18 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
19 |
*
|
20 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
21 |
*
|
22 |
* This program is free software; you can redistribute it and/or
|
23 |
* modify it under the terms of the GNU General Public License
|
24 |
* as published by the Free Software Foundation; either version 2
|
25 |
* of the License, or (at your option) any later version.
|
26 |
*
|
27 |
* This program is distributed in the hope that it will be useful,
|
28 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
29 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
30 |
* GNU General Public License for more details.
|
31 |
*
|
32 |
* You should have received a copy of the GNU General Public License
|
33 |
* along with this program; if not, write to the Free Software
|
34 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
35 |
*
|
36 |
* For more information, contact:
|
37 |
*
|
38 |
* Generalitat Valenciana
|
39 |
* Conselleria d'Infraestructures i Transport
|
40 |
* Av. Blasco Ib??ez, 50
|
41 |
* 46010 VALENCIA
|
42 |
* SPAIN
|
43 |
*
|
44 |
* +34 963862235
|
45 |
* gvsig@gva.es
|
46 |
* www.gvsig.gva.es
|
47 |
*
|
48 |
* or
|
49 |
*
|
50 |
* IVER T.I. S.A
|
51 |
* Salamanca 50
|
52 |
* 46005 Valencia
|
53 |
* Spain
|
54 |
*
|
55 |
* +34 963163400
|
56 |
* dac@iver.es
|
57 |
*/
|
58 |
/* CVS MESSAGES:
|
59 |
*
|
60 |
* $Id: FLyrWFSFactory.java 11020 2007-04-03 10:24:25Z jorpiell $
|
61 |
* $Log$
|
62 |
* Revision 1.2.2.5 2007-04-03 10:24:25 jorpiell
|
63 |
* La transformaci?n de coordenadas que se usa para reproyactar no debe ponerse en la capa a pi?on fijo.
|
64 |
*
|
65 |
* Revision 1.2.2.4 2007/01/04 10:06:25 jcampos
|
66 |
* Upgrade new version
|
67 |
*
|
68 |
* Revision 1.2.2.3 2006/11/17 11:28:45 ppiqueras
|
69 |
* Corregidos bugs y a?adida nueva funcionalidad.
|
70 |
*
|
71 |
* Revision 1.3 2006/11/16 16:57:05 jorpiell
|
72 |
* Se inserta en adapter
|
73 |
*
|
74 |
* Revision 1.2 2006/11/06 13:58:03 jorpiell
|
75 |
* Al crear una nueva capa se declara como activa. De esa forma se pueden aplicar tantos filtros como queramos
|
76 |
*
|
77 |
* Revision 1.1 2006/10/31 09:38:15 jorpiell
|
78 |
* Se ha creado una factoria para crear la capa. De ese modo no se repite c?digo desde le panel de propiedades y desde el panel de la capa
|
79 |
*
|
80 |
*
|
81 |
*/
|
82 |
/**
|
83 |
* @author Jorge Piera Llodr? (piera_jor@gva.es)
|
84 |
*/
|
85 |
public class FLyrWFSFactory { |
86 |
|
87 |
public FLyrWFS getFLyrWFS(FLayer layer,
|
88 |
URL host,
|
89 |
String onlineResource,
|
90 |
FMapWFSDriver driver, |
91 |
boolean loadLayer){
|
92 |
FLyrWFS wfsLayer = (FLyrWFS)layer; |
93 |
wfsLayer.setHost(host); |
94 |
wfsLayer.setWfsDriver(driver); |
95 |
// Sets the WFS adapter
|
96 |
WFSAdapter adapter = new WFSAdapter();
|
97 |
adapter.setDriver((VectorialDriver) driver); |
98 |
wfsLayer.setSource(adapter); |
99 |
wfsLayer.setOnlineResource(onlineResource); |
100 |
BaseView activeView = |
101 |
(BaseView) PluginServices.getMDIManager().getActiveWindow(); |
102 |
wfsLayer.setProjection(CRSFactory.getCRS(wfsLayer.getSrs())); |
103 |
if (loadLayer){
|
104 |
try {
|
105 |
wfsLayer.load(); |
106 |
if (wfsLayer.getNumfeatures() == wfsLayer.getWfsDriver().getRowCount()) {
|
107 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
108 |
PluginServices.getText(this,"maxFeatures_aviso")); |
109 |
} |
110 |
} catch (Exception e) { |
111 |
// TODO Auto-generated catch block
|
112 |
Logger.getLogger(getClass().getName()).error(e.getMessage());
|
113 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
114 |
PluginServices.getText(this,"cantLoad")); |
115 |
return null; |
116 |
} |
117 |
} |
118 |
wfsLayer.setActive(true);
|
119 |
return wfsLayer;
|
120 |
} |
121 |
|
122 |
} |