/[schmitzm]/trunk/src/skrueger/geotools/MapView.java
ViewVC logotype

Diff of /trunk/src/skrueger/geotools/MapView.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 48 by alfonx, Fri Apr 17 12:49:33 2009 UTC revision 164 by alfonx, Tue Jun 23 16:06:23 2009 UTC
# Line 1  Line 1 
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;
# Line 8  import javax.swing.JPanel; Line 9  import javax.swing.JPanel;
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;
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 {
# Line 33  public class MapView extends JPanel { Line 31  public class MapView extends JPanel {
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            
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          protected final GeoMapPane geoMapPane = new GeoMapPane();          // 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    
# Line 44  public class MapView extends JPanel { Line 52  public class MapView extends JPanel {
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;
# Line 60  public class MapView extends JPanel { Line 68  public class MapView extends JPanel {
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          /**          /**
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                    
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
# Line 80  public class MapView extends JPanel { Line 91  public class MapView extends JPanel {
91                                  5, 2, 5)));                                  5, 2, 5)));
92                  this.add(statusBar, BorderLayout.SOUTH);                  this.add(statusBar, BorderLayout.SOUTH);
93    
94                  splitPane.setDividerLocation(0.4);                  
95                  splitPane.setDividerSize(5);                  /**
96                     * The layout of the split pane can be configured in the atlas.
97                  splitPane.add(getSidePane());                   */
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
# Line 92  public class MapView extends JPanel { Line 108  public class MapView extends JPanel {
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          /**          /**
# Line 109  public class MapView extends JPanel { Line 125  public class MapView extends JPanel {
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    

Legend:
Removed from v.48  
changed lines
  Added in v.164

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26