changeset 483:c8089cd7d777

Added explicit index scheme to palette classes to allow external references. gnv-artifacts/trunk@558 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 18 Jan 2010 10:56:41 +0000
parents 64e65daa65e9
children 823e4f808418
files gnv-artifacts/ChangeLog gnv-artifacts/doc/conf/conf.xml gnv-artifacts/doc/conf/palette/flow-velocity.xml gnv-artifacts/doc/conf/palette/salinity.xml gnv-artifacts/doc/conf/palette/water-levels.xml gnv-artifacts/doc/conf/palette/water-temperature.xml gnv-artifacts/src/main/java/de/intevation/gnv/raster/Palette.java
diffstat 7 files changed, 148 insertions(+), 107 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog	Sun Jan 17 21:26:21 2010 +0000
+++ b/gnv-artifacts/ChangeLog	Mon Jan 18 10:56:41 2010 +0000
@@ -1,3 +1,20 @@
+2010-01-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/raster/Palette.java:
+	  load <range> attribute "index" as external index. This
+	  is useful to match color classes with external sources.
+	  If no explicit index is given the order of ranges is
+	  used as external index.
+
+	* doc/conf/palette/flow-velocity.xml,
+	  doc/conf/palette/water-levels.xml,
+	  doc/conf/palette/salinity.xml,
+	  doc/conf/palette/water-temperature.xml: Set explicit
+	  external color class indices.
+
+	* doc/conf/conf.xml: Set ground interpolation of "Horizontalschnitte" 
+	  to bilinear.
+
 2010-01-17	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* doc/conf/conf.xml: Reduced number of "Horizontalschnitt"
--- a/gnv-artifacts/doc/conf/conf.xml	Sun Jan 17 21:26:21 2010 +0000
+++ b/gnv-artifacts/doc/conf/conf.xml	Mon Jan 18 10:56:41 2010 +0000
@@ -421,6 +421,7 @@
         <horizontal-cross-section>
             <!-- This section configures the HorizontalCrossSection ("Horizontalschnitt") -->
             <samples number="256"/>
+            <ground interpolation="bilinear" />
             <result-shapefile-directory path="${artifacts.config.dir}/../shapefiles/"/>
         </horizontal-cross-section>
 
--- a/gnv-artifacts/doc/conf/palette/flow-velocity.xml	Sun Jan 17 21:26:21 2010 +0000
+++ b/gnv-artifacts/doc/conf/palette/flow-velocity.xml	Mon Jan 18 10:56:41 2010 +0000
@@ -1,15 +1,15 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <ranges>
-  <range from="-inf"  to="0.025" rgb="#38a800" description="&lt; 0.025"/>
-  <range from="0.025" to="0.05"  rgb="#56b800" description="0.025 - 0.05"/>
-  <range from="0.05"  to="0.1"   rgb="#74c700" description="0.05 - 0.1"/>
-  <range from="0.1"   to="0.3"   rgb="#96d600" description="0.1 - 0.3"/>
-  <range from="0.3"   to="0.5"   rgb="#bfe600" description="0.3 - 0.5"/>
-  <range from="0.5"   to="0.7"   rgb="#e9f500" description="0.5 - 0.7"/>
-  <range from="0.7"   to="0.9"   rgb="#ffea00" description="0.7 - 0.9"/>
-  <range from="0.9"   to="1.1"   rgb="#ffbb00" description="0.9 - 1.1"/>
-  <range from="1.1"   to="1.3"   rgb="#ff8c00" description="1.1 - 1.3"/>
-  <range from="1.3"   to="1.5"   rgb="#ff5e00" description="1.3 - 1.5"/>
-  <range from="1.5"   to="1.7"   rgb="#ff2f00" description="1.5 - 1.7"/>
-  <range from="1.7"   to="inf"   rgb="#ff0000" description="&gt; 1.7"/>
+  <range index="0"  from="-inf"  to="0.025" rgb="#38a800" description="&lt; 0.025"/>
+  <range index="1"  from="0.025" to="0.05"  rgb="#56b800" description="0.025 - 0.05"/>
+  <range index="2"  from="0.05"  to="0.1"   rgb="#74c700" description="0.05 - 0.1"/>
+  <range index="3"  from="0.1"   to="0.3"   rgb="#96d600" description="0.1 - 0.3"/>
+  <range index="4"  from="0.3"   to="0.5"   rgb="#bfe600" description="0.3 - 0.5"/>
+  <range index="5"  from="0.5"   to="0.7"   rgb="#e9f500" description="0.5 - 0.7"/>
+  <range index="6"  from="0.7"   to="0.9"   rgb="#ffea00" description="0.7 - 0.9"/>
+  <range index="7"  from="0.9"   to="1.1"   rgb="#ffbb00" description="0.9 - 1.1"/>
+  <range index="8"  from="1.1"   to="1.3"   rgb="#ff8c00" description="1.1 - 1.3"/>
+  <range index="9"  from="1.3"   to="1.5"   rgb="#ff5e00" description="1.3 - 1.5"/>
+  <range index="10" from="1.5"   to="1.7"   rgb="#ff2f00" description="1.5 - 1.7"/>
+  <range index="11" from="1.7"   to="inf"   rgb="#ff0000" description="&gt; 1.7"/>
 </ranges>
--- a/gnv-artifacts/doc/conf/palette/salinity.xml	Sun Jan 17 21:26:21 2010 +0000
+++ b/gnv-artifacts/doc/conf/palette/salinity.xml	Mon Jan 18 10:56:41 2010 +0000
@@ -1,31 +1,31 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <ranges>
-  <range from="-inf" to="2.0" rgb="#02db00" description="&lt; 2.0"/>
-  <range from="2.0" to="3.0" rgb="#01e600" description="2.0 - 3.0"/>
-  <range from="3.0" to="4.0" rgb="#02f200" description="3.0 - 4.0"/>
-  <range from="4.0" to="5.0" rgb="#00ff00" description="4.0 - 5.0"/>
-  <range from="5.0" to="6.0" rgb="#23fd22" description="5.0 - 6.0"/>
-  <range from="6.0" to="7.0" rgb="#47fe46" description="6.0 - 7.0"/>
-  <range from="7.0" to="8.0" rgb="#5afd59" description="7.0 - 8.0"/>
-  <range from="8.0" to="9.0" rgb="#6ffe6e" description="8.0 - 9.0"/>
-  <range from="9.0" to="10.0" rgb="#89fd88" description="9.0 - 10.0"/>
-  <range from="10.0" to="12.0" rgb="#a5fea4" description="10.0 - 12.0"/>
-  <range from="12.0" to="14.0" rgb="#b3feb3" description="12.0 - 14.0"/>
-  <range from="14.0" to="16.0" rgb="#c2fec2" description="14.0 - 16.0"/>
-  <range from="16.0" to="18.0" rgb="#e0fee0" description="16.0 - 18.0"/>
-  <range from="18.0" to="20.0" rgb="#ffffff" description="18.0 - 20.0"/>
-  <range from="20.0" to="24.0" rgb="#fef5ef" description="20.0 - 24.0"/>
-  <range from="24.0" to="28.0" rgb="#feede0" description="24.0 - 28.0"/>
-  <range from="28.0" to="30.0" rgb="#fee5d1" description="28.0 - 30.0"/>
-  <range from="30.0" to="32.0" rgb="#fdd8ba" description="30.0 - 32.0"/>
-  <range from="32.0" to="34.0" rgb="#fecca4" description="32.0 - 34.0"/>
-  <range from="34.0" to="34.5" rgb="#fdbe8b" description="34.0 - 34.5"/>
-  <range from="34.5" to="35.0" rgb="#feb073" description="34.5 - 35.0"/>
-  <range from="35.0" to="35.2" rgb="#fda35b" description="35.0 - 35.2"/>
-  <range from="35.2" to="35.4" rgb="#fe9846" description="35.2 - 35.4"/>
-  <range from="35.4" to="35.6" rgb="#fd8422" description="35.4 - 35.6"/>
-  <range from="35.6" to="35.8" rgb="#fe7100" description="35.6 - 35.8"/>
-  <range from="35.8" to="36.0" rgb="#fe6900" description="35.8 - 36.0"/>
-  <range from="36.0" to="37.0" rgb="#fe6100" description="36.0 - 37.0"/>
-  <range from="37.0" to="inf" rgb="#fe5900" description="&gt; 37.0"/>
+  <range index="0"  from="-inf" to="2.0"  rgb="#02db00" description="&lt; 2.0"/>
+  <range index="1"  from="2.0"  to="3.0"  rgb="#01e600" description="2.0 - 3.0"/>
+  <range index="2"  from="3.0"  to="4.0"  rgb="#02f200" description="3.0 - 4.0"/>
+  <range index="3"  from="4.0"  to="5.0"  rgb="#00ff00" description="4.0 - 5.0"/>
+  <range index="4"  from="5.0"  to="6.0"  rgb="#23fd22" description="5.0 - 6.0"/>
+  <range index="5"  from="6.0"  to="7.0"  rgb="#47fe46" description="6.0 - 7.0"/>
+  <range index="6"  from="7.0"  to="8.0"  rgb="#5afd59" description="7.0 - 8.0"/>
+  <range index="7"  from="8.0"  to="9.0"  rgb="#6ffe6e" description="8.0 - 9.0"/>
+  <range index="8"  from="9.0"  to="10.0" rgb="#89fd88" description="9.0 - 10.0"/>
+  <range index="9"  from="10.0" to="12.0" rgb="#a5fea4" description="10.0 - 12.0"/>
+  <range index="10" from="12.0" to="14.0" rgb="#b3feb3" description="12.0 - 14.0"/>
+  <range index="11" from="14.0" to="16.0" rgb="#c2fec2" description="14.0 - 16.0"/>
+  <range index="12" from="16.0" to="18.0" rgb="#e0fee0" description="16.0 - 18.0"/>
+  <range index="13" from="18.0" to="20.0" rgb="#ffffff" description="18.0 - 20.0"/>
+  <range index="14" from="20.0" to="24.0" rgb="#fef5ef" description="20.0 - 24.0"/>
+  <range index="15" from="24.0" to="28.0" rgb="#feede0" description="24.0 - 28.0"/>
+  <range index="16" from="28.0" to="30.0" rgb="#fee5d1" description="28.0 - 30.0"/>
+  <range index="17" from="30.0" to="32.0" rgb="#fdd8ba" description="30.0 - 32.0"/>
+  <range index="18" from="32.0" to="34.0" rgb="#fecca4" description="32.0 - 34.0"/>
+  <range index="19" from="34.0" to="34.5" rgb="#fdbe8b" description="34.0 - 34.5"/>
+  <range index="20" from="34.5" to="35.0" rgb="#feb073" description="34.5 - 35.0"/>
+  <range index="21" from="35.0" to="35.2" rgb="#fda35b" description="35.0 - 35.2"/>
+  <range index="22" from="35.2" to="35.4" rgb="#fe9846" description="35.2 - 35.4"/>
+  <range index="23" from="35.4" to="35.6" rgb="#fd8422" description="35.4 - 35.6"/>
+  <range index="24" from="35.6" to="35.8" rgb="#fe7100" description="35.6 - 35.8"/>
+  <range index="25" from="35.8" to="36.0" rgb="#fe6900" description="35.8 - 36.0"/>
+  <range index="26" from="36.0" to="37.0" rgb="#fe6100" description="36.0 - 37.0"/>
+  <range index="27" from="37.0" to="inf"  rgb="#fe5900" description="&gt; 37.0"/>
 </ranges>
--- a/gnv-artifacts/doc/conf/palette/water-levels.xml	Sun Jan 17 21:26:21 2010 +0000
+++ b/gnv-artifacts/doc/conf/palette/water-levels.xml	Mon Jan 18 10:56:41 2010 +0000
@@ -1,27 +1,27 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <ranges>
-  <range from="-inf" to="5" rgb="#870087" description="&lt; 5"/>
-  <range from="-5.0" to="-4.5" rgb="#c700c7" description="-5.0 - -4.5"/>
-  <range from="-4.5" to="-4.0" rgb="#ff00ff" description="-4.5 - -4.0"/>
-  <range from="-4.0" to="-3.5" rgb="#bb00ff" description="-4.0 - -3.5"/>
-  <range from="-3.5" to="-3.0" rgb="#7700ff" description="-3.5 - -3.0"/>
-  <range from="-3.0" to="-2.5" rgb="#0000ff" description="-3.0 - -2.5"/>
-  <range from="-2.5" to="-2.0" rgb="#0000e8" description="-2.5 - -2.0"/>
-  <range from="-2.0" to="-1.5" rgb="#0082d9" description="-2.0 - -1.5"/>
-  <range from="-1.5" to="-1.0" rgb="#00b2ff" description="-1.5 - -1.0"/>
-  <range from="-1.0" to="-0.5" rgb="#00ddff" description="-1.0 - -0.5"/>
-  <range from="-0.5" to="0.0" rgb="#00ffff" description="-0.5 - 0.0"/>
-  <range from="0.0" to="0.5" rgb="#49d1cd" description="0.0 - 0.5"/>
-  <range from="0.5" to="1.0" rgb="#20b0a9" description="0.5 - 1.0"/>
-  <range from="1.0" to="1.5" rgb="#14c76d" description="1.0 - 1.5"/>
-  <range from="1.5" to="2.0" rgb="#09e03b" description="1.5 - 2.0"/>
-  <range from="2.0" to="2.5" rgb="#00ff1a" description="2.0 - 2.5"/>
-  <range from="2.5" to="3.0" rgb="#aeff00" description="2.5 - 3.0"/>
-  <range from="3.0" to="3.5" rgb="#f2ff00" description="3.0 - 3.5"/>
-  <range from="3.5" to="4.0" rgb="#ffc800" description="3.5 - 4.0"/>
-  <range from="4.0" to="4.5" rgb="#ff8800" description="4.0 - 4.5"/>
-  <range from="4.5" to="5.0" rgb="#ff4400" description="4.5 - 5.0"/>
-  <range from="5.0" to="5.5" rgb="#ff0000" description="5.0 - 5.5"/>
-  <range from="5.5" to="6.0" rgb="#c70000" description="5.5 - 6.0"/>
-  <range from="6.0" to="inf" rgb="#870000" description="&gt; 6.0"/>
+  <range index="0"  from="-inf" to="5"    rgb="#870087" description="&lt; 5"/>
+  <range index="1"  from="-5.0" to="-4.5" rgb="#c700c7" description="-5.0 - -4.5"/>
+  <range index="2"  from="-4.5" to="-4.0" rgb="#ff00ff" description="-4.5 - -4.0"/>
+  <range index="3"  from="-4.0" to="-3.5" rgb="#bb00ff" description="-4.0 - -3.5"/>
+  <range index="4"  from="-3.5" to="-3.0" rgb="#7700ff" description="-3.5 - -3.0"/>
+  <range index="5"  from="-3.0" to="-2.5" rgb="#0000ff" description="-3.0 - -2.5"/>
+  <range index="6"  from="-2.5" to="-2.0" rgb="#0000e8" description="-2.5 - -2.0"/>
+  <range index="7"  from="-2.0" to="-1.5" rgb="#0082d9" description="-2.0 - -1.5"/>
+  <range index="8"  from="-1.5" to="-1.0" rgb="#00b2ff" description="-1.5 - -1.0"/>
+  <range index="9"  from="-1.0" to="-0.5" rgb="#00ddff" description="-1.0 - -0.5"/>
+  <range index="10" from="-0.5" to="0.0"  rgb="#00ffff" description="-0.5 - 0.0"/>
+  <range index="11" from="0.0"  to="0.5"  rgb="#49d1cd" description="0.0 - 0.5"/>
+  <range index="12" from="0.5"  to="1.0"  rgb="#20b0a9" description="0.5 - 1.0"/>
+  <range index="13" from="1.0"  to="1.5"  rgb="#14c76d" description="1.0 - 1.5"/>
+  <range index="14" from="1.5"  to="2.0"  rgb="#09e03b" description="1.5 - 2.0"/>
+  <range index="15" from="2.0"  to="2.5"  rgb="#00ff1a" description="2.0 - 2.5"/>
+  <range index="16" from="2.5"  to="3.0"  rgb="#aeff00" description="2.5 - 3.0"/>
+  <range index="17" from="3.0"  to="3.5"  rgb="#f2ff00" description="3.0 - 3.5"/>
+  <range index="18" from="3.5"  to="4.0"  rgb="#ffc800" description="3.5 - 4.0"/>
+  <range index="19" from="4.0"  to="4.5"  rgb="#ff8800" description="4.0 - 4.5"/>
+  <range index="20" from="4.5"  to="5.0"  rgb="#ff4400" description="4.5 - 5.0"/>
+  <range index="21" from="5.0"  to="5.5"  rgb="#ff0000" description="5.0 - 5.5"/>
+  <range index="22" from="5.5"  to="6.0"  rgb="#c70000" description="5.5 - 6.0"/>
+  <range index="23" from="6.0"  to="inf"  rgb="#870000" description="&gt; 6.0"/>
 </ranges>
