Revision 6906

View differences:

trunk/libraries/libJCRS/src/org/gvsig/crs/ui/CrsView.java
31 31
	ProjChooserPanel pcp;
32 32
	
33 33
	private JButton cancel = null;
34
	private JButton next = null;
34
	public static JButton next = null;
35
	public static JButton accept = null;
35 36
	private JPanel jPanelButton = null;
36 37
	
37 38
	int crs_target = -1;
......
39 40
	int transformation_code = 0;
40 41
	private CRSSelectionPanel contentPane = null;
41 42
	private JPanel buttonPane = null;
42
	private JCheckBox withOutTrans = null;
43
	private JCheckBox nadgrids = null;
44
	private JCheckBox epsgTrans = null;
45
	private JCheckBox manualTrans = null;
43
	public static JCheckBox withOutTrans = null;
44
	public static JCheckBox nadgrids = null;
45
	public static JCheckBox epsgTrans = null;
46
	public static JCheckBox manualTrans = null;
46 47

  
47 48
	public CrsView(int target) {
48 49
		super();
......
57 58
	}
58 59
	 
59 60
	private void getJPanel() {
60
		this.add(getCheckButtonPane(), null);
61
		this.add(getCheckButtonPane(), null);		
61 62
		this.add(getButtons(), null);
63
		if (!CRSSelectionPanel.si){
64
			withOutTrans.setEnabled(false);
65
			nadgrids.setEnabled(false);
66
			epsgTrans.setEnabled(false);
67
			manualTrans.setEnabled(false);
68
			next.setVisible(false);
69
			accept.setVisible(true);
70
		}		
62 71
	}
63 72
	
64 73
	public CRSSelectionPanel getContentPanel() {
65 74
	    if (contentPane == null) {
66
        	contentPane = new CRSSelectionPanel();
75
        	contentPane = new CRSSelectionPanel(true);
67 76
        	contentPane.setLayout(new GridLayout(3,3));
68 77
        	contentPane.setLayout(new FlowLayout(FlowLayout.LEFT,10,10));
69 78
	    	contentPane.setPreferredSize(new Dimension(650,370));
......
188 197
			jPanelButton.setLayout(new FlowLayout(FlowLayout.RIGHT,5,5));
189 198
			jPanelButton.add(getCancel(), null);
190 199
			jPanelButton.add(getNext(), null);
191
			
200
			jPanelButton.add(getAccept(), null);
192 201
		}
193 202
		return jPanelButton;
194 203
	}
195 204
	
205
	private JButton getAccept() {
206
		if(accept == null) {
207
			accept = new JButton();
208
			accept.setText("Ok");
209
			accept.setMnemonic('O');
210
			accept.setPreferredSize(new Dimension(100,25));
211
			accept.addActionListener(new java.awt.event.ActionListener() { 
212
				public void actionPerformed(java.awt.event.ActionEvent e) {    
213
					accept_actionPerformed(e);					
214
				}
215
			});
216
		}
217
		return accept;
218
	}
219
	
220
	private void accept_actionPerformed(ActionEvent e) {
221
		PluginServices.getMDIManager().closeView(this);
222
	}
223
	
224
	
