comparison artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadLSGenerator.java @ 6791:dd5355775ce1 longitudinal-symmetry

merge changes from default into longitudinal-symmetrie branch and make it build
author Tom Gottfried <tom@intevation.de>
date Wed, 07 Aug 2013 18:53:15 +0200
parents ef3b02034f6a 252806ee7dd1
children
comparison
equal deleted inserted replaced
6518:1a7f5d09b9d8 6791:dd5355775ce1
34 import org.dive4elements.river.jfree.RiverAnnotation; 34 import org.dive4elements.river.jfree.RiverAnnotation;
35 import org.dive4elements.river.jfree.StyledXYSeries; 35 import org.dive4elements.river.jfree.StyledXYSeries;
36 import org.dive4elements.river.utils.DataUtil; 36 import org.dive4elements.river.utils.DataUtil;
37 37
38 38
39 /** Generator for Longitudinal Sections of SedimentLoad-Calculations. */
39 public class SedimentLoadLSGenerator 40 public class SedimentLoadLSGenerator
40 extends LongitudinalSectionGenerator 41 extends LongitudinalSectionGenerator
41 implements FacetTypes 42 implements FacetTypes
42 { 43 {
44 /** Y-Axis enum defining the four possible axes. */
43 public enum YAXIS { 45 public enum YAXIS {
44 L(0), 46 L(0),
45 D(1), 47 D(1),
46 DW(2), 48 DW(2),
47 V(3); 49 V(3);
69 public static final String I18N_YAXIS_LABEL_DEFAULT_1 = "[t/a]"; 71 public static final String I18N_YAXIS_LABEL_DEFAULT_1 = "[t/a]";
70 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]";
71 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]";
72 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]";
73 75
74 private String yLabel = ""; 76 /** Enumerator over y-axes. */
75
76 @Override 77 @Override
77 protected YAxisWalker getYAxisWalker() { 78 protected YAxisWalker getYAxisWalker() {
78 return new YAxisWalker() { 79 return new YAxisWalker() {
79 80
80 @Override 81 @Override
102 } 103 }
103 104
104 Facet facet = bundle.getFacet(); 105 Facet facet = bundle.getFacet();
105 D4EArtifact artifact = (D4EArtifact)bundle.getArtifact(); 106 D4EArtifact artifact = (D4EArtifact)bundle.getArtifact();
106 107
107 SedimentLoadAccess slaccess = new SedimentLoadAccess(artifact);
108 String unit = slaccess.getUnit();
109 if (unit != null && unit.equals("m3_per_a")) {
110 yLabel = msg(I18N_YAXIS_LABEL_2, I18N_YAXIS_LABEL_DEFAULT_2);
111 }
112 else {
113 yLabel = msg(I18N_YAXIS_LABEL_1, I18N_YAXIS_LABEL_DEFAULT_1);
114 }
115 if (facet == null) { 108 if (facet == null) {
116 return; 109 return;
117 } 110 }
118 if (getXBounds(0) != null && getDomainAxisRange() != null) { 111 if (getXBounds(0) != null && getDomainAxisRange() != null) {
119 logger.debug(Arrays.toString(getDomainAxisRangeFromRequest())); 112 logger.debug(Arrays.toString(getDomainAxisRangeFromRequest()));
233 226
234 @Override 227 @Override
235 protected String getDefaultYAxisLabel(int pos) { 228 protected String getDefaultYAxisLabel(int pos) {
236 String label = "default"; 229 String label = "default";
237 if (pos == YAXIS.L.idx) { 230 if (pos == YAXIS.L.idx) {
238 label = yLabel; 231 SedimentLoadAccess slaccess =
232 new SedimentLoadAccess((D4EArtifact) getMaster());
233 String unit = slaccess.getUnit();
234 if (unit != null && unit.equals("m3_per_a")) {
235 label = msg(I18N_YAXIS_LABEL_2, I18N_YAXIS_LABEL_DEFAULT_2);
236 }
237 else {
238 label = msg(I18N_YAXIS_LABEL_1, I18N_YAXIS_LABEL_DEFAULT_1);
239 }
239 } 240 }
240 else if (pos == YAXIS.V.idx) { 241 else if (pos == YAXIS.V.idx) {
241 label = msg(I18N_YAXIS_V_LABEL, I18N_YAXIS_V_LABEL_DEFAULT); 242 label = msg(I18N_YAXIS_V_LABEL, I18N_YAXIS_V_LABEL_DEFAULT);
242 } 243 }
243 else if (pos == YAXIS.D.idx) { 244 else if (pos == YAXIS.D.idx) {

http://dive4elements.wald.intevation.org