annotate gnv-artifacts/src/main/java/de/intevation/gnv/raster/ExternalIndexConverter.java @ 612:e86d37008fd1

Added new Transition and State for using the PreSettingsValue for the decision if a Transition could be used and the usage of PreSettings as InputValues. gnv-artifacts/trunk@678 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 12 Feb 2010 09:11:49 +0000
parents 823e4f808418
children c4156275c1e1
rev   line source
484
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.gnv.raster;
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 import org.apache.log4j.Logger;
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5 /**
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6 * @author Sascha L. Teichmann (sascha.teichmann@intevation.de)
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7 */
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8 public class ExternalIndexConverter
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9 implements JTSMultiPolygonProducer.ValueConverter
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10 {
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11 private static Logger log = Logger.getLogger(
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 ExternalIndexConverter.class);
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14 protected Palette palette;
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16 public ExternalIndexConverter() {
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17 }
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 public ExternalIndexConverter(Palette palette) {
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20 this.palette = palette;
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21 }
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23 public Integer convert(Integer value) {
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24 if (value == null) {
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 return value;
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26 }
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
28 int v = value.intValue();
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 if (v == -1) {
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 return value;
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32 }
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 Palette.Entry entry = palette.getEntryByIndex(v);
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 if (entry == null) {
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37 log.warn("cannot find palette entry for index: " + v);
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38 return value;
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39 }
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 return Integer.valueOf(entry.getExternalIndex());
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42 }
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43 }
823e4f808418 Generate JTS geometries (multi polygons and multi linestrings) from
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
44 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org