[Schmitzm-commits] r603 - branches/1.0-gt2-2.6/src/schmitzm/geotools/styling
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Dec 8 12:15:26 CET 2009
Author: alfonx
Date: 2009-12-08 12:15:26 +0100 (Tue, 08 Dec 2009)
New Revision: 603
Modified:
branches/1.0-gt2-2.6/src/schmitzm/geotools/styling/StylingUtil.java
Log:
* Better checking for valid attribute names.. even in filters now...
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/styling/StylingUtil.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/styling/StylingUtil.java 2009-12-08 11:15:00 UTC (rev 602)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/styling/StylingUtil.java 2009-12-08 11:15:26 UTC (rev 603)
@@ -66,6 +66,10 @@
import org.geotools.factory.GeoTools;
import org.geotools.feature.FeatureCollection;
import org.geotools.feature.GeometryAttributeType;
+import org.geotools.filter.AttributeExpression;
+import org.geotools.filter.AttributeExpressionImpl;
+import org.geotools.filter.AttributeExpressionImpl2;
+import org.geotools.filter.BinaryComparisonAbstract;
import org.geotools.filter.ConstantExpression;
import org.geotools.filter.FilterAttributeExtractor;
import org.geotools.geometry.jts.ReferencedEnvelope;
@@ -105,6 +109,7 @@
import org.opengis.coverage.grid.GridCoverage;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
+import org.opengis.feature.type.Name;
import org.opengis.filter.And;
import org.opengis.filter.Filter;
import org.opengis.filter.FilterFactory;
@@ -1340,7 +1345,7 @@
}
} else if ((geom instanceof MultiPolygon)
|| (geom instanceof Polygon)) {
-
+
if (symb instanceof PolygonSymbolizer) {
if (((PolygonSymbolizer) symb).getFill() != null)
passt = true;
@@ -2418,8 +2423,8 @@
// Der "scaleDenominator" der aktuellen JMapPane
Double scaleDenominator = RendererUtilities.calculateOGCScale(
new ReferencedEnvelope(xMapPane.getMapArea(), xMapPane
- .getMapContext().getCoordinateReferenceSystem()), xMapPane
- .getBounds().width, null);
+ .getMapContext().getCoordinateReferenceSystem()),
+ xMapPane.getBounds().width, null);
return filterSLDVisibleOnly(fc, style, scaleDenominator);
}
@@ -2492,13 +2497,45 @@
super.visit(sym);
}
+ @Override
+ public Expression copy(Expression expression) {
+ if (expression instanceof PropertyName) {
+ PropertyName pName = (PropertyName) expression;
+
+ Name correctedName = FeatureUtil
+ .findBestMatchingAttributeFallBackFirst(schema,
+ pName.getPropertyName());
+
+ return ff.property(correctedName);
+ }
+// if (expression instanceof AttributeExpression) {
+// AttributeExpression aExpression = (AttributeExpression) expression;
+// Name correctedName = FeatureUtil
+// .findBestMatchingAttributeFallBackFirst(schema,
+// aExpression.getPropertyName());
+//
+// return new AttributeExpressionImpl(correctedName
+// .getLocalPart());
+// }
+ return super.copy(expression);
+ }
+
+ @Override
+ protected Filter copy(Filter filter) {
+
+ if (filter instanceof BinaryComparisonAbstract) {
+ BinaryComparisonAbstract binFilter = (BinaryComparisonAbstract)filter;
+ binFilter.setExpression1(copy(binFilter.getExpression1()));
+ binFilter.setExpression2(copy(binFilter.getExpression2()));
+ }
+ return (Filter)super.copy(filter);
+ }
};
dsv.visit(style);
return (Style) dsv.getCopy();
}
-
/**
* Geopublisher allows to use one or two attributes for labelling, like
@@ -2615,7 +2652,6 @@
.get(1).getLocalName());
}
-
/**
* AtlasStyler has a fixed system that allows to use one or two label
* attributes. If two are used, the are seperated by ": ". This mehtod stes
@@ -2645,5 +2681,4 @@
}
}
-
}
More information about the Schmitzm-commits
mailing list