comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/HistoricalDischargeComputeState.java @ 4144:d7db9baa4e62

#930 Added unit [cm] of discharge tables to the facet description of historical discharge curves if calculation mode is W.
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 16 Oct 2012 09:55:15 +0200
parents d20215a0afd8
children b3aa91e45010
comparison
equal deleted inserted replaced
4139:947d79b9c675 4144:d7db9baa4e62
34 implements FacetTypes 34 implements FacetTypes
35 { 35 {
36 36
37 private static final Logger logger = 37 private static final Logger logger =
38 Logger.getLogger(HistoricalDischargeComputeState.class); 38 Logger.getLogger(HistoricalDischargeComputeState.class);
39
40 public static final String DEFAULT_UNIT = "cm";
39 41
40 42
41 @Override 43 @Override
42 protected void appendItems( 44 protected void appendItems(
43 Artifact artifact, 45 Artifact artifact,
101 // TODO CREATE BETTER TITLE FOR FACETS 103 // TODO CREATE BETTER TITLE FOR FACETS
102 104
103 facets.add(new HistoricalDischargeFacet( 105 facets.add(new HistoricalDischargeFacet(
104 i, 106 i,
105 HISTORICAL_DISCHARGE_Q, 107 HISTORICAL_DISCHARGE_Q,
106 wqt.getName())); 108 createFacetTitle(wqt)));
107 109
108 if (wqt instanceof HistoricalWQTimerange) { 110 if (wqt instanceof HistoricalWQTimerange) {
109 logger.debug("Create another facet for historical differences."); 111 logger.debug("Create another facet for historical differences.");
110 112
111 facets.add(new HistoricalDischargeDifferenceFacet( 113 facets.add(new HistoricalDischargeDifferenceFacet(
115 } 117 }
116 118
117 i++; 119 i++;
118 } 120 }
119 } 121 }
122
123
124 protected String createFacetTitle(WQTimerange wqt) {
125 String name = wqt.getName();
126
127 return name != null && name.indexOf("W") >= 0
128 ? createFacetTitleW(wqt)
129 : createFacetTitleQ(wqt);
130 }
131
132
133 protected String createFacetTitleW(WQTimerange wqt) {
134 String name = wqt.getName();
135 return name + " " + DEFAULT_UNIT;
136 }
137
138
139 protected String createFacetTitleQ(WQTimerange wqt) {
140 return wqt.getName();
141 }
120 } 142 }
121 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : 143 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org