Index: org.gvsig.projection.app.jcrs/org.gvsig.projection.app.jcrs.common/src/main/java/org/gvsig/crs/gui/panels/EPSGpanel.java =================================================================== --- org.gvsig.projection.app.jcrs/org.gvsig.projection.app.jcrs.common/src/main/java/org/gvsig/crs/gui/panels/EPSGpanel.java (revisione 342) +++ org.gvsig.projection.app.jcrs/org.gvsig.projection.app.jcrs.common/src/main/java/org/gvsig/crs/gui/panels/EPSGpanel.java (copia locale) @@ -111,15 +111,12 @@ public int epsg_code = 0; public int selectedRowTable = -1; private int codeCRS = -1; - int[] valid_method_code = { 1024, 9800, 9801, 9802, 9803, 9804, 9805, 9806, 9807, 9808, 9809, 9810, - 9811, 9812, 9813, 9814, 9815, 9816, 9817, 9602, 9659, 9818, 9819, 9820, 9822, - 9827}; + int[] valid_method_code = {1024, 9800, 9801, 9802, 9803, 9804, 9805, 9806, 9807, 9808, 9809, 9810, + 9811, 9812, 9813, 9814, 9815, 9816, 9817, 9602, 9659, 9818, 9819, 9820, 9822, 9827}; - boolean tecla_valida = false; boolean source_yn = false; - private JRadioButton codeRadioButton = null; private JRadioButton nameRadioButton = null; private JRadioButton areaRadioButton = null; @@ -278,13 +275,13 @@ */ int bus = 2; if (codeRadioButton.isSelected() && !not_numeric) { - bus=0; + bus = 0; key = searchTextField.getText(); int code = Integer.parseInt(key); String sentence = "SELECT coord_ref_sys_code, coord_ref_sys_name, coord_ref_sys_kind, area_of_use_code, " + - "source_geogcrs_code, projection_conv_code " + + "source_geogcrs_code, projection_conv_code, deprecated " + "FROM epsg_coordinatereferencesystem " + - "WHERE coord_ref_sys_code = " + code; + "WHERE coord_ref_sys_code = " + code + " AND deprecated = 0"; result = Query.select(sentence,connect.getConnection()); @@ -291,39 +288,36 @@ } else if (nameRadioButton.isSelected()) { - bus=0; + bus = 0; key = searchTextField.getText(); - key = key.toLowerCase(); - String key2 = key.substring(0,1); - String key3 = key.substring(1,key.length()); - key2 = key2.toUpperCase(); - + key = key.toLowerCase(); String sentence = "SELECT coord_ref_sys_code, coord_ref_sys_name, coord_ref_sys_kind, " + - "area_of_use_code, source_geogcrs_code, projection_conv_code " + - "FROM epsg_coordinatereferencesystem " + - "WHERE (coord_ref_sys_name LIKE '%" + key + "%') OR (coord_ref_sys_name LIKE '%"+ - key.toUpperCase() +"%') " + - "OR (coord_ref_sys_name LIKE '%" + key2+key3 +"%')"; + "area_of_use_code, source_geogcrs_code, projection_conv_code, deprecated " + + "FROM epsg_coordinatereferencesystem " + + "WHERE (LCASE(coord_ref_sys_name) LIKE '%" + key + "%') " + + "AND deprecated = 0 " + + "AND coord_ref_sys_kind IN ('geographic 2D', 'projected') " + + "ORDER BY coord_ref_sys_name"; result = Query.select(sentence,connect.getConnection()); } else if (areaRadioButton.isSelected()) { - bus=1; + bus = 0; key = searchTextField.getText(); key = key.toLowerCase(); - String key2 = key.substring(0,1); - String key3 = key.substring(1,key.length()); - key2 = key2.toUpperCase(); - - String sentence = "SELECT area_name, area_of_use, area_code " + - "FROM epsg_area " + - "WHERE (area_name LIKE '%" + key + "%') OR (area_of_use LIKE '%" + key + "%') "+ - "OR (area_name LIKE '%" + key.toUpperCase() + "%') OR (area_of_use LIKE '%" + key.toUpperCase() + "%') "+ - "OR (area_name LIKE '%" + key2+key3 + "%') OR (area_of_use LIKE '%" + key2+key3 + "%') "; + String sentence = "SELECT epsg_coordinatereferencesystem.coord_ref_sys_code, epsg_coordinatereferencesystem.coord_ref_sys_name, " + + "epsg_coordinatereferencesystem.coord_ref_sys_kind, epsg_coordinatereferencesystem.area_of_use_code, " + + "epsg_coordinatereferencesystem.source_geogcrs_code, epsg_coordinatereferencesystem.projection_conv_code, " + + "epsg_coordinatereferencesystem.deprecated FROM epsg_coordinatereferencesystem " + + "INNER JOIN epsg_area ON (epsg_coordinatereferencesystem.area_of_use_code = epsg_area.area_code) " + + "WHERE ((LCASE(epsg_area.area_name) LIKE '%" + key + "%') OR (LCASE(epsg_area.area_of_use) LIKE '%" + key + "%')) " + + "AND (epsg_coordinatereferencesystem.deprecated = 0) " + + "AND (epsg_coordinatereferencesystem.coord_ref_sys_kind IN ('geographic 2D', 'projected')) " + + "ORDER BY epsg_coordinatereferencesystem.coord_ref_sys_name"; result = Query.select(sentence,connect.getConnection()); } - if (bus==0){ + if (bus == 0){ try { while(result.next()) { Object[]data = new Object[5]; @@ -337,7 +331,7 @@ int area_of_use_code = Integer.parseInt(result.getString("area_of_use_code")); String sentence = "SELECT area_name, area_of_use FROM epsg_area " + - "WHERE area_code = "+ area_of_use_code ; + "WHERE area_code = " + area_of_use_code ; result2 = Query.select(sentence,connect.getConnection()); while(result2.next()){ @@ -354,7 +348,7 @@ logger.error("Can't get values from RecordSet.",e1); } } - else if (bus==1){ + else if (bus == 1){ try { while(result.next()) { Object[]data = new Object[5]; @@ -363,10 +357,12 @@ int area_of_use_code = Integer.parseInt(result.getString("area_code")); - String sentence = "SELECT coord_ref_sys_code, coord_ref_sys_name, " + - "coord_ref_sys_kind, source_geogcrs_code, projection_conv_code " + + String sentence = "SELECT coord_ref_sys_code, coord_ref_sys_name, coord_ref_sys_kind, " + + "source_geogcrs_code, projection_conv_code, deprecated " + "FROM epsg_coordinatereferencesystem " + - "WHERE area_of_use_code = "+ area_of_use_code ; + "WHERE area_of_use_code = " + area_of_use_code + " AND deprecated = 0 " + + "AND coord_ref_sys_kind IN ('geographic 2D', 'projected') " + + "ORDER BY coord_ref_sys_name"; result2 = Query.select(sentence,connect.getConnection()); while(result2.next()){ @@ -384,7 +380,7 @@ */ if (data[0]!=null /*&& validCRS(projection_conv_code)*/ && valid(crs_kind)){ dtm.addRow(data); - } + } if (notValid(crs_kind)){ not_valid = true; } @@ -546,7 +542,7 @@ else if (i == 2) { column.setPreferredWidth(80); } - else if (i==4){ + else if (i == 4){ column.setPreferredWidth(300); } else { @@ -695,9 +691,9 @@ public void loadViewCRS(int code){ connection(); String sentence = "SELECT coord_ref_sys_code, coord_ref_sys_name, coord_ref_sys_kind, area_of_use_code, " + - "source_geogcrs_code, projection_conv_code " + + "source_geogcrs_code, projection_conv_code, deprecated " + "FROM epsg_coordinatereferencesystem " + - "WHERE coord_ref_sys_code = " + code; + "WHERE coord_ref_sys_code = " + code + " AND deprecated = 0"; ResultSet result = Query.select(sentence,connect.getConnection()); try {