/[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 2 by mojays, Tue Feb 24 22:43:52 2009 UTC revision 87 by alfonx, Thu Apr 23 19:39:13 2009 UTC
# Line 1  Line 1 
1  package skrueger.geotools;  package skrueger.geotools;
2    
3  import java.awt.BorderLayout;  import java.awt.BorderLayout;
 import java.awt.Dimension;  
4  import java.awt.Window;  import java.awt.Window;
 import java.awt.event.ActionEvent;  
 import java.util.ArrayList;  
 import java.util.LinkedList;  
5    
 import javax.swing.AbstractAction;  
6  import javax.swing.BorderFactory;  import javax.swing.BorderFactory;
 import javax.swing.ButtonGroup;  
 import javax.swing.ImageIcon;  
 import javax.swing.JButton;  
7  import javax.swing.JComponent;  import javax.swing.JComponent;
 import javax.swing.JLabel;  
8  import javax.swing.JPanel;  import javax.swing.JPanel;
9  import javax.swing.JSplitPane;  import javax.swing.JSplitPane;
 import javax.swing.JToggleButton;  
 import javax.swing.JToolBar;  
10    
11  import org.apache.log4j.Logger;  import org.apache.log4j.Logger;
12    
# Line 25  import schmitzm.geotools.gui.GeoMapPane; Line 14  import schmitzm.geotools.gui.GeoMapPane;
14  import schmitzm.geotools.gui.JMapPane;  import schmitzm.geotools.gui.JMapPane;
15  import schmitzm.geotools.gui.MapContextControlPane;  import schmitzm.geotools.gui.MapContextControlPane;
16  import schmitzm.geotools.gui.MapPaneStatusBar;  import schmitzm.geotools.gui.MapPaneStatusBar;
 import schmitzm.geotools.map.event.JMapPaneEvent;  
 import schmitzm.geotools.map.event.JMapPaneListener;  
 import schmitzm.geotools.map.event.MapAreaChangedEvent;  
17  import schmitzm.geotools.styling.ColorMapManager;  import schmitzm.geotools.styling.ColorMapManager;
18  import schmitzm.swing.SwingUtil;  import schmitzm.swing.SwingUtil;
19    
 import com.vividsolutions.jts.geom.Envelope;  
   
20  /**  /**
21   * Achtung! Dieser code ist verwuestet   * Achtung! Dieser code ist verwuestet
22   */   */
# Line 54  public class MapView extends JPanel { Line 38  public class MapView extends JPanel {
38           */           */
39          protected final GeoMapPane geoMapPane = new GeoMapPane();          protected final GeoMapPane geoMapPane = new GeoMapPane();
40    
 //  
 //      /** This is the layered Pane that holds the buttons and maybe the flying logo * */  
 //      protected JLayeredPane layeredPane;  
   
         protected boolean zoomBackForwardButtonInAction;  
   
41          private MapPaneToolBar jToolBar;          private MapPaneToolBar jToolBar;
42    
43          /**          /**
# Line 67  public class MapView extends JPanel { Line 45  public class MapView extends JPanel {
45           * {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left,           * {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left,
46           * and some buttons floating over the {@link JMapPane}           * and some buttons floating over the {@link JMapPane}
47           */           */
48          public MapView(Window owner2, MapPaneToolBar toolBar) {          public MapView(Window parentGui, MapPaneToolBar toolBar) {
49                  super(new BorderLayout());                  super(new BorderLayout());
50                  // Call initialize() by yourself afterwards.                  // Call initialize() by yourself afterwards.
51                  // Needed because variables for the overwritten methods                  // Needed because variables for the overwritten methods
52                  // are not yet set.                  // are not yet set.
53                  getGeoMapPane().getMapPane().setWaitCursorComponent(owner2);                  getGeoMapPane().getMapPane().setWaitCursorComponent(parentGui);
54                  if ( toolBar == null )                  if ( toolBar == null )
55                    toolBar = new MapPaneToolBar(getMapPane());                    toolBar = new MapPaneToolBar(getMapPane());
56                  jToolBar = toolBar;                  jToolBar = toolBar;
# Line 83  public class MapView extends JPanel { Line 61  public class MapView extends JPanel {
61       * {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left,       * {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left,
62       * and some buttons floating over the {@link JMapPane}       * and some buttons floating over the {@link JMapPane}
63       */       */
64      public MapView(Window owner2) {      public MapView(Window parentGui) {
65        this(owner2, null);        this(parentGui, null);
66      }      }
67    
     // /**  
         // * Nuetzlich wenn die Componente gedruckt wird. Dann wird der Hintergrund  
         // auf {@link Color#WHITE} gesetzt.zoomoutToggleButton  
         // *  
         // * @author <a href="mailto:[email protected]">Stefan Alfons  
         // Kr&uuml;ger</a>  
         // */  
         // @Override  
         // public void print(Graphics g) {  
         //                
         // // SK: Ich habe keine Ahnung mehr, was das soll... Ich habs mal  
         // auskommentiert.  
         //  
         // // wrap in try/finally so that we always restore the state  
         // try {  
         // panToggleButton.setVisible(false);  
         // zoominToggleButton.setVisible(false);  
         // zoomoutToggleButton.setVisible(false);  
         // infoToggleButton.setVisible(false);  
         //  
         // super.print(g);  
         // } finally {  
         // panToggleButton.setVisible(true);  
         // zoominToggleButton.setVisible(true);  
         // zoomoutToggleButton.setVisible(true);  
         // infoToggleButton.setVisible(true);  
         // }  
         // }  
   
68          /**          /**
69           * Calls #getSidePanel() which can be overwritten.           * Calls #getSidePanel() which can be overwritten.
70           *           *
# Line 146  public class MapView extends JPanel { Line 95  public class MapView extends JPanel {
95                  newRight.add(getGeoMapPane(), BorderLayout.CENTER);                  newRight.add(getGeoMapPane(), BorderLayout.CENTER);
96                  splitPane.add(newRight);                  splitPane.add(newRight);
97    
                 // gpSize = new Dimension(40,50);  
                 // getGeoMapPane().setSize(gpSize);  
   
                 // layeredPane = new JLayeredPane();  
                 // layeredPane.add(getGeoMapPane(), JLayeredPane.DEFAULT_LAYER);  
                 // createMapButtons(layeredPane);  
   
                 // //****************************************************************************  
                 // // The JLayeredPane doesn't manage the size of its layers.. we do it  
                 // // This listener will actually correct the size of the JLayeredPane  
                 // //****************************************************************************  
                 // splitPane.addPropertyChangeListener(new PropertyChangeListener() {  
                 //  
                 // public void propertyChange(final PropertyChangeEvent evt) {  
                 // final JSplitPane sp = (JSplitPane) evt.getSource();  
                 //  
                 // adjustSizeOfGeoMapPane();  
                 //  
                 // }  
                 //  
                 // });  
   
98                  this.add(splitPane, BorderLayout.CENTER);                  this.add(splitPane, BorderLayout.CENTER);
99          }          }
100    
# Line 186  public class MapView extends JPanel { Line 113  public class MapView extends JPanel {
113                  return this.splitPane;                  return this.splitPane;
114          }          }
115    
         //  
         // /**  
         // * Called by the listerner. Calculates the exact size of the {@link  
         // GeoMapPane} and sets it.  
         // */  
         // private void adjustSizeOfGeoMapPane() {  
         // final int newWidth = (int) (splitPane.getSize().getWidth()  
         // - splitPane.getComponent(1).getSize().getWidth()  
         // - splitPane.getComponent(0).getSize().getWidth())  
         // - 4;  
         // final int newHeight = (int) splitPane.getComponent(1).getSize()  
         // .getHeight();  
         //  
         // if (newWidth <= 20 )  
         // return;  
         //  
         // gpSize.setSize(newWidth, newHeight);  
         //  
         // getGeoMapPane().getMapPane().setWaitCursorDuringNextRepaint(true);  
         //  
         // getGeoMapPane().setSize( gpSize );  
         // // getGeoMapPane().refreshMap(); nicht nötig .. schön  
         //  
         // positionLayeredObjects();  
         // }  
 //  
 //      /**  
 //       * Adds the floating Map Contol Buttons to the {@link JLayeredPane}, with Z =  
 //       * 10  
 //       *  
 //       * @param lp  
 //       *            {@link JLayeredPane} that contains the {@link GeoMapPane}  
 //       */  
 //      private void createMapButtons(final JLayeredPane lp) {  
 //  
 //              final Integer zlayer = new Integer(10);  
 //  
 //              toggleButtonsList = new LinkedList<JToggleButton>();  
 //              toggleButtonsList.add(infoToggleButton);  
 //              toggleButtonsList.add(panToggleButton);  
 //              toggleButtonsList.add(zoominToggleButton);  
 //              toggleButtonsList.add(zoomoutToggleButton);  
 //  
 //  
 //              positionLayeredObjects();  
 //  
 //              final ButtonGroup bg = new ButtonGroup();  
 //              for (final JToggleButton b : toggleButtonsList) {  
 //                      // final FontMetrics fm = b.getFontMetrics( b.getFont() );  
 //                      // final int w = fm.stringWidth( b.getText() );  
 //  
 //                      // b.setBorder( BorderFactory.createRaisedBevelBorder() );  
 //                      b.setBorder(BorderFactory.createEmptyBorder());  
 //                      b.setSize(new Dimension(32, 32));  
 //                      bg.add(b);  
 //                      lp.add(b, zlayer);  
 //              }  
 //  
 //              zoomBackButton.setSize(32, 32);  
 //              zoomBackButton.setBorder(BorderFactory.createEmptyBorder());  
 //              lp.add(zoomBackButton, zlayer);  
 //  
 //              zoomForwardButton.setSize(32, 32);  
 //              zoomForwardButton.setBorder(BorderFactory.createEmptyBorder());  
 //              lp.add(zoomForwardButton, zlayer);  
 //      }  
   
 //      /**  
 //       * This method will update the  
 //       */  
 //      public void updateIconsForButtons() {  
 //              if (zoomoutToggleButton.isSelected())  
 //                      zoomoutToggleButton.setIcon(new ImageIcon(MapView.class  
 //                                      .getResource("zoom_out.png")));  
 //              else  
 //                      zoomoutToggleButton.setIcon(new ImageIcon(MapView.class  
 //                                      .getResource("zoom_out.png")));  
 //  
 //              if (zoominToggleButton.isSelected())  
 //                      zoominToggleButton.setIcon(new ImageIcon(MapView.class  
 //                                      .getResource("zoom_in.png")));  
 //              else  
 //                      zoominToggleButton.setIcon(new ImageIcon(MapView.class  
 //                                      .getResource("zoom_in.png")));  
 //  
 //              if (infoToggleButton.isSelected())  
 //                      infoToggleButton.setIcon(new ImageIcon(MapView.class  
 //                                      .getResource("info.png")));  
 //              else  
 //                      infoToggleButton.setIcon(new ImageIcon(MapView.class  
 //                                      .getResource("info_aus.png")));  
 //  
 //              if (panToggleButton.isSelected())  
 //                      panToggleButton.setIcon(new ImageIcon(MapView.class  
 //                                      .getResource("pan.png")));  
 //              else  
 //                      panToggleButton.setIcon(new ImageIcon(MapView.class  
 //                                      .getResource("pan_aus.png")));  
 //  
 //      }  
116    
117          /**          /**
118           * Sets the active tool.           * Sets the active tool.
# Line 329  public class MapView extends JPanel { Line 156  public class MapView extends JPanel {
156          public boolean isToolEnabled(Integer tool) {          public boolean isToolEnabled(Integer tool) {
157            return jToolBar.isButtonEnabled(tool);            return jToolBar.isButtonEnabled(tool);
158          }          }
 //  
 //      /**  
 //       * Positions the Map Control Buttons on top of the {@link GeoMapPane}  
 //       *  
 //       * @author <a href="mailto:[email protected]">Stefan Alfons Kr&uuml;ger</a>  
 //       *  
 //       */  
 //      protected void positionLayeredObjects() {  
 //  
 //              // Abstand zwischen den Buttons und Button zu Rand  
 //              final int gap = 10;  
 //  
 //              // 45 entspicht der breite des Grids/ der Gradanzeige  
 //              // TODO den wert aus der geomappane auslesen...  
 //              int x = GridPanel.VERT_WIDTH;  
 //  
 //              for (final JToggleButton b : toggleButtonsList) {  
 //                      x += gap;  
 //                      // final FontMetrics fm = b.getFontMetrics( b.getFont() );  
 //                      b.setLocation(x, 10);  
 //  
 //                      final int w = 32;  
 //                      x += w;  
 //                      // y += b.getWidth();  
 //              }  
 //  
 //              // Und noch die zwei ZoomBackup und ZoomForward Buttons  
 //              zoomBackButton.setLocation(x + 32 + gap, 10);  
 //              zoomForwardButton.setLocation(x + 64 + gap * 2, 10);  
 //      }  
159    
160          /**          /**
161           * called by initialize() to fill the left of the XULUMapView Supposed to be           * called by initialize() to fill the left of the XULUMapView Supposed to be
# Line 384  public class MapView extends JPanel { Line 181  public class MapView extends JPanel {
181                  return getGeoMapPane().getMapPane();                  return getGeoMapPane().getMapPane();
182          }          }
183    
         // /**  
         // * Liefert das in einem Layer dargestellte Objekt.  
         // *  
         // * @param layer  
         // * ein Layer  
         // */  
         // public Object getMapObject(final MapLayer layer) {  
         // // return layerObjects.get(layer);  
         // return null;  
         // }  
   
184          public GeoMapPane getGeoMapPane() {          public GeoMapPane getGeoMapPane() {
185                  return geoMapPane;                  return geoMapPane;
186          }          }

Legend:
Removed from v.2  
changed lines
  Added in v.87

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26