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