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 |
|
|
14 |
import schmitzm.geotools.gui.GeoMapPane; |
import schmitzm.geotools.gui.GeoMapPane; |
15 |
import schmitzm.geotools.gui.JMapPane; |
import schmitzm.geotools.gui.JMapPane; |
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 |
public final JSplitPane splitPane = new JSplitPane( |
private 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 StreamingRenderer()); |
47 |
|
|
48 |
private MapPaneToolBar jToolBar; |
private MapPaneToolBar jToolBar; |
49 |
|
|
73 |
} |
} |
74 |
|
|
75 |
/** |
/** |
76 |
* Calls #getSidePanel() which can be overwritten. |
* This routine creates the main components of the GUI: The left Side and the map on the right side.<br/> |
77 |
|
* Calls #getSidePanel() which can be overwritten (call super!).<br/> |
78 |
|
* |
79 |
|
* This method initialized the variables {@link #statusBar} and {@link #splitPane} |
80 |
* |
* |
81 |
* @see #adjustSizeOfGeoMapPane() |
* @see #adjustSizeOfGeoMapPane() |
82 |
*/ |
*/ |
83 |
public void initialize() { |
public void initialize() { |
84 |
// horizontales SplitPane initialisieren |
// horizontales SplitPane initialisieren |
85 |
// SK 19.6.09: Removed because we are not using it. Probably a test. |
|
86 |
// // Status-Zeile |
// Status-Line to show Coordinates and Rastervalues. |
87 |
// statusBar = new MapPaneStatusBar(getGeoMapPane() |
statusBar = new MapPaneStatusBar(getGeoMapPane() |
88 |
// .getMapPane()); |
.getMapPane()); |
89 |
// statusBar.setBorder(BorderFactory.createCompoundBorder(BorderFactory |
statusBar.setBorder(BorderFactory.createCompoundBorder(BorderFactory |
90 |
// .createLoweredBevelBorder(), BorderFactory.createEmptyBorder(2, |
.createLoweredBevelBorder(), BorderFactory.createEmptyBorder(2, |
91 |
// 5, 2, 5))); |
5, 2, 5))); |
92 |
// this.add(statusBar, BorderLayout.SOUTH); |
this.add(statusBar, BorderLayout.SOUTH); |
93 |
|
|
|
splitPane.setDividerLocation(-1); |
|
|
splitPane.setDividerSize(5); |
|
94 |
|
|
95 |
splitPane.setResizeWeight(0.0); |
/** |
96 |
splitPane.add(getSidePane()); |
* The layout of the split pane can be configured in the atlas. |
97 |
|
*/ |
98 |
|
getSplitPane().setDividerSize(5); |
99 |
|
getSplitPane().setDividerLocation(-1); |
100 |
|
|
101 |
|
getSplitPane().setResizeWeight(0.0); |
102 |
|
getSplitPane().add(getSidePane()); |
103 |
|
|
104 |
/*********************************************************************** |
/*********************************************************************** |
105 |
* To the right side we now add a JPanel that consists of a toolbar and |
* To the right side we now add a JPanel that consists of a toolbar and |
108 |
JPanel newRight = new JPanel(new BorderLayout()); |
JPanel newRight = new JPanel(new BorderLayout()); |
109 |
newRight.add(getToolBar(), BorderLayout.NORTH); |
newRight.add(getToolBar(), BorderLayout.NORTH); |
110 |
newRight.add(getGeoMapPane(), BorderLayout.CENTER); |
newRight.add(getGeoMapPane(), BorderLayout.CENTER); |
111 |
splitPane.add(newRight); |
getSplitPane().add(newRight); |
112 |
|
|
113 |
this.add(splitPane, BorderLayout.CENTER); |
this.add(getSplitPane(), BorderLayout.CENTER); |
114 |
} |
} |
115 |
|
|
116 |
/** |
/** |
125 |
* Returns the split pane which divides the layer list from the map panel. |
* Returns the split pane which divides the layer list from the map panel. |
126 |
*/ |
*/ |
127 |
public JSplitPane getSplitPane() { |
public JSplitPane getSplitPane() { |
128 |
return this.splitPane; |
return splitPane; |
129 |
} |
} |
130 |
|
|
131 |
|
|