Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/charts/CrossSectionApp.java @ 2399:73b15736cb80
Improved the interface and implementations of Bounds.
flys-artifacts/trunk@4025 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 10 Feb 2012 10:43:29 +0000 |
parents | e384d78ff78b |
children | 9d2a06c3a134 |
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 |
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
|
5 import de.intevation.flys.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 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
32 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
|
33 |
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 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
|
35 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
|
36 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
|
37 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
|
38 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
|
39 |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
40 import java.awt.Color; |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
41 import java.awt.Paint; |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
42 import java.awt.TexturePaint; |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
43 |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
44 import java.awt.image.BufferedImage; |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
45 |
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
|
46 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
|
47 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
|
48 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
|
49 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
|
50 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
|
51 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
|
52 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
|
53 |
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 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
|
55 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
|
56 |
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 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
|
58 |
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 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
|
60 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
|
61 |
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 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
|
63 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
|
64 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
|
65 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
|
66 |
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 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
|
68 |
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 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
|
70 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
|
71 |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
72 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
|
73 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
|
74 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
|
75 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
|
76 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
|
77 |
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 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
|
79 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
|
80 |
2017
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1884
diff
changeset
|
81 /** |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1884
diff
changeset
|
82 * Standalone tech-demo. |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1884
diff
changeset
|
83 */ |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
84 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
|
85 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
|
86 { |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
938
diff
changeset
|
87 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
|
88 |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
89 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
|
90 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
91 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
|
92 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
93 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
|
94 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 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
|
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 JComboBox crossSectionLinesCB; |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
98 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
|
99 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 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
|
101 |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
102 protected Double lastWaterLevel; |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
103 |
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
|
104 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
|
105 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
|
106 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
|
107 protected boolean [] drawGround; |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
108 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
|
109 |
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
|
110 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
|
111 |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
112 protected static final Paint TRANSPARENT = createTransparentPaint(); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
113 |
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
|
114 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
|
115 |
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 @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
|
117 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
|
118 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
|
119 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
|
120 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
|
121 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
|
122 case 3: return "Boden"; |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
123 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
|
124 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
125 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
|
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 |
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 @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
|
129 public int getColumnCount() { |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
130 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
|
131 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
132 |
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 @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
|
134 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
|
135 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
|
136 } |
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 |
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 @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
|
139 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
|
140 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
|
141 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
|
142 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
|
143 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
|
144 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
|
145 case 3: return drawGround[row]; |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
146 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
|
147 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
148 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
|
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 |
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 @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
|
152 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
|
153 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
|
154 case 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
|
155 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
|
156 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
|
157 } |
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 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
|
159 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
|
160 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
|
161 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
|
162 } |
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 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
|
164 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
|
165 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
|
166 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
|
167 } |
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 break; |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
169 case 4: |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
170 if (change(drawFill, row, (Boolean)value)) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
171 fireTableCellUpdated(row, col); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
172 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
173 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
|
174 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
175 } |
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 @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
|
178 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
|
179 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
|
180 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
|
181 case 1: |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
182 case 2: |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
183 case 3: |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
184 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
|
185 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
186 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
|
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 |
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 @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
|
190 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
|
191 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
|
192 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
|
193 ) { |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
194 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
|
195 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
196 } // 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
|
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 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
|
199 boolean [] values, |
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 int index, |
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 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
|
202 ) { |
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 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
|
204 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
|
205 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
|
206 } |
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 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
|
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 |
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 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
|
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 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
|
213 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
|
214 |
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 public 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
|
216 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
|
217 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
|
218 ) { |
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 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
|
220 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
|
221 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
222 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
223 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
|
224 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
|
225 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
226 } // CrossSectionLineItem |
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 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
|
229 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
|
230 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
231 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
|
232 .createSessionFactory() |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
233 .openSession(); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
234 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
235 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
|
236 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
|
237 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
|
238 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
239 } |
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 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
|
242 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
|
243 "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
|
244 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
|
245 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
|
246 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
247 |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
248 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
|
249 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
|
250 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
|
251 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
|
252 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
|
253 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
|
254 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
|
255 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
|
256 List<Pair<CrossSection, CrossSectionLine>> ls |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
257 = 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
|
258 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
|
259 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
|
260 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
|
261 } |
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.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
|
263 } |
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 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
|
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 |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
268 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
|
269 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
|
270 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
271 |
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 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
|
273 |
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
|
274 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
|
275 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
|
276 |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
277 int CS = crossSections.size(); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
278 Arrays.fill(drawCrossSection = new boolean[CS], true); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
279 drawWaterLevel = new boolean[CS]; |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
280 drawGround = new boolean[CS]; |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
281 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
|
282 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
283 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
|
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 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
|
286 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
287 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
|
288 |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
289 if (KM != null) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
290 try { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
291 double km = Double.parseDouble(KM); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
292 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
293 CrossSectionLineItem found = null; |
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 for (Object o: clis) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
296 CrossSectionLineItem csli = (CrossSectionLineItem)o; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
297 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
|
298 found = csli; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
299 break; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
300 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
301 } |
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 if (found != null) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
304 crossSectionLinesCB.setSelectedItem(found); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
305 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
306 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
307 catch (NumberFormatException nfe) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
308 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
|
309 + nfe.getMessage()); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
310 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
311 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
312 |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
313 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
|
314 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
315 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
|
316 @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
|
317 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
|
318 if (ie.getStateChange() == ItemEvent.SELECTED) { |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
319 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
|
320 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
321 } |
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 |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
324 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
|
325 |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
326 if (WATER_LEVEL != null) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
327 try { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
328 waterlevelTF.setText( |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
329 (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
|
330 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
331 catch (NumberFormatException nfe) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
332 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
|
333 nfe.getMessage()); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
334 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
335 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
336 |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
337 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
|
338 @Override |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
339 public void actionPerformed(ActionEvent ae) { |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
340 waterLevelChanged(); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
341 } |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
342 }); |
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 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
|
345 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
346 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
|
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 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
|
349 @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
|
350 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
|
351 dumpData(); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
352 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
353 }); |
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 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
|
356 |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
357 |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
358 chartPanel = createChartPanel(); |
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 panel.add(chartPanel, BorderLayout.CENTER); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
361 |
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
|
362 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
363 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
|
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 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
|
366 @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
|
367 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
|
368 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
|
369 } |
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 }); |
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 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
|
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 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
|
375 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
|
376 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
|
377 |
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(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
|
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 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
|
381 |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
382 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
|
383 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
384 |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
385 protected void waterLevelChanged() { |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
386 String value = waterlevelTF.getText(); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
387 try { |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
388 lastWaterLevel = Double.valueOf(value); |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
389 } |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
390 catch (NumberFormatException nfe) { |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
391 waterlevelTF.setText( |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
392 lastWaterLevel != null ? lastWaterLevel.toString() : ""); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
393 return; |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
394 } |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
395 updateChart(); |
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 |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
398 protected void updateChart() { |
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 CrossSectionLineItem csli = |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
401 (CrossSectionLineItem)crossSectionLinesCB.getSelectedItem(); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
402 |
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
|
403 JFreeChart chart = createChart(); |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
404 |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
405 chartPanel.setChart(chart); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
406 } |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
407 |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
408 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
|
409 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
|
410 (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
|
411 |
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
|
412 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
|
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 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
|
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 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
417 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
|
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 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
|
420 (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
|
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 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
|
423 return; |
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 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
426 |
1820
d562772a418e
CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1817
diff
changeset
|
427 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
|
428 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
429 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
|
430 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
431 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
|
432 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
|
433 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
|
434 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
|
435 } |
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 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
|
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 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
|
440 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
441 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
|
442 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
443 try { |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
444 out = |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
445 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
|
446 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
|
447 |
1820
d562772a418e
CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1817
diff
changeset
|
448 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
|
449 out.println("# " + pair.getA().getDescription()); |
d562772a418e
CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1817
diff
changeset
|
450 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
|
451 out.println( |
d562772a418e
CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1817
diff
changeset
|
452 point.getX().round(mc) + " " + |
d562772a418e
CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1817
diff
changeset
|
453 point.getY().round(mc)); |
d562772a418e
CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1817
diff
changeset
|
454 } |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
455 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
456 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
457 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
|
458 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
459 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
|
460 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
|
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 finally { |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
463 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
|
464 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
|
465 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
466 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
467 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
468 |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
469 public void generateWaterLevels( |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
470 List<Point2D> points, |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
471 List<Pair<XYDataset, XYItemRenderer>> datasets |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
472 ) { |
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
|
473 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
|
474 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
|
475 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
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 [][] data = Lines.createWaterLines(points, lastWaterLevel); |
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 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
|
479 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
|
480 |
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
|
481 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
|
482 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
|
483 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
|
484 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
|
485 } |
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
|
486 |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
487 datasets.add(new Pair<XYDataset, XYItemRenderer>( |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
488 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
|
489 } |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
490 |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
491 public void generateFill( |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
492 List<Point2D> points, |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
493 String legend, |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
494 List<Pair<XYDataset, XYItemRenderer>> datasets |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
495 ) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
496 if (points == null || points.isEmpty() || lastWaterLevel == null) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
497 return; |
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 |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
500 double [][] data = Lines.createWaterLines(points, lastWaterLevel); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
501 double [][] values = CrossSectionLine.fetchCrossSectionProfile(points); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
502 |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
503 DefaultXYDataset dataset = new DefaultXYDataset(); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
504 |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
505 dataset.addSeries(legend + "-Linie", values); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
506 dataset.addSeries(legend + "-Fl\u00e4che", data); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
507 |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
508 datasets.add(new Pair<XYDataset, XYItemRenderer>( |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
509 dataset, |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
510 new StableXYDifferenceRenderer( |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
511 TRANSPARENT, Color.blue, false))); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
512 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
513 |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
514 public void generateProfile( |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
515 List<Point2D> points, |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
516 String legend, |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
517 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
|
518 ) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
519 if (points == null || points.isEmpty()) { |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
520 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
|
521 } |
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 |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1122
diff
changeset
|
523 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
|
524 |
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
|
525 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
|
526 |
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
|
527 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
|
528 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
|
529 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
|
530 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
|
531 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
532 |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
533 datasets.add(new Pair<XYDataset, XYItemRenderer>( |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
534 new XYSeriesCollection(series), null));; |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
535 } |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
536 |
2017
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1884
diff
changeset
|
537 |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1884
diff
changeset
|
538 /** |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1884
diff
changeset
|
539 * @param legend the legend entry. |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1884
diff
changeset
|
540 */ |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
541 public void generateGround( |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
542 List<Point2D> points, |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
543 String legend, |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
544 List<Pair<XYDataset, XYItemRenderer>> datasets |
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 if (points == null || points.isEmpty()) { |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
547 return; |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
548 } |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
549 |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
550 double [][] values = CrossSectionLine.fetchCrossSectionProfile(points); |
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 DefaultXYDataset dataset = new DefaultXYDataset(); |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
553 |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
554 XYSeries series = new XYSeries(legend, false); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
555 |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
556 dataset.addSeries(legend, values); |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
557 |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
558 StableXYDifferenceRenderer renderer = |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
559 new StableXYDifferenceRenderer(); |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
560 |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
561 datasets.add(new Pair<XYDataset, XYItemRenderer>( |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
562 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
|
563 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
564 |
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
|
565 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
|
566 |
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
|
567 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
|
568 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
|
569 |
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 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
|
571 (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
|
572 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
573 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
|
574 List<Point2D> points = null; |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
575 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
|
576 |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
577 if (drawGround[i]) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
578 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
|
579 if (csl.getA() == cs) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
580 if (points == null) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
581 points = csl.getB().fetchCrossSectionLinesPoints(); |
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 generateGround( |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
584 points, |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
585 cs.getDescription() + "/Boden", |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
586 datasets); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
587 break; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
588 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
589 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
590 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
591 |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
592 if (drawFill[i]) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
593 for (Pair<CrossSection, CrossSectionLine> csl: csli.lines) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
594 if (csl.getA() == cs) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
595 if (points == null) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
596 points = csl.getB().fetchCrossSectionLinesPoints(); |
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 generateFill( |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
600 points, cs.getDescription(), datasets); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
601 break; |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
602 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
603 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
604 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
605 |
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
|
606 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
|
607 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
|
608 if (csl.getA() == cs) { |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
609 if (points == null) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
610 points = csl.getB().fetchCrossSectionLinesPoints(); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
611 } |
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
|
612 |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
613 generateProfile( |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
614 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
|
615 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
|
616 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
617 } |
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 } |
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 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
620 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
|
621 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
|
622 if (csl.getA() == cs) { |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
623 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
|
624 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
|
625 } |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
626 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
|
627 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
|
628 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
629 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
630 } |
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 |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
632 } |
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
|
633 |
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
|
634 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
|
635 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
636 |
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
|
637 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
|
638 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
|
639 ) { |
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 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
|
641 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
|
642 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
|
643 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
|
644 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
|
645 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
|
646 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
|
647 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
648 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
|
649 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
650 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
651 |
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
|
652 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
|
653 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
|
654 null, |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
655 "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
|
656 "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
|
657 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
|
658 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
|
659 true, |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
660 true, |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
661 false); |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
662 |
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
|
663 List<Pair<XYDataset, XYItemRenderer>> datasets = |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
664 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
|
665 |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
666 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
|
667 |
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 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
|
669 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
|
670 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
|
671 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
|
672 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
|
673 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
|
674 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
|
675 } |
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
|
676 } |
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
|
677 |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
678 NumberAxis yAxis = (NumberAxis)plot.getRangeAxis(); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
679 yAxis.setAutoRangeIncludesZero(false); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
680 |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
681 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
|
682 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
|
683 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
684 |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
685 protected static Paint createTransparentPaint() { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
686 BufferedImage texture = new BufferedImage( |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
687 1, 1, BufferedImage.TYPE_4BYTE_ABGR); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
688 |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
689 return new TexturePaint( |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
690 texture, new Rectangle2D.Double(0d, 0d, 0d, 0d)); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
691 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
692 |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
693 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
|
694 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
|
695 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
|
696 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
|
697 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
|
698 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
699 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
700 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |