[Schmitzm-commits] r552 - branches/1.0-gt2-2.6/src/schmitzm/geotools/feature

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Nov 23 16:48:19 CET 2009


Author: alfonx
Date: 2009-11-23 16:48:16 +0100 (Mon, 23 Nov 2009)
New Revision: 552

Modified:
   branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureUtil.java
Log:
* Some cleanup and out-commented debug messages

Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureUtil.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureUtil.java	2009-11-23 15:47:04 UTC (rev 551)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureUtil.java	2009-11-23 15:48:16 UTC (rev 552)
@@ -519,24 +519,32 @@
 	public static SimpleFeature[] featuresToArray(
 			FeatureCollection<SimpleFeatureType, SimpleFeature> fc,
 			boolean includeNullFeatures) {
-		// if ( includeNullFeatures )
-		// return featuresToArray(fc);
-		if (fc == null)
+		if (fc == null || fc.isEmpty())
 			return new SimpleFeature[0];
 
+//		long startTime = System.currentTimeMillis();
+
 		// Naiv alle Features durchgehen.
-		Vector<SimpleFeature> fv = new Vector<SimpleFeature>();
-		FeatureIterator<SimpleFeature> fi = fc.features();
+		final Vector<SimpleFeature> fv = new Vector<SimpleFeature>();
+		final FeatureIterator<SimpleFeature> fi = fc.features();
 		try {
 
-			for (int i = 0; fi.hasNext(); i++) {
-				SimpleFeature f = fi.next();
+//			for (int i = 0; fi.hasNext(); i++) {
+//				SimpleFeature f = fi.next();
+//					fv.add(f);
+//			}
+			
+			while( fi.hasNext() ) {
+				final SimpleFeature f = fi.next();
 				if (includeNullFeatures || f != null)
 					fv.add(f);
 			}
 		} finally {
 			fc.close(fi);
 		}
+		
+//	    LOGGER.info("took "+ (System.currentTimeMillis()-startTime) +"to put features into vector");
+	    
 		return fv.toArray(new SimpleFeature[0]);
 	}
 



More information about the Schmitzm-commits mailing list