comparison artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadLSGenerator.java @ 6552:95aecf6cc5ad

issue1235: Fix determination of SedimentLoadLSGenerators Y-Axis (m3/a or t/a).
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 10 Jul 2013 10:33:56 +0200
parents 4f9ad0366977
children 252806ee7dd1
comparison
equal deleted inserted replaced
6551:8c226c5089e0 6552:95aecf6cc5ad
71 public static final String I18N_YAXIS_LABEL_DEFAULT_1 = "[t/a]"; 71 public static final String I18N_YAXIS_LABEL_DEFAULT_1 = "[t/a]";
72 public static final String I18N_YAXIS_LABEL_DEFAULT_2 = "[m\u00b3/a]"; 72 public static final String I18N_YAXIS_LABEL_DEFAULT_2 = "[m\u00b3/a]";
73 public static final String I18N_YAXIS_D_LABEL_DEFAULT = "delta S [m]"; 73 public static final String I18N_YAXIS_D_LABEL_DEFAULT = "delta S [m]";
74 public static final String I18N_YAXIS_V_LABEL_DEFAULT = "Geschwindigkeit v [m/s]"; 74 public static final String I18N_YAXIS_V_LABEL_DEFAULT = "Geschwindigkeit v [m/s]";
75 75
76 private String yLabel = "";
77
78 @Override 76 @Override
79 protected YAxisWalker getYAxisWalker() { 77 protected YAxisWalker getYAxisWalker() {
80 return new YAxisWalker() { 78 return new YAxisWalker() {
81 79
82 @Override 80 @Override
104 } 102 }
105 103
106 Facet facet = bundle.getFacet(); 104 Facet facet = bundle.getFacet();
107 D4EArtifact artifact = (D4EArtifact)bundle.getArtifact(); 105 D4EArtifact artifact = (D4EArtifact)bundle.getArtifact();
108 106
109 SedimentLoadAccess slaccess = new SedimentLoadAccess(artifact);
110 String unit = slaccess.getUnit();
111 if (unit != null && unit.equals("m3_per_a")) {
112 yLabel = msg(I18N_YAXIS_LABEL_2, I18N_YAXIS_LABEL_DEFAULT_2);
113 }
114 else {
115 yLabel = msg(I18N_YAXIS_LABEL_1, I18N_YAXIS_LABEL_DEFAULT_1);
116 }
117 if (facet == null) { 107 if (facet == null) {
118 return; 108 return;
119 } 109 }
120 if (getXBounds(0) != null && getDomainAxisRange() != null) { 110 if (getXBounds(0) != null && getDomainAxisRange() != null) {
121 logger.debug(Arrays.toString(getDomainAxisRangeFromRequest())); 111 logger.debug(Arrays.toString(getDomainAxisRangeFromRequest()));
240 230
241 @Override 231 @Override
242 protected String getDefaultYAxisLabel(int pos) { 232 protected String getDefaultYAxisLabel(int pos) {
243 String label = "default"; 233 String label = "default";
244 if (pos == YAXIS.L.idx) { 234 if (pos == YAXIS.L.idx) {
245 label = yLabel; 235 SedimentLoadAccess slaccess =
236 new SedimentLoadAccess((D4EArtifact) getMaster());
237 String unit = slaccess.getUnit();
238 if (unit != null && unit.equals("m3_per_a")) {
239 label = msg(I18N_YAXIS_LABEL_2, I18N_YAXIS_LABEL_DEFAULT_2);
240 }
241 else {
242 label = msg(I18N_YAXIS_LABEL_1, I18N_YAXIS_LABEL_DEFAULT_1);
243 }
246 } 244 }
247 else if (pos == YAXIS.V.idx) { 245 else if (pos == YAXIS.V.idx) {
248 label = msg(I18N_YAXIS_V_LABEL, I18N_YAXIS_V_LABEL_DEFAULT); 246 label = msg(I18N_YAXIS_V_LABEL, I18N_YAXIS_V_LABEL_DEFAULT);
249 } 247 }
250 else if (pos == YAXIS.D.idx) { 248 else if (pos == YAXIS.D.idx) {

http://dive4elements.wald.intevation.org