# HG changeset patch # User Felix Wolfsteller # Date 1320842916 0 # Node ID 8e5b4ea2851c648c05e36222198ab7fbee9bf359 # Parent 6deed62a2468bbca36a00e0a14dc1c060ae7a3ad Minor cosmetics and let facets be inactive in duration curve diagrams. flys-artifacts/trunk@3191 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 6deed62a2468 -r 8e5b4ea2851c flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Wed Nov 09 12:38:02 2011 +0000 +++ b/flys-artifacts/ChangeLog Wed Nov 09 12:48:36 2011 +0000 @@ -1,3 +1,10 @@ +2011-11-09 Felix Wolfsteller + + * src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java + (): Minor cosmetics, added stability. + (getInitialFacetActivity): Let facets be inactive in duration curve + diagrams. + 2011-11-09 Felix Wolfsteller * doc/conf/artifacts/winfo.xml: Allow other.wqkms facets in many diff -r 6deed62a2468 -r 8e5b4ea2851c flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java Wed Nov 09 12:38:02 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java Wed Nov 09 12:48:36 2011 +0000 @@ -122,13 +122,13 @@ state = new StaticState(STATIC_STATE_NAME); List fs = (List) facets.get(STATIC_STATE_NAME); - DefaultOutput mainValuesOutput2 = new DefaultOutput( + DefaultOutput mainValuesOutput = new DefaultOutput( "computed_discharge_curve", "output.computed_discharge_curve", "image/png", fs, "chart"); - state.getOutputs().add(mainValuesOutput2); + state.getOutputs().add(mainValuesOutput); return state; } @@ -137,9 +137,16 @@ protected void initialize(Artifact artifact, Object context, CallMeta meta) { logger.debug("MainValuesArtifact.initialize"); WINFOArtifact winfo = (WINFOArtifact) artifact; - double location = FLYSUtils.getLocations(winfo)[0]; - addData("location", new DefaultStateData("location", null, null, + double [] locations = FLYSUtils.getLocations(winfo); + if (locations != null) { + double location = locations[0]; + addData("location", new DefaultStateData("location", null, null, String.valueOf(location))); + } + else { + logger.warn("No location for mainvalues given."); + } + // TODO use importData addData("river", winfo.getData("river")); } @@ -200,12 +207,14 @@ protected Gauge getGauge() { River river = FLYSUtils.getRiver(this); - if (river == null) { + // TODO use helper to get location as double + String locationStr = getDataAsString("location"); + + if (river == null || locationStr == null) { return null; } - double location = Double.parseDouble( - getDataAsString("location")); + double location = Double.parseDouble(locationStr); return river.determineGaugeByPosition(location); } @@ -216,8 +225,7 @@ * @return the location. */ public double getLocation() { - double location = Double.parseDouble( - (String)getData("location").getValue()); + double location = Double.parseDouble(getDataAsString("location")); return location; } @@ -261,6 +269,7 @@ Gauge gauge = getGauge(); WstValueTable interpolator = WstValueTableFactory.getTable(FLYSUtils.getRiver(this)); Calculation c = new Calculation(); + double gaugeStation = gauge.getStation().doubleValue(); double w_out[] = {0.0f}; double q_out[] = {0.0f}; @@ -304,7 +313,8 @@ + "/" + facetName); - if (outputName.equals("computed_discharge_curve")) { + if (outputName.equals("computed_discharge_curve") + || outputName.equals("duration_curve")) { return 0; } else {