Mercurial > dive4elements > river
changeset 7477:bc16d5031b31
issue1657: Spawn BEDHEIGHT_SOUNDING_WIDTH facet if asked to. Twiggly.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 31 Oct 2013 11:43:32 +0100 |
parents | 05c534215025 |
children | 2803a70177c2 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/BedHeightsArtifact.java artifacts/src/main/java/org/dive4elements/river/exports/process/BedHeightSoundingProcessor.java |
diffstat | 2 files changed, 24 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/BedHeightsArtifact.java Thu Oct 31 11:41:39 2013 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/BedHeightsArtifact.java Thu Oct 31 11:43:32 2013 +0100 @@ -26,6 +26,8 @@ import org.dive4elements.river.artifacts.model.minfo.BedHeightFactory; import org.dive4elements.river.artifacts.states.StaticState; +import org.dive4elements.river.artifacts.resources.Resources; + public class BedHeightsArtifact extends AbstractStaticStateArtifact implements FacetTypes @@ -86,8 +88,20 @@ String [] parts = code.split("-"); if (parts.length >= 4) { + // The setting is a bit complicated: + // This artifact can spawn epoch type bedheight facets, + // 'singlevalue'/singleyear bedheight facets or + // sounding-width facets. The type is indicated by + // the ids-param which comes from datacage. + String name = parts[0]; String type = parts[1]; + String facetType = BEDHEIGHT; + if (type.equals("soundings")) { + type = "singlevalues"; + facetType = BEDHEIGHT_SOUNDING_WIDTH; + } + // e.g. 'single' String btype = type; int hId = Integer.parseInt(parts[2]); if (name.equals("bedheight")) { @@ -101,8 +115,16 @@ String bedHName = BedHeightFactory.getHeightName(btype, hId); + if (facetType.equals(BEDHEIGHT_SOUNDING_WIDTH)) { + bedHName = Resources.getMsg( + callMeta, + "facet.bedheight.sounding_width", + "facet.bedheight.sounding_widt", + new Object[] { bedHName }); + } + Facet facet = new BedHeightFacet( - BEDHEIGHT, bedHName, type); + facetType, bedHName, type); ArrayList<Facet> facets = new ArrayList<Facet>(1); facets.add(facet);
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedHeightSoundingProcessor.java Thu Oct 31 11:41:39 2013 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedHeightSoundingProcessor.java Thu Oct 31 11:43:32 2013 +0100 @@ -89,7 +89,7 @@ @Override public boolean canHandle(String facettype) { - return FacetTypes.BEDHEIGHT.equals(facettype); + return FacetTypes.BEDHEIGHT_SOUNDING_WIDTH.equals(facettype); } @Override