Mercurial > dive4elements > river
changeset 3460:d625f4d06b6a
Create proper facets for Ws and Qs in FixRealizingCompute state.
flys-artifacts/trunk@5128 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 25 Jul 2012 12:58:52 +0000 |
parents | 7485338aedff |
children | 1481322efc02 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java |
diffstat | 2 files changed, 61 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Wed Jul 25 12:10:55 2012 +0000 +++ b/flys-artifacts/ChangeLog Wed Jul 25 12:58:52 2012 +0000 @@ -1,3 +1,8 @@ +2012-07-25 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java: + Create proper facets for Ws and Qs. + 2012-07-25 Felix Wolfsteller <felix.wolfsteller@intevation.de> * src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java Wed Jul 25 12:10:55 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java Wed Jul 25 12:58:52 2012 +0000 @@ -1,28 +1,24 @@ package de.intevation.flys.artifacts.states.fixation; -import de.intevation.artifactdatabase.state.Facet; - -import de.intevation.artifacts.CallContext; - -import de.intevation.flys.artifacts.FLYSArtifact; - -import de.intevation.flys.artifacts.access.FixRealizingAccess; - -import de.intevation.flys.artifacts.model.CalculationResult; -import de.intevation.flys.artifacts.model.FacetTypes; -import de.intevation.flys.artifacts.model.ReportFacet; -import de.intevation.flys.artifacts.model.WQKms; -import de.intevation.flys.artifacts.model.WaterlevelFacet; - -import de.intevation.flys.artifacts.model.fixings.FixRealizingCalculation; -import de.intevation.flys.artifacts.model.fixings.FixRealizingResult; - -import de.intevation.flys.artifacts.states.DefaultState; - import java.util.List; import org.apache.log4j.Logger; +import de.intevation.artifactdatabase.state.Facet; +import de.intevation.artifacts.CallContext; +import de.intevation.flys.artifacts.FLYSArtifact; +import de.intevation.flys.artifacts.access.FixRealizingAccess; +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.ReportFacet; +import de.intevation.flys.artifacts.model.WQCKms; +import de.intevation.flys.artifacts.model.WQKms; +import de.intevation.flys.artifacts.model.WaterlevelFacet; +import de.intevation.flys.artifacts.model.fixings.FixRealizingCalculation; +import de.intevation.flys.artifacts.model.fixings.FixRealizingResult; +import de.intevation.flys.artifacts.states.DefaultState; + /** * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> @@ -65,29 +61,50 @@ return res; } - if (res.getReport().hasProblems()) { - facets.add(new ReportFacet(ComputeType.ADVANCE, hash, id)); + FixRealizingResult fixRes = (FixRealizingResult) res.getData(); + WQKms [] wqkms = fixRes != null ? fixRes.getWQKms() : new WQKms[0]; + + for (int i = 0; i < wqkms.length; i++) { + String nameW = null; + String nameQ = null; + + if (access.isQ()) { + nameQ = wqkms[i].getName(); + nameW = "W(" + nameQ + ")"; + } + else { + nameW = wqkms[i].getName(); + nameQ = "Q(" + nameW + ")"; + } + + Facet w = new WaterlevelFacet( + i, LONGITUDINAL_W, nameW); + + Facet q = new WaterlevelFacet( + i, LONGITUDINAL_Q, nameQ); + + facets.add(w); + facets.add(q); + + if (wqkms[i] instanceof WQCKms) { + String nameC = nameW.replace( + "benutzerdefiniert", + "benutzerdefiniert [korrigiert]"); + + Facet c = new WaterlevelFacet( + i, DISCHARGE_LONGITUDINAL_C, nameC); + + facets.add(c); + } } - // TODO: Add more facets. - FixRealizingResult fr = (FixRealizingResult) res.getData(); - - /* - facets.add( - new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id)); - */ + if (wqkms.length > 0) { + facets.add(new DataFacet(CSV, "CSV data")); + facets.add(new DataFacet(WST, "WST data")); + } - // WaterlevelFacet - // Also: DataFacet and WQstuff - // TODO naming, i18n. - String nameW = "waterlevel"; - String nameQ = "discharge"; - WQKms[] wqkms = fr.getWQKms(); - for (int i = 0; i < wqkms.length; i++) { - facets.add(new WaterlevelFacet( - i, LONGITUDINAL_W, nameW, ComputeType.ADVANCE, id, hash)); - facets.add(new WaterlevelFacet( - i, LONGITUDINAL_Q, nameQ, ComputeType.ADVANCE, id, hash)); + if (res.getReport().hasProblems()) { + facets.add(new ReportFacet()); } return res;