Mercurial > dive4elements > river
changeset 5138:fc0cdcae8f07
New facet types and renaming for infoldings.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Thu, 28 Feb 2013 13:09:26 +0100 |
parents | 04eb62eae722 |
children | 76db0e48dbc0 |
files | flys-artifacts/doc/conf/artifacts/winfo.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation4.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DischargeLongitudinalSection.java flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionGenerator.java |
diffstat | 5 files changed, 56 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/doc/conf/artifacts/winfo.xml Thu Feb 28 12:58:25 2013 +0100 +++ b/flys-artifacts/doc/conf/artifacts/winfo.xml Thu Feb 28 13:09:26 2013 +0100 @@ -402,6 +402,8 @@ <facets> <facet name="discharge_longitudinal_section.w"/> <facet name="discharge_longitudinal_section.q"/> + <facet name="discharge_longitudinal_section.q.infolding"/> + <facet name="discharge_longitudinal_section.q.cutting"/> <facet name="discharge_longitudinal_section.c"/> <facet name="discharge_longitudinal_section.manualpoints" description="Manuelle Punkte"/> <facet name="other.wqkms.w"/>
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation4.java Thu Feb 28 12:58:25 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation4.java Thu Feb 28 13:09:26 2013 +0100 @@ -323,9 +323,7 @@ int numProblemsBefore = numProblems(); double [] qs = qf.findQs(kms, this); - // TODO: i18n - String name = "Umh\u00fcllende " + columns[i].getName(); - + String name = columns[i].getName(); ConstantWQKms infolding = new ConstantWQKms(kms, qs, ws, name); if (numProblems() > numProblemsBefore) { @@ -335,6 +333,19 @@ infoldings.add(infolding); } + for (int i = 0; i < infoldings.size(); i++) { + String name = infoldings.get(i).getName(); + // TODO: i18n + if (i == 0) { + infoldings.get(i).setName("untere Umh\u00fcllende " + name); + } + else if (i == infoldings.size() - 1) { + infoldings.get(i).setName("obere Umh\u00fcllende " + name); + } + else { + infoldings.get(i).setName("geschnitten " + name); + } + } return infoldings.toArray(new ConstantWQKms[infoldings.size()]); }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java Thu Feb 28 12:58:25 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java Thu Feb 28 13:09:26 2013 +0100 @@ -175,6 +175,8 @@ String DISCHARGE_LONGITUDINAL_W = "discharge_longitudinal_section.w"; String DISCHARGE_LONGITUDINAL_Q = "discharge_longitudinal_section.q"; + String DISCHARGE_LONGITUDINAL_Q_INFOLD = "discharge_longitudinal_section.q.infolding"; + String DISCHARGE_LONGITUDINAL_Q_INFOLD_CUT = "discharge_longitudinal_section.q.cutting"; String DISCHARGE_LONGITUDINAL_C = "discharge_longitudinal_section.c"; String LONGITUDINAL_W = "longitudinal_section.w";
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DischargeLongitudinalSection.java Thu Feb 28 12:58:25 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DischargeLongitudinalSection.java Thu Feb 28 13:09:26 2013 +0100 @@ -1,7 +1,9 @@ package de.intevation.flys.artifacts.states; import de.intevation.artifactdatabase.state.Facet; +import de.intevation.artifactdatabase.state.FacetActivity; +import de.intevation.artifacts.Artifact; import de.intevation.artifacts.CallContext; import de.intevation.flys.artifacts.ChartArtifact; @@ -32,6 +34,26 @@ private static Logger log = Logger.getLogger(DischargeLongitudinalSection.class); + static { + // Active/deactivate facets. + FacetActivity.Registry.getInstance().register( + "winfo", + new FacetActivity() { + @Override + public Boolean isInitialActive( + Artifact artifact, + Facet facet, + String output + ) { + String name = facet.getName(); + if (name.equals(DISCHARGE_LONGITUDINAL_Q_INFOLD_CUT)) { + return Boolean.FALSE; + } + return Boolean.TRUE; + } + }); + } + @Override public Object computeAdvance( FLYSArtifact artifact, @@ -80,14 +102,24 @@ Facet s = new CrossSectionWaterLineFacet(i, nameW); + Facet q = new WaterlevelFacet( + i, DISCHARGE_LONGITUDINAL_Q, nameQ); facets.add(s); facets.add(w); + facets.add(q); } - - Facet q = new WaterlevelFacet( - i, DISCHARGE_LONGITUDINAL_Q, nameQ); - - facets.add(q); + else { + Facet q; + if (nameQ.contains("geschnitten")) { + q = new WaterlevelFacet( + i, DISCHARGE_LONGITUDINAL_Q_INFOLD_CUT, nameQ); + } + else { + q = new WaterlevelFacet( + i, DISCHARGE_LONGITUDINAL_Q_INFOLD, nameQ); + } + facets.add(q); + } if (wqkms[i] instanceof WQCKms) { // TODO DO i18n
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionGenerator.java Thu Feb 28 12:58:25 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionGenerator.java Thu Feb 28 13:09:26 2013 +0100 @@ -54,7 +54,7 @@ Facet facet = artifactFacet.getFacet(); - if (name.equals(DISCHARGE_LONGITUDINAL_Q)) { + if (name.contains(DISCHARGE_LONGITUDINAL_Q)) { doQOut( (WQKms) artifactFacet.getData(context), artifactFacet,