Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/themes/ThemeDocument.java @ 8856:5e38e2924c07 3.2.x
Fix code style.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 18 Jan 2018 20:12:01 +0100 |
parents | c421c9530aba |
children | e5f688820951 0a5239a1e46e |
comparison
equal
deleted
inserted
replaced
8855:d7c005e12af0 | 8856:5e38e2924c07 |
---|---|
29 { | 29 { |
30 private static Logger log = Logger.getLogger(ThemeDocument.class); | 30 private static Logger log = Logger.getLogger(ThemeDocument.class); |
31 | 31 |
32 private static final String MSG_ISOBATH_CLASS = "floodmap.isobath.class"; | 32 private static final String MSG_ISOBATH_CLASS = "floodmap.isobath.class"; |
33 | 33 |
34 private static final String MSG_ISOBATH_LASTCLASS = "floodmap.isobath.lastclass"; | 34 private static final String MSG_ISOBATH_LASTCLASS = |
35 "floodmap.isobath.lastclass"; | |
35 | 36 |
36 public final static String FILL_COLOR = "fillcolor"; | 37 public final static String FILL_COLOR = "fillcolor"; |
37 | 38 |
38 public final static String LINE_COLOR = "linecolor"; | 39 public final static String LINE_COLOR = "linecolor"; |
39 | 40 |
662 to = to >= 0 ? to : 9999; | 663 to = to >= 0 ? to : 9999; |
663 step = to != from ? step : 1; | 664 step = to != from ? step : 1; |
664 | 665 |
665 int numClasses = (int)((to - from) / step + 1); | 666 int numClasses = (int)((to - from) / step + 1); |
666 | 667 |
667 float rd = (endColor.getRed() - startColor.getRed()) / (float)numClasses; | 668 float rd = (endColor.getRed() - startColor.getRed()) |
668 float gd = (endColor.getGreen() - startColor.getGreen()) / (float)numClasses; | 669 / (float)numClasses; |
669 float bd = (endColor.getBlue() - startColor.getBlue()) / (float)numClasses; | 670 float gd = (endColor.getGreen() - startColor.getGreen()) |
671 / (float)numClasses; | |
672 float bd = (endColor.getBlue() - startColor.getBlue()) | |
673 / (float)numClasses; | |
670 | 674 |
671 for (int n = 0; n < numClasses; n++) { | 675 for (int n = 0; n < numClasses; n++) { |
672 StringBuilder newColor = new StringBuilder(); | 676 StringBuilder newColor = new StringBuilder(); |
673 newColor.append(startColor.getRed() + Math.round(n * rd)); | 677 newColor.append(startColor.getRed() + Math.round(n * rd)); |
674 newColor.append(' '); | 678 newColor.append(' '); |
675 newColor.append(startColor.getGreen() + Math.round(n * gd)); | 679 newColor.append(startColor.getGreen() + Math.round(n * gd)); |
676 newColor.append(' '); | 680 newColor.append(' '); |
677 newColor.append(startColor.getBlue() + Math.round(n * bd)); | 681 newColor.append(startColor.getBlue() + Math.round(n * bd)); |
678 | 682 |
679 String expr = createWSPLGENClassExpression(from + n * step, step, n + 1, numClasses); | 683 String expr = createWSPLGENClassExpression( |
680 String name = createWSPLGENClassName(from + n * step, step, n + 1, numClasses, meta); | 684 from + n * step, step, n + 1, numClasses); |
685 String name = createWSPLGENClassName( | |
686 from + n * step, step, n + 1, numClasses, meta); | |
681 | 687 |
682 Clazz c = new Clazz(name); | 688 Clazz c = new Clazz(name); |
683 Style s = new Style(); | 689 Style s = new Style(); |
684 s.setColor(newColor.toString()); | 690 s.setColor(newColor.toString()); |
685 s.setSize(5); | 691 s.setSize(5); |
692 | 698 |
693 return ms.toString(); | 699 return ms.toString(); |
694 } | 700 } |
695 | 701 |
696 | 702 |
697 protected static String createWSPLGENClassExpression(float val, float step, int idx, int maxIdx) { | 703 protected static String createWSPLGENClassExpression( |
704 float val, | |
705 float step, | |
706 int idx, | |
707 int maxIdx | |
708 ) { | |
698 if (idx < maxIdx) { | 709 if (idx < maxIdx) { |
699 return "[DIFF] >= " + val + " AND [DIFF] < " + (val + step); | 710 return "[DIFF] >= " + val + " AND [DIFF] < " + (val + step); |
700 } | 711 } |
701 else { | 712 else { |
702 return "[DIFF] >= " + val; | 713 return "[DIFF] >= " + val; |