Revision: 5470
          http://sourceforge.net/p/jump-pilot/code/5470
Author:   ma15569
Date:     2017-07-14 08:18:44 +0000 (Fri, 14 Jul 2017)
Log Message:
-----------
Small enhancement on SRS detection

Modified Paths:
--------------
    core/trunk/src/org/openjump/core/ui/plugin/task/TaskPropertiesPlugIn.java
    core/trunk/src/org/openjump/core/ui/plugin/task/Utils.java

Modified: 
core/trunk/src/org/openjump/core/ui/plugin/task/TaskPropertiesPlugIn.java
===================================================================
--- core/trunk/src/org/openjump/core/ui/plugin/task/TaskPropertiesPlugIn.java   
2017-06-29 18:55:30 UTC (rev 5469)
+++ core/trunk/src/org/openjump/core/ui/plugin/task/TaskPropertiesPlugIn.java   
2017-07-14 08:18:44 UTC (rev 5470)
@@ -31,6 +31,7 @@
 import javax.swing.UIManager;
 import javax.xml.namespace.QName;
 
+
 import org.openjump.core.ccordsys.utils.SRSInfo;
 import org.openjump.core.ccordsys.utils.SridLookupTable;
 import org.saig.core.gui.swing.sldeditor.util.FormUtils;
@@ -133,7 +134,8 @@
             textFieldYMax, textFielddate, textFieldnumLyr, textFieldUnit;
 
     private MultiTabInputDialog dialog;
-    final Map<String, String> codes = new LinkedHashMap<String, String>(64);
+    String[] codes;
+   // final Map<String, String> codes = new LinkedHashMap<String, String>(64);
     public static SuggestTreeComboBox localSuggestTreeComboBox;
 
     private LayersPanel layersPanel;
@@ -179,10 +181,13 @@
         dialog.setMinimumSize(new Dimension(400, 270));
         dialog.setCancelVisible(false);
         dialog.setResizable(true);
-        this.codes.clear();
-        this.codes.putAll(Utils.mapSRIDS());
-        localSuggestTreeComboBox = new SuggestTreeComboBox(this.codes.keySet()
-                .toArray(new String[this.codes.size()]), 40);
+        //    this.codes.clear();
+        //    this.codes.putAll(Utils.mapSRIDS());
+        //     localSuggestTreeComboBox = new 
SuggestTreeComboBox(this.codes.keySet()
+        //           .toArray(new String[this.codes.size()]), 40);
+         codes = Utils.mapSRIDasString();
+         localSuggestTreeComboBox = new SuggestTreeComboBox(
+             codes, 40);
         if (selectedTask.getProperties().containsKey(
                 new QName(Task.PROJECT_SRS_KEY))) {
             this.srsCode = selectedTask.getProperty(
@@ -349,10 +354,13 @@
     private JPanel srsPanel(PlugInContext context) throws IOException {
         JPanel srsPanel = new JPanel(new GridBagLayout());
         srsPanel.setBorder(BorderFactory.createTitledBorder("SRS"));
-        this.codes.clear();
-        this.codes.putAll(Utils.mapSRIDS());
-        localSuggestTreeComboBox = new SuggestTreeComboBox(this.codes.keySet()
-                .toArray(new String[this.codes.size()]), 40);
+       //    this.codes.clear();
+       //    this.codes.putAll(Utils.mapSRIDS());
+       //     localSuggestTreeComboBox = new 
SuggestTreeComboBox(this.codes.keySet()
+       //           .toArray(new String[this.codes.size()]), 40);
+        codes = Utils.mapSRIDasString();
+        localSuggestTreeComboBox = new SuggestTreeComboBox(
+            codes, 40);
         Task selectedTask = context.getTask();
         if (selectedTask.getProperties().containsKey(
                 new QName(Task.PROJECT_SRS_KEY))) {

Modified: core/trunk/src/org/openjump/core/ui/plugin/task/Utils.java
===================================================================
--- core/trunk/src/org/openjump/core/ui/plugin/task/Utils.java  2017-06-29 
18:55:30 UTC (rev 5469)
+++ core/trunk/src/org/openjump/core/ui/plugin/task/Utils.java  2017-07-14 
08:18:44 UTC (rev 5470)
@@ -421,6 +421,37 @@
         }
     }
 
+    
+    public static String[] mapSRIDasString() throws IOException {
+      String[] arr = null;
+      List<String> codes = new ArrayList<String>();
+      InputStream localInputStream = ProjUtils.class
+              .getResourceAsStream("srid.txt");
+      try {
+
+          BufferedReader localBufferedReader = new BufferedReader(
+                  new InputStreamReader(localInputStream));
+
+          String str1;
+          while (null != (str1 = localBufferedReader.readLine())) {
+              if (str1.startsWith("<")) {
+                  String str3 = str1.substring(1, str1.indexOf(">"));
+                  codes.add(str3);
+
+              }
+          }
+          arr = codes.toArray(new String[codes.size()]);
+          return arr;
+      } finally {
+          if (localInputStream != null) {
+              try {
+                  localInputStream.close();
+              } catch (IOException localIOException2) {
+              }
+          }
+      }
+  }
+    
     public static void removeButton(Container container) {
         Component[] components = container.getComponents();
         for (Component component : components) {


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to