--- a/gnv-artifacts/doc/conf/palette/water-temperature.xml	Sun Jan 17 21:26:21 2010 +0000
+++ b/gnv-artifacts/doc/conf/palette/water-temperature.xml	Mon Jan 18 10:56:41 2010 +0000
@@ -1,31 +1,31 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <ranges>
-  <range from="-inf" to="-1" rgb="#ff33ff" description="&lt; -1"/>
-  <range from="-1" to="0" rgb="#ff98ff" description="-1 - 0"/>
-  <range from="0" to="1" rgb="#3300cc" description="0 - 1"/>
-  <range from="1" to="2" rgb="#3366ff" description="1 - 2"/>
-  <range from="2" to="3" rgb="#3399ff" description="2 - 3"/>
-  <range from="3" to="4" rgb="#33ccff" description="3 - 4"/>
-  <range from="4" to="5" rgb="#33ffff" description="4 - 5"/>
-  <range from="5" to="6" rgb="#007800" description="5 - 6"/>
-  <range from="6" to="7" rgb="#009900" description="6 - 7"/>
-  <range from="7" to="8" rgb="#00ba00" description="7 - 8"/>
-  <range from="8" to="9" rgb="#00de00" description="8 - 9"/>
-  <range from="9" to="10" rgb="#00ff00" description="9 - 10"/>
-  <range from="10" to="11" rgb="#ffff33" description="10 - 11"/>
-  <range from="11" to="12" rgb="#ffee33" description="11 - 12"/>
-  <range from="12" to="13" rgb="#ffdd33" description="12 - 13"/>
-  <range from="13" to="14" rgb="#ffcc33" description="13 - 14"/>
-  <range from="14" to="15" rgb="#ffbb33" description="14 - 15"/>
-  <range from="15" to="16" rgb="#ffaa00" description="15 - 16"/>
-  <range from="16" to="17" rgb="#ff9900" description="16 - 17"/>
-  <range from="17" to="18" rgb="#ff7700" description="17 - 18"/>
-  <range from="18" to="19" rgb="#ff0000" description="18 - 19"/>
-  <range from="19" to="20" rgb="#ed0000" description="19 - 20"/>
-  <range from="20" to="21" rgb="#cc0000" description="20 - 21"/>
-  <range from="21" to="22" rgb="#ba0000" description="21 - 22"/>
-  <range from="22" to="23" rgb="#ab0000" description="22 - 23"/>
-  <range from="23" to="24" rgb="#990000" description="23 - 24"/>
-  <range from="24" to="25" rgb="#870000" description="24 - 25"/>
-  <range from="25" to="inf" rgb="#ab0089" description="&gt; 25"/>
+  <range index="0"  from="-inf" to="-1"  rgb="#ff33ff" description="&lt; -1"/>
+  <range index="1"  from="-1"   to="0"   rgb="#ff98ff" description="-1 - 0"/>
+  <range index="2"  from="0"    to="1"   rgb="#3300cc" description="0 - 1"/>
+  <range index="3"  from="1"    to="2"   rgb="#3366ff" description="1 - 2"/>
+  <range index="4"  from="2"    to="3"   rgb="#3399ff" description="2 - 3"/>
+  <range index="5"  from="3"    to="4"   rgb="#33ccff" description="3 - 4"/>
+  <range index="6"  from="4"    to="5"   rgb="#33ffff" description="4 - 5"/>
+  <range index="7"  from="5"    to="6"   rgb="#007800" description="5 - 6"/>
+  <range index="8"  from="6"    to="7"   rgb="#009900" description="6 - 7"/>
+  <range index="9"  from="7"    to="8"   rgb="#00ba00" description="7 - 8"/>
+  <range index="10" from="8"    to="9"   rgb="#00de00" description="8 - 9"/>
+  <range index="11" from="9"    to="10"  rgb="#00ff00" description="9 - 10"/>
+  <range index="12" from="10"   to="11"  rgb="#ffff33" description="10 - 11"/>
+  <range index="13" from="11"   to="12"  rgb="#ffee33" description="11 - 12"/>
+  <range index="14" from="12"   to="13"  rgb="#ffdd33" description="12 - 13"/>
+  <range index="15" from="13"   to="14"  rgb="#ffcc33" description="13 - 14"/>
+  <range index="16" from="14"   to="15"  rgb="#ffbb33" description="14 - 15"/>
+  <range index="17" from="15"   to="16"  rgb="#ffaa00" description="15 - 16"/>
+  <range index="18" from="16"   to="17"  rgb="#ff9900" description="16 - 17"/>
+  <range index="19" from="17"   to="18"  rgb="#ff7700" description="17 - 18"/>
+  <range index="20" from="18"   to="19"  rgb="#ff0000" description="18 - 19"/>
+  <range index="21" from="19"   to="20"  rgb="#ed0000" description="19 - 20"/>
+  <range index="22" from="20"   to="21"  rgb="#cc0000" description="20 - 21"/>
+  <range index="23" from="21"   to="22"  rgb="#ba0000" description="21 - 22"/>
+  <range index="24" from="22"   to="23"  rgb="#ab0000" description="22 - 23"/>
+  <range index="25" from="23"   to="24"  rgb="#990000" description="23 - 24"/>
+  <range index="26" from="24"   to="25"  rgb="#870000" description="24 - 25"/>
+  <range index="27" from="25"   to="inf" rgb="#ab0089" description="&gt; 25"/>
 </ranges>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/Palette.java	Sun Jan 17 21:26:21 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/Palette.java	Mon Jan 18 10:56:41 2010 +0000
