annotate gnv-artifacts/src/main/java/de/intevation/gnv/raster/IsoAttributeGenerator.java @ 453:537e663d6c0c

vertical cross section: Fixed problem with running to max depth on every column in interpolation. gnv-artifacts/trunk@501 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 04 Jan 2010 13:42:49 +0000
parents 3cb2bea50456
children f7038820df2e
rev   line source
448
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.gnv.raster;
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 public class IsoAttributeGenerator
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4 implements IsoPolygonSeriesProducer.AttributeGenerator
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5 {
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6 protected Palette palette;
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8 public IsoAttributeGenerator() {
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9 }
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11 public IsoAttributeGenerator(Palette palette) {
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 this.palette = palette;
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13 }
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15 public Object generateAttribute(int neighbor1, int neighbor2) {
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16 Palette.Entry e1 = palette.getEntryByIndex(neighbor1);
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17 Palette.Entry e2 = palette.getEntryByIndex(neighbor2);
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 if (e1 == null || e2 == null) {
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20 return null;
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21 }
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23 double e1t = e1.getFrom();
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24 double e2f = e2.getTo();
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26 return Double.valueOf(e2f >= e1t
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27 ? 0.5d*(e1t+e2f)
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
28 : 0.5d*(e2.getTo()+e1.getFrom()));
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29 }
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 }
3cb2bea50456 Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

http://dive4elements.wald.intevation.org