Revision 8262
trunk/libraries/libJCRS/src/org/gvsig/crs/CrsWkt.java | ||
---|---|---|
17 | 17 |
private int contador = 0; |
18 | 18 |
private String[] authority = {"",""}; |
19 | 19 |
|
20 |
public CrsWkt(String wkt) { |
|
20 |
public CrsWkt(String wkt_spaces) { |
|
21 |
String aux; |
|
22 |
String wkt = ""; |
|
23 |
for(int i = 0; i < wkt_spaces.length(); i++) { |
|
24 |
aux = ""+wkt_spaces.charAt(i); |
|
25 |
if(!aux.equals(" ")) { |
|
26 |
wkt+=aux; |
|
27 |
}else { |
|
28 |
wkt += ""; |
|
29 |
} |
|
30 |
} |
|
21 | 31 |
fromWKT(wkt, false); |
22 | 32 |
} |
23 | 33 |
|
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/CRSMainTrPanel.java | ||
---|---|---|
15 | 15 |
import org.cresques.cts.IProjection; |
16 | 16 |
import org.gvsig.crs.CrsException; |
17 | 17 |
import org.gvsig.crs.CrsFactory; |
18 |
import org.gvsig.crs.CrsWkt; |
|
18 | 19 |
import org.gvsig.crs.EpsgConnection; |
19 | 20 |
import org.gvsig.crs.ICrs; |
20 | 21 |
import org.gvsig.crs.Query; |
... | ... | |
45 | 46 |
boolean targetNad = false; |
46 | 47 |
|
47 | 48 |
int crs_target = -1; |
48 |
String datum_target = "";
|
|
49 |
CrsWkt crsWkt_target = null;
|
|
49 | 50 |
|
50 |
private EpsgConnection connection = null; |
|
51 |
//private EpsgConnection connection = null;
|
|
51 | 52 |
|
52 | 53 |
int transformation_code = 0; |
53 | 54 |
|
... | ... | |
73 | 74 |
String dataSource = ""; |
74 | 75 |
ICrs curProj = null; |
75 | 76 |
|
76 |
public CRSMainTrPanel(int target, String datum, ICrs proj) {
|
|
77 |
public CRSMainTrPanel(int target, CrsWkt crsWkttarget, ICrs proj) {
|
|
77 | 78 |
curProj = proj; |
78 | 79 |
crsMainPanel = new CRSMainPanel(target); |
79 | 80 |
viewPan = crsMainPanel; |
80 | 81 |
|
81 | 82 |
crs_target = target; |
82 |
datum_target = datum;
|
|
83 |
crsWkt_target = crsWkttarget;
|
|
83 | 84 |
|
84 | 85 |
manualTrPanel = new TransformationManualPanel(); |
85 | 86 |
epsgTrPanel = new TransformationEpsgPanel(crs_target); |
... | ... | |
285 | 286 |
crsfirst = proj; |
286 | 287 |
} |
287 | 288 |
|
288 |
private void setListeners(){
|
|
289 |
private void setListeners(){ |
|
289 | 290 |
|
290 | 291 |
CRSMainTrPanelListener listener = new CRSMainTrPanelListener(this); |
291 | 292 |
|
... | ... | |
308 | 309 |
crsMainPanel.getEsriPanel().getJTextOpen().getDocument().addDocumentListener(listener); |
309 | 310 |
} |
310 | 311 |
|
311 |
public void compareDatum(int base){ |
|
312 |
connection = new EpsgConnection(); |
|
312 |
public void compareDatum(String wktSource){ |
|
313 |
CrsWkt crsWkt_source = new CrsWkt(wktSource); |
|
314 |
|
|
315 |
if (!crsWkt_source.getSpheroid()[1].equals(crsWkt_target.getSpheroid()[1])){ |
|
316 |
jComboOptions.setEnabled(true); |
|
317 |
} |
|
318 |
else if (!crsWkt_source.getSpheroid()[2].equals(crsWkt_target.getSpheroid()[2])){ |
|
319 |
jComboOptions.setEnabled(true); |
|
320 |
} |
|
321 |
else jComboOptions.setEnabled(false); |
|
322 |
|
|
323 |
/*connection = new EpsgConnection(); |
|
313 | 324 |
connection.setConnectionEPSG(); |
314 | 325 |
String datum = ""; |
315 | 326 |
int datum_code = -1; |
... | ... | |
329 | 340 |
base = source; |
330 | 341 |
} |
331 | 342 |
|
332 |
/* |
|
343 |
|
|
333 | 344 |
* Recuperamos el Datum del CRS que esta seleccionado de manera provisional |
334 | 345 |
* y realizamos la comparacion para saber si, en caso de elegir el crs que |
335 | 346 |
* tenemos seleccionado, se puede producir una transformacion |
336 |
*/ |
|
347 |
|
|
337 | 348 |
sentence = "SELECT datum_code " + |
338 | 349 |
"FROM epsg_coordinatereferencesystem " + |
339 | 350 |
"WHERE coord_ref_sys_code = "+ base ; |
... | ... | |
358 | 369 |
e1.printStackTrace(); |
359 | 370 |
} |
360 | 371 |
|
361 |
if (!(datum_target.equals(datum.replaceAll(" ","")))){
|
|
372 |
if (!(crsWkt_target.equals(datum.replaceAll(" ","")))){
|
|
362 | 373 |
jComboOptions.setEnabled(true); |
363 | 374 |
} |
364 | 375 |
else { |
365 | 376 |
jComboOptions.setEnabled(false); |
366 |
} |
|
377 |
}*/
|
|
367 | 378 |
} |
368 | 379 |
|
369 | 380 |
|
... | ... | |
466 | 477 |
this.newSelection = newSelection; |
467 | 478 |
} |
468 | 479 |
|
469 |
public EpsgConnection getConnection() { |
|
480 |
/*public EpsgConnection getConnection() {
|
|
470 | 481 |
return connection; |
471 | 482 |
} |
472 | 483 |
|
473 | 484 |
public void setConnection(EpsgConnection connect) { |
474 | 485 |
this.connection = connect; |
475 |
} |
|
486 |
}*/
|
|
476 | 487 |
} |
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/panels/TransformationEpsgPanel.java | ||
---|---|---|
70 | 70 |
public TableSorter sorter = null; |
71 | 71 |
|
72 | 72 |
public TransformationEpsgPanel(int target) { |
73 |
crs_target = target; |
|
74 |
connect = new EpsgConnection(); |
|
75 |
connect.setConnectionEPSG(); |
|
73 |
crs_target = target; |
|
76 | 74 |
} |
77 | 75 |
|
78 | 76 |
public JPanel getJPanel(){ |
... | ... | |
411 | 409 |
} |
412 | 410 |
|
413 | 411 |
public void setSource(int code){ |
412 |
connect = new EpsgConnection(); |
|
413 |
connect.setConnectionEPSG(); |
|
414 | 414 |
inverseTranformation = false; |
415 | 415 |
crs_source_code = code; |
416 | 416 |
callTransformation(crs_source_code); |
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/CRSSelectionTrDialog.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import javax.swing.JPanel; |
4 | 4 |
|
5 |
import org.gvsig.crs.CrsWkt; |
|
5 | 6 |
import org.gvsig.crs.ICrs; |
6 | 7 |
|
7 | 8 |
import com.iver.andami.PluginServices; |
... | ... | |
33 | 34 |
IWindow activeWindow = PluginServices.getMDIManager().getActiveWindow(); |
34 | 35 |
View activeView = (com.iver.cit.gvsig.gui.View) activeWindow; |
35 | 36 |
int target = ((ICrs) activeView.getMapControl().getProjection()).getCode(); |
36 |
String datum = ((ICrs) activeView.getMapControl().getProjection()).getCrsWkt().getDatumName(); |
|
37 |
if (datum.equals("")){ |
|
38 |
datum = "EuropeanDatum1950"; |
|
37 |
CrsWkt crsWktTarget = ((ICrs) activeView.getMapControl().getProjection()).getCrsWkt(); |
|
38 |
if (crsWktTarget.getDatumName().equals("")){ |
|
39 | 39 |
} |
40 |
contentPane = new CRSMainTrPanel(target, datum, curProj);
|
|
40 |
contentPane = new CRSMainTrPanel(target, crsWktTarget, curProj);
|
|
41 | 41 |
|
42 | 42 |
} |
43 | 43 |
return contentPane; |
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/listeners/CRSMainTrPanelListener.java | ||
---|---|---|
155 | 155 |
panel.getCrsMainPanel().getRecentsPanel().selectedRowTable = lsm.getMinSelectionIndex(); |
156 | 156 |
panel.getCrsMainPanel().getRecentsPanel().setCodeCRS(Integer.parseInt((String)panel.getCrsMainPanel().getRecentsPanel().sorter.getValueAt(panel.getCrsMainPanel().getRecentsPanel().selectedRowTable,1))); |
157 | 157 |
panel.getCrsMainPanel().getRecentsPanel().setWKT((String)panel.getCrsMainPanel().getRecentsPanel().sorter.getValueAt(panel.getCrsMainPanel().getRecentsPanel().selectedRowTable,0)); |
158 |
int base = panel.getCrsMainPanel().getRecentsPanel().getCodeCRS(); |
|
158 |
//int base = panel.getCrsMainPanel().getRecentsPanel().getCodeCRS();
|
|
159 | 159 |
String sour = (String)panel.getCrsMainPanel().getRecentsPanel().sorter.getValueAt(panel.getCrsMainPanel().getRecentsPanel().selectedRowTable,0); |
160 | 160 |
IWindow activeWindow = PluginServices.getMDIManager().getActiveWindow(); |
161 | 161 |
View activeView = (com.iver.cit.gvsig.gui.View) activeWindow; |
162 | 162 |
String authority = ((ICrs) activeView.getMapControl().getProjection()).getCrsWkt().getAuthority()[0]; |
163 | 163 |
if (sour.equals("EPSG") && authority.equals("EPSG")){ |
164 |
panel.compareDatum(base);
|
|
164 |
panel.compareDatum(panel.getCrsMainPanel().getRecentsPanel().getWKT());
|
|
165 | 165 |
} |
166 | 166 |
else { |
167 | 167 |
panel.getJComboOptions().setEnabled(false); |
... | ... | |
171 | 171 |
} |
172 | 172 |
|
173 | 173 |
if (e.getSource() == panel.getCrsMainPanel().getEpsgPanel().getJTable().getSelectionModel()){ |
174 |
panel.setConnection(new EpsgConnection()); |
|
175 |
panel.getConnection().setConnectionEPSG(); |
|
174 |
/*panel.setConnection(new EpsgConnection());
|
|
175 |
panel.getConnection().setConnectionEPSG();*/
|
|
176 | 176 |
String[] not_soported = {"engineering", "vertical", "compound", "geocentric"}; |
177 | 177 |
boolean soported = true; |
178 | 178 |
ListSelectionModel lsm = (ListSelectionModel)e.getSource(); |
... | ... | |
196 | 196 |
panel.getCrsMainPanel().getEpsgPanel().setWKT(); |
197 | 197 |
panel.getJButtonAccept().setEnabled(true); |
198 | 198 |
int base = panel.getCrsMainPanel().getEpsgPanel().getCodeCRS(); |
199 |
panel.compareDatum(base);
|
|
199 |
panel.compareDatum(panel.getCrsMainPanel().getEpsgPanel().getWKT());
|
|
200 | 200 |
} |
201 | 201 |
else { |
202 | 202 |
JOptionPane.showMessageDialog(panel, "CRS no soportado.", "Warning...", |
Also available in: Unified diff