Mercurial > dive4elements > gnv-client
changeset 760:f82e57a60124
Added a further column in the isolines shapefile to store a description used to be displayed as labels in a wms layer (issue209).
gnv-artifacts/trunk@814 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 22 Mar 2010 10:57:35 +0000 |
parents | 93489a0c1328 |
children | 0b1de7e38907 |
files | gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java |
diffstat | 2 files changed, 26 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog Mon Mar 22 09:15:05 2010 +0000 +++ b/gnv-artifacts/ChangeLog Mon Mar 22 10:57:35 2010 +0000 @@ -1,3 +1,15 @@ +2010-03-22 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue209 + + * src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java: Added a + further column in the isolines shapefile to store a description for each + line. This description column contains the double value with three maximum + fraction digits. This is a workaround to adjust the rendering of double + values which cannot be adjusted in MapServer at the moment. MapServer + would display all fraction digits contained in the shapefile causing very + long labels. + 2010-03-22 Ingo Weinzierl <ingo.weinzierl@intevation.de> Issue208 (Added a cleanup mechanism to do some things before exporting an
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java Mon Mar 22 09:15:05 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java Mon Mar 22 10:57:35 2010 +0000 @@ -4,6 +4,7 @@ import java.io.IOException; import java.io.Serializable; import java.net.MalformedURLException; +import java.text.NumberFormat; import java.util.Collection; import java.util.Date; import java.util.HashMap; @@ -43,6 +44,10 @@ private static Logger log = Logger.getLogger( ShapeFileWriter.class); + private static NumberFormat format = NumberFormat.getInstance(); + + public static final int DOUBLE_PRECISION = 3; + private ShapeFileWriter() { } @@ -96,7 +101,8 @@ "PARAMETER:Integer," + "LAYER:Integer," + "DATE:Date," + - "VALUE:Double"); + "VALUE:Double," + + "DESC:String"); } catch (SchemaException se) { log.error(se.getLocalizedMessage(), se); @@ -115,6 +121,7 @@ featureBuilder.add(layer); featureBuilder.add(date); featureBuilder.add(pair.getA()); + featureBuilder.add(value2description(asDouble(pair.getA()))); SimpleFeature feature = featureBuilder.buildFeature(null); collection.add(feature); } @@ -398,5 +405,11 @@ } return 0d; } + + private static final String value2description(Double value) { + format.setMaximumFractionDigits(DOUBLE_PRECISION); + + return format.format(value); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :