Revision 3095
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/ICanReproject.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 13-oct-2005 |
|
3 |
* |
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
5 |
* |
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
7 |
* |
|
8 |
* This program is free software; you can redistribute it and/or |
|
9 |
* modify it under the terms of the GNU General Public License |
|
10 |
* as published by the Free Software Foundation; either version 2 |
|
11 |
* of the License, or (at your option) any later version. |
|
12 |
* |
|
13 |
* This program is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
* GNU General Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License |
|
19 |
* along with this program; if not, write to the Free Software |
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
21 |
* |
|
22 |
* For more information, contact: |
|
23 |
* |
|
24 |
* Generalitat Valenciana |
|
25 |
* Conselleria d'Infraestructures i Transport |
|
26 |
* Av. Blasco Ib??ez, 50 |
|
27 |
* 46010 VALENCIA |
|
28 |
* SPAIN |
|
29 |
* |
|
30 |
* +34 963862235 |
|
31 |
* gvsig@gva.es |
|
32 |
* www.gvsig.gva.es |
|
33 |
* |
|
34 |
* or |
|
35 |
* |
|
36 |
* IVER T.I. S.A |
|
37 |
* Salamanca 50 |
|
38 |
* 46005 Valencia |
|
39 |
* Spain |
|
40 |
* |
|
41 |
* +34 963163400 |
|
42 |
* dac@iver.es |
|
43 |
*/ |
|
44 |
package com.iver.cit.gvsig.fmap.core; |
|
45 |
|
|
46 |
/** |
|
47 |
* @author fjp |
|
48 |
* If a driver can reproject, it must implement this |
|
49 |
* interface. |
|
50 |
*/ |
|
51 |
public interface ICanReproject { |
|
52 |
/** |
|
53 |
* @return a EPSG string defining the original projection. |
|
54 |
* It means that the original data are in this proj. |
|
55 |
*/ |
|
56 |
String getSourceProjection(); |
|
57 |
|
|
58 |
/** |
|
59 |
* @return a EPSG string. You set this variable with setDestProjection(String epsg) |
|
60 |
*/ |
|
61 |
String getDestProjection(); |
|
62 |
|
|
63 |
|
|
64 |
/** |
|
65 |
* Set this variable to tell the driver in which projection |
|
66 |
* do you want your data. If the driver can reproject to this |
|
67 |
* new EPSG, it will return true in canReproject. |
|
68 |
* Otherwise, it will return false. |
|
69 |
* @param toEPSG |
|
70 |
*/ |
|
71 |
void setDestProjection(String toEPSG); |
|
72 |
|
|
73 |
|
|
74 |
/** |
|
75 |
* @return true if the driver will be able to deliver the |
|
76 |
* entities in the destiny projection. False otherwise. |
|
77 |
*/ |
|
78 |
boolean canReproject(String toEPSGdestinyProjection); |
|
79 |
|
|
80 |
} |
|
0 | 81 |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/VectorialDatabaseDriver.java | ||
---|---|---|
85 | 85 |
*/ |
86 | 86 |
public void setXMLEntity(XMLEntity xml) throws XMLException; |
87 | 87 |
|
88 |
|
|
89 | 88 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/operations/strategies/DBStrategy.java | ||
---|---|---|
44 | 44 |
package com.iver.cit.gvsig.fmap.operations.strategies; |
45 | 45 |
|
46 | 46 |
import java.awt.Graphics2D; |
47 |
import java.awt.geom.Rectangle2D; |
|
47 | 48 |
import java.awt.image.BufferedImage; |
48 | 49 |
import java.sql.SQLException; |
49 | 50 |
import java.util.BitSet; |
... | ... | |
55 | 56 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
56 | 57 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
57 | 58 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
59 |
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes; |
|
58 | 60 |
import com.iver.cit.gvsig.fmap.drivers.IFeatureIterator; |
59 | 61 |
import com.iver.cit.gvsig.fmap.drivers.VectorialDatabaseDriver; |
60 | 62 |
import com.iver.cit.gvsig.fmap.layers.FBitSet; |
... | ... | |
103 | 105 |
// con todos los campos de Vias: 11 segundos. |
104 | 106 |
// => MODIFICAR EL getFeatureIterator para que admita los nombres |
105 | 107 |
// de los campos adem?s del rect?ngulo que pides. |
108 |
Rectangle2D rectAux = viewPort.getAdjustedExtent(); |
|
109 |
if (ct != null) { |
|
110 |
ICoordTrans invertedCT = ct.getInverted(); |
|
111 |
rectAux = invertedCT.convert(rectAux); |
|
112 |
} |
|
113 |
|
|
106 | 114 |
|
107 |
IFeatureIterator geomIt = dbAdapter.getFeatureIterator(viewPort.getAdjustedExtent(), strEPSG);
|
|
115 |
IFeatureIterator geomIt = dbAdapter.getFeatureIterator(rectAux, strEPSG);
|
|
108 | 116 |
VectorialLegend l = (VectorialLegend) ((ClassifiableVectorial) capa).getLegend(); |
117 |
|
|
118 |
DriverAttributes attr = dbAdapter.getDriverAttributes(); |
|
119 |
boolean bMustClone = false; |
|
120 |
if (attr != null) |
|
121 |
{ |
|
122 |
if (attr.isLoadedInMemory()) |
|
123 |
{ |
|
124 |
bMustClone = attr.isLoadedInMemory(); |
|
125 |
} |
|
126 |
} |
|
127 |
|
|
128 |
|
|
109 | 129 |
int i; |
110 | 130 |
FSymbol symbol; |
111 | 131 |
try { |
... | ... | |
117 | 137 |
} |
118 | 138 |
IFeature feat = geomIt.next(); |
119 | 139 |
IGeometry geom = feat.getGeometry(); |
140 |
|
|
141 |
if (ct != null) { |
|
142 |
if (bMustClone) |
|
143 |
geom = geom.cloneGeometry(); |
|
144 |
geom.reProject(ct); |
|
145 |
} |
|
146 |
|
|
120 | 147 |
i = dbDriver.getRowIndexByFID(feat); |
121 | 148 |
// System.out.println("Antes de pintar " + i); |
122 | 149 |
// symbol = l.getSymbolByFeature(feat); |
trunk/extensions/extJDBC/text_es.properties | ||
---|---|---|
1 |
next=Siguiente |
|
2 |
back=Anterior |
|
3 |
connection_name=Nombre de la conexi?n |
|
4 |
bd=Cat?logo |
|
5 |
seleccione_tabla=Seleccione la tabla a incorporar |
|
6 |
error_conexion=Error al conectar a la base de datos. |
|
7 |
toda_la_tabla=Toda la tabla |
|
8 |
area_trabajo=Area de trabajo |
|
9 |
importar_extent=Usar el rect?ngulo visible actual |
|
10 |
nombre_capa=Nombre de la capa |
|
11 |
seleccion_de_campos=Selecci?n de campos |
|
12 |
select_all=Seleccionar todos |
|
13 |
select_none=Quitar selecci?n |
|
14 |
select_geom_field=Seleccione el campo que contiene las geometr?as |
|
15 |
select_unique_field=Seleccione el campo con la clave ?nica |
|
16 |
aviso_sin_extent_de_referencia=Para usar esta opci?n necesita tener como m?nimo una capa ya a?adida que sirva de referencia. |
|
0 | 17 |
trunk/extensions/extJDBC/src/com/iver/cit/gvsig/fmap/drivers/jdbc/mysql/MySQLDriver.java | ||
---|---|---|
49 | 49 |
import java.sql.SQLException; |
50 | 50 |
import java.sql.Statement; |
51 | 51 |
|
52 |
import org.cresques.cts.ICoordTrans; |
|
53 |
|
|
52 | 54 |
import com.hardcode.gdbms.engine.data.edition.DataWare; |
55 |
import com.iver.andami.messages.NotificationManager; |
|
53 | 56 |
import com.iver.cit.gvsig.fmap.DriverException; |
54 | 57 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
55 | 58 |
import com.iver.cit.gvsig.fmap.drivers.DefaultDBDriver; |
56 | 59 |
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes; |
57 | 60 |
import com.iver.cit.gvsig.fmap.drivers.IFeatureIterator; |
61 |
import com.iver.cit.gvsig.fmap.drivers.WKTParser; |
|
58 | 62 |
import com.iver.cit.gvsig.fmap.drivers.jdbc.WKBParser; |
63 |
import com.vividsolutions.jts.io.ParseException; |
|
59 | 64 |
|
60 | 65 |
/** |
61 | 66 |
* @author FJP |
... | ... | |
65 | 70 |
*/ |
66 | 71 |
public class MySQLDriver extends DefaultDBDriver { |
67 | 72 |
private WKBParser parser = new WKBParser(); |
73 |
private WKTParser wktParser = new WKTParser(); |
|
68 | 74 |
/* private int fetch_min=-1; |
69 | 75 |
private int fetch_max=-1; */ |
70 | 76 |
private Statement st; |
71 | 77 |
private Rectangle2D fullExtent = null; |
72 | 78 |
private String strAux; |
79 |
private String strEPSG = "-1"; |
|
80 |
private String originalEPSG; |
|
73 | 81 |
/** |
74 | 82 |
* |
75 | 83 |
*/ |
... | ... | |
149 | 157 |
this.sqlOrig = "SELECT " + fields + " FROM " + tableName + " " + whereClause; |
150 | 158 |
this.idFID_FieldName = id_FID_field; |
151 | 159 |
try { |
160 |
|
|
161 |
// NO ESTA LISTO ESTO AUN EN mySQL, o no s? usuarlo getTableEPSG(); |
|
162 |
|
|
152 | 163 |
st = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); |
153 |
rs = st.executeQuery(sqlOrig); |
|
164 |
|
|
165 |
String sqlAux = getCompoundWhere(workingArea, strEPSG); |
|
166 |
System.out.println("mySQL: setData con sql=" + sqlAux); |
|
167 |
rs = st.executeQuery(sqlAux); |
|
154 | 168 |
metaData = rs.getMetaData(); |
155 | 169 |
// Le pegamos un primera pasada para poder relacionar |
156 | 170 |
// un campo de identificador ?nico (parecido al OID en |
... | ... | |
160 | 174 |
doRelateID_FID(); |
161 | 175 |
|
162 | 176 |
} catch (SQLException e) { |
163 |
// TODO Auto-generated catch block
|
|
177 |
NotificationManager.addError("Error al conectar a la base de datos.",e);
|
|
164 | 178 |
e.printStackTrace(); |
165 | 179 |
} |
166 | 180 |
} |
... | ... | |
169 | 183 |
* @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getFullExtent() |
170 | 184 |
*/ |
171 | 185 |
public Rectangle2D getFullExtent(){ |
186 |
/* |
|
187 |
* NO SE PUEDE HACER AS?. DA EL EXTENT PARA CADA GEOMETRIA, |
|
188 |
* NO DA EL GLOBAL. HABR? QUE ESPERAR A QUE LO PONGAN. |
|
189 |
* if (fullExtent == null) |
|
190 |
{ |
|
191 |
try |
|
192 |
{ |
|
193 |
Statement s = conn.createStatement(); |
|
194 |
|
|
195 |
ResultSet r = s.executeQuery("SELECT AsText(Envelope(ogc_geom)) AS FullExtent FROM " + tableName); |
|
196 |
r.next(); |
|
197 |
String strAux = r.getString(1); |
|
198 |
System.out.println("fullExtent = " + strAux); |
|
199 |
// byte[] data = rs.getBytes(1); |
|
200 |
// IGeometry geom = parser.parse(data); |
|
201 |
IGeometry geom = wktParser.read(strAux); |
|
202 |
|
|
203 |
fullExtent = geom.getBounds2D(); |
|
204 |
} |
|
205 |
catch (SQLException e) |
|
206 |
{ |
|
207 |
System.err.println(e.getMessage()); |
|
208 |
} catch (ParseException e) { |
|
209 |
// TODO Auto-generated catch block |
|
210 |
e.printStackTrace(); |
|
211 |
} |
|
212 |
|
|
213 |
} |
|
214 |
return fullExtent; |
|
215 |
*/ |
|
216 |
|
|
172 | 217 |
if (fullExtent == null) |
173 | 218 |
{ |
174 | 219 |
try |
... | ... | |
221 | 266 |
public IFeatureIterator getFeatureIterator(Rectangle2D r, String strEPSG) throws DriverException { |
222 | 267 |
if (workingArea != null) |
223 | 268 |
r = r.createIntersection(workingArea); |
269 |
String sqlAux = getCompoundWhere(r, strEPSG); |
|
270 |
|
|
271 |
return getFeatureIterator(sqlAux); |
|
272 |
} |
|
273 |
|
|
274 |
/** |
|
275 |
* Le pasas el rect?ngulo que quieres pedir. La primera |
|
276 |
* vez es el workingArea, y las siguientes una interseccion |
|
277 |
* de este rectangulo con el workingArea |
|
278 |
* @param r |
|
279 |
* @param strEPSG |
|
280 |
* @return |
|
281 |
*/ |
|
282 |
private String getCompoundWhere(Rectangle2D r, String strEPSG) { |
|
283 |
if (r==null) |
|
284 |
return this.sqlOrig; |
|
285 |
|
|
224 | 286 |
double xMin = r.getMinX(); |
225 | 287 |
double yMin = r.getMinY(); |
226 | 288 |
double xMax = r.getMaxX(); |
227 | 289 |
double yMax = r.getMaxY(); |
228 | 290 |
|
229 | 291 |
String wktBox = "GeomFromText('LINESTRING(" + xMin + " " + yMin + ", " |
230 |
+ xMax + " " + yMin + ", "
|
|
231 |
+ xMax + " " + yMax + ", "
|
|
232 |
+ xMin + " " + yMax + ")', "
|
|
233 |
+ strEPSG + ")";
|
|
292 |
+ xMax + " " + yMin + ", "
|
|
293 |
+ xMax + " " + yMax + ", "
|
|
294 |
+ xMin + " " + yMax + ")', "
|
|
295 |
+ strEPSG + ")";
|
|
234 | 296 |
String sqlAux; |
235 | 297 |
if (getWhereClause().startsWith("WHERE")) |
236 | 298 |
sqlAux = sqlOrig + " MBRIntersects(" + wktBox + ",ogc_geom);" ; |
237 | 299 |
else |
238 | 300 |
sqlAux = sqlOrig + "WHERE MBRIntersects(" + wktBox + ",ogc_geom);" ; |
239 |
|
|
301 |
return sqlAux; |
|
302 |
} |
|
240 | 303 |
|
241 |
return getFeatureIterator(sqlAux); |
|
242 |
} |
|
304 |
|
|
243 | 305 |
public void open() { |
244 | 306 |
// TODO Auto-generated method stub |
245 | 307 |
|
... | ... | |
285 | 347 |
|
286 | 348 |
} |
287 | 349 |
|
350 |
private void getTableEPSG() |
|
351 |
{ |
|
352 |
try { |
|
353 |
Statement stAux = conn.createStatement(); |
|
354 |
|
|
355 |
String sql = "SELECT SRID(ogc_geom) FROM " + |
|
356 |
getTableName() + " LIMIT 1;"; |
|
357 |
ResultSet rs = stAux.executeQuery(sql); |
|
358 |
rs.next(); |
|
359 |
originalEPSG = "" + rs.getInt(1); |
|
360 |
rs.close(); |
|
361 |
} catch (SQLException e) { |
|
362 |
// TODO Auto-generated catch block |
|
363 |
e.printStackTrace(); |
|
364 |
} |
|
365 |
|
|
366 |
} |
|
367 |
|
|
288 | 368 |
|
289 |
|
|
290 | 369 |
} |
trunk/extensions/extJDBC/src/com/iver/cit/gvsig/fmap/drivers/jdbc/postgis/PostGisDriver.java | ||
---|---|---|
58 | 58 |
import com.hardcode.gdbms.engine.data.edition.DataWare; |
59 | 59 |
import com.hardcode.gdbms.engine.values.Value; |
60 | 60 |
import com.hardcode.gdbms.engine.values.ValueFactory; |
61 |
import com.iver.andami.messages.NotificationManager; |
|
61 | 62 |
import com.iver.cit.gvsig.fmap.DriverException; |
63 |
import com.iver.cit.gvsig.fmap.core.ICanReproject; |
|
62 | 64 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
63 | 65 |
import com.iver.cit.gvsig.fmap.drivers.DefaultDBDriver; |
64 | 66 |
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes; |
... | ... | |
71 | 73 |
* TODO To change the template for this generated type comment go to |
72 | 74 |
* Window - Preferences - Java - Code Generation - Code and Comments |
73 | 75 |
*/ |
74 |
public class PostGisDriver extends DefaultDBDriver { |
|
76 |
public class PostGisDriver extends DefaultDBDriver implements ICanReproject {
|
|
75 | 77 |
private static Logger logger = Logger.getLogger(PostGisDriver.class.getName()); |
76 | 78 |
private WKBParser parser = new WKBParser(); |
77 | 79 |
private int fetch_min=-1; |
78 | 80 |
private int fetch_max=-1; |
79 | 81 |
|
82 |
private String strEPSG = null; |
|
83 |
private String originalEPSG = null; |
|
84 |
|
|
80 | 85 |
private Rectangle2D fullExtent = null; |
81 | 86 |
private String strAux; |
82 | 87 |
static { |
... | ... | |
126 | 131 |
return geom; |
127 | 132 |
} |
128 | 133 |
/** |
134 |
* Antes de llamar a esta funci?n hay que haber fijado el |
|
135 |
* workingArea si se quiere usar. |
|
129 | 136 |
* @param conn |
130 | 137 |
* @param tableName |
131 | 138 |
* @param fields OJO: EL PRIMER CAMPO HA DE SER EL DE GEOMETRIA |
... | ... | |
139 | 146 |
this.whereClause = whereClause; |
140 | 147 |
this.sqlOrig = "SELECT " + fields + " FROM " + tableName + " " + whereClause; |
141 | 148 |
this.idFID_FieldName = id_FID_field; |
149 |
|
|
150 |
getTableEPSG(); |
|
151 |
|
|
142 | 152 |
try { |
153 |
String sqlAux = null; |
|
154 |
if (canReproject(strEPSG)) |
|
155 |
{ |
|
156 |
sqlAux = getCompoundWhere(workingArea, strEPSG); |
|
157 |
} |
|
158 |
else |
|
159 |
{ |
|
160 |
sqlAux = getCompoundWhere(workingArea, originalEPSG); |
|
161 |
} |
|
162 |
logger.info("Cadena SQL:" + sqlAux); |
|
143 | 163 |
st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); |
144 | 164 |
st.setFetchSize(5000); |
145 |
logger.info("Cadena SQL:" + this.sqlOrig); |
|
146 | 165 |
st.execute("declare wkb_cursor binary cursor for " + sqlOrig); |
147 | 166 |
rs = st.executeQuery("fetch forward all in wkb_cursor"); |
148 | 167 |
// st.execute("begin"); |
... | ... | |
154 | 173 |
doRelateID_FID(); |
155 | 174 |
|
156 | 175 |
} catch (SQLException e) { |
157 |
// TODO Auto-generated catch block |
|
158 |
e.printStackTrace(); |
|
176 |
NotificationManager.addError("Error al conectar a la base de datos.",e); |
|
159 | 177 |
} |
160 | 178 |
} |
161 | 179 |
|
... | ... | |
229 | 247 |
|
230 | 248 |
public IFeatureIterator getFeatureIterator(Rectangle2D r, String strEPSG) throws DriverException { |
231 | 249 |
if (workingArea != null) |
232 |
r = r.createIntersection(workingArea); |
|
250 |
r = r.createIntersection(workingArea); |
|
251 |
|
|
252 |
String sqlAux; |
|
253 |
if (canReproject(strEPSG)) |
|
254 |
{ |
|
255 |
sqlAux = getCompoundWhere(r, strEPSG); |
|
256 |
} |
|
257 |
else |
|
258 |
{ |
|
259 |
sqlAux = getCompoundWhere(r, originalEPSG); |
|
260 |
} |
|
261 |
|
|
262 |
System.out.println("SqlAux getFeatureIterator = " + sqlAux); |
|
263 |
|
|
264 |
return getFeatureIterator(sqlAux); |
|
265 |
} |
|
266 |
/** |
|
267 |
* Le pasas el rect?ngulo que quieres pedir. La primera |
|
268 |
* vez es el workingArea, y las siguientes una interseccion |
|
269 |
* de este rectangulo con el workingArea |
|
270 |
* @param r |
|
271 |
* @param strEPSG |
|
272 |
* @return |
|
273 |
*/ |
|
274 |
private String getCompoundWhere(Rectangle2D r, String strEPSG) { |
|
275 |
if (r==null) |
|
276 |
return this.sqlOrig; |
|
277 |
|
|
233 | 278 |
double xMin = r.getMinX(); |
234 | 279 |
double yMin = r.getMinY(); |
235 | 280 |
double xMax = r.getMaxX(); |
236 | 281 |
double yMax = r.getMaxY(); |
237 |
|
|
238 | 282 |
String wktBox = "GeometryFromText('LINESTRING(" + xMin + " " + yMin + ", " |
239 | 283 |
+ xMax + " " + yMin + ", " |
240 | 284 |
+ xMax + " " + yMax + ", " |
... | ... | |
244 | 288 |
if (getWhereClause().startsWith("WHERE")) |
245 | 289 |
sqlAux = sqlOrig + " the_geom && " + wktBox; |
246 | 290 |
else |
247 |
sqlAux = sqlOrig + "WHERE the_geom && " + wktBox; |
|
248 |
|
|
249 |
|
|
250 |
return getFeatureIterator(sqlAux); |
|
291 |
sqlAux = sqlOrig + "WHERE the_geom && " + wktBox; |
|
292 |
return sqlAux; |
|
251 | 293 |
} |
252 | 294 |
/** |
253 | 295 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialDatabaseDriver#getConnectionStringBeginning() |
... | ... | |
376 | 418 |
// TODO Auto-generated method stub |
377 | 419 |
|
378 | 420 |
} |
421 |
/* (non-Javadoc) |
|
422 |
* @see com.iver.cit.gvsig.fmap.core.ICanReproject#getSourceProjection() |
|
423 |
*/ |
|
424 |
public String getSourceProjection() { |
|
425 |
if (originalEPSG == null) |
|
426 |
getTableEPSG(); |
|
427 |
return originalEPSG; |
|
428 |
} |
|
379 | 429 |
|
430 |
private void getTableEPSG() |
|
431 |
{ |
|
432 |
try { |
|
433 |
Statement stAux = conn.createStatement(); |
|
434 |
|
|
435 |
String sql = "SELECT * FROM GEOMETRY_COLUMNS WHERE F_TABLE_NAME = '" + |
|
436 |
getTableName() + "';"; |
|
437 |
ResultSet rs = stAux.executeQuery(sql); |
|
438 |
rs.next(); |
|
439 |
originalEPSG = "" + rs.getInt("SRID"); |
|
440 |
rs.close(); |
|
441 |
} catch (SQLException e) { |
|
442 |
// TODO Auto-generated catch block |
|
443 |
e.printStackTrace(); |
|
444 |
} |
|
445 |
|
|
446 |
} |
|
380 | 447 |
|
448 |
/* (non-Javadoc) |
|
449 |
* @see com.iver.cit.gvsig.fmap.core.ICanReproject#getDestProjection() |
|
450 |
*/ |
|
451 |
public String getDestProjection() { |
|
452 |
return strEPSG; |
|
453 |
} |
|
454 |
/* (non-Javadoc) |
|
455 |
* @see com.iver.cit.gvsig.fmap.core.ICanReproject#setDestProjection(java.lang.String) |
|
456 |
*/ |
|
457 |
public void setDestProjection(String toEPSG) { |
|
458 |
this.strEPSG = toEPSG; |
|
459 |
} |
|
460 |
/* (non-Javadoc) |
|
461 |
* @see com.iver.cit.gvsig.fmap.core.ICanReproject#canReproject(java.lang.String) |
|
462 |
*/ |
|
463 |
public boolean canReproject(String toEPSGdestinyProjection) { |
|
464 |
// TODO POR AHORA, REPROYECTA SIEMPRE gvSIG. |
|
465 |
return false; |
|
466 |
} |
|
467 |
|
|
468 |
|
|
381 | 469 |
} |
trunk/extensions/extJDBC/src/com/iver/cit/gvsig/jdbc_spatial/gui/jdbcwizard/FieldSelection.java | ||
---|---|---|
11 | 11 |
import com.iver.utiles.swing.wizard.Step; |
12 | 12 |
import com.iver.utiles.swing.wizard.WizardControl; |
13 | 13 |
import javax.swing.JButton; |
14 |
import java.awt.CardLayout; |
|
15 |
import java.awt.GridLayout; |
|
16 |
import javax.swing.BoxLayout; |
|
17 |
import java.awt.BorderLayout; |
|
14 | 18 |
/** |
15 | 19 |
* @author Fernando Gonz?lez Cort?s |
16 | 20 |
*/ |
... | ... | |
23 | 27 |
private JPanel jPanel = null; |
24 | 28 |
private JButton jButton = null; |
25 | 29 |
private JButton jButton1 = null; |
30 |
private JPanel jPanel1 = null; // @jve:decl-index=0:visual-constraint="326,146" |
|
31 |
private JPanel jPanel2 = null; // @jve:decl-index=0:visual-constraint="340,183" |
|
26 | 32 |
|
27 | 33 |
/** |
28 | 34 |
* This is the default constructor |
... | ... | |
38 | 44 |
*/ |
39 | 45 |
private void initialize() { |
40 | 46 |
jLabel = new JLabel(); |
41 |
this.setSize(300, 200); |
|
47 |
this.setLayout(new BorderLayout()); |
|
48 |
this.setSize(300, 261); |
|
42 | 49 |
jLabel.setText(PluginServices.getText(this, "seleccion_de_campos") + ":"); |
43 | 50 |
jLabel.setPreferredSize(new java.awt.Dimension(352,15)); |
44 | 51 |
jLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); |
45 |
this.add(jLabel, null); |
|
46 |
this.add(getJScrollPane(), null); |
|
47 |
this.add(getJPanel(), null); |
|
52 |
jLabel.setName("jLabel"); |
|
53 |
this.add(getJPanel2(), java.awt.BorderLayout.WEST); |
|
54 |
this.add(getJPanel1(), java.awt.BorderLayout.EAST); |
|
55 |
this.add(getJPanel(), java.awt.BorderLayout.SOUTH); |
|
56 |
this.add(getJScrollPane(), java.awt.BorderLayout.CENTER); |
|
57 |
this.add(jLabel, java.awt.BorderLayout.NORTH); |
|
48 | 58 |
} |
49 | 59 |
|
50 | 60 |
/** |
... | ... | |
86 | 96 |
if (jScrollPane == null) { |
87 | 97 |
jScrollPane = new JScrollPane(); |
88 | 98 |
jScrollPane.setPreferredSize(new java.awt.Dimension(200,140)); |
99 |
jScrollPane.setName("jScrollPane"); |
|
89 | 100 |
jScrollPane.setViewportView(getLstCampos()); |
90 | 101 |
} |
91 | 102 |
return jScrollPane; |
... | ... | |
115 | 126 |
if (jPanel == null) { |
116 | 127 |
jPanel = new JPanel(); |
117 | 128 |
jPanel.setPreferredSize(new java.awt.Dimension(350,25)); |
129 |
jPanel.setName("jPanel"); |
|
118 | 130 |
jPanel.add(getJButton(), null); |
119 | 131 |
jPanel.add(getJButton1(), null); |
120 | 132 |
} |
... | ... | |
128 | 140 |
private JButton getJButton() { |
129 | 141 |
if (jButton == null) { |
130 | 142 |
jButton = new JButton(); |
131 |
jButton.setText(PluginServices.getText(this, "select_all")+ ":");
|
|
132 |
jButton.setPreferredSize(new java.awt.Dimension(93,18));
|
|
143 |
jButton.setText(PluginServices.getText(this, "select_all")); |
|
144 |
jButton.setPreferredSize(new java.awt.Dimension(140,18));
|
|
133 | 145 |
jButton.addActionListener(new java.awt.event.ActionListener() { |
134 | 146 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
135 | 147 |
int[] indices = new int[lstCampos.getModel().getSize()]; |
... | ... | |
150 | 162 |
private JButton getJButton1() { |
151 | 163 |
if (jButton1 == null) { |
152 | 164 |
jButton1 = new JButton(); |
153 |
jButton1.setText(PluginServices.getText(this, "select_none")+ ":");
|
|
154 |
jButton1.setPreferredSize(new java.awt.Dimension(108,18));
|
|
165 |
jButton1.setText(PluginServices.getText(this, "select_none")); |
|
166 |
jButton1.setPreferredSize(new java.awt.Dimension(140,18));
|
|
155 | 167 |
jButton1.addActionListener(new java.awt.event.ActionListener() { |
156 | 168 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
157 | 169 |
lstCampos.setSelectedIndices(new int[0]); |
... | ... | |
166 | 178 |
public boolean done() { |
167 | 179 |
return getLstCampos().getSelectedIndex() != -1; |
168 | 180 |
} |
169 |
} |
|
181 |
/** |
|
182 |
* This method initializes jPanel1 |
|
183 |
* |
|
184 |
* @return javax.swing.JPanel |
|
185 |
*/ |
|
186 |
private JPanel getJPanel1() { |
|
187 |
if (jPanel1 == null) { |
|
188 |
jPanel1 = new JPanel(); |
|
189 |
jPanel1.setSize(56, 71); |
|
190 |
jPanel1.setPreferredSize(new java.awt.Dimension(70,10)); |
|
191 |
} |
|
192 |
return jPanel1; |
|
193 |
} |
|
194 |
/** |
|
195 |
* This method initializes jPanel2 |
|
196 |
* |
|
197 |
* @return javax.swing.JPanel |
|
198 |
*/ |
|
199 |
private JPanel getJPanel2() { |
|
200 |
if (jPanel2 == null) { |
|
201 |
jPanel2 = new JPanel(); |
|
202 |
jPanel2.setSize(42, 60); |
|
203 |
jPanel2.setPreferredSize(new java.awt.Dimension(70,10)); |
|
204 |
} |
|
205 |
return jPanel2; |
|
206 |
} |
|
207 |
} // @jve:decl-index=0:visual-constraint="10,10" |
trunk/extensions/extJDBC/src/com/iver/cit/gvsig/jdbc_spatial/gui/jdbcwizard/DBLayerDefinition.java | ||
---|---|---|
13 | 13 |
import javax.swing.DefaultListModel; |
14 | 14 |
import javax.swing.JLabel; |
15 | 15 |
import javax.swing.JList; |
16 |
import javax.swing.JOptionPane; |
|
16 | 17 |
import javax.swing.JPanel; |
17 | 18 |
import javax.swing.JRadioButton; |
18 | 19 |
import javax.swing.JScrollPane; |
... | ... | |
116 | 117 |
pnlExtent = new JPanel(); |
117 | 118 |
pnlExtent.setLayout(null); |
118 | 119 |
pnlExtent.setPreferredSize(new java.awt.Dimension(400,60)); |
119 |
jLabel1.setText("MinX:");
|
|
120 |
jLabel1.setText(PluginServices.getText(this, "minx:"));
|
|
120 | 121 |
jLabel1.setBounds(9, 25, 50, 15); |
121 |
jLabel2.setText("MaxX:"); |
|
122 |
jLabel2.setBounds(9, 50, 50, 15); |
|
123 |
jLabel3.setText("MinY:"); |
|
124 |
jLabel3.setBounds(9, 104, 50, 15); |
|
125 |
jLabel4.setText("MaxY:"); |
|
126 |
jLabel4.setBounds(9, 80, 50, 15); |
|
127 |
pnlExtent.setBounds(318, 86, 155, 131); |
|
128 |
pnlExtent.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Working Area", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
122 |
jLabel2.setText(PluginServices.getText(this, "maxx:")); |
|
123 |
jLabel2.setBounds(9, 80, 50, 15); |
|
124 |
jLabel3.setText(PluginServices.getText(this, "miny:")); |
|
125 |
jLabel3.setBounds(9, 48, 50, 15); |
|
126 |
jLabel4.setText(PluginServices.getText(this, "maxy:")); |
|
127 |
jLabel4.setBounds(9, 103, 50, 15); |
|
128 |
pnlExtent.setBounds(300, 118, 194, 131); |
|
129 |
String strWorkingArea = PluginServices.getText(this,"area_trabajo"); |
|
130 |
pnlExtent.setBorder(javax.swing.BorderFactory.createTitledBorder(null, strWorkingArea, javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
129 | 131 |
pnlExtent.add(getTxtMaxY(), null); |
130 | 132 |
pnlExtent.add(jLabel4, null); |
131 | 133 |
pnlExtent.add(getTxtMinY(), null); |
... | ... | |
148 | 150 |
if (txtMinX == null) { |
149 | 151 |
txtMinX = new JTextField(); |
150 | 152 |
txtMinX.setPreferredSize(new java.awt.Dimension(100, 19)); |
151 |
txtMinX.setBounds(65, 21, 82, 19);
|
|
153 |
txtMinX.setBounds(65, 21, 118, 19);
|
|
152 | 154 |
} |
153 | 155 |
|
154 | 156 |
return txtMinX; |
... | ... | |
163 | 165 |
if (txtMaxX == null) { |
164 | 166 |
txtMaxX = new JTextField(); |
165 | 167 |
txtMaxX.setPreferredSize(new java.awt.Dimension(100, 19)); |
166 |
txtMaxX.setBounds(65, 46, 82, 19);
|
|
168 |
txtMaxX.setBounds(65, 76, 118, 19);
|
|
167 | 169 |
} |
168 | 170 |
|
169 | 171 |
return txtMaxX; |
... | ... | |
178 | 180 |
if (txtMinY == null) { |
179 | 181 |
txtMinY = new JTextField(); |
180 | 182 |
txtMinY.setPreferredSize(new java.awt.Dimension(100, 19)); |
181 |
txtMinY.setBounds(65, 100, 82, 19);
|
|
183 |
txtMinY.setBounds(65, 44, 118, 19);
|
|
182 | 184 |
} |
183 | 185 |
|
184 | 186 |
return txtMinY; |
... | ... | |
193 | 195 |
if (txtMaxY == null) { |
194 | 196 |
txtMaxY = new JTextField(); |
195 | 197 |
txtMaxY.setPreferredSize(new java.awt.Dimension(100, 19)); |
196 |
txtMaxY.setBounds(65, 76, 82, 19);
|
|
198 |
txtMaxY.setBounds(65, 99, 118, 19);
|
|
197 | 199 |
} |
198 | 200 |
|
199 | 201 |
return txtMaxY; |
... | ... | |
295 | 297 |
radFullTable = new JRadioButton(); |
296 | 298 |
radFullTable.setText(PluginServices.getText(this, "toda_la_tabla")+":"); |
297 | 299 |
radFullTable.setSelected(true); |
300 |
radFullTable.setPreferredSize(new java.awt.Dimension(189,23)); |
|
298 | 301 |
radFullTable.addActionListener(new ActionListener() { |
299 | 302 |
public void actionPerformed(ActionEvent e) { |
300 | 303 |
enableExtent(radWorkingArea.isSelected()); |
... | ... | |
314 | 317 |
for (int i = 0; i < pnlExtent.getComponentCount(); i++) { |
315 | 318 |
pnlExtent.getComponent(i).setEnabled(enable); |
316 | 319 |
} |
320 |
getJButton().setEnabled(enable); |
|
317 | 321 |
} |
318 | 322 |
|
319 | 323 |
/** |
... | ... | |
325 | 329 |
if (radWorkingArea == null) { |
326 | 330 |
radWorkingArea = new JRadioButton(); |
327 | 331 |
radWorkingArea.setText(PluginServices.getText(this, "area_trabajo")+":"); |
332 |
radWorkingArea.setPreferredSize(new java.awt.Dimension(189,23)); |
|
328 | 333 |
radWorkingArea.addActionListener(new ActionListener() { |
329 | 334 |
public void actionPerformed(ActionEvent e) { |
330 | 335 |
enableExtent(radWorkingArea.isSelected()); |
... | ... | |
365 | 370 |
private JPanel getJPanel() { |
366 | 371 |
if (jPanel == null) { |
367 | 372 |
jPanel = new JPanel(); |
368 |
jPanel.setBounds(295, 26, 197, 33);
|
|
373 |
jPanel.setBounds(295, 26, 197, 55);
|
|
369 | 374 |
jPanel.add(getRadFullTable(), null); |
370 | 375 |
jPanel.add(getRadWorkingArea(), null); |
376 |
|
|
371 | 377 |
} |
372 | 378 |
|
373 | 379 |
return jPanel; |
... | ... | |
401 | 407 |
jLabel5.setBounds(3, 7, 106, 15); |
402 | 408 |
jPanel1.setLayout(null); |
403 | 409 |
jPanel1.setPreferredSize(new java.awt.Dimension(383,29)); |
404 |
jPanel1.setBounds(19, 223, 299, 29);
|
|
410 |
jPanel1.setBounds(19, 223, 278, 29);
|
|
405 | 411 |
jPanel1.add(getTxtLayerName(), null); |
406 | 412 |
jPanel1.add(jLabel5, null); |
407 | 413 |
} |
... | ... | |
433 | 439 |
if (jButton == null) { |
434 | 440 |
jButton = new JButton(); |
435 | 441 |
jButton.setText(PluginServices.getText(this, "importar_extent")+":"); |
436 |
jButton.setBounds(341, 62, 111, 23);
|
|
442 |
jButton.setBounds(297, 86, 196, 27);
|
|
437 | 443 |
jButton.addActionListener(new ActionListener() { |
438 | 444 |
public void actionPerformed(ActionEvent e) { |
439 | 445 |
View v = PluginServices.getMDIManager().getActiveView(); |
440 | 446 |
com.iver.cit.gvsig.gui.View vista = (com.iver.cit.gvsig.gui.View) v; |
441 | 447 |
Rectangle2D r = vista.getModel().getMapContext().getViewPort().getAdjustedExtent(); |
448 |
if (r == null) |
|
449 |
{ |
|
450 |
JOptionPane.showMessageDialog(null,PluginServices.getText(this, "aviso_sin_extent_de_referencia")); |
|
451 |
return; |
|
452 |
} |
|
453 |
|
|
442 | 454 |
getTxtMinX().setText(Double.toString(r.getMinX())); |
443 | 455 |
getTxtMinY().setText(Double.toString(r.getMinY())); |
444 | 456 |
getTxtMaxX().setText(Double.toString(r.getMaxX())); |
trunk/extensions/extJDBC/src/com/iver/cit/gvsig/jdbc_spatial/gui/jdbcwizard/ConnectionPanel.java | ||
---|---|---|
28 | 28 |
* @author Fernando Gonz?lez Cort?s |
29 | 29 |
*/ |
30 | 30 |
public class ConnectionPanel extends JPanel implements Step { |
31 |
private static String passw = null; |
|
32 |
|
|
31 | 33 |
private JPanel jPanel = null; |
32 | 34 |
private JLabel jLabel = null; |
33 | 35 |
private JTextField txtHost = null; |
... | ... | |
45 | 47 |
private JLabel jLabel6 = null; |
46 | 48 |
private com.iver.utiles.swing.JComboBox cmbName = null; |
47 | 49 |
private HashMap cs = new HashMap(); |
50 |
|
|
51 |
|
|
48 | 52 |
|
49 | 53 |
/** |
50 | 54 |
* This is the default constructor |
... | ... | |
61 | 65 |
this.setSize(400, 240); |
62 | 66 |
this.add(getJPanel(), null); |
63 | 67 |
this.add(getJPanel1(), null); |
68 |
|
|
69 |
if (passw != null) |
|
70 |
txtPassword.setText(passw); |
|
71 |
|
|
64 | 72 |
} |
65 | 73 |
|
66 | 74 |
/** |
... | ... | |
261 | 269 |
* @return DOCUMENT ME! |
262 | 270 |
*/ |
263 | 271 |
public String getPassword() { |
264 |
return new String(getTxtPassword().getPassword()); |
|
272 |
passw = String.copyValueOf(getTxtPassword().getPassword()); |
|
273 |
return passw; |
|
265 | 274 |
} |
266 | 275 |
|
267 | 276 |
/** |
trunk/extensions/extJDBC/src/com/iver/cit/gvsig/jdbc_spatial/gui/jdbcwizard/UniqueFieldSelection.java | ||
---|---|---|
8 | 8 |
import javax.swing.JList; |
9 | 9 |
|
10 | 10 |
import com.iver.andami.PluginServices; |
11 |
import java.awt.BorderLayout; |
|
11 | 12 |
/** |
12 | 13 |
* @author Fernando Gonz?lez Cort?s |
13 | 14 |
*/ |
... | ... | |
17 | 18 |
private JScrollPane jScrollPane = null; |
18 | 19 |
private JList lstFields = null; |
19 | 20 |
private WizardJDBC w; |
21 |
private JPanel jPanel = null; // @jve:decl-index=0:visual-constraint="312,136" |
|
22 |
private JPanel jPanel1 = null; // @jve:decl-index=0:visual-constraint="2,118" |
|
20 | 23 |
/** |
21 | 24 |
* This is the default constructor |
22 | 25 |
*/ |
... | ... | |
31 | 34 |
*/ |
32 | 35 |
private void initialize() { |
33 | 36 |
jLabel = new JLabel(); |
34 |
this.setSize(300,200); |
|
37 |
this.setLayout(new BorderLayout()); |
|
38 |
this.setSize(300, 226); |
|
35 | 39 |
jLabel.setText(PluginServices.getText(this, "select_unique_field")+":"); |
36 | 40 |
jLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); |
37 | 41 |
jLabel.setPreferredSize(new java.awt.Dimension(315,15)); |
38 |
this.add(jLabel, null); |
|
42 |
this.add(getJPanel(), java.awt.BorderLayout.EAST); |
|
43 |
this.add(getJScrollPane(), java.awt.BorderLayout.CENTER); |
|
44 |
this.add(getJPanel1(), java.awt.BorderLayout.WEST); |
|
45 |
this.add(jLabel, java.awt.BorderLayout.NORTH); |
|
39 | 46 |
this.add(getJScrollPane(), null); |
40 |
this.add(getJScrollPane(), null); |
|
41 | 47 |
} |
42 | 48 |
/** |
43 | 49 |
* This method initializes jScrollPane |
... | ... | |
87 | 93 |
public String getField(){ |
88 | 94 |
return (String) getLstFields().getSelectedValue(); |
89 | 95 |
} |
90 |
} |
|
96 |
/** |
|
97 |
* This method initializes jPanel |
|
98 |
* |
|
99 |
* @return javax.swing.JPanel |
|
100 |
*/ |
|
101 |
private JPanel getJPanel() { |
|
102 |
if (jPanel == null) { |
|
103 |
jPanel = new JPanel(); |
|
104 |
jPanel.setSize(77, 60); |
|
105 |
jPanel.setPreferredSize(new java.awt.Dimension(80,10)); |
|
106 |
} |
|
107 |
return jPanel; |
|
108 |
} |
|
109 |
/** |
|
110 |
* This method initializes jPanel1 |
|
111 |
* |
|
112 |
* @return javax.swing.JPanel |
|
113 |
*/ |
|
114 |
private JPanel getJPanel1() { |
|
115 |
if (jPanel1 == null) { |
|
116 |
jPanel1 = new JPanel(); |
|
117 |
jPanel1.setSize(37, 71); |
|
118 |
jPanel1.setPreferredSize(new java.awt.Dimension(80,10)); |
|
119 |
} |
|
120 |
return jPanel1; |
|
121 |
} |
|
122 |
} // @jve:decl-index=0:visual-constraint="10,10" |
trunk/extensions/extJDBC/src/com/iver/cit/gvsig/jdbc_spatial/gui/jdbcwizard/GeomFieldSelection.java | ||
---|---|---|
8 | 8 |
import javax.swing.JScrollPane; |
9 | 9 |
|
10 | 10 |
import com.iver.andami.PluginServices; |
11 |
import java.awt.BorderLayout; |
|
11 | 12 |
/** |
12 | 13 |
* @author Fernando Gonz?lez Cort?s |
13 | 14 |
*/ |
... | ... | |
16 | 17 |
private JLabel jLabel = null; |
17 | 18 |
private JList lstFields = null; |
18 | 19 |
private JScrollPane jScrollPane = null; |
20 |
private JPanel jPanel = null; // @jve:decl-index=0:visual-constraint="215,282" |
|
21 |
private JPanel jPanel1 = null; // @jve:decl-index=0:visual-constraint="9,197" |
|
19 | 22 |
/** |
20 | 23 |
* This is the default constructor |
21 | 24 |
*/ |
... | ... | |
30 | 33 |
*/ |
31 | 34 |
private void initialize() { |
32 | 35 |
jLabel = new JLabel(); |
33 |
this.setSize(300,200); |
|
36 |
this.setLayout(new BorderLayout()); |
|
37 |
this.setSize(300, 263); |
|
34 | 38 |
jLabel.setText(PluginServices.getText(this, "select_geom_field") + ":"); |
35 | 39 |
jLabel.setPreferredSize(new java.awt.Dimension(359,15)); |
36 | 40 |
jLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); |
37 |
this.add(jLabel, null); |
|
38 |
this.add(getJScrollPane(), null); |
|
41 |
this.add(getJPanel1(), java.awt.BorderLayout.WEST); |
|
42 |
this.add(getJPanel(), java.awt.BorderLayout.EAST); |
|
43 |
this.add(getJScrollPane(), java.awt.BorderLayout.CENTER); |
|
44 |
this.add(jLabel, java.awt.BorderLayout.NORTH); |
|
39 | 45 |
} |
40 | 46 |
/** |
41 | 47 |
* This method initializes jList |
... | ... | |
81 | 87 |
public String getField(){ |
82 | 88 |
return (String) getLstFields().getSelectedValue(); |
83 | 89 |
} |
84 |
} |
|
90 |
/** |
|
91 |
* This method initializes jPanel |
|
92 |
* |
|
93 |
* @return javax.swing.JPanel |
|
94 |
*/ |
|
95 |
private JPanel getJPanel() { |
|
96 |
if (jPanel == null) { |
|
97 |
jPanel = new JPanel(); |
|
98 |
jPanel.setSize(46, 32); |
|
99 |
jPanel.setPreferredSize(new java.awt.Dimension(80,10)); |
|
100 |
} |
|
101 |
return jPanel; |
|
102 |
} |
|
103 |
/** |
|
104 |
* This method initializes jPanel1 |
|
105 |
* |
|
106 |
* @return javax.swing.JPanel |
|
107 |
*/ |
|
108 |
private JPanel getJPanel1() { |
|
109 |
if (jPanel1 == null) { |
|
110 |
jPanel1 = new JPanel(); |
|
111 |
jPanel1.setSize(47, 66); |
|
112 |
jPanel1.setPreferredSize(new java.awt.Dimension(80,10)); |
|
113 |
} |
|
114 |
return jPanel1; |
|
115 |
} |
|
116 |
} // @jve:decl-index=0:visual-constraint="10,10" |
trunk/extensions/extJDBC/src/com/iver/cit/gvsig/jdbc_spatial/gui/jdbcwizard/WizardJDBC.java | ||
---|---|---|
18 | 18 |
import javax.swing.JOptionPane; |
19 | 19 |
import javax.swing.JPanel; |
20 | 20 |
|
21 |
import org.cresques.cts.IProjection; |
|
22 |
import org.cresques.cts.ProjectionPool; |
|
23 |
|
|
21 | 24 |
import com.hardcode.driverManager.DriverLoadException; |
22 | 25 |
import com.hardcode.gdbms.engine.data.NoSuchTableException; |
23 | 26 |
import com.iver.andami.PluginServices; |
24 | 27 |
import com.iver.andami.messages.NotificationManager; |
28 |
import com.iver.cit.gvsig.fmap.core.ICanReproject; |
|
25 | 29 |
import com.iver.cit.gvsig.fmap.drivers.DefaultDBDriver; |
26 | 30 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
27 | 31 |
import com.iver.cit.gvsig.fmap.drivers.VectorialJDBCDriver; |
... | ... | |
217 | 221 |
else if (step == 1) { |
218 | 222 |
fieldSelection.setFields(getTableFields()); |
219 | 223 |
}else if (step == 2) { |
220 |
geomFieldSelection.setFields(getFields()); |
|
224 |
geomFieldSelection.setFields(getTableFields());
|
|
221 | 225 |
}else if (step == 3) { |
222 | 226 |
uniqueFieldSelection.setFields(getTableFields()); |
223 | 227 |
} |
... | ... | |
453 | 457 |
public FLayer getLayer() { |
454 | 458 |
WizardJDBC wiz = this; |
455 | 459 |
//true -> Modo desconectado. Por ahora, no se usa |
460 |
IProjection proj = null; |
|
456 | 461 |
if (false){ |
457 | 462 |
try { |
458 | 463 |
String dbURL = wiz.getConnectionString(); |
... | ... | |
472 | 477 |
conn.setAutoCommit(false); |
473 | 478 |
|
474 | 479 |
VectorialJDBCDriver driver = wiz.getDriver(); |
475 |
driver.setData(conn, tableName, fields, whereClause, fidField); |
|
476 | 480 |
if (dbLayerDefinition.getWorkingArea() != null){ |
477 | 481 |
driver.setWorkingArea(dbLayerDefinition.getWorkingArea()); |
478 | 482 |
} |
483 |
String strEPSG = getMapCtrl().getViewPort() |
|
484 |
.getProjection().getAbrev() |
|
485 |
.substring(5); |
|
486 |
if (driver instanceof ICanReproject) |
|
487 |
{ |
|
488 |
((ICanReproject)driver).setDestProjection(strEPSG); |
|
489 |
} |
|
490 |
driver.setData(conn, tableName, fields, whereClause, fidField); |
|
491 |
if (driver instanceof ICanReproject) |
|
492 |
{ |
|
493 |
proj = ProjectionPool.get("EPSG:" + ((ICanReproject)driver).getSourceProjection()); |
|
494 |
} |
|
495 |
|
|
479 | 496 |
/* Disconnected d = new Disconnected(driver, layerName); |
480 | 497 |
PluginServices.backgroundExecution(d); |
481 | 498 |
lyr = d.getLayer(); |
482 | 499 |
*/ |
483 |
FLayer lyr = LayerFactory.createDisconnectedDBLayer(driver, layerName, null, null);
|
|
500 |
FLayer lyr = LayerFactory.createDisconnectedDBLayer(driver, layerName, proj, null);
|
|
484 | 501 |
if (lyr != null) { |
485 | 502 |
lyr.setVisible(true); |
486 | 503 |
} |
... | ... | |
526 | 543 |
if (driver instanceof DefaultDBDriver) |
527 | 544 |
{ |
528 | 545 |
DefaultDBDriver dbDriver = (DefaultDBDriver) driver; |
529 |
dbDriver.setData(conn, tableName, fields, whereClause, fidField); |
|
530 |
if (dbLayerDefinition.getWorkingArea() != null){ |
|
531 |
driver.setWorkingArea(dbLayerDefinition.getWorkingArea()); |
|
532 |
} |
|
546 |
String strEPSG = getMapCtrl().getViewPort() |
|
547 |
.getProjection().getAbrev() |
|
548 |
.substring(5); |
|
549 |
if (driver instanceof ICanReproject) |
|
550 |
{ |
|
551 |
((ICanReproject)driver).setDestProjection(strEPSG); |
|
552 |
} |
|
553 |
|
|
554 |
if (dbLayerDefinition.getWorkingArea() != null){ |
|
555 |
driver.setWorkingArea(dbLayerDefinition.getWorkingArea()); |
|
556 |
} |
|
557 |
dbDriver.setData(conn, tableName, fields, whereClause, fidField); |
|
558 |
if (driver instanceof ICanReproject) |
|
559 |
{ |
|
560 |
proj = ProjectionPool.get("EPSG:" + ((ICanReproject)driver).getSourceProjection()); |
|
561 |
} |
|
562 |
|
|
533 | 563 |
} |
534 | 564 |
|
535 |
return LayerFactory.createDBLayer(driver, layerName, null);
|
|
565 |
return LayerFactory.createDBLayer(driver, layerName, proj);
|
|
536 | 566 |
} catch (SQLException e) { |
537 | 567 |
// TODO Auto-generated catch block |
538 | 568 |
e.printStackTrace(); |
trunk/extensions/extJDBC/.classpath | ||
---|---|---|
48 | 48 |
<attributes> |
49 | 49 |
</attributes> |
50 | 50 |
</classpathentry> |
51 |
<classpathentry kind="lib" path="/FMap 03/lib/jts-1.6.jar"> |
|
52 |
<attributes> |
|
53 |
</attributes> |
|
54 |
</classpathentry> |
|
51 | 55 |
<classpathentry kind="output" path="bin"/> |
52 | 56 |
</classpath> |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/AddLayer.java | ||
---|---|---|
60 | 60 |
import com.iver.andami.messages.NotificationManager; |
61 | 61 |
import com.iver.andami.plugins.Extension; |
62 | 62 |
import com.iver.cit.gvsig.fmap.DriverException; |
63 |
import com.iver.cit.gvsig.fmap.ViewPort; |
|
63 | 64 |
import com.iver.cit.gvsig.fmap.drivers.RasterDriver; |
64 | 65 |
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver; |
65 | 66 |
import com.iver.cit.gvsig.fmap.drivers.WithDefaultLegend; |
... | ... | |
125 | 126 |
public void inicializar() { |
126 | 127 |
} |
127 | 128 |
|
129 |
private void checkProjection(FLayer lyr, ViewPort viewPort) |
|
130 |
{ |
|
131 |
if (lyr instanceof FLyrVect) |
|
132 |
{ |
|
133 |
FLyrVect lyrVect = (FLyrVect) lyr; |
|
134 |
IProjection proj = lyr.getProjection(); |
|
135 |
// Comprobar que la projecci?n es la misma que la vista |
|
136 |
if (proj == null) |
|
137 |
{ |
|
138 |
// SUPONEMOS que la capa est? en la proyecci?n que |
|
139 |
// estamos pidiendo (que ya es mucho suponer, ya). |
|
140 |
lyrVect.setProjection(viewPort.getProjection()); |
|
141 |
return; |
|
142 |
} |
|
143 |
if (proj != viewPort.getProjection()) { |
|
144 |
int option = JOptionPane.showConfirmDialog(null, |
|
145 |
PluginServices.getText(this, "reproyectar_aviso"), |
|
146 |
PluginServices.getText(this, "reproyectar_pregunta"), |
|
147 |
JOptionPane.YES_NO_OPTION); |
|
148 |
|
|
149 |
if (option == JOptionPane.NO_OPTION) { |
|
150 |
return; |
|
151 |
} else { |
|
152 |
ICoordTrans ct = new CoordTrans((CoordSys) proj, |
|
153 |
(CoordSys) viewPort.getProjection()); |
|
154 |
lyrVect.setCoordTrans(ct); |
|
155 |
System.err.println("coordTrans = " + |
|
156 |
proj.getAbrev() + " " + |
|
157 |
viewPort.getProjection().getAbrev()); |
|
158 |
} |
|
159 |
} |
|
160 |
} |
|
161 |
|
|
162 |
} |
|
128 | 163 |
/** |
129 | 164 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String) |
130 | 165 |
*/ |
... | ... | |
215 | 250 |
// Le asignamos tambi?n una legenda por defecto acorde con |
216 | 251 |
// el tipo de shape que tenga. Tampoco s? si es aqu? el |
217 | 252 |
// sitio adecuado, pero en fin.... |
253 |
checkProjection(lyr, theView.getMapControl().getViewPort()); |
|
218 | 254 |
if (lyr instanceof FLyrVect) |
219 | 255 |
{ |
220 | 256 |
FLyrVect lyrVect = (FLyrVect) lyr; |
221 |
// Comprobar que la projecci?n es la misma que la vista |
|
222 |
if (proj != theView.getProjection()) { |
|
223 |
int option = JOptionPane.showConfirmDialog(null, |
|
224 |
PluginServices.getText(this, "reproyectar_aviso"), |
|
225 |
PluginServices.getText(this, "reproyectar_pregunta"), |
|
226 |
JOptionPane.YES_NO_OPTION); |
|
227 |
|
|
228 |
if (option == JOptionPane.NO_OPTION) { |
|
229 |
return; |
|
230 |
} else { |
|
231 |
ICoordTrans ct = new CoordTrans((CoordSys) proj, |
|
232 |
(CoordSys) theView.getProjection()); |
|
233 |
lyrVect.setCoordTrans(ct); |
|
234 |
System.err.println("coordTrans = " + |
|
235 |
proj.getAbrev() + " " + |
|
236 |
theView.getProjection().getAbrev()); |
|
237 |
} |
|
238 |
} |
|
239 |
|
|
240 | 257 |
if (drivers[iFile] instanceof WithDefaultLegend) { |
241 | 258 |
WithDefaultLegend aux = (WithDefaultLegend) drivers[iFile]; |
242 | 259 |
lyrVect.setLegend((VectorialLegend) aux.getDefaultLegend()); |
... | ... | |
292 | 309 |
theView.getMapControl().getMapContext().getLayers() |
293 | 310 |
.addLayer(lyr); |
294 | 311 |
theView.getMapControl().getMapContext().endAtomicEvent(); |
312 |
checkProjection(lyr, theView.getMapControl().getViewPort()); |
|
295 | 313 |
} |
296 | 314 |
/* } else if (fopen.getSelectedTab() == wms) { |
297 | 315 |
String layerName = wms.getLayerName(); |
Also available in: Unified diff