/[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 164 by alfonx, Tue Jun 23 16:06:23 2009 UTC revision 165 by alfonx, Tue Jun 23 16:31:32 2009 UTC
# Line 18  import schmitzm.geotools.gui.MapPaneStat Line 18  import schmitzm.geotools.gui.MapPaneStat
18  import schmitzm.geotools.styling.ColorMapManager;  import schmitzm.geotools.styling.ColorMapManager;
19    
20  /**  /**
21   * Achtung! Dieser code ist verwuestet   * Achtung! Dieser code ist verwuestet TODO DOKU und initialize schöner machen.
22   * TODO DOKU und initialize schöner machen. SK   * 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);
# Line 28  public class MapView extends JPanel { Line 28  public class MapView extends JPanel {
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            
37          /**          /**
38           * SK: 21.6.09: ShapeFileRenderer is supposed to be about 5x faster on           * SK: 21.6.09: ShapeFileRenderer is supposed to be about 5x faster on
39           * ShapeFiles. The ShapeFileRenderer falls back to the           * ShapeFiles. The ShapeFileRenderer falls back to the StreamingRenderer.
          * StreamingRenderer.  
40           */           */
41          // Old code:          // Old code:
42          //      protected final GeoMapPane geoMapPane = new GeoMapPane(null,null,null,null, new StreamingRenderer());          // protected final GeoMapPane geoMapPane = new
43                    // GeoMapPane(null,null,null,null, new StreamingRenderer());
44          // New Code uses Streaming renderer.          // New Code uses Streaming renderer.
45          protected final GeoMapPane geoMapPane = new GeoMapPane(null,null,null,null, new StreamingRenderer());          protected final GeoMapPane geoMapPane = new GeoMapPane(null, null, null,
46                            null, new StreamingRenderer());
47    
48          private MapPaneToolBar jToolBar;          private MapPaneToolBar jToolBar;
49    
50          /**          /**
51           * Creates a new {@link MapView}. A {@link MapView} is a combination of a           * Creates a new {@link MapView}. A {@link MapView} is a combination of a
52           * {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left,           * {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left, and
53           * and some buttons floating over the {@link JMapPane}           * some buttons floating over the {@link JMapPane}
54           */           */
55          public MapView(Window parentGui, MapPaneToolBar toolBar) {          public MapView(Window parentGui, MapPaneToolBar toolBar) {
56                  super(new BorderLayout());                  super(new BorderLayout());
# Line 58  public class MapView extends JPanel { Line 58  public class MapView extends JPanel {
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(parentGui);                  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;
64          }          }
65    
66      /**          /**
67       * Creates a new {@link MapView}. A {@link MapView} is a combination of a           * Creates a new {@link MapView}. A {@link MapView} is a combination of a
68       * {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left,           * {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left, and
69       * and some buttons floating over the {@link JMapPane}           * some buttons floating over the {@link JMapPane}
70       */           */
71      public MapView(Window parentGui) {          public MapView(Window parentGui) {
72        this(parentGui, null);                  this(parentGui, null);
73      }          }
74    
75          /**          /**
76           * This routine creates the main components of the GUI: The left Side and the map on the right side.<br/>           * This routine creates the main components of the GUI: The left Side and
77             * the map on the right side.<br/>
78           * Calls #getSidePanel() which can be overwritten (call super!).<br/>           * Calls #getSidePanel() which can be overwritten (call super!).<br/>
79           *           *
80           * This method initialized the variables {@link #statusBar} and {@link #splitPane}           * This method initialized the variables {@link #statusBar} and
81             * {@link #splitPane}
82           *           *
83           * @see #adjustSizeOfGeoMapPane()           * @see #adjustSizeOfGeoMapPane()
84           */           */
85          public void initialize() {          public void initialize() {
86                  // horizontales SplitPane initialisieren                  // horizontales SplitPane initialisieren
87                    
88                  // Status-Line to show Coordinates and Rastervalues.                  // Status-Line to show Coordinates and Rastervalues.
89                  statusBar = new MapPaneStatusBar(getGeoMapPane()                  statusBar = new MapPaneStatusBar(getGeoMapPane().getMapPane());
                                 .getMapPane());  
90                  statusBar.setBorder(BorderFactory.createCompoundBorder(BorderFactory                  statusBar.setBorder(BorderFactory.createCompoundBorder(BorderFactory
91                                  .createLoweredBevelBorder(), BorderFactory.createEmptyBorder(2,                                  .createLoweredBevelBorder(), BorderFactory.createEmptyBorder(2,
92                                  5, 2, 5)));                                  5, 2, 5)));
93                  this.add(statusBar, BorderLayout.SOUTH);                  this.add(statusBar, BorderLayout.SOUTH);
94    
                   
95                  /**                  /**
96                   * The layout of the split pane can be configured in the atlas.                   * The layout of the split pane can be configured in the atlas.
97                     * setDividerLocation(-1); has no effect here because the component is
98                     * not visible yet.
99                   */                   */
100                  getSplitPane().setDividerSize(5);                  getSplitPane().setDividerSize(5);
101                  getSplitPane().setDividerLocation(-1);  
                   
102                  getSplitPane().setResizeWeight(0.0);                  getSplitPane().setResizeWeight(0.0);
103                  getSplitPane().add(getSidePane());                  getSplitPane().add(getSidePane());
104    
# Line 115  public class MapView extends JPanel { Line 116  public class MapView extends JPanel {
116    
117          /**          /**
118           * Returns the tool bar which controls the active mouse actions on the map.           * Returns the tool bar which controls the active mouse actions on the map.
119             *
120           * @return           * @return
121           */           */
122          public MapPaneToolBar getToolBar() {          public MapPaneToolBar getToolBar() {
123            return jToolBar;                  return jToolBar;
124          }          }
125    
126          /**          /**
# Line 128  public class MapView extends JPanel { Line 130  public class MapView extends JPanel {
130                  return splitPane;                  return splitPane;
131          }          }
132    
   
133          /**          /**
134           * Sets the active tool.           * Sets the active tool. Simply calls
135           * Simply calls {@link MapPaneToolBar#setSelectedTool(Integer)}.           * {@link MapPaneToolBar#setSelectedTool(Integer)}.
136             *
137           * @param tool           * @param tool
138           *            One of {@link #TOOL_INFO}, {@link #TOOL_PAN} .. constants           *            One of {@link #TOOL_INFO}, {@link #TOOL_PAN} .. constants
139           */           */
140          public void setSelectedTool(Integer tool) {          public void setSelectedTool(Integer tool) {
141            jToolBar.setSelectedTool(tool);                  jToolBar.setSelectedTool(tool);
142          }          }
143            
144      /**          /**
145       * Sets whether a tool is activated or not.           * Sets whether a tool is activated or not. Simply calls
146       * Simply calls {@link MapPaneToolBar#setButtonEnabled(int, boolean, boolean)}.           * {@link MapPaneToolBar#setButtonEnabled(int, boolean, boolean)}.
147       * @param tool tool ID           *
148       * @param enabled if {@code true} the tool becomes available           * @param tool
149       * @param hideOnDisable if {@code true} the button is also hidden if           *            tool ID
150       *                      {@code enabled} is {@code false}           * @param enabled
151       */           *            if {@code true} the tool becomes available
152          public void setToolEnabled(Integer tool, boolean enabled, boolean hideOnDisable) {           * @param hideOnDisable
153             jToolBar.setButtonEnabled(tool,enabled,hideOnDisable);           *            if {@code true} the button is also hidden if {@code enabled}
154          }           *            is {@code false}
155             */
156      /**          public void setToolEnabled(Integer tool, boolean enabled,
157       * Sets the activation for all tools.                          boolean hideOnDisable) {
158       * Simply calls {@link MapPaneToolBar#setAllToolsEnabled(boolean, boolean)}.                  jToolBar.setButtonEnabled(tool, enabled, hideOnDisable);
159       * @param enabled if {@code true} all tool becomes available          }
160       * @param hideOnDisable if {@code true} the buttons are also hidden if  
161       *                      {@code enabled} is {@code false}          /**
162       */           * Sets the activation for all tools. Simply calls
163      public void setAllToolsEnabled(boolean enabled, boolean hideOnDisable) {           * {@link MapPaneToolBar#setAllToolsEnabled(boolean, boolean)}.
164        jToolBar.setAllToolsEnabled(enabled, hideOnDisable);           *
165      }             * @param enabled
166             *            if {@code true} all tool becomes available
167      /**           * @param hideOnDisable
168           * Checks whether a tool is activated.           *            if {@code true} the buttons are also hidden if {@code enabled}
169       * Simply calls {@link MapPaneToolBar#isButtonEnabled(Integer)}.           *            is {@code false}
170           * @param tool tool ID           */
171            public void setAllToolsEnabled(boolean enabled, boolean hideOnDisable) {
172                    jToolBar.setAllToolsEnabled(enabled, hideOnDisable);
173            }
174    
175            /**
176             * Checks whether a tool is activated. Simply calls
177             * {@link MapPaneToolBar#isButtonEnabled(Integer)}.
178             *
179             * @param tool
180             *            tool ID
181           * @return {@code false} if an unknown ID is specified           * @return {@code false} if an unknown ID is specified
182           */           */
183          public boolean isToolEnabled(Integer tool) {          public boolean isToolEnabled(Integer tool) {
184            return jToolBar.isButtonEnabled(tool);                  return jToolBar.isButtonEnabled(tool);
185          }          }
186    
187          /**          /**
# Line 183  public class MapView extends JPanel { Line 195  public class MapView extends JPanel {
195    
196          /**          /**
197           * Liefert die Status-Zeile, in der die Koordinaten und Raster-Werte           * Liefert die Status-Zeile, in der die Koordinaten und Raster-Werte
198           * angezeigt werden.           * angezeigt werden.
199           */           */
200          public MapPaneStatusBar getStatusBar() {          public MapPaneStatusBar getStatusBar() {
201            return this.statusBar;                  return this.statusBar;
202          }          }
203            
204          /**          /**
205           * Liefert den Karten-Bereich der Komponente.           * Liefert den Karten-Bereich der Komponente.
206           */           */

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26