Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/raster/IsoPolygonSeriesProducer.java @ 1129:ccfa07b88476
merged geo-backend
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:01 +0200 |
parents | f953c9a559d8 |
children |
rev | line source |
---|---|
1115
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
802
diff
changeset
|
1 /* |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
802
diff
changeset
|
2 * Copyright (c) 2010 by Intevation GmbH |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
802
diff
changeset
|
3 * |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
802
diff
changeset
|
4 * This program is free software under the LGPL (>=v2.1) |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
802
diff
changeset
|
5 * Read the file LGPL.txt coming with the software for details |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
802
diff
changeset
|
6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
802
diff
changeset
|
7 */ |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
802
diff
changeset
|
8 |
437
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 package de.intevation.gnv.raster; |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
779
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
521
diff
changeset
|
11 import de.intevation.gnv.jfreechart.CompactXYItems; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
521
diff
changeset
|
12 import de.intevation.gnv.jfreechart.PolygonSeries; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
521
diff
changeset
|
13 |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
521
diff
changeset
|
14 import de.intevation.gnv.math.IJKey; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
521
diff
changeset
|
15 |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
521
diff
changeset
|
16 import de.intevation.gnv.raster.Vectorizer.Edge; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
521
diff
changeset
|
17 |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
521
diff
changeset
|
18 import gnu.trove.TDoubleArrayList; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
521
diff
changeset
|
19 import gnu.trove.TIntObjectHashMap; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
521
diff
changeset
|
20 |
437
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 import java.util.ArrayList; |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 import java.util.Collection; |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 |
447
92b7ccbf6163
Improved generation of iso lines in vertical cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
440
diff
changeset
|
24 import org.apache.log4j.Logger; |
92b7ccbf6163
Improved generation of iso lines in vertical cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
440
diff
changeset
|
25 |
437
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 /** |
802
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
27 * Vectorizer backend to generate iso lines which are able to be visualized |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
28 * via {@link de.intevation.gnv.jfreechart.PolygonPlot} as line strings |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
29 * and custom labels on the chart. |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
30 * |
780
c4156275c1e1
Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
779
diff
changeset
|
31 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> |
437
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 */ |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 public class IsoPolygonSeriesProducer |
465
f7038820df2e
Added support to trace rasters to JTS multi polygons and multi line strings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
448
diff
changeset
|
34 extends IsoProducer |
437
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 { |
448
3cb2bea50456
Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
36 private static Logger log = Logger.getLogger( |
3cb2bea50456
Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
37 IsoPolygonSeriesProducer.class); |
447
92b7ccbf6163
Improved generation of iso lines in vertical cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
440
diff
changeset
|
38 |
802
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
39 /** |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
40 * The line width of the line string used in the chart. |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
41 */ |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
42 public static final Float LINE_WIDTH = Float.valueOf(0.1f); |
447
92b7ccbf6163
Improved generation of iso lines in vertical cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
440
diff
changeset
|
43 |
802
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
44 /** |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
45 * Constructor to create an IsoPolygonSeriesProducer with a |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
46 * given world bounding box. |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
47 * @param minX Min x coord of the world. |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
48 * @param minY Min y coord of the world. |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
49 * @param maxX Max x coord of the world. |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
50 * @param maxY Max y coord of the world. |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
51 */ |
437
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 public IsoPolygonSeriesProducer( |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 double minX, double minY, |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 double maxX, double maxY |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 ) { |
465
f7038820df2e
Added support to trace rasters to JTS multi polygons and multi line strings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
448
diff
changeset
|
56 super(minX, minY, maxX, maxY); |
437
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 } |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 |
802
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
59 /** |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
60 * Returns a collection of series with line strings |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
61 * with no AttributeGenerator. |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
62 * @return The collection with line strings. |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
63 */ |
437
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 public Collection<PolygonSeries> getSeries() { |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 return getSeries(null); |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 } |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 |
802
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
68 /** |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
69 * Returns a collection of series with line strings. |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
70 * The label attributes are generated with a given generator. |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
71 * @param attributeGenerator The attribute generator. Maybe null |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
72 * if no attributes should be generated. |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
73 * @return The collection with the line strings. |
4abe172be970
Finished Javadoc of the raster package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
801
diff
changeset
|
74 */ |
448
3cb2bea50456
Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
75 public Collection<PolygonSeries> getSeries( |
3cb2bea50456
Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
76 AttributeGenerator attributeGenerator |
3cb2bea50456
Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
77 ) { |
437
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
78 ArrayList<PolygonSeries> series = new ArrayList<PolygonSeries>(); |
447
92b7ccbf6163
Improved generation of iso lines in vertical cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
440
diff
changeset
|
79 |
437
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
80 double b1 = minX; |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
81 double m1 = width != 1 |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
82 ? (maxX - minX)/(width-1) |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
83 : 0d; |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
84 |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
85 double b2 = minY; |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
86 double m2 = height != 1 |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
87 ? (maxY - minY)/(height-1) |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
88 : 0d; |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
89 |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
90 TDoubleArrayList vertices = new TDoubleArrayList(); |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
91 |
465
f7038820df2e
Added support to trace rasters to JTS multi polygons and multi line strings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
448
diff
changeset
|
92 for (IJKey key: joinPairs()) { |
437
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
93 PolygonSeries ps = new PolygonSeries(); |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
94 |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 // process complete |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 ArrayList<Edge> completeList = complete.get(key); |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 if (completeList != null) { |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 for (Edge head: completeList) { |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 Edge current = head; |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 do { |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
101 vertices.add(m1*(current.a % width) + b1); |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
102 vertices.add(m2*(current.a / width) + b2); |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
103 } |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
104 while ((current = current.next) != head); |
447
92b7ccbf6163
Improved generation of iso lines in vertical cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
440
diff
changeset
|
105 // add head again to close shape |
92b7ccbf6163
Improved generation of iso lines in vertical cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
440
diff
changeset
|
106 vertices.add(m1*(head.a % width) + b1); |
92b7ccbf6163
Improved generation of iso lines in vertical cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
440
diff
changeset
|
107 vertices.add(m2*(head.a / width) + b2); |
437
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
108 ps.addRing(new CompactXYItems(vertices.toNativeArray())); |
521
1bf058f1a2d1
Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
465
diff
changeset
|
109 vertices.reset(); |
437
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
110 } |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
111 } |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
112 |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
113 // process open |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
114 TIntObjectHashMap map = commonOpen.get(key); |
447
92b7ccbf6163
Improved generation of iso lines in vertical cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
440
diff
changeset
|
115 |
437
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
116 if (map != null) { |
465
f7038820df2e
Added support to trace rasters to JTS multi polygons and multi line strings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
448
diff
changeset
|
117 for (Edge head: headList(map)) { |
447
92b7ccbf6163
Improved generation of iso lines in vertical cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
440
diff
changeset
|
118 |
437
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
119 head = Vectorizer.simplify(head, width); |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
120 Edge current = head, last = head; |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
121 do { |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
122 vertices.add(m1*(current.a % width) + b1); |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
123 vertices.add(m2*(current.a / width) + b2); |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
124 last = current; |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
125 } |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
126 while ((current = current.next) != null); |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
127 // add b from tail |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
128 vertices.add(m1*(last.b % width) + b1); |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
129 vertices.add(m2*(last.b / width) + b2); |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
130 ps.addRing(new CompactXYItems(vertices.toNativeArray())); |
521
1bf058f1a2d1
Generate seabed polygon to "Profilschnitte".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
465
diff
changeset
|
131 vertices.reset(); |
437
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
132 } // for all in common open |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
133 } // if map defined for key |
447
92b7ccbf6163
Improved generation of iso lines in vertical cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
440
diff
changeset
|
134 |
801
d766fe2d917a
More javadoc.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
135 if (ps.getItemCount() > 0) { |
d766fe2d917a
More javadoc.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
136 series.add(ps); |
d766fe2d917a
More javadoc.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
137 if (attributeGenerator != null) { |
448
3cb2bea50456
Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
138 Object attribute = attributeGenerator |
3cb2bea50456
Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
139 .generateAttribute(key.i, key.j); |
3cb2bea50456
Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
140 |
3cb2bea50456
Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
141 if (attribute != null) { |
3cb2bea50456
Generate iso line classes according gnv-issues/issue108
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
142 ps.setAttribute("label", attribute); |
801
d766fe2d917a
More javadoc.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
143 } |
d766fe2d917a
More javadoc.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
144 } |
d766fe2d917a
More javadoc.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
145 ps.setAttribute("line.width", LINE_WIDTH); |
d766fe2d917a
More javadoc.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
146 } |
437
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
147 } // for all pairs |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
148 |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
149 return series; |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
150 } |
b624879d2902
Added vectorizer rings callback to generate iso lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
151 } |
798
6cff63d0c434
Fixed vim modeline. Added some Javadoc.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
780
diff
changeset
|
152 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |