Mercurial > dive4elements > river
changeset 3099:ef0dd585b5e0
Display measurements in SQ relation charts.
flys-artifacts/trunk@4698 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 19 Jun 2012 10:26:26 +0000 |
parents | 1d79c85bd8c2 |
children | c0abfb695332 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/SQMeasurementFacet.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SQRelation.java flys-artifacts/src/main/java/de/intevation/flys/exports/sq/SQRelationGenerator.java |
diffstat | 4 files changed, 53 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Tue Jun 19 09:57:41 2012 +0000 +++ b/flys-artifacts/ChangeLog Tue Jun 19 10:26:26 2012 +0000 @@ -1,3 +1,17 @@ +2012-06-19 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/flys/artifacts/model/sq/SQMeasurementFacet.java: + Implemented getData(). It returns the SQ[] of + SQResult.getMeasurements(). + + * src/main/java/de/intevation/flys/artifacts/states/SQRelation.java: Create + proper facet for sq measurements and corrected constructor call of + SQOutlierFacet. + + * src/main/java/de/intevation/flys/exports/sq/SQRelationGenerator.java: + Generalized doSQMeasurementsOut() and doSQOutliersOut() to one single + method doSQOut() which is able to handle SQ[] data. + 2012-06-19 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/utils/ThemeUtil.java: Changed the
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/SQMeasurementFacet.java Tue Jun 19 09:57:41 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/SQMeasurementFacet.java Tue Jun 19 10:26:26 2012 +0000 @@ -5,10 +5,11 @@ import de.intevation.artifacts.Artifact; import de.intevation.artifacts.CallContext; - +import de.intevation.flys.artifacts.FLYSArtifact; +import de.intevation.flys.artifacts.model.CalculationResult; +import de.intevation.flys.artifacts.model.DataFacet; import de.intevation.flys.artifacts.model.FacetTypes; -import de.intevation.flys.artifacts.model.DataFacet; - +import de.intevation.flys.artifacts.model.sq.SQResult; import de.intevation.flys.artifacts.states.DefaultState.ComputeType; @@ -26,15 +27,31 @@ } - public SQMeasurementFacet(int idx, String name, String description) { - super(idx, name, description, ComputeType.ADVANCE, null, null); + public SQMeasurementFacet( + int idx, + String name, + String description, + String hash, + String stateId + ) { + super(idx, name, description, ComputeType.ADVANCE, hash, stateId); } @Override public Object getData(Artifact artifact, CallContext context) { log.debug("SQMeasurementFacet.getData"); - log.error("NOT IMPLEMENTED!"); + + if (artifact instanceof FLYSArtifact) { + FLYSArtifact flys = (FLYSArtifact) artifact; + + CalculationResult res = (CalculationResult) flys.compute( + context, ComputeType.ADVANCE, false); + + SQResult[] result = (SQResult[]) res.getData(); + + return result[index].getMeasurements(); + } return null; }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SQRelation.java Tue Jun 19 09:57:41 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SQRelation.java Tue Jun 19 10:26:26 2012 +0000 @@ -78,8 +78,17 @@ SQResult[] sqr, String hash ) { + String stateId = getID(); + // TODO Create facets for each parameter type (A-F) - container.add(new SQMeasurementFacet(0, SQ_A_MEASUREMENT, "TODO")); + container.add(new SQMeasurementFacet( + 0, + SQ_A_MEASUREMENT, + "Measurement TODO", + hash, + stateId + )); + container.add(new SQCurveFacet(0, SQ_A_CURVE, "TODO")); for (int i = 0, C = sqr[0].getOutliersCount(); i < C; i++) { @@ -88,8 +97,8 @@ i, SQ_A_OUTLIER, "OUTLIER AT" + i, - getID(), - hash + hash, + stateId )); } }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/sq/SQRelationGenerator.java Tue Jun 19 09:57:41 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/sq/SQRelationGenerator.java Tue Jun 19 10:26:26 2012 +0000 @@ -104,10 +104,10 @@ doSQCurveOut(artifactAndFacet, attr, visible); } else if (IS.SQ_MEASUREMENT(name)) { - doSQMeasurementsOut(artifactAndFacet, attr, visible); + doSQOut(artifactAndFacet, attr, visible); } else if (IS.SQ_OUTLIER(name)) { - doSQOutliersOut(artifactAndFacet, attr, visible); + doSQOut(artifactAndFacet, attr, visible); } } @@ -122,22 +122,12 @@ } - protected void doSQMeasurementsOut( + protected void doSQOut( ArtifactAndFacet artifactAndFacet, Document attr, boolean visible ) { - logger.debug("doSQMeasurementsOut"); - logger.error("NOT IMPLEMENTED: doSQMeasurementsOut"); - } - - - protected void doSQOutliersOut( - ArtifactAndFacet artifactAndFacet, - Document attr, - boolean visible - ) { - logger.debug("doSQOutliersOut"); + logger.debug("doSQOut: " + artifactAndFacet.getFacetDescription()); Facet f = artifactAndFacet.getFacet(); SQ[] sqs = (SQ[]) artifactAndFacet.getData(context);