196 225
	private JButton getNext() {
197 226
		if(next == null) {
198 227
			next = new JButton();
trunk/libraries/libJCRS/src/org/gvsig/crs/ui/TransformationEpsgPanel.java
51 51
	private JButton cancel;
52 52
	
53 53
	ProjChooserPanelTransformation pcpt;	
54
	int transformation_code = 0;
55 54
	int crs_target = -1;
56 55
	
57 56
	public DefaultTableModel dtm = null;
trunk/libraries/libJCRS/src/org/gvsig/crs/ui/CRSSelectionDialogPanel.java
29 29

  
30 30
	public JPanel getContentPanel() {
31 31
	    if (contentPane == null) {
32
        	contentPane = new CRSSelectionPanel();
32
        	contentPane = new CRSSelectionPanel(false);
33 33
        	contentPane.setLayout(new GridLayout(3,3));
34 34
        	contentPane.setLayout(new FlowLayout(FlowLayout.LEFT,10,10));
35 35
	    	contentPane.setPreferredSize(new Dimension(650,400));
trunk/libraries/libJCRS/src/org/gvsig/crs/ui/CRSSelectionPanel.java
34 34
import org.gvsig.crs.ogr.GetCRSepsg;
35 35

  
36 36
import com.iver.andami.PluginServices;
37
import com.iver.andami.ui.mdiManager.View;
38
import com.iver.andami.ui.mdiManager.ViewInfo;
37
import com.iver.cit.gvsig.gui.View;
39 38
import com.iver.cit.gvsig.gui.panels.ProjChooserPanel;
40 39

  
41 40
public class CRSSelectionPanel extends JPanel {
......
78 77
	
79 78
	private int codeCRS = -1;	
80 79
	
81
	public CRSSelectionPanel() {		
82
		super();	
80
	/*
81
	 * distinguira entre si es el panel para seleccion solo de CRS o para el de CRS y
82
	 * transformacion
83
	 */
84
	boolean transfPanel = false;
85
	public static boolean si = false;
86
	
87
	public CRSSelectionPanel(boolean trans) {		
88
		super();
89
		transfPanel = trans;
83 90
		pcp = new ProjChooserPanel();
84 91
		initialize();
85 92
	}
......
432 439
			        } 
433 440
			        else {
434 441
			            selectedRowTable = lsm.getMinSelectionIndex();
435

  
436 442
			            setCodeCRS(Integer.parseInt((String)dtm.getValueAt(selectedRowTable,0)));
437 443
			            setWKT();
444
			            
445
			            if (transfPanel){
446
			            	compareCRS();
447
			            }
438 448
			        }
439 449
			        infoCrs.setEnabled(true);
440 450
			    }
451

  
452
				private void compareCRS() {
453
					int base = getCodeCRS();
454
					String datum = "";
455
					int datum_code = -1;
456
					String sentence = "SELECT source_geogcrs_code " +
457
									"FROM epsg_coordinatereferencesystem " +
458
									"WHERE coord_ref_sys_code = "+ base ;
459
					ResultSet result = Query.select(sentence,pcp.connect.getConnection());
460
					int source = 0;
461
					try {
462
						result.next();
463
						source = result.getInt("source_geogcrs_code");
464
					} catch (SQLException e1) {
465
						e1.printStackTrace();
466
					}				
467
				    
468
				    if (source != 0){
469
				    		base = source;		            	
470
				    }
471
				    
472
				    sentence = "SELECT datum_code " +
473
						"FROM epsg_coordinatereferencesystem " +
474
						"WHERE coord_ref_sys_code = "+ base ;
475
				    result = Query.select(sentence,pcp.connect.getConnection());
476
				    
477
				    try {
478
						result.next();
479
						datum_code = result.getInt("datum_code");
480
					} catch (SQLException e1) {
481
						e1.printStackTrace();
482
					}	
483
					
484
					sentence = "SELECT datum_name " +
485
					"FROM epsg_datum " +
486
					"WHERE datum_code = "+ datum_code ;
487
				    result = Query.select(sentence,pcp.connect.getConnection());
488
				    
489
				    try {
490
						result.next();
491
						datum = result.getString("datum_name");
492
					} catch (SQLException e1) {
493
						e1.printStackTrace();
494
					}	
495
					    
496
					if (!((ICrs) View.m_MapControl.getProjection()).getCrsWkt().getDatumName().equals(datum.replaceAll(" ",""))){
497
						si = true;
498
						CrsView.withOutTrans.setEnabled(true);
499
						CrsView.nadgrids.setEnabled(true);
500
						CrsView.epsgTrans.setEnabled(true);
501
						CrsView.manualTrans.setEnabled(true);
502
						CrsView.next.setVisible(true);
503
						CrsView.accept.setVisible(false);
504
						/*
505
						 * logica necesaria para comprobar si los crs bases son iguales
506
						 * y en ese caso deshabilitar opcion transformacion de
507
						 * TransformationEpsgPanel
508
						 */
509
					}
510
					else {
511
						si = false;
512
						CrsView.withOutTrans.setEnabled(false);
513
						CrsView.nadgrids.setEnabled(false);
514
						CrsView.epsgTrans.setEnabled(false);
515
						CrsView.manualTrans.setEnabled(false);
516
						CrsView.next.setVisible(false);
517
						CrsView.accept.setVisible(true);
518
					}
519
				}
441 520
		});
442 521
	}
443 522
		return jTable;

Also available in: Unified diff