[Schmitzm-commits] r425 - in branches/1.0-gt2-2.6/src/schmitzm/geotools: feature gui
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Oct 2 16:16:13 CEST 2009
Author: alfonx
Date: 2009-10-02 16:16:12 +0200 (Fri, 02 Oct 2009)
New Revision: 425
Modified:
branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/CQLFilterParser.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FilterParser.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureCollectionFilterPanel.java
Log:
* Some fixes to better support the GT2.6 CQL Filters
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/CQLFilterParser.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/CQLFilterParser.java 2009-10-02 13:34:20 UTC (rev 424)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/CQLFilterParser.java 2009-10-02 14:16:12 UTC (rev 425)
@@ -30,6 +30,7 @@
package schmitzm.geotools.feature;
+import org.geotools.factory.CommonFactoryFinder;
import org.geotools.filter.text.cql2.CQL;
import org.geotools.filter.text.cql2.CQLException;
import org.opengis.filter.Filter;
@@ -67,7 +68,7 @@
@Override
public Filter parseFilter(String rule) {
if (rule == null || rule.trim().equals(""))
- rule = "TRUE";
+ return Filter.EXCLUDE;
try {
return CQL.toFilter(rule);
} catch (CQLException err) {
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FilterParser.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FilterParser.java 2009-10-02 13:34:20 UTC (rev 424)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FilterParser.java 2009-10-02 14:16:12 UTC (rev 425)
@@ -39,9 +39,9 @@
*/
public interface FilterParser {
/**
- * Creates a {@link Filter} by parsing a rule string-
+ * Creates a {@link Filter} by parsing a rule string. Should return Filter.EXCLUDE if the given ruleString is empty or null.
* @param rule rule string
*/
- public Filter parseFilter(String rule);
+ public Filter parseFilter(String ruleString);
}
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureCollectionFilterPanel.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureCollectionFilterPanel.java 2009-10-02 13:34:20 UTC (rev 424)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureCollectionFilterPanel.java 2009-10-02 14:16:12 UTC (rev 425)
@@ -52,6 +52,7 @@
import javax.swing.event.AncestorListener;
import org.apache.log4j.Logger;
+import org.geotools.data.store.EmptyFeatureCollection;
import org.geotools.feature.FeatureCollection;
import org.geotools.map.DefaultMapLayer;
import org.geotools.styling.Style;
@@ -622,8 +623,14 @@
*
* @see FeatureCollection#subCollection(Filter)
*/
- public FeatureCollection<SimpleFeatureType,SimpleFeature> filterFeatureCollection() {
- return getFeatureCollection().subCollection(createFilter());
+ public FeatureCollection<SimpleFeatureType, SimpleFeature> filterFeatureCollection() {
+ final Filter filterParsed = createFilter();
+
+ if (filterParsed == Filter.EXCLUDE) {
+ // If no Filter String has been entered, just show all Features
+ return new EmptyFeatureCollection(getFeatureType());
+ }
+ return getFeatureCollection().subCollection(filterParsed);
}
/**
More information about the Schmitzm-commits
mailing list