annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/charts/CrossSectionApp.java @ 1881:0e9c0b49b4ef

CrossSectionApp: draw ground with StableXYDifferenceRenderer flys-artifacts/trunk@3240 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sat, 12 Nov 2011 12:05:37 +0000
parents 94871b7ce9e9
children eb671699fbc2
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;
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
25
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 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
27 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
28 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
29 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
30
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 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
32
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
33 import java.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
34 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
35 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
36 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
37 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
38
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
39 import 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
40 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
41 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
42 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
43 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
44 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
45 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
46
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.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
48 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
49
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.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
51
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 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
53 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
54
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
55 import 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
56 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
57 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
58 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
59
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
60 import org.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
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.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
63 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
64
1881
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
65 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
66 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
67 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
68 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
69 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
70
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
71 import org.jfree.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
72 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
73
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
74 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
75 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
76 {
1122
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 938
diff changeset
77 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
78
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
79 public static final double EPSILON = 1e-4;
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 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
82
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
83 protected JComboBox crossSectionLinesCB;
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
84 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
85
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
86 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
87
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
88 protected Double lastWaterLevel;
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
89
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
90 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
91 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
92 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
93 protected boolean [] drawGround;
936
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
94
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
95 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
96
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
97 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
98
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
99 @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
100 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
101 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
102 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
103 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
104 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
105 case 3: return "Boden";
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
106 }
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 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
108 }
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
109
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
110 @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
111 public int getColumnCount() {
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 return 4;
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 }
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
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 @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
116 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
117 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
118 }
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
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
120 @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
121 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
122 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
123 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
124 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
125 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
126 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
127 case 3: return drawGround[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
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 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
130 }
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
131
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
132 @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
133 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
134 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
135 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
136 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
137 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
138 }
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
139 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
140 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
141 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
142 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
143 }
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 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
145 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
146 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
147 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
148 }
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 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
150 }
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
151 }
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
152
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
153 @Override
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
154 public 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
155 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
156 case 0: return String.class;
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 case 1: return Boolean.class;
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 case 2: return Boolean.class;
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
159 case 3: return Boolean.class;
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 }
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 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
162 }
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
163
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 @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
165 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
166 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
167 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
168 ) {
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
169 return columnIndex >= 1 && columnIndex <= 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
170 }
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 } // 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
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 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
174 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
175 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
176 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
177 ) {
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
178 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
179 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
180 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
181 }
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 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
183 }
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 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
186
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 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
188 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
189
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
190 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
191 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
192 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
193 ) {
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 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
195 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
196 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
197
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
198 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
199 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
200 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
201 } // CrossSectionLineItem
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
202
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
203 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
204 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
205
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
206 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
207 .createSessionFactory()
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
208 .openSession();
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
209
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
210 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
211 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
212 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
213
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
214 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
215
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
216 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
217 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
218 "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
219 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
220 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
221 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
222
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
223 protected Map<Double, List<Pair<CrossSection, CrossSectionLine>>> loadAllLines(
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
224 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
225 ) {
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
226 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
227 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
228 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
229 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
230 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
231 Double km = Math.round(csl.getKm().doubleValue() * 1000d)/1000d;
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
232 List<Pair<CrossSection, CrossSectionLine>> ls = km2lines.get(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
233 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
234 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
235 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
236 }
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
237 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
238 }
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
239 }
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
240 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
241 }
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
242
936
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
243 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
244 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
245
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
246
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
247 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
248
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
249 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
250 km2lines = loadAllLines(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
251 drawCrossSection = new boolean[crossSections.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
252 Arrays.fill(drawCrossSection, true);
936
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
253
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
254 drawWaterLevel = new boolean[crossSections.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
255 drawGround = new boolean[crossSections.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
256
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 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
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 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
260
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
261 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
262
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
263 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
264
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
265 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
266 @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
267 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
268 if (ie.getStateChange() == ItemEvent.SELECTED) {
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
269 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
270 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
271 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
272 });
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
273
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
274 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
275
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
276 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
277 @Override
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
278 public void actionPerformed(ActionEvent ae) {
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
279 waterLevelChanged();
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
280 }
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
281 });
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
282
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
283 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
284
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
285 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
286
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
287 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
288 @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
289 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
290 dumpData();
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
291 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
292 });
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
293
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
294 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
295
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
296
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
297 chartPanel = createChartPanel();
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
298
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
299 panel.add(chartPanel, BorderLayout.CENTER);
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
300
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
301
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
302 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
303
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
304 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
305 @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
306 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
307 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
308 }
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
309 });
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
310
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
311 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
312
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 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
314 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
315 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
316
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
317 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
318
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
319 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
320
936
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
321 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
322 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
323
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
324 protected void waterLevelChanged() {
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
325 String value = waterlevelTF.getText();
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
326 try {
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
327 lastWaterLevel = Double.parseDouble(value);
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
328 }
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
329 catch (NumberFormatException nfe) {
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
330 waterlevelTF.setText(
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
331 lastWaterLevel != null ? lastWaterLevel.toString() : "");
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
332 return;
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
333 }
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
334 updateChart();
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
335 }
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
336
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
337 protected void updateChart() {
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 CrossSectionLineItem csli =
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
340 (CrossSectionLineItem)crossSectionLinesCB.getSelectedItem();
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
341
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
342 JFreeChart chart = createChart();
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
343
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
344 chartPanel.setChart(chart);
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
345 }
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
346
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 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
348 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
349 (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
350
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
351 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
352
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
353 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
354 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
355
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
356 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
357
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
358 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
359 (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
360
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
361 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
362 return;
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
363 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
364
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
365
1820
d562772a418e CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1817
diff changeset
366 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
367
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
368 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
369
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
370 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
371 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
372 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
373 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
374 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
375
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
376 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
377
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
378 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
379
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
380 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
381
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
382 try {
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
383 out =
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
384 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
385 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
386
1820
d562772a418e CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1817
diff changeset
387 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
388 out.println("# " + pair.getA().getDescription());
d562772a418e CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1817
diff changeset
389 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
390 out.println(
d562772a418e CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1817
diff changeset
391 point.getX().round(mc) + " " +
d562772a418e CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1817
diff changeset
392 point.getY().round(mc));
d562772a418e CrossSectionApp: Re-enabled dumping data to disk.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1817
diff changeset
393 }
936
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
394 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
395
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
396 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
397 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
398 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
399 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
400 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
401 finally {
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
402 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
403 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
404 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
405 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
406 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
407
1881
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
408 public void generateWaterLevels(
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
409 List<Point2D> points,
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
410 List<Pair<XYDataset, XYItemRenderer>> datasets
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
411 ) {
1858
94871b7ce9e9 CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1820
diff changeset
412 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
413 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
414 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
415
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
416 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
417 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
418 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
419
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
420 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
421 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
422 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
423 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
424 }
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
425
1881
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
426 datasets.add(new Pair<XYDataset, XYItemRenderer>(
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
427 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
428 }
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
429
1881
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
430 public void generateProfile(
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
431 List<Point2D> points,
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
432 String legend,
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
433 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
434 ) {
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
435 if (points == null || points.isEmpty()) {
1881
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
436 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
437 }
936
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
438
1651
a7def20539fb flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1122
diff changeset
439 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
440
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
441 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
442
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
443 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
444 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
445 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
446 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
447 }
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
448
1881
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
449 datasets.add(new Pair<XYDataset, XYItemRenderer>(
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
450 new XYSeriesCollection(series), null));;
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
451 }
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
452
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
453 public void generateGround(
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
454 List<Point2D> points,
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
455 String legend,
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
456 List<Pair<XYDataset, XYItemRenderer>> datasets
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
457 ) {
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
458 if (points == null || points.isEmpty()) {
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
459 return;
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
460 }
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
461
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
462 double [][] values = CrossSectionLine.fetchCrossSectionProfile(points);
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
463
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
464 DefaultXYDataset dataset = new DefaultXYDataset();
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
465 dataset.addSeries(legend, values);
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
466
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
467 StableXYDifferenceRenderer renderer =
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
468 new StableXYDifferenceRenderer();
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
469
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
470 datasets.add(new Pair<XYDataset, XYItemRenderer>(
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
471 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
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 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
475
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 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
477 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
478
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
479 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
480 (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
481
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
482 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
483 List<Point2D> points = null;
1881
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
484 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
485
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 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
487 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
488 if (csl.getA() == cs) {
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
489 points = csl.getB().fetchCrossSectionLinesPoints();
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
490
1881
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
491 generateProfile(
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
492 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
493 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
494 }
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
495 }
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
496 }
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
497
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
498 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
499 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
500 if (csl.getA() == cs) {
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
501 if (points != 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
502 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
503 }
1881
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
504 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
505 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
506 }
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
507 }
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
508 }
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
509
1881
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
510 if (drawGround[i]) {
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
511 for (Pair<CrossSection, CrossSectionLine> csl: csli.lines) {
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
512 if (csl.getA() == cs) {
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
513 if (points != null) {
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
514 points = csl.getB().fetchCrossSectionLinesPoints();
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
515 }
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
516 generateGround(
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
517 points,
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
518 cs.getDescription() + "/Boden",
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
519 datasets);
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
520 break;
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
521 }
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
522 }
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
523 }
936
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
524 }
1817
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
525
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
526 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
527 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
528
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
529 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
530 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
531 ) {
595c404523a6 Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1651
diff changeset
532 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
533 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
534 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
535 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
536 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
537 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
538 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
539 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
540 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
541 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
542
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
543
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
544 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
545 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
546 null,
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
547 "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
548 "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
549 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
550 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
551 true,
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
552 true,
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
553 false);
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
554
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
555 List<Pair<XYDataset, XYItemRenderer>> datasets =
1881
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1858
diff changeset
556 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
557
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
558 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
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 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
561 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
562 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
563 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
564 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
565 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
566 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
567 }
94871b7ce9e9 CrossSectionApp: split curves in separated datasets to make them renderable with different renderers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1820
diff changeset
568 }
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
569
938
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
570 NumberAxis yAxis = (NumberAxis)plot.getRangeAxis();
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
571 yAxis.setAutoRangeIncludesZero(false);
bd3683453928 Debugged the water fill algorithm.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 936
diff changeset
572
936
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
573 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
574 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
575 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
576
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
577 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
578 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
579 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
580 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
581 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
582 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
583 }
759808931a2e Add Swing standalone app to test/develope cross sections directly from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
584 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org