1 |
package skrueger.geotools; |
package skrueger.geotools; |
2 |
|
|
3 |
import java.awt.BorderLayout; |
import java.awt.BorderLayout; |
4 |
|
import java.awt.Window; |
5 |
|
|
6 |
import javax.swing.BorderFactory; |
import javax.swing.BorderFactory; |
7 |
import javax.swing.JComponent; |
import javax.swing.JComponent; |
9 |
import javax.swing.JSplitPane; |
import javax.swing.JSplitPane; |
10 |
|
|
11 |
import org.apache.log4j.Logger; |
import org.apache.log4j.Logger; |
12 |
|
import org.geotools.renderer.lite.StreamingRenderer; |
13 |
|
import org.geotools.renderer.shape.ShapefileRenderer; |
14 |
|
|
15 |
import schmitzm.geotools.gui.GeoMapPane; |
import schmitzm.geotools.gui.GeoMapPane; |
16 |
import schmitzm.geotools.gui.JMapPane; |
import schmitzm.geotools.gui.JMapPane; |
17 |
import schmitzm.geotools.gui.MapContextControlPane; |
import schmitzm.geotools.gui.MapContextControlPane; |
18 |
import schmitzm.geotools.gui.MapPaneStatusBar; |
import schmitzm.geotools.gui.MapPaneStatusBar; |
19 |
import schmitzm.geotools.styling.ColorMapManager; |
import schmitzm.geotools.styling.ColorMapManager; |
|
import schmitzm.swing.SwingUtil; |
|
20 |
|
|
21 |
/** |
/** |
22 |
* Achtung! Dieser code ist verwuestet |
* Achtung! Dieser code ist verwuestet |
|
*/ |
|
|
|
|
|
/** |
|
23 |
* TODO DOKU und initialize schöner machen. SK |
* TODO DOKU und initialize schöner machen. SK |
24 |
*/ |
*/ |
25 |
public class MapView extends JPanel { |
public class MapView extends JPanel { |
26 |
private static final Logger LOGGER = Logger.getLogger(MapView.class); |
private static final Logger LOGGER = Logger.getLogger(MapView.class); |
27 |
|
|
28 |
private final JSplitPane splitPane = new JSplitPane( |
public final JSplitPane splitPane = new JSplitPane( |
29 |
JSplitPane.HORIZONTAL_SPLIT); |
JSplitPane.HORIZONTAL_SPLIT); |
30 |
|
|
31 |
protected MapPaneStatusBar statusBar = null; |
protected MapPaneStatusBar statusBar = null; |
32 |
|
|
33 |
/** |
/** |
34 |
* Komponente, in der die Karten, der Massstab und das Koordinaten-Raster |
* Komponente, in der die Karten, der Massstab und das Koordinaten-Raster |
35 |
* dargestellt werden |
* dargestellt werden. |
36 |
*/ |
*/ |
37 |
protected final GeoMapPane geoMapPane = new GeoMapPane(); |
|
38 |
|
/** |
39 |
|
* SK: 21.6.09: ShapeFileRenderer is supposed to be about 5x faster on |
40 |
|
* ShapeFiles. The ShapeFileRenderer falls back to the |
41 |
|
* StreamingRenderer. |
42 |
|
*/ |
43 |
|
// Old code: |
44 |
|
// protected final GeoMapPane geoMapPane = new GeoMapPane(null,null,null,null, new StreamingRenderer()); |
45 |
|
|
46 |
|
// New Code uses Streaming renderer. |
47 |
|
protected final GeoMapPane geoMapPane = new GeoMapPane(null,null,null,null, new StreamingRenderer()); |
48 |
|
|
49 |
private MapPaneToolBar jToolBar; |
private MapPaneToolBar jToolBar; |
50 |
|
|
53 |
* {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left, |
* {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left, |
54 |
* and some buttons floating over the {@link JMapPane} |
* and some buttons floating over the {@link JMapPane} |
55 |
*/ |
*/ |
56 |
public MapView(MapPaneToolBar toolBar) { |
public MapView(Window parentGui, MapPaneToolBar toolBar) { |
57 |
super(new BorderLayout()); |
super(new BorderLayout()); |
58 |
// Call initialize() by yourself afterwards. |
// Call initialize() by yourself afterwards. |
59 |
// Needed because variables for the overwritten methods |
// Needed because variables for the overwritten methods |
60 |
// are not yet set. |
// are not yet set. |
61 |
getGeoMapPane().getMapPane().setWaitCursorComponent(SwingUtil.getParentWindow(this)); |
getGeoMapPane().getMapPane().setWaitCursorComponent(parentGui); |
62 |
if ( toolBar == null ) |
if ( toolBar == null ) |
63 |
toolBar = new MapPaneToolBar(getMapPane()); |
toolBar = new MapPaneToolBar(getMapPane()); |
64 |
jToolBar = toolBar; |
jToolBar = toolBar; |
69 |
* {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left, |
* {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left, |
70 |
* and some buttons floating over the {@link JMapPane} |
* and some buttons floating over the {@link JMapPane} |
71 |
*/ |
*/ |
72 |
public MapView() { |
public MapView(Window parentGui) { |
73 |
this(null); |
this(parentGui, null); |
74 |
} |
} |
75 |
|
|
76 |
/** |
/** |
80 |
*/ |
*/ |
81 |
public void initialize() { |
public void initialize() { |
82 |
// horizontales SplitPane initialisieren |
// horizontales SplitPane initialisieren |
83 |
|
// Status-Line to show Coordinates and Rastervalues. |
|
// Status-Zeile |
|
84 |
statusBar = new MapPaneStatusBar(getGeoMapPane() |
statusBar = new MapPaneStatusBar(getGeoMapPane() |
85 |
.getMapPane()); |
.getMapPane()); |
86 |
statusBar.setBorder(BorderFactory.createCompoundBorder(BorderFactory |
statusBar.setBorder(BorderFactory.createCompoundBorder(BorderFactory |
88 |
5, 2, 5))); |
5, 2, 5))); |
89 |
this.add(statusBar, BorderLayout.SOUTH); |
this.add(statusBar, BorderLayout.SOUTH); |
90 |
|
|
91 |
splitPane.setDividerLocation(0.4); |
splitPane.setDividerLocation(-1); |
92 |
splitPane.setDividerSize(5); |
splitPane.setDividerSize(5); |
93 |
|
|
94 |
|
splitPane.setResizeWeight(0.0); |
95 |
splitPane.add(getSidePane()); |
splitPane.add(getSidePane()); |
96 |
|
|
97 |
/*********************************************************************** |
/*********************************************************************** |