Revision 8158

View differences:

trunk/libraries/libJCRS/src/org/gvsig/crs/gui/CRSMainTrPanel.java
449 449
	        	jComboOptions.setEnabled(false);       	
450 450
	        } 
451 451
	        else {        	
452
	        	CRSPanel.iau.selectedRowTable = lsm.getMinSelectionIndex();
453
	        	String cadWKT = (String)CRSPanel.iau.sorter.getValueAt(CRSPanel.iau.selectedRowTable,1);
452
	        	CRSPanel.iau.selectedRowTable = lsm.getMinSelectionIndex();	        	
454 453
	        	CRSPanel.iau.setCodeCRS(Integer.parseInt((String)CRSPanel.iau.sorter.getValueAt(CRSPanel.iau.selectedRowTable,0)));
455
	        	cadWKT = cadWKT.substring(0, cadWKT.length()-1) + ", AUTHORITY[\"IAU2000\","+ CRSPanel.iau.getCodeCRS()+"]]";
456
        		CRSPanel.iau.setWKT(cadWKT);  
454
        		CRSPanel.iau.setWKT();  
457 455
        		jComboOptions.setEnabled(false);
458 456
        		getJButtonAccept().setEnabled(true);	            	
459 457
	        }
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/panels/IAU2000panel.java
109 109
			
110 110
			ResultSet result = null;			
111 111
			
112
			/*
113
			iau_code
114
			iau_wkt
115
			iau_proj
116
			iau_geog
117
			iau_datum
118
			 */
119
			
112 120
			key = searchTextField.getText();
113 121
			int code = Integer.parseInt(key);
114
			String sentence = "SELECT iau_code, iau_name " +							 
122
			String sentence = "SELECT iau_code, iau_wkt, iau_proj, iau_geog, iau_datum " +							 
115 123
							  "FROM IAU2000 " +	                              
116 124
                              "WHERE iau_code = " + code;
117 125
			
......
124 132
				e.printStackTrace();
125 133
			}
126 134
			
127
			Object[] data = new Object[2];
135
			Object[] data = new Object[4];
128 136
			try {
129 137
				while (result.next()){
130 138
					data[0]	= result.getString("iau_code");
131
					data[1] = result.getString("iau_name");
139
					data[1] = result.getString("iau_wkt");
140
					String proj = result.getString("iau_proj");
141
					if (!proj.equals("")){
142
						data[1] = proj;
143
						data[2] = PluginServices.getText(this,"S?");
144
					} 
145
					else 
146
					{
147
						data[1] = result.getString("iau_geog");
148
						data[2] = PluginServices.getText(this,"No");
149
					}
150
					
151
					data[3] = result.getString("iau_datum");
132 152
					dtm.addRow(data);
133 153
				}
134 154
			} catch (SQLException e1) {
......
169 189
	
170 190
	public JTable getJTable() {
171 191
		if (jTable == null) {
172
			String[] columnNames= {"Code of CRS","Cadena WKT"};
192
			String[] columnNames= {"Code of CRS","Name", "Projected", "Datum"};
173 193
			Object[][]data = {};			
174 194
			dtm = new DefaultTableModel(data, columnNames)
175 195
			 {
......
196 216
			jTable.setColumnSelectionAllowed(false);
197 217
			jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
198 218
			TableColumn column = null;
199
			for (int i = 0; i < 2; i++) {
219
			for (int i = 0; i < 4; i++) {
200 220
			    column = jTable.getColumnModel().getColumn(i);
201 221
			    if (i == 0) {
202 222
			        column.setPreferredWidth(80); //code column is shorter			     	
203
			    }else {
204
			    	column.setPreferredWidth(400);
223
			    }else if (i ==2) {
224
			    	column.setPreferredWidth(50);
225
			    } else {
226
			    	column.setPreferredWidth(175);
205 227
			    }
206 228
			    
207 229
			}			
......
244 266
		return null;
245 267
	}
246 268
	
247
	public void setWKT(String wk){
248
		cadWKT = wk;
269
	public void setWKT(){
270
		int code = getCodeCRS();
271
		String sentence = "SELECT iau_code, iau_wkt, iau_proj, iau_geog, iau_datum " +							 
272
						  "FROM IAU2000 " +	                              
273
                          "WHERE iau_code = " + code;
274
		
275
		connect.setConnectionIAU2000();	
276
		ResultSet result = Query.select(sentence,connect.getConnection());	
277
		try {
278
			connect.shutdown();
279
		} catch (SQLException e) {
280
			// TODO Auto-generated catch block
281
			e.printStackTrace();
282
		}
283
		try {
284
			result.next();			
285
			cadWKT = result.getString("iau_wkt");			
286
		} catch (SQLException e1) {
287
			e1.printStackTrace();
288
		}
289
		
290
		cadWKT = cadWKT.substring(0, cadWKT.length()-1) + ", AUTHORITY[\"IAU2000\","+ getCodeCRS()+"]]";
249 291
	}
250 292
	
251 293
	public String getWKT(){
......
257 299
	}
258 300
	
259 301
	public void loadViewCRS(int code){
260
		connection();
261
		String sentence = "SELECT iau_code, iau_name " +							 
262
		  "FROM IAU2000 " +	                              
263
        "WHERE iau_code = " + code;
264

  
302
		connection();		
303
		String sentence = "SELECT iau_code, iau_wkt, iau_proj, iau_geog, iau_datum " +							 
304
						  "FROM IAU2000 " +	                              
305
                          "WHERE iau_code = " + code;
306
				
265 307
		connect.setConnectionIAU2000();	
266 308
		ResultSet result = Query.select(sentence,connect.getConnection());	
267 309
		try {
......
271 313
			e.printStackTrace();
272 314
		}
273 315
		
274
		Object[] data = new Object[2];
316
		Object[] data = new Object[4];
275 317
		try {
276 318
			while (result.next()){
277 319
				data[0]	= result.getString("iau_code");
278
				data[1] = result.getString("iau_name");
320
				data[1] = result.getString("iau_wkt");
321
				String proj = result.getString("iau_proj");
322
				if (!proj.equals("")){
323
					data[1] = proj;
324
					data[2] = PluginServices.getText(this,"S?");
325
				} 
326
				else 
327
				{
328
					data[1] = result.getString("iau_geog");
329
					data[2] = PluginServices.getText(this,"No");
330
				}
331
				
332
				data[3] = result.getString("iau_datum");
279 333
				dtm.addRow(data);
280 334
			}
281 335
		} catch (SQLException e1) {
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/CRSSelectionTrDialog.java
29 29
    }
30 30

  
31 31
	public JPanel getContentPanel() {
32
	    if (contentPane == null) {
32
	    if (contentPane == null) {	    	
33 33
	    	IWindow activeWindow = PluginServices.getMDIManager().getActiveWindow();
34 34
	    	View activeView = (com.iver.cit.gvsig.gui.View) activeWindow;
35 35
	    	int target = ((ICrs) activeView.getMapControl().getProjection()).getCode();
......
40 40
        	contentPane = new CRSMainTrPanel(target, datum, curProj);        	
41 41
	    	      	
42 42
       }
43
      return contentPane;
43
	   return contentPane;
44 44
    }
45 45
	
46 46
}
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/CRSSelectionDialog.java
185 185
	        } 
186 186
	        else {        	
187 187
	        	vp.iau.selectedRowTable = lsm.getMinSelectionIndex();
188
	        	String cadWKT = (String)vp.iau.sorter.getValueAt(vp.iau.selectedRowTable,1);
189
        	
188
	        	
190 189
        		vp.iau.setCodeCRS(Integer.parseInt((String)vp.iau.sorter.getValueAt(vp.iau.selectedRowTable,0)));
191
        		cadWKT = cadWKT.substring(0, cadWKT.length()-1) + ", AUTHORITY[\"IAU2000\","+ vp.iau.getCodeCRS()+"]]";
192
            	vp.iau.setWKT(cadWKT);
190
        		
191
            	vp.iau.setWKT();
193 192
            	setCode(vp.iau.getCodeCRS());
194 193
            	vp.getJButtonAccept().setEnabled(true);	
195 194
	        }

Also available in: Unified diff