comparison gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java @ 521:1bf058f1a2d1

Generate seabed polygon to "Profilschnitte". gnv-artifacts/trunk@615 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sun, 24 Jan 2010 20:24:03 +0000
parents ab29e4ff2fda
children b248531fa20b
comparison
equal deleted inserted replaced
520:a8f6ca59b26e 521:1bf058f1a2d1
1 /** 1 /**
2 * 2 *
3 */ 3 */
4 package de.intevation.gnv.artifacts.context; 4 package de.intevation.gnv.artifacts.context;
5
6 import java.awt.Color;
7 import java.awt.Paint;
5 8
6 import java.io.FileInputStream; 9 import java.io.FileInputStream;
7 import java.io.FileNotFoundException; 10 import java.io.FileNotFoundException;
8 import java.io.IOException; 11 import java.io.IOException;
9 import java.io.InputStream; 12 import java.io.InputStream;
87 public final static String VERTICAL_CROSS_SECTION_FILTERS = 90 public final static String VERTICAL_CROSS_SECTION_FILTERS =
88 "/artifact-database/gnv/vertical-cross-section/filters/filter"; 91 "/artifact-database/gnv/vertical-cross-section/filters/filter";
89 92
90 public final static String VERTICAL_CROSS_SECTION_GROUND_INTERPOLATION = 93 public final static String VERTICAL_CROSS_SECTION_GROUND_INTERPOLATION =
91 "/artifact-database/gnv/vertical-cross-section/ground/@interpolation"; 94 "/artifact-database/gnv/vertical-cross-section/ground/@interpolation";
95
96 public final static String VERTICAL_CROSS_SECTION_GROUND_FILL_COLOR =
97 "/artifact-database/gnv/vertical-cross-section/ground/@fill-color";
92 98
93 /** 99 /**
94 * Constructor 100 * Constructor
95 */ 101 */
96 public GNVArtifactContextFactory() { 102 public GNVArtifactContextFactory() {
162 ) { 168 ) {
163 log.info("configuration of vertical cross section"); 169 log.info("configuration of vertical cross section");
164 configureVerticalCrossSectionSamples(config, context); 170 configureVerticalCrossSectionSamples(config, context);
165 configureVerticalCrossSectionFilters(config, context); 171 configureVerticalCrossSectionFilters(config, context);
166 configureVerticalCrossSectionGroundInterpolation(config, context); 172 configureVerticalCrossSectionGroundInterpolation(config, context);
173 configureVerticalCrossSectionGroundFillColor(config, context);
174 }
175
176 protected void configureVerticalCrossSectionGroundFillColor(
177 Document config,
178 GNVArtifactContext context
179 ) {
180 log.info("configuration of vertical cross section ground fill color");
181
182 String fillColor = Config.getStringXPath(
183 config,
184 VERTICAL_CROSS_SECTION_GROUND_FILL_COLOR);
185
186 Paint fill =
187 GNVArtifactContext.DEFAULT_VERTICAL_CROSS_SECTION_GROUND_FILL;
188
189 if (fillColor != null
190 && (fillColor = fillColor.trim()).length() != 0) {
191 try {
192 Color color = Color.decode(fillColor);
193 log.info("ground fill color: #" +
194 Integer.toHexString(color.getRGB()));
195 fill = color;
196 }
197 catch (NumberFormatException nfe) {
198 log.error("'" + fillColor + "' is not a valid color");
199 }
200 }
201
202 context.put(
203 GNVArtifactContext
204 .VERTICAL_CROSS_SECTION_GROUND_FILL_KEY,
205 fill);
167 } 206 }
168 207
169 protected void configureVerticalCrossSectionGroundInterpolation( 208 protected void configureVerticalCrossSectionGroundInterpolation(
170 Document config, 209 Document config,
171 GNVArtifactContext context 210 GNVArtifactContext context

http://dive4elements.wald.intevation.org