@@ -28,6 +28,8 @@
 
         private int    index;
 
+        private int    externalIndex;
+
         private double from;
         private double to;
 
@@ -39,25 +41,28 @@
         }
 
         public Entry(Entry other) {
-            index       = other.index;
-            from        = other.from;
-            to          = other.to;
-            description = other.description;
-            color       = other.color;
+            index         = other.index;
+            externalIndex = other.externalIndex;
+            from          = other.from;
+            to            = other.to;
+            description   = other.description;
+            color         = other.color;
         }
 
         public Entry(
             int    index, 
+            int    externalIndex,
             double from, 
             double to, 
             Color  color,
             String description
         ) {
-            this.index       = index;
-            this.from        = from;
-            this.to          = to;
-            this.color       = color;
-            this.description = description;
+            this.index         = index;
+            this.externalIndex = externalIndex;
+            this.from          = from;
+            this.to            = to;
+            this.color         = color;
+            this.description   = description;
         }
 
         public int compareTo(Object other) {
@@ -79,6 +84,10 @@
             return color;
         }
 
+        public int getExternalIndex() {
+            return externalIndex;
+        }
+
         public Entry locateEntry(double value) {
             Entry current = this;
             while (current != null) {
@@ -150,12 +159,13 @@
 
         for (int i = 0; i < entries.length; ++i) {
             Element rangeElement = (Element)rangeNodes.item(i);
-            double from  = doubleValue(rangeElement.getAttribute("from"));
-            double to    = doubleValue(rangeElement.getAttribute("to"));
-            Color  color = color(rangeElement.getAttribute("rgb"));
-            String desc = rangeElement.getAttribute("description");
+            double from     = doubleValue(rangeElement.getAttribute("from"));
+            double to       = doubleValue(rangeElement.getAttribute("to"));
+            int    extIndex = intValue(rangeElement.getAttribute("index"), i);
+            Color  color    = color(rangeElement.getAttribute("rgb"));
+            String desc     = rangeElement.getAttribute("description");
             if (from > to) { double t = from; from = to; to = t; }
-            entries[i] = new Entry(i, from, to, color, desc);
+            entries[i] = new Entry(i, extIndex, from, to, color, desc);
             rgbs[i] = color;
         }
 
@@ -207,6 +217,19 @@
         buildLookup();
     }
 
+    private static final int intValue(String s, int def) {
+        if (s == null || (s = s.trim()).length() == 0) {
+            return def;
+        }
+        try {
+            return Integer.parseInt(s);
+        }
+        catch (NumberFormatException nfe) {
+            log.error(nfe.getLocalizedMessage(), nfe);
+        }
+        return def;
+    }
+
     private static final double doubleValue(String s) {
         if (s == null || (s = s.trim()).length() == 0) {
             return 0d;

http://dive4elements.wald.intevation.org