Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java @ 1684:bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
flys-artifacts/trunk@2902 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 07 Oct 2011 10:51:09 +0000 |
parents | 69929c471646 |
children | 7e19449d7826 |
comparison
equal
deleted
inserted
replaced
1683:acb4d20b130e | 1684:bdb05dc9b763 |
---|---|
79 return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT); | 79 return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT); |
80 } | 80 } |
81 | 81 |
82 | 82 |
83 @Override | 83 @Override |
84 public void doOut(Artifact artifact, Facet facet, Document attr) { | 84 public void doOut( |
85 Artifact artifact, | |
86 Facet facet, | |
87 Document attr, | |
88 boolean visible | |
89 ) { | |
85 String name = (facet != null) ? facet.getName() : null; | 90 String name = (facet != null) ? facet.getName() : null; |
86 | 91 |
87 logger.debug("ComputedDischargeCurveGenerator.doOut: " + name); | 92 logger.debug("ComputedDischargeCurveGenerator.doOut: " + name); |
88 | 93 |
89 if (name == null) { | 94 if (name == null) { |
93 | 98 |
94 FLYSArtifact flys = (FLYSArtifact) artifact; | 99 FLYSArtifact flys = (FLYSArtifact) artifact; |
95 Facet f = flys.getNativeFacet(facet); | 100 Facet f = flys.getNativeFacet(facet); |
96 | 101 |
97 if (name.equals(COMPUTED_DISCHARGE_Q)) { | 102 if (name.equals(COMPUTED_DISCHARGE_Q)) { |
98 doQOut((WQKms) f.getData(artifact, context), attr); | 103 doQOut((WQKms) f.getData(artifact, context), attr, visible); |
99 } | 104 } |
100 else if (name.equals(COMPUTED_DISCHARGE_MAINVALUES_Q)) { | 105 else if (name.equals(COMPUTED_DISCHARGE_MAINVALUES_Q)) { |
101 doMainValueQAnnotations(f.getData(artifact, context), attr); | 106 doMainValueQAnnotations(f.getData(artifact, context), attr,visible); |
102 } | 107 } |
103 else if (name.equals(COMPUTED_DISCHARGE_MAINVALUES_W)) { | 108 else if (name.equals(COMPUTED_DISCHARGE_MAINVALUES_W)) { |
104 doMainValueWAnnotations(f.getData(artifact, context), attr); | 109 doMainValueWAnnotations(f.getData(artifact, context), attr,visible); |
105 } | 110 } |
106 else { | 111 else { |
107 logger.warn("Unknown facet type for computed discharge: " + name); | 112 logger.warn("Unknown facet type for computed discharge: " + name); |
108 return; | 113 return; |
109 } | 114 } |
111 | 116 |
112 | 117 |
113 /** | 118 /** |
114 * Store W MainValues as annotations for later plotting. | 119 * Store W MainValues as annotations for later plotting. |
115 */ | 120 */ |
116 protected void doMainValueWAnnotations(Object o, Document theme) { | 121 protected void doMainValueWAnnotations( |
122 Object o, | |
123 Document theme, | |
124 boolean visible | |
125 ) { | |
117 logger.debug("ComputedDischargeCurveGenerator set W MainValues."); | 126 logger.debug("ComputedDischargeCurveGenerator set W MainValues."); |
118 | 127 |
119 FLYSAnnotation fa = (FLYSAnnotation) o; | 128 FLYSAnnotation fa = (FLYSAnnotation) o; |
120 fa.setTheme(theme); | 129 fa.setTheme(theme); |
121 addAnnotations(fa); | 130 addAnnotations(fa, visible); |
122 } | 131 } |
123 | 132 |
124 | 133 |
125 /** | 134 /** |
126 * Store Q MainValues as annotations for later plotting. | 135 * Store Q MainValues as annotations for later plotting. |
127 */ | 136 */ |
128 protected void doMainValueQAnnotations(Object o, Document theme) { | 137 protected void doMainValueQAnnotations( |
138 Object o, | |
139 Document theme, | |
140 boolean visible | |
141 ) { | |
129 logger.debug("ComputedDischargeCurveGenerator set Q MainValues."); | 142 logger.debug("ComputedDischargeCurveGenerator set Q MainValues."); |
130 | 143 |
131 FLYSAnnotation fa = (FLYSAnnotation) o; | 144 FLYSAnnotation fa = (FLYSAnnotation) o; |
132 fa.setTheme(theme); | 145 fa.setTheme(theme); |
133 addAnnotations(fa); | 146 addAnnotations(fa, visible); |
134 } | 147 } |
135 | 148 |
136 | 149 |
137 /** | 150 /** |
138 * Add Q-Series to plot. | 151 * Add Q-Series to plot. |
139 * @param wqkms actual data | 152 * @param wqkms actual data |
140 * @param theme theme to use. | 153 * @param theme theme to use. |
141 */ | 154 */ |
142 protected void doQOut(WQKms wqkms, Document theme) { | 155 protected void doQOut(WQKms wqkms, Document theme, boolean visible) { |
143 int size = wqkms.size(); | 156 int size = wqkms.size(); |
144 | 157 |
145 double[] res = new double[3]; | 158 double[] res = new double[3]; |
146 | 159 |
147 XYSeries series = new StyledXYSeries(getSeriesName(wqkms), theme); | 160 XYSeries series = new StyledXYSeries(getSeriesName(wqkms), theme); |
148 for (int i = 0; i < size; i++) { | 161 for (int i = 0; i < size; i++) { |
149 res = wqkms.get(i, res); | 162 res = wqkms.get(i, res); |
150 series.add(res[1], res[0]); | 163 series.add(res[1], res[0]); |
151 } | 164 } |
152 | 165 |
153 addFirstAxisSeries(series); | 166 addFirstAxisSeries(series, visible); |
154 } | 167 } |
155 | 168 |
156 | 169 |
157 /** | 170 /** |
158 * Get the series name to display in legend. | 171 * Get the series name to display in legend. |