Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonRenderer.java @ 437:b624879d2902
Added vectorizer rings callback to generate iso lines.
gnv-artifacts/trunk@485 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sun, 27 Dec 2009 05:25:40 +0000 |
parents | f426f55d4f7a |
children | f5a041000357 |
comparison
equal
deleted
inserted
replaced
436:6642ab6c583c | 437:b624879d2902 |
---|---|
62 Integer colorIdx = (Integer)series.getAttribute("fill"); | 62 Integer colorIdx = (Integer)series.getAttribute("fill"); |
63 | 63 |
64 if (colorIdx != null) { | 64 if (colorIdx != null) { |
65 Paint paint = lookup.getPaint(colorIdx.intValue()); | 65 Paint paint = lookup.getPaint(colorIdx.intValue()); |
66 graphics.setPaint(paint != null ? paint : Color.black); | 66 graphics.setPaint(paint != null ? paint : Color.black); |
67 graphics.fill(constructShape(series)); | 67 graphics.fill(constructShape(series, true)); |
68 } | 68 } |
69 else { | 69 else { |
70 graphics.setPaint(Color.black); | 70 graphics.setPaint(Color.black); |
71 graphics.draw(constructShape(series)); | 71 graphics.draw(constructShape(series, false)); |
72 } | 72 } |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 protected Shape constructShape(PolygonSeries series) { | 76 protected Shape constructShape(PolygonSeries series, boolean close) { |
77 CompactXYItems [] rings = series.getRings(); | 77 CompactXYItems [] rings = series.getRings(); |
78 GeneralPath path = new GeneralPath(); | 78 GeneralPath path = new GeneralPath(); |
79 for (int i = 0; i < rings.length; ++i) { | 79 for (int i = 0; i < rings.length; ++i) { |
80 CompactXYItems ring = rings[i]; | 80 CompactXYItems ring = rings[i]; |
81 double [] data = ring.getData(); | 81 double [] data = ring.getData(); |
85 for (int j = 2; j < data.length;) { | 85 for (int j = 2; j < data.length;) { |
86 float x = (float)data[j++]; | 86 float x = (float)data[j++]; |
87 float y = (float)data[j++]; | 87 float y = (float)data[j++]; |
88 path.lineTo(x, y); | 88 path.lineTo(x, y); |
89 } | 89 } |
90 path.closePath(); | 90 if (close) { |
91 path.closePath(); | |
92 } | |
91 } | 93 } |
92 return path; | 94 return path; |
93 } | 95 } |
94 | 96 |
95 public Rectangle2D getBoundingBox(PolygonDataset dataset) { | 97 public Rectangle2D getBoundingBox(PolygonDataset dataset) { |