annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/charts/CrossSectionApp.java @ 4015:7f8d92873d58

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

http://dive4elements.wald.intevation.org