/[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 48 by alfonx, Fri Apr 17 12:49:33 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;  
 import java.awt.Window;  
 import java.awt.event.ActionEvent;  
 import java.util.ArrayList;  
 import java.util.LinkedList;  
4    
 import javax.swing.AbstractAction;  
5  import javax.swing.BorderFactory;  import javax.swing.BorderFactory;
 import javax.swing.ButtonGroup;  
 import javax.swing.ImageIcon;  
 import javax.swing.JButton;  
6  import javax.swing.JComponent;  import javax.swing.JComponent;
 import javax.swing.JLabel;  
7  import javax.swing.JPanel;  import javax.swing.JPanel;
8  import javax.swing.JSplitPane;  import javax.swing.JSplitPane;
 import javax.swing.JToggleButton;  
 import javax.swing.JToolBar;  
9    
10  import org.apache.log4j.Logger;  import org.apache.log4j.Logger;
11    
# Line 25  import schmitzm.geotools.gui.GeoMapPane; Line 13  import schmitzm.geotools.gui.GeoMapPane;
13  import schmitzm.geotools.gui.JMapPane;  import schmitzm.geotools.gui.JMapPane;
14  import schmitzm.geotools.gui.MapContextControlPane;  import schmitzm.geotools.gui.MapContextControlPane;
15  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;  
16  import schmitzm.geotools.styling.ColorMapManager;  import schmitzm.geotools.styling.ColorMapManager;
17  import schmitzm.swing.SwingUtil;  import schmitzm.swing.SwingUtil;
18    
 import com.vividsolutions.jts.geom.Envelope;  
   
19  /**  /**
20   * Achtung! Dieser code ist verwuestet   * Achtung! Dieser code ist verwuestet
21   */   */
# Line 54  public class MapView extends JPanel { Line 37  public class MapView extends JPanel {
37           */           */
38          protected final GeoMapPane geoMapPane = new GeoMapPane();          protected final GeoMapPane geoMapPane = new GeoMapPane();
39    
 //  
 //      /** This is the layered Pane that holds the buttons and maybe the flying logo * */  
 //      protected JLayeredPane layeredPane;  
   
         protected boolean zoomBackForwardButtonInAction;  
   
40          private MapPaneToolBar jToolBar;          private MapPaneToolBar jToolBar;
41    
42          /**          /**
# Line 67  public class MapView extends JPanel { Line 44  public class MapView extends JPanel {
44           * {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left,           * {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left,
45           * and some buttons floating over the {@link JMapPane}           * and some buttons floating over the {@link JMapPane}
46           */           */
47          public MapView(Window owner2, MapPaneToolBar toolBar) {          public MapView(MapPaneToolBar toolBar) {
48                  super(new BorderLayout());                  super(new BorderLayout());
49                  // Call initialize() by yourself afterwards.                  // Call initialize() by yourself afterwards.
50                  // Needed because variables for the overwritten methods                  // Needed because variables for the overwritten methods
51                  // are not yet set.                  // are not yet set.
52                  getGeoMapPane().getMapPane().setWaitCursorComponent(owner2);                  getGeoMapPane().getMapPane().setWaitCursorComponent(SwingUtil.getParentWindow(this));
53                  if ( toolBar == null )                  if ( toolBar == null )
54                    toolBar = new MapPaneToolBar(getMapPane());                    toolBar = new MapPaneToolBar(getMapPane());
55                  jToolBar = toolBar;                  jToolBar = toolBar;
# Line 83  public class MapView extends JPanel { Line 60  public class MapView extends JPanel {
60       * {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left,       * {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left,
61       * and some buttons floating over the {@link JMapPane}       * and some buttons floating over the {@link JMapPane}
62       */       */
63      public MapView(Window owner2) {      public MapView() {
64        this(owner2, null);        this(null);
65      }      }
66    
     // /**  
         // * 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);  
         // }  
         // }  
   
67          /**          /**
68           * Calls #getSidePanel() which can be overwritten.           * Calls #getSidePanel() which can be overwritten.
69           *           *
# Line 146  public class MapView extends JPanel { Line 94  public class MapView extends JPanel {
94                  newRight.add(getGeoMapPane(), BorderLayout.CENTER);                  newRight.add(getGeoMapPane(), BorderLayout.CENTER);
95                  splitPane.add(newRight);                  splitPane.add(newRight);
96    
                 // 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();  
                 //  
                 // }  
                 //  
                 // });  
   
97                  this.add(splitPane, BorderLayout.CENTER);                  this.add(splitPane, BorderLayout.CENTER);
98          }          }
99    
# Line 186  public class MapView extends JPanel { Line 112  public class MapView extends JPanel {
112                  return this.splitPane;                  return this.splitPane;
113          }          }
114    
         //  
         // /**  
         // * 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")));  
 //  
 //      }  
115    
116          /**          /**
117           * Sets the active tool.           * Sets the active tool.
# Line 329  public class MapView extends JPanel { Line 155  public class MapView extends JPanel {
155          public boolean isToolEnabled(Integer tool) {          public boolean isToolEnabled(Integer tool) {
156            return jToolBar.isButtonEnabled(tool);            return jToolBar.isButtonEnabled(tool);
157          }          }
 //  
 //      /**  
 //       * 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);  
 //      }  
158    
159          /**          /**
160           * 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 180  public class MapView extends JPanel {
180                  return getGeoMapPane().getMapPane();                  return getGeoMapPane().getMapPane();
181          }          }
182    
         // /**  
         // * Liefert das in einem Layer dargestellte Objekt.  
         // *  
         // * @param layer  
         // * ein Layer  
         // */  
         // public Object getMapObject(final MapLayer layer) {  
         // // return layerObjects.get(layer);  
         // return null;  
         // }  
   
183          public GeoMapPane getGeoMapPane() {          public GeoMapPane getGeoMapPane() {
184                  return geoMapPane;                  return geoMapPane;
185          }          }

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26