Revision: 5678
          http://sourceforge.net/p/jump-pilot/code/5678
Author:   edso
Date:     2018-01-22 14:14:14 +0000 (Mon, 22 Jan 2018)
Log Message:
-----------
move SRID parsing to the end to speed up GML/JML parsing
minor clarifications

Modified Paths:
--------------
    core/trunk/src/com/vividsolutions/jump/io/GMLReader.java

Modified: core/trunk/src/com/vividsolutions/jump/io/GMLReader.java
===================================================================
--- core/trunk/src/com/vividsolutions/jump/io/GMLReader.java    2018-01-22 
11:33:09 UTC (rev 5677)
+++ core/trunk/src/com/vividsolutions/jump/io/GMLReader.java    2018-01-22 
14:14:14 UTC (rev 5678)
@@ -269,7 +269,7 @@
   private static int STATE_PARSE_GEOM_SIMPLE = 4;
   private static int STATE_WAIT_COLLECTION_TAG = 1;
   private static int STATE_WAIT_FEATURE_TAG = 2;
-  private static int STATE_WAIT_CRS_TAG = 8;
+  private static int STATE_WAIT_GMLBOX_TAG = 8;
 
   private final static List<String> simpleGeoms = new ArrayList<>();
   private final static List<String> multiGeoms = new ArrayList<>();
@@ -642,38 +642,7 @@
 
         return;
       }
-      
       if ((STATE == STATE_WAIT_FEATURE_TAG)
-          && GMLinput.crsTag != null && 
compareToIgnoreCaseWithOptionalGmlColonPrefix(qName, GMLinput.crsTag) ) {
-        // found the crs1 tag
-
-        return;
-      }
-
-      if ((STATE == STATE_WAIT_FEATURE_TAG)
-          && compareToIgnoreCaseWithOptionalGmlColonPrefix(qName, "Box") ) {
-        // found the crs2 box tag
-
-        // fetch srid id
-        for (int i = 0; i < atts.getLength(); i++) {
-          String attName = atts.getQName(i);
-          if (attName.equalsIgnoreCase("srsName")){
-            String attValue = atts.getValue(i);
-            String sridString = attValue.substring(attValue.lastIndexOf("#") + 
1);
-
-            try {
-              SRID = Integer.valueOf(sridString);
-            } catch (NumberFormatException e) {
-              addParseException("srid '"+sridString+"'is not a number.", e);
-            }
-          }
-        }
-        STATE = STATE_WAIT_FEATURE_TAG;
-
-        return;
-      }
-
-      if ((STATE == STATE_WAIT_FEATURE_TAG)
           && (qName.compareToIgnoreCase(GMLinput.featureTag) == 0)) {
         // found the feature tag
         // System.out.println("found feature");
@@ -761,6 +730,35 @@
         current_geom_qname = qName;
       }
 
+      if ((STATE == STATE_WAIT_FEATURE_TAG)
+          && GMLinput.crsTag != null && 
compareToIgnoreCaseWithOptionalGmlColonPrefix(qName, GMLinput.crsTag) ) {
+        // found the crs1 tag
+        STATE = STATE_WAIT_GMLBOX_TAG;
+
+        return;
+      }
+      if ((STATE == STATE_WAIT_GMLBOX_TAG)
+          && compareToIgnoreCaseWithOptionalGmlColonPrefix(qName, "Box") ) {
+        // found the crs2 box tag
+
+        // fetch srid id
+        for (int i = 0; i < atts.getLength(); i++) {
+          String attName = atts.getQName(i);
+          if (attName.equalsIgnoreCase("srsName")){
+            String attValue = atts.getValue(i);
+            String sridString = attValue.substring(attValue.lastIndexOf("#") + 
1);
+
+            try {
+              SRID = Integer.valueOf(sridString);
+            } catch (NumberFormatException e) {
+              addParseException("srid '"+sridString+"'is not a number.", e);
+            }
+          }
+        }
+        STATE = STATE_WAIT_FEATURE_TAG;
+        return;
+      }
+
     } catch (Exception e) {
       e.printStackTrace(System.err);
       throw new SAXException(e.getMessage());
@@ -999,14 +997,14 @@
         tagBody = new StringBuffer();
 
         return; // still look for start collection tag
-      } else if (STATE == STATE_WAIT_CRS_TAG) {
-        if (compareToIgnoreCaseWithOptionalGmlColonPrefix(qName, "Box")) {
-          STATE = STATE_WAIT_COLLECTION_TAG;
-        }
-        return; // still looking for <gml:Box/>
       }
-      
-      
+      else if (STATE == STATE_WAIT_GMLBOX_TAG && 
+          compareToIgnoreCaseWithOptionalGmlColonPrefix(qName, "boundedBy")) {
+        // found </gml:boundedBy>, return to feature parsing
+        STATE = STATE_WAIT_FEATURE_TAG;
+        return;
+      }
+
     } catch (Exception e) {
       e.printStackTrace();
       throw new SAXException(e.getMessage());


------------------------------------------------------------------------------
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