[Schmitzm-commits] r747 - trunk/src/schmitzm/jfree/feature/style
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Mar 3 13:38:31 CET 2010
Author: alfonx
Date: 2010-03-03 13:38:28 +0100 (Wed, 03 Mar 2010)
New Revision: 747
Modified:
trunk/src/schmitzm/jfree/feature/style/FeatureChartUtil.java
Log:
FeatureCHartUtil.createCategoryDataset throws an exceptin if an weighted aggregation is selceted, but not attribute is selected for it.
Modified: trunk/src/schmitzm/jfree/feature/style/FeatureChartUtil.java
===================================================================
--- trunk/src/schmitzm/jfree/feature/style/FeatureChartUtil.java 2010-03-03 12:17:30 UTC (rev 746)
+++ trunk/src/schmitzm/jfree/feature/style/FeatureChartUtil.java 2010-03-03 12:38:28 UTC (rev 747)
@@ -565,13 +565,9 @@
continue;
if (chartStyle
.getAttributeAggregationWeightAttributeName(attrIdx) == null)
- continue;
+ throw new RuntimeException(
+ "A weighted AggregationFunction is selected, but not artribute for weighting is selected."); // i8n
- // Filter out NODATA values
- // Weder der eigentliche attributwert, noch das WEIGHT
- // attribut, noch das DOMAIN attribute dürfen hier
- // NODATA sein
-
// NODATA Check yValue attribute
String yAttrName = chartStyle.getAttributeName(attrIdx);
Number yValue = (Number) next.getAttribute(yAttrName);
@@ -583,7 +579,8 @@
Number weight = (Number) next
.getAttribute(chartStyle
.getAttributeAggregationWeightAttributeName(attrIdx));
- if (chartStyle.isWeightAttributeNoDataValue(attrIdx, weight))
+ if (chartStyle.isWeightAttributeNoDataValue(attrIdx,
+ weight))
continue;
// NODATA Check Domain attribute
@@ -673,15 +670,19 @@
aggrStat);
}
- if (attributeAggregation.isWeighted()
- && chartStyle
- .getAttributeAggregationWeightAttributeName(attrIdx) != null) {
+ if (attributeAggregation.isWeighted()) {
+
+ if (chartStyle
+ .getAttributeAggregationWeightAttributeName(attrIdx) == null)
+ throw new RuntimeException(
+ "A weighted AggregationFunction is selected, but not artribute for weighting is selected."); // i8n
+
Object weightObj = f
.getAttribute(chartStyle
.getAttributeAggregationWeightAttributeName(attrIdx));
- if (!chartStyle.isWeightAttributeNoDataValue(attrIdx,
- weightObj)) {
+ if (!chartStyle.isWeightAttributeNoDataValue(
+ attrIdx, weightObj)) {
Number weight = (Number) weightObj;
aggrStat.add(yValue.doubleValue()
* weight.doubleValue()
@@ -726,7 +727,6 @@
}
} finally {
if (features != null) {
- // this is a hint
fc.close(features);
}
}
@@ -752,7 +752,6 @@
// 1. Check.. all attributes in the atm should be in the schema as well.
// maybe correct some upperCase/loweCase stuff
-
for (int idx = 0; idx < featureChartStyle.getAttributeCount(); idx++) {
// Check the main attribute
@@ -806,7 +805,8 @@
/**
* Passes the NODATA Values stored in the {@link AttributeMetadataMap} to
- * the attributes (and optional weighting attributes) of the {@link ChartStyle}.
+ * the attributes (and optional weighting attributes) of the
+ * {@link ChartStyle}.
*/
public static void passNoDataValues(
AttributeMetadataMap attributeMetaDataMap,
More information about the Schmitzm-commits
mailing list