Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/GaugeDischargeState.java @ 3785:a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
file:///home/clients/bsh/bsh-generischer-viewer/Material/SVN/flys-artifacts/trunk
........
r5501 | felix | 2012-09-18 11:49:45 +0200 (Di, 18 Sep 2012) | 1 line
fix issue865 - missing showarea theme prop.
........
r5502 | clins | 2012-09-18 12:18:30 +0200 (Di, 18 Sep 2012) | 1 line
Add robustness checks to prevent NPEs
........
r5504 | felix | 2012-09-18 14:03:15 +0200 (Di, 18 Sep 2012) | 1 line
i18n for area label (fix issue487).
........
r5505 | clins | 2012-09-18 16:19:59 +0200 (Di, 18 Sep 2012) | 1 line
Update themes to show point descriptions
........
r5506 | rrenkert | 2012-09-18 17:00:30 +0200 (Di, 18 Sep 2012) | 3 lines
Removed incorrect characteristic diameter.
........
r5507 | rrenkert | 2012-09-18 17:03:20 +0200 (Di, 18 Sep 2012) | 3 lines
Fixed some stupid bugs in bed quality data factory and calculation.
........
r5508 | teichmann | 2012-09-18 17:45:49 +0200 (Di, 18 Sep 2012) | 1 line
The usual whitespace and import cleanups.
........
r5511 | teichmann | 2012-09-18 18:24:51 +0200 (Di, 18 Sep 2012) | 1 line
Use generics aware Collections.emptyList().
........
r5512 | teichmann | 2012-09-18 20:36:52 +0200 (Di, 18 Sep 2012) | 1 line
Some more little steps towards "Auslagerung extremer Wasserspiegellagen".
........
r5513 | clins | 2012-09-18 23:38:19 +0200 (Di, 18 Sep 2012) | 1 line
A and B facets of fix analyis are now deactivated by default
........
r5516 | bricks | 2012-09-19 10:45:51 +0200 (Mi, 19 Sep 2012) | 2 lines
Add the gauge station to the GaugeOverviewInfoService xml response
........
r5517 | rrenkert | 2012-09-19 10:50:23 +0200 (Mi, 19 Sep 2012) | 3 lines
Added CSV export to bed quality calculation.
........
r5518 | bricks | 2012-09-19 11:04:04 +0200 (Mi, 19 Sep 2012) | 2 lines
Fix date in changelog entry
........
r5519 | teichmann | 2012-09-19 11:17:14 +0200 (Mi, 19 Sep 2012) | 1 line
Removed trailing whitespace.
........
flys-artifacts/tags/2.9.1@5531 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 19 Sep 2012 14:58:31 +0000 |
parents | 94d78e0dc5e9 |
children |
line wrap: on
line source
package de.intevation.flys.artifacts.states; import java.util.List; import org.apache.log4j.Logger; import de.intevation.artifacts.CallMeta; import de.intevation.artifacts.CallContext; import de.intevation.artifactdatabase.state.Facet; import de.intevation.flys.artifacts.ChartArtifact; import de.intevation.flys.artifacts.GaugeDischargeArtifact; import de.intevation.flys.artifacts.FLYSArtifact; import de.intevation.flys.artifacts.model.GaugeDischargeFacet; import de.intevation.flys.artifacts.model.FacetTypes; import de.intevation.flys.artifacts.model.WQKms; import de.intevation.flys.artifacts.model.ReportFacet; import de.intevation.flys.artifacts.model.EmptyFacet; import de.intevation.flys.artifacts.model.CalculationResult; import de.intevation.flys.artifacts.resources.Resources; import de.intevation.flys.model.Gauge; /** * The only state for an GaugeDischargeState (River and km known). */ public class GaugeDischargeState extends DefaultState implements FacetTypes { /** Developer-centric description of facet. */ public static final String I18N_DESCRIPTION = "facet.discharge.curve"; /** The logger that is used in this state. */ private static final Logger logger = Logger.getLogger(GaugeDischargeState.class); /** * Create i18ned name for gaugedischargeFacet. * @param artifact The artifact which has information about the gauge. * @param meta used for i18n. * @return localized name for gaugedischargefacet. */ protected String createFacetName(GaugeDischargeArtifact artifact, CallMeta meta) { Gauge gauge = artifact.getGauge(); Object[] args = new Object[] { gauge.getName(), gauge.getStation() }; String name = Resources.getMsg( meta, "chart.computed.discharge.curve.gauge", "", args); return name; } /** * Add an GaugeDischargeFacet to list of Facets. * * @param artifact Ignored. * @param hash Ignored. * @param context Ignored. * @param meta CallMeta to be used for internationalization. * @param facets List to add AnnotationFacet to. * * @return null. */ @Override public Object computeInit( FLYSArtifact artifact, String hash, Object context, CallMeta meta, List<Facet> facets ) { logger.debug("GaugeDischargeState.computeInit()"); GaugeDischargeFacet facet = new GaugeDischargeFacet( 0, DISCHARGE_CURVE, createFacetName((GaugeDischargeArtifact) artifact, meta)); facets.add(facet); return null; } /** * 'Calculate' Discharge at Gauge. */ @Override public Object computeAdvance( FLYSArtifact artifact, String hash, CallContext context, List<Facet> facets, Object old ) { if (artifact instanceof GaugeDischargeArtifact) { logger.debug("GaugeDischargeState.computeAdvance()"); GaugeDischargeArtifact dischargeArtifact = (GaugeDischargeArtifact) artifact; CalculationResult res; if (old instanceof CalculationResult) { res = (CalculationResult) old; } else { res = dischargeArtifact.getDischargeCurveData(); } WQKms[] wqkms = (WQKms[]) res.getData(); if (wqkms != null && facets != null) { logger.debug("GaugeDischargeState.computeAdvance(): create facets"); GaugeDischargeFacet facet = new GaugeDischargeFacet( 0, DISCHARGE_CURVE, createFacetName(dischargeArtifact, context.getMeta())); facets.add(facet); //facets.add(new DataFacet(CSV, "CSV data")); //facets.add(new DataFacet(PDF, "PDF data")); if (res.getReport().hasProblems()) { facets.add(new ReportFacet()); } } else { if (wqkms == null) logger.debug("GaugeDischargeState.computeAdvance(): wqkms 0"); else logger.debug("GaugeDischargeState.computeAdvance(): facets 0"); } return res; } else if (artifact instanceof ChartArtifact) { ChartArtifact chart = (ChartArtifact)artifact; facets.add(new EmptyFacet()); return null; } return null; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :