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

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

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

revision 649 by alfonx, Thu Jan 28 17:24:15 2010 UTC revision 656 by alfonx, Wed Feb 3 12:18:35 2010 UTC
# Line 104  public class XMapPane extends JPanel { Line 104  public class XMapPane extends JPanel {
104          // private static final int IMAGETYPE_withAlpha =          // private static final int IMAGETYPE_withAlpha =
105          // BufferedImage.TYPE_INT_ARGB;          // BufferedImage.TYPE_INT_ARGB;
106          private static final int IMAGETYPE = BufferedImage.TYPE_3BYTE_BGR;          private static final int IMAGETYPE = BufferedImage.TYPE_3BYTE_BGR;
107            public XMapPaneTool getTool() {
108                    return tool;
109            }
110    
111          private static final int IMAGETYPE_withAlpha = BufferedImage.TYPE_4BYTE_ABGR;          private static final int IMAGETYPE_withAlpha = BufferedImage.TYPE_4BYTE_ABGR;
112    
113          private final static Logger LOGGER = Logger.getLogger(XMapPane.class);          private final static Logger LOGGER = Logger.getLogger(XMapPane.class);
# Line 174  public class XMapPane extends JPanel { Line 178  public class XMapPane extends JPanel {
178           * Flag for no-tool.           * Flag for no-tool.
179           */           */
180          public static final int NONE = -123;          public static final int NONE = -123;
181    //
182          /**  //      /**
183           * Flag fuer Modus "Kartenausschnitt bewegen". Nicht fuer Window-Auswahl  //       * Flag fuer Modus "Kartenausschnitt bewegen". Nicht fuer Window-Auswahl
184           * moeglich!  //       * moeglich!
185           *  //       *
186           * @see #setState(int)  //       * @see #setState(int)
187           */  //       */
188          public static final int PAN = 1;  //      public static final int PAN = 1;
189    //
190          /**  //      /**
191           * Flag fuer Modus "Heran zoomen".  //       * Flag fuer Modus "Heran zoomen".
192           *  //       *
193           * @see #setState(int)  //       * @see #setState(int)
194           * @see #setState(int)  //       * @see #setState(int)
195           */  //       */
196          public static final int ZOOM_IN = 2;  //      public static final int ZOOM_IN = 2;
197    //
198          /**  //      /**
199           * Flag fuer Modus "Heraus zoomen". Nicht fuer Window-Auswahl moeglich!  //       * Flag fuer Modus "Heraus zoomen". Nicht fuer Window-Auswahl moeglich!
200           *  //       *
201           * @see #setState(int)  //       * @see #setState(int)
202           */  //       */
203          public static final int ZOOM_OUT = 3;  //      public static final int ZOOM_OUT = 3;
   
         /**  
          * Flag fuer Modus "SimpleFeature-Auswahl auf allen (sichtbaren) Layern".  
          *  
          * @see #setState(int)  
          * @see #setState(int)  
          */  
         public static final int SELECT_ALL = 103;  
         /**  
          * Flag fuer Modus  
          * "Auswahl nur eines Features, das erste sichtbare von Oben".  
          *  
          * @see #setState(int)  
          * @see #setState(int)  
          */  
         public static final int SELECT_ONE_FROM_TOP = 104;  
         /**  
          * Flag fuer Modus  
          * "SimpleFeature-Auswahl auf dem obersten (sichtbaren) Layer".  
          *  
          * @see #setState(int)  
          * @see #setState(int)  
          */  
         public static final int SELECT_TOP = 4;  
204    
205          /**          /**
206           * {@link Font} used to paint the wait messages into the map           * {@link Font} used to paint the wait messages into the map
# Line 301  public class XMapPane extends JPanel { Line 281  public class XMapPane extends JPanel {
281                          final MapLayer layer = event.getLayer();                          final MapLayer layer = event.getLayer();
282                          layer.addMapLayerListener(bgMapLayerListener);                          layer.addMapLayerListener(bgMapLayerListener);
283                          requestStartRendering();                          requestStartRendering();
   
284                  }                  }
285    
286                  @Override                  @Override
# Line 395  public class XMapPane extends JPanel { Line 374  public class XMapPane extends JPanel {
374           * While dragging, the {@link #updateFinalImage()} method is translating the           * While dragging, the {@link #updateFinalImage()} method is translating the
375           * cached images while setting it together.           * cached images while setting it together.
376           **/           **/
377          Point imageOrigin = new Point(0, 0);          private final Point imageOrigin = new Point(0, 0);
378          /**          /**
379           * For every rendering thread started,           * For every rendering thread started,
380           * {@link GTUtil#createGTRenderer(MapContext)} is called to create a new           * {@link GTUtil#createGTRenderer(MapContext)} is called to create a new
# Line 562  public class XMapPane extends JPanel { Line 541  public class XMapPane extends JPanel {
541           * thread.           * thread.
542           */           */
543          final private Timer startRenderThreadsTimer;          final private Timer startRenderThreadsTimer;
544    //
545          /**  //      /**
546           * The default state is ZOOM_IN, hence by default the  //       * The default state is ZOOM_IN, hence by default the
547           * {@link #xMapPaneMouseListener} is also enabled.  //       * {@link #xMapPaneMouseListener} is also enabled.
548           **/  //       **/
549          private int state = ZOOM_IN;  //      private int state = ZOOM_IN;
550    //
551          /**  //      /**
552           * Manuell gesetzter statischer Cursor, unabhaengig von der aktuellen  //       * Manuell gesetzter statischer Cursor, unabhaengig von der aktuellen
553           * MapPane-Funktion  //       * MapPane-Funktion
554           */  //       */
555          protected Cursor staticCursor = null;  //      protected Cursor staticCursor = null;
556    
557          private AffineTransform worldToScreen;          private AffineTransform worldToScreen;
558    
# Line 632  public class XMapPane extends JPanel { Line 611  public class XMapPane extends JPanel {
611                  this.addMouseListener(xMapPaneMouseListener);                  this.addMouseListener(xMapPaneMouseListener);
612                  this.addMouseMotionListener(xMapPaneMouseListener);                  this.addMouseMotionListener(xMapPaneMouseListener);
613                  this.addMouseWheelListener(xMapPaneMouseListener);                  this.addMouseWheelListener(xMapPaneMouseListener);
614                  xMapPaneMouseListener.actions.put(MouseInputType.LClick,                  
615                                  XMapPaneAction.ZOOM_IN);                  // By default the XMapPAne uses the ZOOM_IN tool.
616                  xMapPaneMouseListener.actions.put(MouseInputType.LDrag,                  setTool(XMapPaneTool.ZOOM_IN);
617                                  XMapPaneAction.ZOOM_IN);                  
                 xMapPaneMouseListener.actions.put(MouseInputType.Wheel,  
                                 XMapPaneAction.ZOOM_IN);  
   
                 xMapPaneMouseListener.actions.put(MouseInputType.RClick,  
                                 XMapPaneAction.ZOOM_OUT);  
   
                 xMapPaneMouseListener.actions.put(MouseInputType.RDrag,  
                                 XMapPaneAction.ZOOM_OUT);  
   
618                  /*                  /*
619                   * We use a Timer object to avoid rendering delays and flickering when                   * We use a Timer object to avoid rendering delays and flickering when
620                   * the user is drag-resizing the parent container of this map pane.                   * the user is drag-resizing the parent container of this map pane.
# Line 1015  public class XMapPane extends JPanel { Line 985  public class XMapPane extends JPanel {
985           */           */
986          protected void drawRectangle(final Graphics graphics, final Point startPos,          protected void drawRectangle(final Graphics graphics, final Point startPos,
987                          final Point e) {                          final Point e) {
988                  drawRectangle(graphics, startPos, e, Color.WHITE);                  drawRectangle(graphics, startPos, e, Color.WHITE, false);
989          }          }
990    
991          /**          /**
# Line 1023  public class XMapPane extends JPanel { Line 993  public class XMapPane extends JPanel {
993           * given point. All in screen coordinates.           * given point. All in screen coordinates.
994           */           */
995          protected void drawRectangle(final Graphics graphics, final Point startPos,          protected void drawRectangle(final Graphics graphics, final Point startPos,
996                          final Point e, Color color) {                          final Point e, Color color, boolean fill) {
997    
998                  if (!isWellDefined())                  if (!isWellDefined())
999                          return;                          return;
# Line 1040  public class XMapPane extends JPanel { Line 1010  public class XMapPane extends JPanel {
1010                          return;                          return;
1011    
1012                  graphics.setXORMode(color);                  graphics.setXORMode(color);
1013                    
1014                    if (fill) {
1015                            graphics.fillRect(left, bottom, width, height);
1016                            graphics.setXORMode(Color.WHITE);      
1017                    }
1018                    
1019                    
1020                  graphics.drawRect(left, bottom, width, height);                  graphics.drawRect(left, bottom, width, height);
1021          }          }
1022    
# Line 1311  public class XMapPane extends JPanel { Line 1288  public class XMapPane extends JPanel {
1288                  return new AffineTransform(screenToWorld);                  return new AffineTransform(screenToWorld);
1289          }          }
1290    
1291          public int getState() {  //      public int getState() {
1292                  return state;  //              return state;
1293          }  //      }
1294    //
1295          /**  //      /**
1296           * Liefert den statisch eingestellten Cursor, der unabhaengig von der  //       * Liefert den statisch eingestellten Cursor, der unabhaengig von der
1297           * eingestellten MapPane-Aktion (Zoom, Auswahl, ...) verwendet wird.  //       * eingestellten MapPane-Aktion (Zoom, Auswahl, ...) verwendet wird.
1298           *  //       *
1299           * @return {@code null}, wenn kein statischer Cursor verwendet, sondern der  //       * @return {@code null}, wenn kein statischer Cursor verwendet, sondern der
1300           *         Cursor automatisch je nach MapPane-Aktion eingestellt wird.  //       *         Cursor automatisch je nach MapPane-Aktion eingestellt wird.
1301           */  //       */
1302          public Cursor getStaticCursor() {  //      public Cursor getStaticCursor() {
1303                  return this.staticCursor;  //              return this.staticCursor;
1304          }  //      }
1305    
1306          public AffineTransform getWorldToScreenTransform() {          public AffineTransform getWorldToScreenTransform() {
1307                  if (worldToScreen == null) {                  if (worldToScreen == null) {
# Line 1378  public class XMapPane extends JPanel { Line 1355  public class XMapPane extends JPanel {
1355          }          }
1356    
1357          /**          /**
1358           * Called from the listeners while the mouse is dragging, this method either           * Usually called from {@link XMapPaneAction_Pan} to pan the image.
          * paints a translated (moved/panned) version of the image, or a rectangle.  
1359           *           *
1360           * @param startPos           * @param startPos
1361           *            in screen coordinates           *            in screen coordinates
1362           * @param lastPos           * @param lastPos
1363           *            in screen coordinates           *            in screen coordinates
          * @param event  
          *            the {@link MouseEvent} to read the mouse buttons from  
1364           */           */
1365          public void mouseDragged(final Point startPos, final Point lastPos,          public void pan(final int dX, final int dY) {
                         final MouseEvent event) {  
1366    
1367                  if ((getState() == XMapPane.PAN)                  // Panning needs a panning coursor
1368                                  || ((event.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0)) {                  if (getCursor() != SwingUtil.PANNING_CURSOR) {
1369                            setCursor(SwingUtil.PANNING_CURSOR);
1370                          // Panning needs a panning coursor  
1371                          if (getCursor() != SwingUtil.PANNING_CURSOR) {                          // While panning, we deactivate the rendering. So the tasks are
1372                                  setCursor(SwingUtil.PANNING_CURSOR);                          // ready to start when the panning is finished.
1373                            if (bgExecuter != null && bgExecuter.isRunning())
1374                                  // While panning, we deactivate the rendering. So the tasks are                                  bgExecuter.cancelTask();
1375                                  // ready to start when the panning is finished.                          if (localExecuter.isRunning())
1376                                  if (bgExecuter != null && bgExecuter.isRunning())                                  localExecuter.cancelTask();
1377                                          bgExecuter.cancelTask();                  }
1378                                  if (localExecuter.isRunning())                  //
1379                                          localExecuter.cancelTask();                  // if (lastPos.x > 0 && lastPos.y > 0) {
1380                          }                  // final int dx = event.getX() - lastPos.x;
1381                    // final int dy = event.getY() - lastPos.y;
1382                          if (lastPos.x > 0 && lastPos.y > 0) {  
1383                                  final int dx = event.getX() - lastPos.x;                  // TODO Stop dragging when the drag would not be valid...
1384                                  final int dy = event.getY() - lastPos.y;                  // boolean dragValid = true;
1385                    // // check if this panning results in a valid mapArea
1386                                  // TODO Stop dragging when the drag would not be valid...                  // {
1387                                  // boolean dragValid = true;                  // Rectangle winBounds = xMapPane.getBounds();
1388                                  // // check if this panning results in a valid mapArea                  // winBounds.translate(xMapPane.imageOrigin.x,
1389                                  // {                  // -xMapPane.imageOrigin.y);
1390                                  // Rectangle winBounds = xMapPane.getBounds();                  // Envelope newMapAreaBefore = xMapPane.tranformWindowToGeo(
1391                                  // winBounds.translate(xMapPane.imageOrigin.x,                  // winBounds.x, winBounds.y, winBounds.x
1392                                  // -xMapPane.imageOrigin.y);                  // + winBounds.width, winBounds.y
1393                                  // Envelope newMapAreaBefore = xMapPane.tranformWindowToGeo(                  // + winBounds.height);
1394                                  // winBounds.x, winBounds.y, winBounds.x                  //                                      
1395                                  // + winBounds.width, winBounds.y                  //
1396                                  // + winBounds.height);                  // winBounds = xMapPane.getBounds();
1397                                  //                                                        // Point testIng = new Point(xMapPane.imageOrigin);
1398                                  //                  // testIng.translate(dx, dy);
1399                                  // winBounds = xMapPane.getBounds();                  // winBounds.translate(testIng.x, -testIng.y);
1400                                  // Point testIng = new Point(xMapPane.imageOrigin);                  // Envelope newMapAreaAfter = xMapPane.tranformWindowToGeo(
1401                                  // testIng.translate(dx, dy);                  // winBounds.x, winBounds.y, winBounds.x
1402                                  // winBounds.translate(testIng.x, -testIng.y);                  // + winBounds.width, winBounds.y
1403                                  // Envelope newMapAreaAfter = xMapPane.tranformWindowToGeo(                  // + winBounds.height);
1404                                  // winBounds.x, winBounds.y, winBounds.x                  //
1405                                  // + winBounds.width, winBounds.y                  // // If the last drag doesn't change the MapArea anymore cancel
1406                                  // + winBounds.height);                  // it.
1407                                  //                  // if (xMapPane.bestAllowedMapArea(newMapAreaAfter).equals(
1408                                  // // If the last drag doesn't change the MapArea anymore cancel                  // xMapPane.bestAllowedMapArea(newMapAreaBefore))){
1409                                  // it.                  // dragValid = false;
1410                                  // if (xMapPane.bestAllowedMapArea(newMapAreaAfter).equals(                  // return;
1411                                  // xMapPane.bestAllowedMapArea(newMapAreaBefore))){                  // }
1412                                  // dragValid = false;                  // }
                                 // return;  
                                 // }  
                                 // }  
1413    
1414                                  imageOrigin.translate(dx, dy);                  getImageOrigin().translate(dX, dY);
1415                                  updateFinalImage();                  updateFinalImage();
1416                                  repaint();                  repaint();
1417                          }                  // }
1418    
1419                  } else if ((getState() == XMapPane.ZOOM_IN)                  // } else if ((getState() == XMapPane.ZOOM_IN)
1420                                  || (getState() == XMapPane.ZOOM_OUT)                  // || (getState() == XMapPane.ZOOM_OUT)
1421                                  || (getState() == XMapPane.SELECT_ALL)                  // || (getState() == XMapPane.SELECT_ALL)
1422                                  || (getState() == XMapPane.SELECT_TOP)) {                  // || (getState() == XMapPane.SELECT_TOP)) {
1423                    //
1424                          // Draws a rectangle                  // // Draws a rectangle
1425                          final Graphics2D graphics = (Graphics2D) getGraphics();                  // final Graphics2D graphics = (Graphics2D) getGraphics();
1426                          drawRectangle(graphics, startPos, event.getPoint());                  // drawRectangle(graphics, startPos, event.getPoint());
1427                          if ((lastPos.x > 0) && (lastPos.y > 0))                  // if ((lastPos.x > 0) && (lastPos.y > 0))
1428                                  drawRectangle(graphics, startPos, lastPos);                  // drawRectangle(graphics, startPos, lastPos);
1429                          graphics.dispose();                  // graphics.dispose();
1430                  }                  // }
1431          }          }
1432    
1433          /**          /**
# Line 1619  public class XMapPane extends JPanel { Line 1589  public class XMapPane extends JPanel {
1589                  }                  }
1590    
1591          }          }
1592    //
1593          /**  //      /**
1594           * Performs a {@value #PAN} action. During panning, the displacement is  //       * Performs a {@value #PAN} action. During panning, the displacement is
1595           * stored in {@link #imageOrigin} object. Calling {@link #performPan()} will  //       * stored in {@link #imageOrigin} object. Calling {@link #performPan()} will
1596           * reset the offset and call {@link #setMapArea(Envelope)}.  //       * reset the offset and call {@link #setMapArea(Envelope)}.
1597           */  //       */
1598          public void performPan() {  //      public void performPan() {
1599    //
1600                  final Rectangle winBounds = getVisibleRect();  //              final Rectangle winBounds = getVisibleRect();
1601    //
1602                  winBounds.translate(-imageOrigin.x, -imageOrigin.y);  //              winBounds.translate(-imageOrigin.x, -imageOrigin.y);
1603                  final Envelope newMapArea = tranformWindowToGeo(winBounds.x,  //              final Envelope newMapArea = tranformWindowToGeo(winBounds.x,
1604                                  winBounds.y, winBounds.x + winBounds.width, winBounds.y  //                              winBounds.y, winBounds.x + winBounds.width, winBounds.y
1605                                                  + winBounds.height);  //                                              + winBounds.height);
1606    //
1607                  imageOrigin.x = 0;  //              imageOrigin.x = 0;
1608                  imageOrigin.y = 0;  //              imageOrigin.y = 0;
1609    //
1610                  if (!setMapArea(newMapArea)) {  //              if (!setMapArea(newMapArea)) {
1611                          /**  //                      /**
1612                           * If setMapArea returns true, the finalImage is updated anyways.  //                       * If setMapArea returns true, the finalImage is updated anyways.
1613                           * This if-case exists to ensure that we repaint a correct image  //                       * This if-case exists to ensure that we repaint a correct image
1614                           * even if the new panning area has been denied.  //                       * even if the new panning area has been denied.
1615                           */  //                       */
1616                          updateFinalImage();  //                      updateFinalImage();
1617                          repaint();  //                      repaint();
1618                  }  //              }
1619    //
1620                  if (getCursor() == SwingUtil.PANNING_CURSOR)  //              if (getCursor() == SwingUtil.PANNING_CURSOR)
1621                          setCursor(SwingUtil.PAN_CURSOR);  //                      setCursor(SwingUtil.PAN_CURSOR);
1622          }  //      }
1623    
1624          /**          /**
1625           * Entfernt einen Listener von der Map.           * Entfernt einen Listener von der Map.
# Line 1958  public class XMapPane extends JPanel { Line 1928  public class XMapPane extends JPanel {
1928    
1929          // /** Stored the time used for the last real rendering in ms. **/          // /** Stored the time used for the last real rendering in ms. **/
1930          private long lastRenderingDuration = 1000;          private long lastRenderingDuration = 1000;
1931            private XMapPaneTool tool = null;
1932    
1933          /**          /**
1934           * Set the minimum (nearest) allowed zoom scale. This is the bigger number           * Set the minimum (nearest) allowed zoom scale. This is the bigger number
# Line 1989  public class XMapPane extends JPanel { Line 1960  public class XMapPane extends JPanel {
1960                          this.rendererHints = rendererHints;                          this.rendererHints = rendererHints;
1961          }          }
1962    
1963          /**  //      @Deprecated
1964           * Enables/Disables the ZOOM Mouse Listener. Upates the Cursor and stops the  //      public void setState(final int state) {
1965           * repaint Timer if  //              this.state = state;
1966           *  //
1967           * @param state  //              // throw new RuntimeException("Old concept.. migrate to new concept!");
1968           */  //
1969          @Deprecated  //              // xMapPaneMouseListener.setEnabled((state == ZOOM_IN
1970          public void setState(final int state) {  //              // || state == ZOOM_OUT || state == PAN));
1971                  this.state = state;  //
1972    //              // Je nach Aktion den Cursor umsetzen
1973                  // throw new RuntimeException("Old concept.. migrate to new concept!");  //              updateCursor();
1974    //      }
                 // xMapPaneMouseListener.setEnabled((state == ZOOM_IN  
                 // || state == ZOOM_OUT || state == PAN));  
   
                 // Je nach Aktion den Cursor umsetzen  
                 updateCursor();  
         }  
1975    
1976          public void configureMouse(MouseInputType type, XMapPaneAction action) {          public void configureMouse(MouseInputType type, XMapPaneAction action) {
1977                  xMapPaneMouseListener.actions.put(type, action);                  xMapPaneMouseListener.actions.put(type, action);
1978          }          }
1979            
1980          /**          /**
1981           * Standardmaessig wird der Cursor automatisch je nach MapPane-Aktion (Zoom,           * Configure the {@link XMapPaneTool} that active on the map. Passing
1982           * Auswahl, ...) gesetzt. Mit dieser Methode kann ein statischer Cursor           * <code>null</code> will set the NO_ACTION tool.
1983           * gesetzt werden, der unabhaengig von der aktuellen MapPanes-Aktion           */
1984           * beibehalten wird. Um diesen statischen Cursor wieder zu entfernen, kann          public void setTool(XMapPaneTool tool) {
1985           * {@code null} als Parameter uebergeben werden                  if (tool == null)
1986           *                          tool = XMapPaneTool.NO_ACTION;
1987           * @param cursor                  this.tool = tool;
1988           *            Cursor                  xMapPaneMouseListener.configure(tool);
1989           */                  setCursor(tool.getCursor());
1990          public void setStaticCursor(final Cursor cursor) {          }
1991                  this.staticCursor = cursor;  
1992                  if (cursor != null)  //      /**
1993                          super.setCursor(cursor);  //       * Standardmaessig wird der Cursor automatisch je nach MapPane-Aktion (Zoom,
1994          }  //       * Auswahl, ...) gesetzt. Mit dieser Methode kann ein statischer Cursor
1995    //       * gesetzt werden, der unabhaengig von der aktuellen MapPanes-Aktion
1996    //       * beibehalten wird. Um diesen statischen Cursor wieder zu entfernen, kann
1997    //       * {@code null} als Parameter uebergeben werden
1998    //       *
1999    //       * @param cursor
2000    //       *            Cursor
2001    //       */
2002    //      public void setStaticCursor(final Cursor cursor) {
2003    //              this.staticCursor = cursor;
2004    //              if (cursor != null)
2005    //                      super.setCursor(cursor);
2006    //      }
2007    
2008          /**          /**
2009           * Starts rendering on one or two threads           * Starts rendering on one or two threads
# Line 2168  public class XMapPane extends JPanel { Line 2145  public class XMapPane extends JPanel {
2145                                  repaint();                                  repaint();
2146                          }                          }
2147                  }                  }
2148    //              
2149                  // wenn manueller Cursor gesetzt ist, dann diesen verwenden (unabhaengig  ////
2150                  // von der aktuellen Aktion  //              // wenn manueller Cursor gesetzt ist, dann diesen verwenden (unabhaengig
2151                  if (this.staticCursor != null) {  //              // von der aktuellen Aktion
2152                          setCursor(staticCursor);  //              if (this.staticCursor != null) {
2153                          return;  //                      setCursor(staticCursor);
2154                  }  //                      return;
2155    //              }
2156    //              
2157                  if (getCursor() == SwingUtil.PANNING_CURSOR) {                  if (getCursor() == SwingUtil.PANNING_CURSOR) {
2158                          // This cursor will reset itself                          // This cursor will reset itself
2159                          return;                          return;
2160                  }                  }
2161                    
2162                  // Set the cursor depending on what tool is in use...                  setCursor(tool.getCursor());
2163                  switch (state) {                  
2164                  case SELECT_TOP:  //
2165                  case SELECT_ONE_FROM_TOP:  //              // Set the cursor depending on what tool is in use...
2166                  case SELECT_ALL:  //              switch (state) {
2167                          setCursor(SwingUtil.CROSSHAIR_CURSOR);  //              case SELECT_TOP:
2168                          break;  //              case SELECT_ONE_FROM_TOP:
2169                  case ZOOM_IN:  //              case SELECT_ALL:
2170                          setCursor(SwingUtil.ZOOMIN_CURSOR);  //                      setCursor(SwingUtil.CROSSHAIR_CURSOR);
2171                          break;  //                      break;
2172                  case ZOOM_OUT:  //              case ZOOM_IN:
2173                          setCursor(SwingUtil.ZOOMOUT_CURSOR);  //                      setCursor(SwingUtil.ZOOMIN_CURSOR);
2174                          break;  //                      break;
2175                  case PAN:  //              case ZOOM_OUT:
2176                          setCursor(SwingUtil.PAN_CURSOR);  //                      setCursor(SwingUtil.ZOOMOUT_CURSOR);
2177                          break;  //                      break;
2178                  default:  //              case PAN:
2179                          setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));  //                      setCursor(SwingUtil.PAN_CURSOR);
2180                          break;  //                      break;
2181                  }  //              default:
2182    //                      setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
2183    //                      break;
2184    //              }
2185          }          }
2186    
2187          /**          /**
# Line 2229  public class XMapPane extends JPanel { Line 2211  public class XMapPane extends JPanel {
2211    
2212                  final Graphics2D finalG = getFinalImage().createGraphics();                  final Graphics2D finalG = getFinalImage().createGraphics();
2213                  finalG.setBackground(getMapBackgroundColor());                  finalG.setBackground(getMapBackgroundColor());
2214                  finalG.drawImage(getPreFinalImage(), imageOrigin.x, imageOrigin.y,                  finalG.drawImage(getPreFinalImage(), getImageOrigin().x, getImageOrigin().y,
2215                                  getMapBackgroundColor(), null);                                  getMapBackgroundColor(), null);
2216    
2217                  // When panning, we have to clear the area around the image                  // When panning, we have to clear the area around the image
2218                  final Rectangle painedArea = new Rectangle(imageOrigin.x,                  final Rectangle painedArea = new Rectangle(getImageOrigin().x,
2219                                  imageOrigin.y, getFinalImage().getWidth(), getFinalImage()                                  getImageOrigin().y, getFinalImage().getWidth(), getFinalImage()
2220                                                  .getHeight());                                                  .getHeight());
2221                  SwingUtil.clearAround(finalG, painedArea, getVisibleRect(),                  SwingUtil.clearAround(finalG, painedArea, getVisibleRect(),
2222                                  getMapBackgroundColor());                                  getMapBackgroundColor());
2223    
2224                  addGadgets(finalG, false);  //              addGadgets(finalG, false);
2225    
2226                  finalG.dispose();                  finalG.dispose();
2227    
# Line 2632  public class XMapPane extends JPanel { Line 2614  public class XMapPane extends JPanel {
2614    
2615          }          }
2616    
2617            public Point getImageOrigin() {
2618                    return imageOrigin;
2619            }
2620    
2621  }  }

Legend:
Removed from v.649  
changed lines
  Added in v.656

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26