Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/BedHeightsArtifact.java @ 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 | f37c7e183b5e |
children | 8d5ca5175038 |
comparison
equal
deleted
inserted
replaced
7476:05c534215025 | 7477:bc16d5031b31 |
---|---|
23 import org.dive4elements.artifacts.common.utils.XMLUtils; | 23 import org.dive4elements.artifacts.common.utils.XMLUtils; |
24 import org.dive4elements.river.artifacts.model.FacetTypes; | 24 import org.dive4elements.river.artifacts.model.FacetTypes; |
25 import org.dive4elements.river.artifacts.model.minfo.BedHeightFacet; | 25 import org.dive4elements.river.artifacts.model.minfo.BedHeightFacet; |
26 import org.dive4elements.river.artifacts.model.minfo.BedHeightFactory; | 26 import org.dive4elements.river.artifacts.model.minfo.BedHeightFactory; |
27 import org.dive4elements.river.artifacts.states.StaticState; | 27 import org.dive4elements.river.artifacts.states.StaticState; |
28 | |
29 import org.dive4elements.river.artifacts.resources.Resources; | |
28 | 30 |
29 public class BedHeightsArtifact | 31 public class BedHeightsArtifact |
30 extends AbstractStaticStateArtifact | 32 extends AbstractStaticStateArtifact |
31 implements FacetTypes | 33 implements FacetTypes |
32 { | 34 { |
84 | 86 |
85 if (code != null) { | 87 if (code != null) { |
86 String [] parts = code.split("-"); | 88 String [] parts = code.split("-"); |
87 | 89 |
88 if (parts.length >= 4) { | 90 if (parts.length >= 4) { |
91 // The setting is a bit complicated: | |
92 // This artifact can spawn epoch type bedheight facets, | |
93 // 'singlevalue'/singleyear bedheight facets or | |
94 // sounding-width facets. The type is indicated by | |
95 // the ids-param which comes from datacage. | |
96 | |
89 String name = parts[0]; | 97 String name = parts[0]; |
90 String type = parts[1]; | 98 String type = parts[1]; |
99 String facetType = BEDHEIGHT; | |
100 if (type.equals("soundings")) { | |
101 type = "singlevalues"; | |
102 facetType = BEDHEIGHT_SOUNDING_WIDTH; | |
103 } | |
104 // e.g. 'single' | |
91 String btype = type; | 105 String btype = type; |
92 int hId = Integer.parseInt(parts[2]); | 106 int hId = Integer.parseInt(parts[2]); |
93 if (name.equals("bedheight")) { | 107 if (name.equals("bedheight")) { |
94 addStringData("type", type); | 108 addStringData("type", type); |
95 addStringData("height_id", parts[2]); | 109 addStringData("height_id", parts[2]); |
99 btype = "single"; | 113 btype = "single"; |
100 } | 114 } |
101 | 115 |
102 String bedHName = BedHeightFactory.getHeightName(btype, hId); | 116 String bedHName = BedHeightFactory.getHeightName(btype, hId); |
103 | 117 |
118 if (facetType.equals(BEDHEIGHT_SOUNDING_WIDTH)) { | |
119 bedHName = Resources.getMsg( | |
120 callMeta, | |
121 "facet.bedheight.sounding_width", | |
122 "facet.bedheight.sounding_widt", | |
123 new Object[] { bedHName }); | |
124 } | |
125 | |
104 Facet facet = new BedHeightFacet( | 126 Facet facet = new BedHeightFacet( |
105 BEDHEIGHT, bedHName, type); | 127 facetType, bedHName, type); |
106 | 128 |
107 ArrayList<Facet> facets = new ArrayList<Facet>(1); | 129 ArrayList<Facet> facets = new ArrayList<Facet>(1); |
108 facets.add(facet); | 130 facets.add(facet); |
109 | 131 |
110 addFacets(STATIC_STATE_NAME, facets); | 132 addFacets(STATIC_STATE_NAME, facets); |