Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/charts/CrossSectionApp.java @ 1909:4b64692b2d1e
Added methods to create WstValueTables ('interpolators') for specific columns of wsts.
flys-artifacts/trunk@3269 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 16 Nov 2011 14:47:02 +0000 |
parents | 4ae9c92feb8c |
children | e384d78ff78b |
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 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
81 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
|
82 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
|
83 { |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
938
diff
changeset
|
84 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
|
85 |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
86 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
|
87 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
88 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
|
89 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
90 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
|
91 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
92 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
|
93 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
94 protected JComboBox crossSectionLinesCB; |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
95 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
|
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 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
|
98 |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
99 protected Double lastWaterLevel; |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
100 |
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
|
101 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
|
102 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
|
103 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
|
104 protected boolean [] drawGround; |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
105 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
|
106 |
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
|
107 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
|
108 |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
109 protected static final Paint TRANSPARENT = createTransparentPaint(); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
110 |
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
|
111 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
|
112 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
113 @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
|
114 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
|
115 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
|
116 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
|
117 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
|
118 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
|
119 case 3: return "Boden"; |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
120 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
|
121 } |
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 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
|
123 } |
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 @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
|
126 public int getColumnCount() { |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
127 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
|
128 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
129 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
130 @Override |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
131 public int 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
|
132 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
|
133 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
134 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
135 @Override |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
136 public 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
|
137 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
|
138 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
|
139 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
|
140 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
|
141 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
|
142 case 3: return drawGround[row]; |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
143 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
|
144 } |
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 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
|
146 } |
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 @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
|
149 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
|
150 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
|
151 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
|
152 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
|
153 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
|
154 } |
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 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
|
156 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
|
157 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
|
158 fireTableCellUpdated(row, col); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
159 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
160 break; |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
161 case 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
|
162 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
|
163 fireTableCellUpdated(row, col); |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
164 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
165 break; |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
166 case 4: |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
167 if (change(drawFill, row, (Boolean)value)) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
168 fireTableCellUpdated(row, col); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
169 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
170 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
|
171 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
172 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
173 |
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 @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
|
175 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
|
176 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
|
177 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
|
178 case 1: |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
179 case 2: |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
180 case 3: |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
181 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
|
182 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
183 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
|
184 } |
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 @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
|
187 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
|
188 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
|
189 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
|
190 ) { |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
191 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
|
192 } |
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 } // 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
|
194 |
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 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
|
196 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
|
197 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
|
198 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
|
199 ) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
200 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
|
201 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
|
202 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
|
203 } |
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 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
|
205 } |
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 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
|
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 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
|
210 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
|
211 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
212 public CrossSectionLineItem( |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
213 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
|
214 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
|
215 ) { |
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 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
|
217 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
|
218 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
219 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
220 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
|
221 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
|
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 } // CrossSectionLineItem |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
224 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
225 public 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
|
226 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
|
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 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
|
229 .createSessionFactory() |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
230 .openSession(); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
231 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
232 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
|
233 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
|
234 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
|
235 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
236 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
237 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
238 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
|
239 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
|
240 "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
|
241 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
|
242 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
|
243 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
244 |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
245 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
|
246 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
|
247 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
|
248 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
|
249 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
|
250 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
|
251 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
|
252 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
|
253 List<Pair<CrossSection, CrossSectionLine>> ls |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
254 = 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
|
255 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
|
256 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
|
257 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
|
258 } |
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.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
|
260 } |
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 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
|
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 |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
265 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
|
266 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
|
267 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
268 |
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 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
|
270 |
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
|
271 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
|
272 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
|
273 |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
274 int CS = crossSections.size(); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
275 Arrays.fill(drawCrossSection = new boolean[CS], true); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
276 drawWaterLevel = new boolean[CS]; |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
277 drawGround = new boolean[CS]; |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
278 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
|
279 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
280 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
|
281 |
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 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
|
283 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
284 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
|
285 |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
286 if (KM != null) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
287 try { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
288 double km = Double.parseDouble(KM); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
289 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
290 CrossSectionLineItem found = null; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
291 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
292 for (Object o: clis) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
293 CrossSectionLineItem csli = (CrossSectionLineItem)o; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
294 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
|
295 found = csli; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
296 break; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
297 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
298 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
299 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
300 if (found != null) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
301 crossSectionLinesCB.setSelectedItem(found); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
302 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
303 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
304 catch (NumberFormatException nfe) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
305 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
|
306 + nfe.getMessage()); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
307 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
308 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
309 |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
310 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
|
311 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
312 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
|
313 @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
|
314 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
|
315 if (ie.getStateChange() == ItemEvent.SELECTED) { |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
316 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
|
317 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
318 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
319 }); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
320 |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
321 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
|
322 |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
323 if (WATER_LEVEL != null) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
324 try { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
325 waterlevelTF.setText( |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
326 (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
|
327 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
328 catch (NumberFormatException nfe) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
329 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
|
330 nfe.getMessage()); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
331 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
332 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
333 |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
334 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
|
335 @Override |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
336 public void actionPerformed(ActionEvent ae) { |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
337 waterLevelChanged(); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
338 } |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
339 }); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
340 |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
341 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
|
342 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
343 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
|
344 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
345 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
|
346 @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
|
347 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
|
348 dumpData(); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
349 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
350 }); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
351 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
352 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
|
353 |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
354 |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
355 chartPanel = createChartPanel(); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
356 |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
357 panel.add(chartPanel, BorderLayout.CENTER); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
358 |
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
|
359 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
360 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
|
361 |
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 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
|
363 @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
|
364 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
|
365 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
|
366 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
367 }); |
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 |
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 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
|
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 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
|
372 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
|
373 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
|
374 |
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 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
|
376 |
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 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
|
378 |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
379 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
|
380 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
381 |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
382 protected void waterLevelChanged() { |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
383 String value = waterlevelTF.getText(); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
384 try { |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
385 lastWaterLevel = Double.valueOf(value); |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
386 } |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
387 catch (NumberFormatException nfe) { |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
388 waterlevelTF.setText( |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
389 lastWaterLevel != null ? lastWaterLevel.toString() : ""); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
390 return; |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
391 } |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
392 updateChart(); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
393 } |
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 protected void 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 CrossSectionLineItem csli = |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
398 (CrossSectionLineItem)crossSectionLinesCB.getSelectedItem(); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
399 |
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
|
400 JFreeChart chart = createChart(); |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
401 |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
402 chartPanel.setChart(chart); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
403 } |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
404 |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
405 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
|
406 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
|
407 (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
|
408 |
1858
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
409 JFreeChart chart = createChart(); |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
410 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
411 return new ChartPanel(chart); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
412 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
413 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
414 protected void dumpData() { |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
415 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
416 CrossSectionLineItem csli = |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
417 (CrossSectionLineItem)crossSectionLinesCB.getSelectedItem(); |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
418 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
419 if (csli == null) { |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
420 return; |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
421 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
422 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
423 |
1820
d562772a418e
CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1817
diff
changeset
|
424 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
|
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 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
|
427 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
428 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
|
429 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
|
430 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
|
431 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
|
432 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
433 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
434 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
|
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 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
|
437 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
438 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
|
439 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
440 try { |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
441 out = |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
442 new PrintWriter( |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
443 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
|
444 |
1820
d562772a418e
CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1817
diff
changeset
|
445 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
|
446 out.println("# " + pair.getA().getDescription()); |
d562772a418e
CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1817
diff
changeset
|
447 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
|
448 out.println( |
d562772a418e
CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1817
diff
changeset
|
449 point.getX().round(mc) + " " + |
d562772a418e
CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1817
diff
changeset
|
450 point.getY().round(mc)); |
d562772a418e
CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1817
diff
changeset
|
451 } |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
452 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
453 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
454 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
|
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 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
|
457 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
|
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 finally { |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
460 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
|
461 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
|
462 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
463 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
464 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
465 |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
466 public void generateWaterLevels( |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
467 List<Point2D> points, |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
468 List<Pair<XYDataset, XYItemRenderer>> datasets |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
469 ) { |
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
|
470 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
|
471 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
|
472 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
473 |
1858
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
474 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
|
475 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
|
476 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
|
477 |
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
|
478 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
|
479 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
|
480 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
|
481 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
|
482 } |
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
|
483 |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
484 datasets.add(new Pair<XYDataset, XYItemRenderer>( |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
485 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
|
486 } |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
487 |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
488 public void generateFill( |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
489 List<Point2D> points, |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
490 String legend, |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
491 List<Pair<XYDataset, XYItemRenderer>> datasets |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
492 ) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
493 if (points == null || points.isEmpty() || lastWaterLevel == null) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
494 return; |
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 |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
497 double [][] data = Lines.createWaterLines(points, lastWaterLevel); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
498 double [][] values = CrossSectionLine.fetchCrossSectionProfile(points); |
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 DefaultXYDataset dataset = new DefaultXYDataset(); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
501 |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
502 dataset.addSeries(legend + "-Linie", values); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
503 dataset.addSeries(legend + "-Fl\u00e4che", data); |
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 datasets.add(new Pair<XYDataset, XYItemRenderer>( |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
506 dataset, |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
507 new StableXYDifferenceRenderer( |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
508 TRANSPARENT, Color.blue, false))); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
509 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
510 |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
511 public void generateProfile( |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
512 List<Point2D> points, |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
513 String legend, |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
514 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
|
515 ) { |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
516 if (points == null || points.isEmpty()) { |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
517 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
|
518 } |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
519 |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1122
diff
changeset
|
520 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
|
521 |
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
|
522 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
|
523 |
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
|
524 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
|
525 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
|
526 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
|
527 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
|
528 } |
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 |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
530 datasets.add(new Pair<XYDataset, XYItemRenderer>( |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
531 new XYSeriesCollection(series), null));; |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
532 } |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
533 |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
534 public void generateGround( |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
535 List<Point2D> points, |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
536 String legend, |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
537 List<Pair<XYDataset, XYItemRenderer>> datasets |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
538 ) { |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
539 if (points == null || points.isEmpty()) { |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
540 return; |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
541 } |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
542 |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
543 double [][] values = CrossSectionLine.fetchCrossSectionProfile(points); |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
544 |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
545 DefaultXYDataset dataset = new DefaultXYDataset(); |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
546 |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
547 XYSeries series = new XYSeries(legend, false); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
548 |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
549 dataset.addSeries(legend, values); |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
550 |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
551 StableXYDifferenceRenderer renderer = |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
552 new StableXYDifferenceRenderer(); |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
553 |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
554 datasets.add(new Pair<XYDataset, XYItemRenderer>( |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
555 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
|
556 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
557 |
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
|
558 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
|
559 |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
560 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
|
561 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
|
562 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
563 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
|
564 (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
|
565 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
566 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
|
567 List<Point2D> points = null; |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
568 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
|
569 |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
570 if (drawGround[i]) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
571 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
|
572 if (csl.getA() == cs) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
573 if (points == null) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
574 points = csl.getB().fetchCrossSectionLinesPoints(); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
575 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
576 generateGround( |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
577 points, |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
578 cs.getDescription() + "/Boden", |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
579 datasets); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
580 break; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
581 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
582 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
583 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
584 |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
585 if (drawFill[i]) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
586 for (Pair<CrossSection, CrossSectionLine> csl: csli.lines) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
587 if (csl.getA() == cs) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
588 if (points == null) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
589 points = csl.getB().fetchCrossSectionLinesPoints(); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
590 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
591 |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
592 generateFill( |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
593 points, cs.getDescription(), datasets); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
594 break; |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
595 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
596 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
597 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
598 |
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
|
599 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
|
600 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
|
601 if (csl.getA() == cs) { |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
602 if (points == null) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
603 points = csl.getB().fetchCrossSectionLinesPoints(); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
604 } |
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
|
605 |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
606 generateProfile( |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
607 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
|
608 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
|
609 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
610 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
611 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
612 |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
613 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
|
614 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
|
615 if (csl.getA() == cs) { |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
616 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
|
617 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
|
618 } |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
619 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
|
620 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
|
621 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
622 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
623 } |
595c404523a6
Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1651
diff
changeset
|
624 |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
625 } |
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
|
626 |
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
|
627 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
|
628 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
629 |
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
|
630 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
|
631 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
|
632 ) { |
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 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
|
634 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
|
635 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
|
636 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
|
637 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
|
638 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
|
639 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
|
640 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
641 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
|
642 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
643 |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
644 |
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
|
645 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
|
646 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
|
647 null, |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
648 "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
|
649 "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
|
650 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
|
651 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
|
652 true, |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
653 true, |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
654 false); |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
655 |
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
|
656 List<Pair<XYDataset, XYItemRenderer>> datasets = |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1858
diff
changeset
|
657 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
|
658 |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
659 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
|
660 |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
661 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
|
662 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
|
663 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
|
664 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
|
665 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
|
666 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
|
667 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
|
668 } |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
669 } |
94871b7ce9e9
CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1820
diff
changeset
|
670 |
938
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
671 NumberAxis yAxis = (NumberAxis)plot.getRangeAxis(); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
672 yAxis.setAutoRangeIncludesZero(false); |
bd3683453928
Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
936
diff
changeset
|
673 |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
674 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
|
675 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
|
676 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
677 |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
678 protected static Paint createTransparentPaint() { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
679 BufferedImage texture = new BufferedImage( |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
680 1, 1, BufferedImage.TYPE_4BYTE_ABGR); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
681 |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
682 return new TexturePaint( |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
683 texture, new Rectangle2D.Double(0d, 0d, 0d, 0d)); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
684 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
685 |
936
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
686 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
|
687 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
|
688 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
|
689 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
|
690 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
|
691 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
692 } |
759808931a2e
Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
693 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |