EPSGpanel.patch

Antonio Falciano, 05/12/2015 08:50 PM

Download (7.6 KB)

View differences:

org.gvsig.projection.app.jcrs/org.gvsig.projection.app.jcrs.common/src/main/java/org/gvsig/crs/gui/panels/EPSGpanel.java (copia locale)
111 111
	public int epsg_code  = 0;
112 112
	public int selectedRowTable = -1;
113 113
	private int codeCRS = -1;
114
	int[] valid_method_code = { 1024, 9800, 9801, 9802, 9803, 9804, 9805, 9806, 9807, 9808, 9809, 9810, 
115
			9811, 9812, 9813, 9814, 9815, 9816, 9817, 9602, 9659, 9818, 9819, 9820, 9822, 
116
			9827};
114
	int[] valid_method_code = {1024, 9800, 9801, 9802, 9803, 9804, 9805, 9806, 9807, 9808, 9809, 9810, 
115
			9811, 9812, 9813, 9814, 9815, 9816, 9817, 9602, 9659, 9818, 9819, 9820, 9822, 9827};
117 116
	
118
	
119 117
	boolean tecla_valida = false;
120 118
	boolean source_yn = false;
121 119
	
122

  
123 120
	private JRadioButton codeRadioButton = null;
124 121
	private JRadioButton nameRadioButton = null;
125 122
	private JRadioButton areaRadioButton = null;
......
278 275
			 */
279 276
			int bus = 2;  			
280 277
			if (codeRadioButton.isSelected() && !not_numeric) {
281
				bus=0;
278
				bus = 0;
282 279
				key = searchTextField.getText();
283 280
				int code = Integer.parseInt(key);
284 281
				String sentence = "SELECT coord_ref_sys_code, coord_ref_sys_name, coord_ref_sys_kind, area_of_use_code, " +
285
								  "source_geogcrs_code, projection_conv_code  " +
282
								  "source_geogcrs_code, projection_conv_code, deprecated  " +
286 283
								  "FROM epsg_coordinatereferencesystem " +	                              
287
	                              "WHERE coord_ref_sys_code = " + code;
284
	                              "WHERE coord_ref_sys_code = " + code + " AND deprecated = 0";
288 285
								
289 286
				result = Query.select(sentence,connect.getConnection());	
290 287
				
291 288
			}
292 289
			
293 290
			else if (nameRadioButton.isSelected()) {
294
				bus=0;
291
				bus = 0;
295 292
				key = searchTextField.getText();
296
				key = key.toLowerCase();
297
				String key2 = key.substring(0,1);
298
				String key3 = key.substring(1,key.length());
299
				key2 = key2.toUpperCase();
300
				
293
				key = key.toLowerCase();				
301 294
				String sentence = "SELECT coord_ref_sys_code, coord_ref_sys_name, coord_ref_sys_kind, " +
302
									"area_of_use_code, source_geogcrs_code, projection_conv_code " +
303
				  					"FROM epsg_coordinatereferencesystem " +	                              
304
				  					"WHERE (coord_ref_sys_name LIKE '%" + key + "%') OR (coord_ref_sys_name LIKE '%"+ 
305
				  					key.toUpperCase() +"%') " +
306
				  					"OR (coord_ref_sys_name LIKE '%" + key2+key3 +"%')";
295
									"area_of_use_code, source_geogcrs_code, projection_conv_code, deprecated " +
296
				  					"FROM epsg_coordinatereferencesystem " +
297
				  					"WHERE (LCASE(coord_ref_sys_name) LIKE '%" + key + "%') " +
298
				  					"AND deprecated = 0 " +
299
				  					"AND coord_ref_sys_kind IN ('geographic 2D', 'projected') " +
300
				  					"ORDER BY coord_ref_sys_name";
307 301
				result = Query.select(sentence,connect.getConnection());
308 302
			}
309 303
			
310 304
			else if (areaRadioButton.isSelected()) {
311
				bus=1;
305
				bus = 0;
312 306
				key = searchTextField.getText();
313 307
				key = key.toLowerCase();				
314
				String key2 = key.substring(0,1);
315
				String key3 = key.substring(1,key.length());
316
				key2 = key2.toUpperCase();				
317
				
318
				String sentence = "SELECT area_name, area_of_use, area_code " +
319
	                              "FROM epsg_area " +
320
	                              "WHERE (area_name LIKE '%" + key + "%') OR (area_of_use LIKE '%" + key + "%') "+
321
	                              "OR (area_name LIKE '%" + key.toUpperCase() + "%') OR (area_of_use LIKE '%" + key.toUpperCase() + "%') "+
322
	                              "OR (area_name LIKE '%" + key2+key3 + "%') OR (area_of_use LIKE '%" + key2+key3 + "%') ";
308
				String sentence = "SELECT epsg_coordinatereferencesystem.coord_ref_sys_code, epsg_coordinatereferencesystem.coord_ref_sys_name, " +
309
								"epsg_coordinatereferencesystem.coord_ref_sys_kind, epsg_coordinatereferencesystem.area_of_use_code, " +
310
								"epsg_coordinatereferencesystem.source_geogcrs_code, epsg_coordinatereferencesystem.projection_conv_code, " +
311
								"epsg_coordinatereferencesystem.deprecated FROM epsg_coordinatereferencesystem " +
312
								"INNER JOIN epsg_area ON (epsg_coordinatereferencesystem.area_of_use_code = epsg_area.area_code) " +
313
								"WHERE ((LCASE(epsg_area.area_name) LIKE '%" + key + "%') OR (LCASE(epsg_area.area_of_use) LIKE '%" + key + "%')) " +
314
								"AND (epsg_coordinatereferencesystem.deprecated = 0) " +
315
			  					"AND (epsg_coordinatereferencesystem.coord_ref_sys_kind IN ('geographic 2D', 'projected')) " +
316
			  					"ORDER BY epsg_coordinatereferencesystem.coord_ref_sys_name";
323 317
				result = Query.select(sentence,connect.getConnection());				
324 318
			}
325 319
			
326
			if (bus==0){
320
			if (bus == 0){
327 321
				try {
328 322
					while(result.next()) {
329 323
						Object[]data = new Object[5];
......
337 331
						int area_of_use_code = Integer.parseInt(result.getString("area_of_use_code"));
338 332
										
339 333
						String sentence = "SELECT area_name, area_of_use FROM epsg_area " +
340
										"WHERE area_code = "+ area_of_use_code ;
334
										"WHERE area_code = " + area_of_use_code ;
341 335
						
342 336
						result2 = Query.select(sentence,connect.getConnection());
343 337
						while(result2.next()){
......
354 348
					logger.error("Can't get values from RecordSet.",e1);
355 349
				}
356 350
			}
357
			else if (bus==1){
351
			else if (bus == 1){
358 352
				try {
359 353
					while(result.next()) {
360 354
						Object[]data = new Object[5];
......
363 357
											
364 358
						int area_of_use_code = Integer.parseInt(result.getString("area_code"));
365 359
										
366
						String sentence = "SELECT coord_ref_sys_code, coord_ref_sys_name, " +
367
										"coord_ref_sys_kind, source_geogcrs_code, projection_conv_code " +
360
						String sentence = "SELECT coord_ref_sys_code, coord_ref_sys_name, coord_ref_sys_kind, " +
361
										"source_geogcrs_code, projection_conv_code, deprecated " +
368 362
										"FROM epsg_coordinatereferencesystem " +
369
										"WHERE area_of_use_code = "+ area_of_use_code ;
363
										"WHERE area_of_use_code = " + area_of_use_code + " AND deprecated = 0 " +
364
										"AND coord_ref_sys_kind IN ('geographic 2D', 'projected') " +
365
										"ORDER BY coord_ref_sys_name";
370 366
						
371 367
						result2 = Query.select(sentence,connect.getConnection());
372 368
						while(result2.next()){
......
384 380
						 */						
385 381
						if (data[0]!=null /*&& validCRS(projection_conv_code)*/ && valid(crs_kind)){
386 382
							dtm.addRow(data);
387
						}	
383
						}
388 384
						if (notValid(crs_kind)){
389 385
							not_valid = true;
390 386
						}
......
546 542
			    else if (i == 2) {
547 543
			    	column.setPreferredWidth(80);
548 544
			    }	
549
			    else if (i==4){
545
			    else if (i == 4){
550 546
			    	column.setPreferredWidth(300);
551 547
			    }
552 548
			    else {
......
695 691
	public void loadViewCRS(int code){
696 692
		connection();
697 693
		String sentence = "SELECT coord_ref_sys_code, coord_ref_sys_name, coord_ref_sys_kind, area_of_use_code, " +
698
						  "source_geogcrs_code, projection_conv_code  " +
694
						  "source_geogcrs_code, projection_conv_code, deprecated  " +
699 695
						  "FROM epsg_coordinatereferencesystem " +	                              
700
				        "WHERE coord_ref_sys_code = " + code;
696
						  "WHERE coord_ref_sys_code = " + code + " AND deprecated = 0";
701 697
		ResultSet result = Query.select(sentence,connect.getConnection());
702 698
		
703 699
		try {