Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/charts/CrossSectionApp.java @ 5569:2a058dff9666
merge
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 05 Apr 2013 09:56:02 +0200 |
parents | 522b424c9c2a |
children |
rev | line source |
---|---|
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.charts; |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
3 import de.intevation.flys.backend.SessionFactoryProvider; |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 |
3227
ed07dd55f487
Fixed various bugs (package declarations, moved classes to correct places).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3076
diff
changeset
|
5 import de.intevation.flys.artifacts.geom.Lines; |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.flys.model.CrossSection; |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.flys.model.CrossSectionLine; |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.flys.model.CrossSectionPoint; |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
11 import de.intevation.flys.utils.Pair; |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
12 |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
13 import de.intevation.flys.jfree.StableXYDifferenceRenderer; |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
14 |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
15 import java.awt.BorderLayout; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
16 import java.awt.Dimension; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
17 import java.awt.FlowLayout; |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
19 import java.awt.event.ActionEvent; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
20 import java.awt.event.ActionListener; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
21 import java.awt.event.ItemEvent; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
22 import java.awt.event.ItemListener; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
23 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
24 import java.awt.geom.Point2D; |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
25 import java.awt.geom.Rectangle2D; |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
26 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
27 import java.io.File; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
28 import java.io.FileWriter; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
29 import java.io.IOException; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
30 import java.io.PrintWriter; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
31 |
2655
60925be3c84f
Make it compilable again after signature change in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2652
diff
changeset
|
32 import java.math.BigDecimal; |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
33 import java.math.MathContext; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
34 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
35 import java.util.ArrayList; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
36 import java.util.Arrays; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
37 import java.util.List; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
38 import java.util.Map; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
39 import java.util.TreeMap; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
40 |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
41 import java.awt.Color; |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
42 import java.awt.Paint; |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
43 import java.awt.TexturePaint; |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
44 |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
45 import java.awt.image.BufferedImage; |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
46 |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
47 import javax.swing.DefaultComboBoxModel; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
48 import javax.swing.JButton; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
49 import javax.swing.JComboBox; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
50 import javax.swing.JPanel; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
51 import javax.swing.JScrollPane; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
52 import javax.swing.JTable; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
53 import javax.swing.JTextField; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
54 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
55 import javax.swing.event.TableModelEvent; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
56 import javax.swing.event.TableModelListener; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
57 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
58 import javax.swing.table.AbstractTableModel; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
59 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
60 import org.hibernate.Query; |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 import org.hibernate.Session; |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
62 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
63 import org.jfree.chart.ChartFactory; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
64 import org.jfree.chart.ChartPanel; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
65 import org.jfree.chart.ChartUtilities; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
66 import org.jfree.chart.JFreeChart; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
67 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
68 import org.jfree.chart.axis.NumberAxis; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
69 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
70 import org.jfree.chart.plot.PlotOrientation; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
71 import org.jfree.chart.plot.XYPlot; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
72 |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
73 import org.jfree.data.xy.DefaultXYDataset; |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
74 import org.jfree.data.xy.XYSeries; |
1858
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
75 import org.jfree.data.xy.XYDataset; |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
76 import org.jfree.data.xy.XYSeriesCollection; |
1858
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
77 import org.jfree.chart.renderer.xy.XYItemRenderer; |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
78 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
79 import org.jfree.ui.ApplicationFrame; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
80 import org.jfree.ui.RefineryUtilities; |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
81 |
4785
522b424c9c2a
CrossSectionApp: Doc and whitespace cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4050
diff
changeset
|
82 |
2017
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1884
diff
changeset
|
83 /** |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1884
diff
changeset
|
84 * Standalone tech-demo. |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1884
diff
changeset
|
85 */ |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
86 public class CrossSectionApp |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
87 extends ApplicationFrame |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
88 { |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
938
diff
changeset
|
89 public static final String RIVER = System.getProperty("river", "Saar"); |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
90 |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
91 public static final String WATER_LEVEL = System.getProperty("waterlevel"); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
92 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
93 public static final String KM = System.getProperty("km"); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
94 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
95 public static final double EPSILON = 1e-4; |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 protected Session session; |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 protected JComboBox crossSectionLinesCB; |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
100 protected JTextField waterlevelTF; |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
101 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
102 protected ChartPanel chartPanel; |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
103 |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
104 protected Double lastWaterLevel; |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
105 |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
106 protected List<CrossSection> crossSections; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
107 protected boolean [] drawCrossSection; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
108 protected boolean [] drawWaterLevel; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
109 protected boolean [] drawGround; |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
110 protected boolean [] drawFill; |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
111 |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
112 protected Map<Double, List<Pair<CrossSection, CrossSectionLine>>> km2lines; |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
113 |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
114 protected static final Paint TRANSPARENT = createTransparentPaint(); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
115 |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
116 public class CrossSectionTableModel extends AbstractTableModel { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
117 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
118 @Override |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
119 public String getColumnName(int col) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
120 switch (col) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
121 case 0: return "Peilungsname"; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
122 case 1: return "Peilung"; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
123 case 2: return "Wasserstand"; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
124 case 3: return "Boden"; |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
125 case 4: return "Wasser"; |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
126 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
127 return ""; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
128 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
129 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
130 @Override |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
131 public int getColumnCount() { |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2655
diff
changeset
|
132 return 5; |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
133 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
134 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
135 @Override |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
136 public int getRowCount() { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
137 return crossSections != null ? crossSections.size() : 0; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
138 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
139 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
140 @Override |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
141 public Object getValueAt(int row, int col) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
142 if (crossSections == null) return null; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
143 switch (col) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
144 case 0: return crossSections.get(row).getDescription(); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
145 case 1: return drawCrossSection[row]; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
146 case 2: return drawWaterLevel[row]; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
147 case 3: return drawGround[row]; |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
148 case 4: return drawFill[row]; |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
149 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
150 return null; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
151 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
152 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
153 @Override |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
154 public void setValueAt(Object value, int row, int col) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
155 switch (col) { |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2655
diff
changeset
|
156 case 1: |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
157 if (change(drawCrossSection, row, (Boolean)value)) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
158 fireTableCellUpdated(row, col); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
159 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
160 break; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
161 case 2: |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
162 if (change(drawWaterLevel, row, (Boolean)value)) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
163 fireTableCellUpdated(row, col); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
164 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
165 break; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
166 case 3: |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
167 if (change(drawGround, row, (Boolean)value)) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
168 fireTableCellUpdated(row, col); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
169 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
170 break; |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
171 case 4: |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
172 if (change(drawFill, row, (Boolean)value)) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
173 fireTableCellUpdated(row, col); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
174 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
175 break; |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
176 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
177 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
178 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
179 @Override |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
180 public Class<?> getColumnClass(int columnIndex) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
181 switch (columnIndex) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
182 case 0: return String.class; |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
183 case 1: |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
184 case 2: |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2655
diff
changeset
|
185 case 3: |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
186 case 4: return Boolean.class; |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
187 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
188 return null; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
189 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
190 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
191 @Override |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
192 public boolean isCellEditable( |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
193 int rowIndex, |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
194 int columnIndex |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
195 ) { |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
196 return columnIndex >= 1 && columnIndex <= 4; |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
197 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
198 } // class CrossSectionTableModel |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
199 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
200 private static boolean change( |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
201 boolean [] values, |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2655
diff
changeset
|
202 int index, |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
203 boolean value |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
204 ) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
205 if (values[index] != value) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
206 values[index] = value; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
207 return true; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
208 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
209 return false; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
210 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
211 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
212 public static class CrossSectionLineItem { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
213 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
214 Double km; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
215 List<Pair<CrossSection, CrossSectionLine>> lines; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
216 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
217 public CrossSectionLineItem( |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2655
diff
changeset
|
218 Double km, |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
219 List<Pair<CrossSection, CrossSectionLine>> lines |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
220 ) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
221 this.km = km; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
222 this.lines = lines; |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
223 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
224 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
225 public String toString() { |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
226 return String.valueOf(km); |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
227 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
228 } // CrossSectionLineItem |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
229 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
230 public CrossSectionApp(String title) { |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
231 super(title); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
232 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
233 session = SessionFactoryProvider |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
234 .createSessionFactory() |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
235 .openSession(); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
236 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
237 JPanel content = createContent(); |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
238 content.setPreferredSize(new Dimension(800, 480)); |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
239 setContentPane(content); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
240 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
241 |
4785
522b424c9c2a
CrossSectionApp: Doc and whitespace cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4050
diff
changeset
|
242 |
522b424c9c2a
CrossSectionApp: Doc and whitespace cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4050
diff
changeset
|
243 /** Query and return CrossSections for named river. */ |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
244 public List<CrossSection> crossSections(String river) { |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
245 Query query = session.createQuery( |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
246 "from CrossSection where river.name = :river"); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
247 query.setParameter("river", river); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
248 return query.list(); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
249 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
250 |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
251 protected Map<Double, List<Pair<CrossSection, CrossSectionLine>>> |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
252 loadAllLines(List<CrossSection> crossSections) { |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
253 Map<Double, List<Pair<CrossSection, CrossSectionLine>>> km2lines = |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
254 new TreeMap<Double, List<Pair<CrossSection, CrossSectionLine>>>(); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
255 for (CrossSection cs: crossSections) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
256 List<CrossSectionLine> lines = cs.getLines(); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
257 for (CrossSectionLine csl: lines) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
258 Double km = Math.round(csl.getKm().doubleValue() * 1000d)/1000d; |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
259 List<Pair<CrossSection, CrossSectionLine>> ls |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
260 = km2lines.get(km); |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
261 if (ls == null) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
262 ls = new ArrayList<Pair<CrossSection, CrossSectionLine>>(2); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
263 km2lines.put(km, ls); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
264 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
265 ls.add(new Pair<CrossSection, CrossSectionLine>(cs, csl)); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
266 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
267 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
268 return km2lines; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
269 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
270 |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
271 public JPanel createContent() { |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
272 JPanel panel = new JPanel(new BorderLayout()); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
273 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
274 JPanel nav = new JPanel(new FlowLayout()); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
275 |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
276 crossSections = crossSections(RIVER); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
277 km2lines = loadAllLines(crossSections); |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
278 |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
279 int CS = crossSections.size(); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
280 Arrays.fill(drawCrossSection = new boolean[CS], true); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
281 drawWaterLevel = new boolean[CS]; |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
282 drawGround = new boolean[CS]; |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
283 drawFill = new boolean[CS]; |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
284 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
285 Object [] clis = createCrossSectionLineItems(km2lines); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
286 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
287 DefaultComboBoxModel dcbm = new DefaultComboBoxModel(clis); |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
288 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
289 crossSectionLinesCB = new JComboBox(dcbm); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
290 |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
291 if (KM != null) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
292 try { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
293 double km = Double.parseDouble(KM); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
294 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
295 CrossSectionLineItem found = null; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
296 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
297 for (Object o: clis) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
298 CrossSectionLineItem csli = (CrossSectionLineItem)o; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
299 if (Math.abs(csli.km - km) < EPSILON) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
300 found = csli; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
301 break; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
302 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
303 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
304 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
305 if (found != null) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
306 crossSectionLinesCB.setSelectedItem(found); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
307 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
308 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
309 catch (NumberFormatException nfe) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
310 System.err.println("km is not a number: " |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
311 + nfe.getMessage()); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
312 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
313 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
314 |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
315 nav.add(crossSectionLinesCB); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
316 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
317 crossSectionLinesCB.addItemListener(new ItemListener() { |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
318 @Override |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
319 public void itemStateChanged(ItemEvent ie) { |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
320 if (ie.getStateChange() == ItemEvent.SELECTED) { |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
321 updateChart(); |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
322 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
323 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
324 }); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
325 |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
326 waterlevelTF = new JTextField(5); |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
327 |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
328 if (WATER_LEVEL != null) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
329 try { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
330 waterlevelTF.setText( |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
331 (lastWaterLevel = Double.valueOf(WATER_LEVEL)).toString()); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
332 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
333 catch (NumberFormatException nfe) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
334 System.err.println("Water level not a number: " + |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
335 nfe.getMessage()); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
336 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
337 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
338 |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
339 waterlevelTF.addActionListener(new ActionListener() { |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
340 @Override |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
341 public void actionPerformed(ActionEvent ae) { |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
342 waterLevelChanged(); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
343 } |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
344 }); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
345 |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
346 nav.add(waterlevelTF); |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
347 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
348 JButton dump = new JButton("dump"); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
349 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
350 dump.addActionListener(new ActionListener() { |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
351 @Override |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
352 public void actionPerformed(ActionEvent ae) { |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
353 dumpData(); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
354 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
355 }); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
356 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
357 nav.add(dump); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
358 |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
359 |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
360 chartPanel = createChartPanel(); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
361 |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
362 panel.add(chartPanel, BorderLayout.CENTER); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
363 |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
364 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
365 CrossSectionTableModel cstm = new CrossSectionTableModel(); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
366 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
367 cstm.addTableModelListener(new TableModelListener() { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
368 @Override |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
369 public void tableChanged(TableModelEvent e) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
370 updateChart(); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
371 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
372 }); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
373 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
374 JTable crossTable = new JTable(cstm); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
375 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
376 JPanel west = new JPanel(new BorderLayout()); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
377 JScrollPane scrollPane = new JScrollPane(crossTable); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
378 west.add(scrollPane); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
379 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
380 west.add(nav, BorderLayout.SOUTH); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
381 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
382 panel.add(west, BorderLayout.WEST); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
383 |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
384 return panel; |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
385 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
386 |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
387 protected void waterLevelChanged() { |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
388 String value = waterlevelTF.getText(); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
389 try { |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
390 lastWaterLevel = Double.valueOf(value); |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
391 } |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
392 catch (NumberFormatException nfe) { |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
393 waterlevelTF.setText( |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
394 lastWaterLevel != null ? lastWaterLevel.toString() : ""); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
395 return; |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
396 } |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
397 updateChart(); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
398 } |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
399 |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
400 protected void updateChart() { |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
401 |
1858
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
402 JFreeChart chart = createChart(); |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
403 |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
404 chartPanel.setChart(chart); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
405 } |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
406 |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
407 protected ChartPanel createChartPanel() { |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
408 |
1858
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
409 JFreeChart chart = createChart(); |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
410 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
411 return new ChartPanel(chart); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
412 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
413 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
414 protected void dumpData() { |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
415 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
416 CrossSectionLineItem csli = |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
417 (CrossSectionLineItem)crossSectionLinesCB.getSelectedItem(); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
418 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
419 if (csli == null) { |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
420 return; |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
421 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
422 |
1820
d562772a418e
CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1817
diff
changeset
|
423 double km = Math.round(csli.km.doubleValue() * 1000d)/1000d; |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
424 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
425 String kmS = String.valueOf(km).replace(".", "-"); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
426 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
427 int i = 1; |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
428 File file = new File("cross-section-" + kmS + ".txt"); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
429 while (file.exists()) { |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
430 file = new File("cross-section-" + kmS + "[" + (i++) + "].txt"); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
431 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
432 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
433 System.err.println("dump points to file '" + file + "'"); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
434 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
435 PrintWriter out = null; |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
436 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
437 MathContext mc = new MathContext(3); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
438 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
439 try { |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
440 out = |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
441 new PrintWriter( |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
442 new FileWriter(file)); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
443 |
1820
d562772a418e
CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1817
diff
changeset
|
444 for (Pair<CrossSection, CrossSectionLine> pair: csli.lines) { |
d562772a418e
CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1817
diff
changeset
|
445 out.println("# " + pair.getA().getDescription()); |
d562772a418e
CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1817
diff
changeset
|
446 for (CrossSectionPoint point: pair.getB().getPoints()) { |
d562772a418e
CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1817
diff
changeset
|
447 out.println( |
2655
60925be3c84f
Make it compilable again after signature change in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2652
diff
changeset
|
448 new BigDecimal(point.getX()).round(mc) + " " + |
60925be3c84f
Make it compilable again after signature change in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2652
diff
changeset
|
449 new BigDecimal(point.getY()).round(mc)); |
1820
d562772a418e
CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1817
diff
changeset
|
450 } |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
451 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
452 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
453 out.flush(); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
454 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
455 catch (IOException ioe) { |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
456 ioe.printStackTrace(); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
457 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
458 finally { |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
459 if (out != null) { |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
460 out.close(); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
461 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
462 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
463 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
464 |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
465 public void generateWaterLevels( |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
466 List<Point2D> points, |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
467 List<Pair<XYDataset, XYItemRenderer>> datasets |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
468 ) { |
1858
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
469 if (points == null || points.isEmpty() || lastWaterLevel == null) { |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
470 return; |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
471 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
472 |
2652
9d2a06c3a134
Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2017
diff
changeset
|
473 double [][] data = Lines.createWaterLines(points, lastWaterLevel).points; |
1858
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
474 XYSeries series = |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
475 new XYSeries(String.valueOf(lastWaterLevel), false); |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
476 |
1858
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
477 double [] x = data[0]; |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
478 double [] y = data[1]; |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
479 for (int i = 0; i < x.length; ++i) { |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
480 series.add(x[i], y[i], false); |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
481 } |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
482 |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
483 datasets.add(new Pair<XYDataset, XYItemRenderer>( |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
484 new XYSeriesCollection(series), null)); |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
485 } |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
486 |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
487 public void generateFill( |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
488 List<Point2D> points, |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
489 String legend, |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
490 List<Pair<XYDataset, XYItemRenderer>> datasets |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
491 ) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
492 if (points == null || points.isEmpty() || lastWaterLevel == null) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
493 return; |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
494 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
495 |
2652
9d2a06c3a134
Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2017
diff
changeset
|
496 double [][] data = Lines.createWaterLines(points, lastWaterLevel).points; |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
497 double [][] values = CrossSectionLine.fetchCrossSectionProfile(points); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
498 |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
499 DefaultXYDataset dataset = new DefaultXYDataset(); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
500 |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
501 dataset.addSeries(legend + "-Linie", values); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
502 dataset.addSeries(legend + "-Fl\u00e4che", data); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
503 |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
504 datasets.add(new Pair<XYDataset, XYItemRenderer>( |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
505 dataset, |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
506 new StableXYDifferenceRenderer( |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
507 TRANSPARENT, Color.blue, false))); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
508 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
509 |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
510 public void generateProfile( |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
511 List<Point2D> points, |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
512 String legend, |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
513 List<Pair<XYDataset, XYItemRenderer>> datasets |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
514 ) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
515 if (points == null || points.isEmpty()) { |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
516 return; |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
517 } |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
518 |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1122
diff
changeset
|
519 double [][] values = CrossSectionLine.fetchCrossSectionProfile(points); |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1122
diff
changeset
|
520 |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
521 XYSeries series = new XYSeries(legend, false); |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
522 |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
523 double [] x = values[0]; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
524 double [] y = values[1]; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
525 for (int i = 0; i < x.length; ++i) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
526 series.add(x[i], y[i], false); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
527 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
528 |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
529 datasets.add(new Pair<XYDataset, XYItemRenderer>( |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
530 new XYSeriesCollection(series), null));; |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
531 } |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
532 |
2017
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1884
diff
changeset
|
533 |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1884
diff
changeset
|
534 /** |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1884
diff
changeset
|
535 * @param legend the legend entry. |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1884
diff
changeset
|
536 */ |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
537 public void generateGround( |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
538 List<Point2D> points, |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
539 String legend, |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
540 List<Pair<XYDataset, XYItemRenderer>> datasets |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
541 ) { |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
542 if (points == null || points.isEmpty()) { |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
543 return; |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
544 } |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
545 |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
546 double [][] values = CrossSectionLine.fetchCrossSectionProfile(points); |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
547 |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
548 DefaultXYDataset dataset = new DefaultXYDataset(); |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
549 |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
550 dataset.addSeries(legend, values); |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
551 |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
552 StableXYDifferenceRenderer renderer = |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
553 new StableXYDifferenceRenderer(); |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
554 |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
555 datasets.add(new Pair<XYDataset, XYItemRenderer>( |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
556 dataset, renderer)); |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
557 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
558 |
1858
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
559 public List<Pair<XYDataset, XYItemRenderer>> generateDatasets() { |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
560 |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
561 List<Pair<XYDataset, XYItemRenderer>> datasets = |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
562 new ArrayList<Pair<XYDataset, XYItemRenderer>>(); |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
563 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
564 CrossSectionLineItem csli = |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
565 (CrossSectionLineItem)crossSectionLinesCB.getSelectedItem(); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
566 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
567 for (int i = 0; i < drawCrossSection.length; ++i) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
568 List<Point2D> points = null; |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
569 CrossSection cs = crossSections.get(i); |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
570 |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
571 if (drawGround[i]) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
572 for (Pair<CrossSection, CrossSectionLine> csl: csli.lines) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
573 if (csl.getA() == cs) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
574 if (points == null) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
575 points = csl.getB().fetchCrossSectionLinesPoints(); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
576 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
577 generateGround( |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
578 points, |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
579 cs.getDescription() + "/Boden", |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
580 datasets); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
581 break; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
582 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
583 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
584 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
585 |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
586 if (drawFill[i]) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
587 for (Pair<CrossSection, CrossSectionLine> csl: csli.lines) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
588 if (csl.getA() == cs) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
589 if (points == null) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
590 points = csl.getB().fetchCrossSectionLinesPoints(); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
591 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
592 |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
593 generateFill( |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
594 points, cs.getDescription(), datasets); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
595 break; |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
596 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
597 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
598 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
599 |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
600 if (drawCrossSection[i]) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
601 for (Pair<CrossSection, CrossSectionLine> csl: csli.lines) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
602 if (csl.getA() == cs) { |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
603 if (points == null) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
604 points = csl.getB().fetchCrossSectionLinesPoints(); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
605 } |
1858
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
606 |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
607 generateProfile( |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
608 points, cs.getDescription(), datasets); |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
609 break; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
610 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
611 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
612 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
613 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
614 if (drawWaterLevel[i]) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
615 for (Pair<CrossSection, CrossSectionLine> csl: csli.lines) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
616 if (csl.getA() == cs) { |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
617 if (points == null) { |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
618 points = csl.getB().fetchCrossSectionLinesPoints(); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
619 } |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
620 generateWaterLevels(points, datasets); |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
621 break; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
622 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
623 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
624 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
625 |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
626 } |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
627 |
1858
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
628 return datasets; |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
629 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
630 |
1817
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
631 protected Object [] createCrossSectionLineItems( |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
632 Map<Double, List<Pair<CrossSection, CrossSectionLine>>> km2lines |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
633 ) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
634 Object [] result = new Object[km2lines.size()]; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
635 int i = 0; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
636 for (Map.Entry<Double, List<Pair<CrossSection, CrossSectionLine>>> entry: |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
637 km2lines.entrySet()) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
638 result[i++] = new CrossSectionLineItem( |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
639 entry.getKey(), |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
640 entry.getValue()); |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
641 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
642 return result; |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
643 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
644 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
645 |
1858
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
646 public JFreeChart createChart() { |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
647 JFreeChart chart = ChartFactory.createXYLineChart( |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
648 null, |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
649 "Abstand [m]", |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
650 "H\u00f6he [m]", |
1858
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
651 null, |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
652 PlotOrientation.VERTICAL, |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
653 true, |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
654 true, |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
655 false); |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
656 |
1858
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
657 List<Pair<XYDataset, XYItemRenderer>> datasets = |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
658 generateDatasets(); |
1858
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
659 |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
660 XYPlot plot = chart.getXYPlot(); |
1858
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
661 |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
662 for (int i = 0, N = datasets.size(); i < N; ++i) { |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
663 Pair<XYDataset, XYItemRenderer> p = datasets.get(i); |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
664 plot.setDataset(i, p.getA()); |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
665 plot.mapDatasetToRangeAxis(i, 0); |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
666 XYItemRenderer renderer = p.getB(); |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
667 if (renderer != null) { |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
668 plot.setRenderer(i, renderer); |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
669 } |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
670 } |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
671 |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
672 NumberAxis yAxis = (NumberAxis)plot.getRangeAxis(); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
673 yAxis.setAutoRangeIncludesZero(false); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
674 |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
675 ChartUtilities.applyCurrentTheme(chart); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
676 return chart; |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
677 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
678 |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
679 protected static Paint createTransparentPaint() { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
680 BufferedImage texture = new BufferedImage( |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
681 1, 1, BufferedImage.TYPE_4BYTE_ABGR); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
682 |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
683 return new TexturePaint( |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
684 texture, new Rectangle2D.Double(0d, 0d, 0d, 0d)); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
685 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
686 |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
687 public static void main(String [] args) { |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
688 CrossSectionApp csa = new CrossSectionApp("Querprofile"); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
689 csa.pack(); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
690 RefineryUtilities.centerFrameOnScreen(csa); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
691 csa.setVisible(true); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
692 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
693 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
694 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |