Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/raster/ExternalIndexConverter.java @ 787:6cd8492019d8
Validate wkt string and display error messages if the validation failed (issue214).
gnv-artifacts/trunk@869 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 30 Mar 2010 16:51:20 +0000 |
parents | c4156275c1e1 |
children | 4abe172be970 |
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 /** |
780
c4156275c1e1
Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
484
diff
changeset
|
6 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> |
484
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 : |