Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java @ 2020:4f7f781e4481
Improved area rendering workflow.
flys-artifacts/trunk@3475 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 20 Dec 2011 06:47:08 +0000 |
parents | 5aecebcc4698 |
children | 76cedac30d35 |
comparison
equal
deleted
inserted
replaced
2019:aa3e7ed1fa46 | 2020:4f7f781e4481 |
---|---|
146 artifactFacet.getData(context), | 146 artifactFacet.getData(context), |
147 artifactFacet.getFacetDescription(), | 147 artifactFacet.getFacetDescription(), |
148 attr, | 148 attr, |
149 visible); | 149 visible); |
150 } | 150 } |
151 else if (name.equals(AREA)) { | 151 else if (FacetTypes.IS.AREA(name)) { |
152 doArea(artifactFacet.getData(context), | 152 doArea(artifactFacet.getData(context), |
153 artifactFacet.getFacetDescription(), | 153 artifactFacet.getFacetDescription(), |
154 attr, | 154 attr, |
155 visible); | 155 visible); |
156 } | 156 } |
157 else { | 157 else { |
158 logger.warn("CrossSection.doOut: Unknown facet name: " + name); | 158 logger.warn("CrossSection.doOut: Unknown facet name: " + name); |
159 return; | 159 return; |
160 } | 160 } |
161 } | 161 } |
162 | |
162 | 163 |
163 /** | 164 /** |
164 * Do Area out. | 165 * Do Area out. |
165 */ | 166 */ |
166 protected void doArea( | 167 protected void doArea( |
168 String seriesName, | 169 String seriesName, |
169 Document theme, | 170 Document theme, |
170 boolean visible | 171 boolean visible |
171 ) { | 172 ) { |
172 logger.debug("CrossSectionGenerator.doArea"); | 173 logger.debug("CrossSectionGenerator.doArea"); |
174 StyledAreaSeriesCollection area = new StyledAreaSeriesCollection(theme); | |
173 | 175 |
174 // TODO make this more stable. | 176 // TODO make this more stable. |
175 Object[] doubles = (Object[]) o; | 177 Object[] doubles = (Object[]) o; |
176 XYSeries up = new StyledXYSeries("up", false, theme); | 178 XYSeries up = null; |
177 XYSeries down = new StyledXYSeries("down", false, theme); | 179 XYSeries down = null; |
178 StyledSeriesBuilder.addPoints(up, (double [][]) doubles[0]); | 180 |
179 StyledSeriesBuilder.addPoints(down, (double [][]) doubles[1]); | 181 if (doubles[1] != null) { |
180 addAreaSeries(up, down, 0, visible); | 182 up = new StyledXYSeries(seriesName, false, theme); |
181 } | 183 StyledSeriesBuilder.addPoints(up, (double [][]) doubles[1]); |
184 } | |
185 | |
186 if (doubles[0] != null) { | |
187 // TODO: Sort this out: when the two series have the same name, | |
188 // the renderer (or anything in between) will not work correctly. | |
189 down = new StyledXYSeries(seriesName + " ", false, theme); | |
190 StyledSeriesBuilder.addPoints(down, (double [][]) doubles[0]); | |
191 } | |
192 | |
193 if (up == null && down != null) { | |
194 area.setMode(StyledAreaSeriesCollection.FILL_MODE.ABOVE); | |
195 down.setKey(seriesName); | |
196 area.addSeries(down); | |
197 } | |
198 else if (up != null && down == null) { | |
199 area.setMode(StyledAreaSeriesCollection.FILL_MODE.UNDER); | |
200 area.addSeries(up); | |
201 } | |
202 else if (up != null && down != null) { | |
203 area.setMode(StyledAreaSeriesCollection.FILL_MODE.BETWEEN); | |
204 area.addSeries(up); | |
205 area.addSeries(down); | |
206 } | |
207 addAreaSeries(area, 0, visible); | |
208 } | |
209 | |
182 | 210 |
183 /** | 211 /** |
184 * Do cross sections waterline out. | 212 * Do cross sections waterline out. |
185 * | 213 * |
186 * @param seriesName name of the data (line) to display in legend. | 214 * @param seriesName name of the data (line) to display in legend. |