/[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 533 by alfonx, Thu Nov 19 17:27:01 2009 UTC revision 540 by alfonx, Fri Nov 20 19:34:50 2009 UTC
# Line 30  import javax.swing.Timer; Line 30  import javax.swing.Timer;
30    
31  import org.apache.log4j.Logger;  import org.apache.log4j.Logger;
32  import org.geotools.feature.FeatureCollection;  import org.geotools.feature.FeatureCollection;
33    import org.geotools.geometry.Envelope2D;
34  import org.geotools.geometry.jts.JTS;  import org.geotools.geometry.jts.JTS;
35  import org.geotools.geometry.jts.ReferencedEnvelope;  import org.geotools.geometry.jts.ReferencedEnvelope;
36  import org.geotools.map.DefaultMapContext;  import org.geotools.map.DefaultMapContext;
# Line 43  import org.geotools.referencing.CRS; Line 44  import org.geotools.referencing.CRS;
44  import org.geotools.renderer.GTRenderer;  import org.geotools.renderer.GTRenderer;
45  import org.geotools.renderer.label.LabelCacheImpl;  import org.geotools.renderer.label.LabelCacheImpl;
46  import org.geotools.renderer.lite.LabelCache;  import org.geotools.renderer.lite.LabelCache;
47    import org.geotools.renderer.lite.RendererUtilities;
48  import org.geotools.renderer.lite.StreamingRenderer;  import org.geotools.renderer.lite.StreamingRenderer;
49  import org.geotools.swing.JMapPane;  import org.geotools.swing.JMapPane;
50  import org.geotools.swing.event.MapMouseEvent;  import org.geotools.swing.event.MapMouseEvent;
# Line 145  public class XMapPane extends JPanel { Line 147  public class XMapPane extends JPanel {
147           * Default delay (milliseconds) before the map will be redrawn when resizing           * Default delay (milliseconds) before the map will be redrawn when resizing
148           * the pane. This is to avoid flickering while drag-resizing.           * the pane. This is to avoid flickering while drag-resizing.
149           */           */
150          public static final int DEFAULT_RESIZING_PAINT_DELAY = 500;          public static final int DEFAULT_RESIZING_PAINT_DELAY = 600;
151    
152          public static final int NONE = -123;          public static final int NONE = -123;
153    
# Line 385  public class XMapPane extends JPanel { Line 387  public class XMapPane extends JPanel {
387                          localRenderer.setContext(getContext());                          localRenderer.setContext(getContext());
388    
389                          if (localContext.getLayers().length == 1) { // the first one                          if (localContext.getLayers().length == 1) { // the first one
390    
391                                  // if the Area of Interest is unset, the LayerBounds are used                                  // if the Area of Interest is unset, the LayerBounds are used
392                                  if (!setMapArea(localContext.getAreaOfInterest()))                                  if (!setMapArea(localContext.getAreaOfInterest()))
393                                          repaint();                                          repaint();
# Line 537  public class XMapPane extends JPanel { Line 540  public class XMapPane extends JPanel {
540    
541          private final Timer resizeTimer;          private final Timer resizeTimer;
542    
         private final int resizingPaintDelay;  
   
543          /**          /**
544           * Transformation zwischen Fenster-Koordinaten und Karten-Koordinaten           * Transformation zwischen Fenster-Koordinaten und Karten-Koordinaten
545           * (lat/lon)           * (lat/lon)
# Line 619  public class XMapPane extends JPanel { Line 620  public class XMapPane extends JPanel {
620                   * Using a ComponentListener doesn't work because, unlike a JFrame, the                   * Using a ComponentListener doesn't work because, unlike a JFrame, the
621                   * pane receives a stream of events during drag-resizing.                   * pane receives a stream of events during drag-resizing.
622                   */                   */
623                  resizingPaintDelay = DEFAULT_RESIZING_PAINT_DELAY;                  resizeTimer = new Timer(DEFAULT_RESIZING_PAINT_DELAY, new ActionListener() {
                 resizeTimer = new Timer(resizingPaintDelay, new ActionListener() {  
624    
625                          public void actionPerformed(final ActionEvent e) {                          public void actionPerformed(final ActionEvent e) {
626                                  paneResized = true;                                  paneResized = true;
# Line 713  public class XMapPane extends JPanel { Line 713  public class XMapPane extends JPanel {
713           *         Kr&uuml;ger</a>           *         Kr&uuml;ger</a>
714           */           */
715          public Envelope bestAllowedMapArea(Envelope env) {          public Envelope bestAllowedMapArea(Envelope env) {
716                    // return env;
717                  if (getWidth() == 0)                  if (getWidth() == 0)
718                          return env;                          return env;
719                  if (env == null)                  if (env == null)
# Line 793  public class XMapPane extends JPanel { Line 794  public class XMapPane extends JPanel {
794    
795                                          // LOGGER.debug("and fix aspect ratio");                                          // LOGGER.debug("and fix aspect ratio");
796    
797                                          newArea = JTSUtil.fixAspectRatio(this.getBounds(), newArea,                                          newArea = JTSUtil.fixAspectRatio(getVisibleRect(), newArea,
798                                                          false);                                                          false);
799                                  }                                  }
800                          }                          }
# Line 817  public class XMapPane extends JPanel { Line 818  public class XMapPane extends JPanel {
818    
819                                          // LOGGER.debug("and fix aspect ratio");                                          // LOGGER.debug("and fix aspect ratio");
820    
821                                          newArea = JTSUtil.fixAspectRatio(this.getBounds(), newArea,                                          newArea = JTSUtil.fixAspectRatio(getVisibleRect(), newArea,
822                                                          false);                                                          false);
823                                  }                                  }
824                          }                          }
# Line 843  public class XMapPane extends JPanel { Line 844  public class XMapPane extends JPanel {
844    
845                                          // LOGGER.debug("and fix aspect ratio");                                          // LOGGER.debug("and fix aspect ratio");
846    
847                                          newArea = JTSUtil.fixAspectRatio(this.getBounds(), newArea,                                          newArea = JTSUtil.fixAspectRatio(getVisibleRect(), newArea,
848                                                          false);                                                          false);
849                                  }                                  }
850                          }                          }
# Line 869  public class XMapPane extends JPanel { Line 870  public class XMapPane extends JPanel {
870    
871                                          // LOGGER.debug("and fix aspect ratio");                                          // LOGGER.debug("and fix aspect ratio");
872    
873                                          newArea = JTSUtil.fixAspectRatio(this.getBounds(), newArea,                                          newArea = JTSUtil.fixAspectRatio(getVisibleRect(), newArea,
874                                                          false);                                                          false);
875                                  }                                  }
876                          }                          }
# Line 920  public class XMapPane extends JPanel { Line 921  public class XMapPane extends JPanel {
921                          }                          }
922                          localExecuter.dispose();                          localExecuter.dispose();
923                  }                  }
924                  //  
                 // if (bgImage != null) {  
                 // bgImage = dispose(bgImage);  
                 // bgImage = null;  
                 // // LangUtil.gcTotal();  
                 // }  
                 //  
                 // if (localImage != null) {  
                 // localImage = dispose(localImage);  
                 // localImage = null;  
                 // // LangUtil.gcTotal();  
                 // }  
                 //  
                 // if (finalImage != null) {  
                 // finalImage = dispose(finalImage);  
                 // finalImage = null;  
                 // // LangUtil.gcTotal();  
                 // }  
                 //  
                 // if (preFinalImage != null) {  
                 // preFinalImage = dispose(preFinalImage);  
                 // preFinalImage = null;  
                 // }  
925                  disposeImages();                  disposeImages();
926    
927                  // LangUtil.gcTotal();                  // LangUtil.gcTotal();
# Line 1000  public class XMapPane extends JPanel { Line 979  public class XMapPane extends JPanel {
979           */           */
980          protected boolean drawScaledPreviewImage_Zoom(final Graphics2D graphics) {          protected boolean drawScaledPreviewImage_Zoom(final Graphics2D graphics) {
981    
982    //              if (1 == 1)return false;
983                    
984                  if (quickPreviewHint == 0)                  if (quickPreviewHint == 0)
985                          return false;                          return false;
986    
# Line 1018  public class XMapPane extends JPanel { Line 999  public class XMapPane extends JPanel {
999                  // Calculate the oldMapArea in the current WindowCoordinates:                  // Calculate the oldMapArea in the current WindowCoordinates:
1000                  final Envelope oldMapWindow = tranformGeoToWindow(oldMapArea.getMinX(),                  final Envelope oldMapWindow = tranformGeoToWindow(oldMapArea.getMinX(),
1001                                  oldMapArea.getMinY(), oldMapArea.getMaxX(), oldMapArea                                  oldMapArea.getMinY(), oldMapArea.getMaxX(), oldMapArea
1002                                                  .getMaxY(), null);                                                  .getMaxY());
1003    
1004                  final int xx1 = (int) Math.round(oldMapWindow.getMinX());                  final int xx1 = (int) Math.round(oldMapWindow.getMinX());
1005                  final int yy1 = (int) Math.round(oldMapWindow.getMinY());                  final int yy1 = (int) Math.round(oldMapWindow.getMinY());
# Line 1074  public class XMapPane extends JPanel { Line 1055  public class XMapPane extends JPanel {
1055                  //                  //
1056                  if (finalImage == null) {                  if (finalImage == null) {
1057                          // Rectangle curPaintArea = getVisibleRect();                          // Rectangle curPaintArea = getVisibleRect();
1058                          finalImage = new BufferedImage(getBounds().width,                          finalImage = new BufferedImage(getVisibleRect().width,
1059                                          getBounds().height, IMAGETYPE);                                          getVisibleRect().height, IMAGETYPE);
1060    
1061                          requestStartRendering();                          requestStartRendering();
1062                  }                  }
# Line 1092  public class XMapPane extends JPanel { Line 1073  public class XMapPane extends JPanel {
1073          private BufferedImage getLocalImage() {          private BufferedImage getLocalImage() {
1074    
1075                  if (localImage == null) {                  if (localImage == null) {
1076                          localImage = new BufferedImage(getBounds().width,                          localImage = new BufferedImage(getVisibleRect().width,
1077                                          getBounds().height, IMAGETYPE_withAlpha);                                          getVisibleRect().height, IMAGETYPE_withAlpha);
1078                  }                  }
1079    
1080                  return localImage;                  return localImage;
# Line 1123  public class XMapPane extends JPanel { Line 1104  public class XMapPane extends JPanel {
1104                  if (mapArea == null)                  if (mapArea == null)
1105                          return null;                          return null;
1106    
1107                    // TODO is needed at all, this should go to setMapArea maybe
1108                  if (localContext.getCoordinateReferenceSystem() == null)                  if (localContext.getCoordinateReferenceSystem() == null)
1109                          try {                          try {
1110                                  localContext.setCoordinateReferenceSystem(GeoImportUtil                                  localContext.setCoordinateReferenceSystem(GeoImportUtil
1111                                                  .getDefaultCRS());                                                  .getDefaultCRS());
1112                          } catch (TransformException e) {                          } catch (Exception e) {
1113                                  // TODO Auto-generated catch block                                  throw new RuntimeException("setting context CRS:", e);
                                 e.printStackTrace();  
                         } catch (FactoryException e) {  
                                 // TODO Auto-generated catch block  
                                 e.printStackTrace();  
1114                          }                          }
1115    
1116                  return new ReferencedEnvelope(mapArea, localContext                  return new ReferencedEnvelope(mapArea, localContext
# Line 1177  public class XMapPane extends JPanel { Line 1155  public class XMapPane extends JPanel {
1155                          }                          }
1156    
1157                          // Kartenbereich um 10% vergroessern                          // Kartenbereich um 10% vergroessern
1158                          return JTSUtil.fixAspectRatio(this.getBounds(), JTSUtil                          return JTSUtil.fixAspectRatio(getVisibleRect(), JTSUtil
1159                                          .expandEnvelope(layerBounds, 0.1), true);                                          .expandEnvelope(layerBounds, 0.1), true);
1160                  }                  }
1161                  return maxExtend;                  return maxExtend;
# Line 1541  public class XMapPane extends JPanel { Line 1519  public class XMapPane extends JPanel {
1519           */           */
1520          public void performPan() {          public void performPan() {
1521    
1522                  final Rectangle winBounds = getBounds();                  Rectangle winBounds = getVisibleRect();
1523                    
1524                  winBounds.translate(-imageOrigin.x, -imageOrigin.y);                  winBounds.translate(-imageOrigin.x, -imageOrigin.y);
1525                  final Envelope newMapArea = tranformWindowToGeo(winBounds.x,                  final Envelope newMapArea = tranformWindowToGeo(winBounds.x,
1526                                  winBounds.y, winBounds.x + winBounds.width, winBounds.y                                  winBounds.y, winBounds.x + winBounds.width, winBounds.y
# Line 1610  public class XMapPane extends JPanel { Line 1589  public class XMapPane extends JPanel {
1589    
1590          }          }
1591    
1592            //
1593            // /**
1594            // * Berechnet die Transformation zwischen Fenster- und Karten-Koordinaten
1595            // * neu.
1596            // */
1597            // protected void resetTransforms() {
1598            // if (getMapArea() == null || getWidth() == 0 || getHeight() == 0)
1599            // return;
1600            //
1601            // // We store the last Transform
1602            // oldScreenToWorld = screenToWorld;
1603            //
1604            // this.screenToWorld = new AffineTransform(
1605            // // Genauso wie die Fenster-Koordinaten, werden die Longitude-Koordinaten
1606            // // nach rechts (Osten) hin groesser
1607            // // --> positive Verschiebung
1608            // getMapArea().getWidth() / getWidth(),
1609            // // keine Verzerrung
1610            // 0.0, 0.0,
1611            // // Waehrend die Fenster-Koordinaten nach unten hin groesser
1612            // // werden,
1613            // // werden Latitude-Koordinaten nach Sueden hin keiner
1614            // // --> negative Verschiebung
1615            // -getMapArea().getHeight() / getHeight(),
1616            // // Die Longitude-Koordinaten werden nach Osten hin groesser
1617            // // --> obere linke Ecke des Fensters hat also den Minimalwert
1618            // getMapArea().getMinX(),
1619            // // Die Latitude-Koordinaten werden nach Norden hin groesser
1620            // // --> obere linke Ecke des Fensters hat also den Maximalwert
1621            // getMapArea().getMaxY());
1622            //
1623            // try {
1624            // this.worldToScreen = screenToWorld.createInverse();
1625            // } catch (final NoninvertibleTransformException e) {
1626            // LOGGER.error(e);
1627            // }
1628            // }
1629    
1630          /**          /**
1631           * Berechnet die Transformation zwischen Fenster- und Karten-Koordinaten           * Calculate the affine transforms used to convert between world and pixel
1632           * neu.           * coordinates. The calculations here are very basic and assume a cartesian
1633           */           * reference system.
1634          protected void resetTransforms() {           * <p>
1635                  if (getMapArea() == null || getWidth() == 0 || getHeight() == 0)           * Tne transform is calculated such that {@code envelope} will be centred in
1636                          return;           * the display
1637             *
1638             * @param envelope
1639             *            the current map extent (world coordinates)
1640             * @param paintArea
1641             *            the current map pane extent (screen units)
1642             */
1643            private void resetTransforms() {
1644                    ReferencedEnvelope refMapEnv = new ReferencedEnvelope(mapArea,
1645                                    getContext().getCoordinateReferenceSystem());
1646    
1647                  // We store the last Transform                  Rectangle paintArea = getVisibleRect(); // NOT USE GET BOUNDS!
1648                  oldScreenToWorld = screenToWorld;                  
1649                    //        
1650                    // double xscale = paintArea.getWidth() / refEnv.getWidth();
1651                    // double yscale = paintArea.getHeight() / refEnv.getHeight();
1652                    //
1653                    // double scale = Math.min(xscale, yscale);
1654                    //
1655                    // double xoff = refEnv.getMedian(0) * scale - paintArea.getCenterX();
1656                    // double yoff = refEnv.getMedian(1) * scale + paintArea.getCenterY();
1657    
1658                  this.screenToWorld = new AffineTransform(                  worldToScreen = RendererUtilities.worldToScreenTransform(refMapEnv,
1659                  // Genauso wie die Fenster-Koordinaten, werden die Longitude-Koordinaten                                  paintArea);
                                 // nach rechts (Osten) hin groesser  
                                 // --> positive Verschiebung  
                                 getMapArea().getWidth() / getWidth(),  
                                 // keine Verzerrung  
                                 0.0, 0.0,  
                                 // Waehrend die Fenster-Koordinaten nach unten hin groesser  
                                 // werden,  
                                 // werden Latitude-Koordinaten nach Sueden hin keiner  
                                 // --> negative Verschiebung  
                                 -getMapArea().getHeight() / getHeight(),  
                                 // Die Longitude-Koordinaten werden nach Osten hin groesser  
                                 // --> obere linke Ecke des Fensters hat also den Minimalwert  
                                 getMapArea().getMinX(),  
                                 // Die Latitude-Koordinaten werden nach Norden hin groesser  
                                 // --> obere linke Ecke des Fensters hat also den Maximalwert  
                                 getMapArea().getMaxY());  
1660    
1661                    // worldToScreen = new AffineTransform(scale, 0, 0, -scale, -xoff,
1662                    // yoff);
1663                  try {                  try {
1664                          this.worldToScreen = screenToWorld.createInverse();                          screenToWorld = worldToScreen.createInverse();
1665                  } catch (final NoninvertibleTransformException e) {  
1666                          LOGGER.error(e);                  } catch (NoninvertibleTransformException ex) {
1667                            ex.printStackTrace();
1668                  }                  }
1669          }          }
1670    
# Line 1738  public class XMapPane extends JPanel { Line 1759  public class XMapPane extends JPanel {
1759                          return false;                          return false;
1760                  }                  }
1761    
1762                    final Envelope candNew = bestAllowedMapArea(newMapArea);
1763    
1764                  // Testing, whether the difference if just minimal                  // Testing, whether the difference if just minimal
1765                  if (mapArea != null) {                  if (mapArea != null) {
                         final Envelope candNew = bestAllowedMapArea(newMapArea);  
1766                          final double tolX = mapArea.getWidth() / 1000.;                          final double tolX = mapArea.getWidth() / 1000.;
1767                          final double tolY = mapArea.getHeight() / 1000.;                          final double tolY = mapArea.getHeight() / 1000.;
1768                          if ((candNew.getMinX() - tolX < mapArea.getMinX())                          if ((candNew.getMinX() - tolX < mapArea.getMinX())
# Line 1760  public class XMapPane extends JPanel { Line 1782  public class XMapPane extends JPanel {
1782                          }                          }
1783                  }                  }
1784    
1785                    // New map are is accepted:
1786                  oldMapArea = mapArea;                  oldMapArea = mapArea;
1787                    mapArea = candNew;
1788                  this.mapArea = bestAllowedMapArea(newMapArea);                  resetTransforms();
1789    
1790                  if (localContext != null) {                  if (localContext != null) {
1791                          localContext.setAreaOfInterest(mapArea, localContext                          localContext.setAreaOfInterest(mapArea, localContext
# Line 1772  public class XMapPane extends JPanel { Line 1795  public class XMapPane extends JPanel {
1795                          bgContext.setAreaOfInterest(mapArea, localContext                          bgContext.setAreaOfInterest(mapArea, localContext
1796                                          .getCoordinateReferenceSystem());                                          .getCoordinateReferenceSystem());
1797                  }                  }
                 resetTransforms();  
1798                  mapImageInvalid = true;                  mapImageInvalid = true;
1799                  mapAreaChanged = true;                  mapAreaChanged = true;
1800                  repaint();                  repaint();
1801    
1802                  // LOGGER.debug("New maparea = " + mapArea);                  LOGGER.debug("New maparea = " + mapArea);
1803                  return true;                  return true;
1804          }          }
1805    
# Line 1997  public class XMapPane extends JPanel { Line 2019  public class XMapPane extends JPanel {
2019           *            {@link #getScreenToWorld()} is used.           *            {@link #getScreenToWorld()} is used.
2020           */           */
2021          public Envelope tranformGeoToWindow(final double ox, final double oy,          public Envelope tranformGeoToWindow(final double ox, final double oy,
2022                          final double px, final double py,                          final double px, final double py) {
2023                          final AffineTransform winToGeotransform) {                  final AffineTransform at = getWorldToScreenTransform();
                 final AffineTransform at = winToGeotransform == null ? getScreenToWorld()  
                                 : winToGeotransform;  
2024                  Point2D geoO;                  Point2D geoO;
2025                  try {                  // try {
2026                          geoO = at.inverseTransform(new Point2D.Double(ox, oy), null);                  geoO = at.transform(new Point2D.Double(ox, oy), null);
2027                          final Point2D geoP = at.inverseTransform(                  final Point2D geoP = at.transform(new Point2D.Double(px, py), null);
2028                                          new Point2D.Double(px, py), null);                  return new Envelope(geoO.getX(), geoP.getX(), geoO.getY(), geoP.getY());
2029                          return new Envelope(geoO.getX(), geoP.getX(), geoO.getY(), geoP                  // } catch (final NoninvertibleTransformException e) {
2030                                          .getY());                  // LOGGER.error(e);
2031                  } catch (final NoninvertibleTransformException e) {                  // return new Envelope(ox, oy, px, py);
2032                          LOGGER.error(e);                  // }
                         return new Envelope(ox, oy, px, py);  
                 }  
2033          }          }
2034    
2035          /**          /**
# Line 2031  public class XMapPane extends JPanel { Line 2049  public class XMapPane extends JPanel {
2049                  final AffineTransform at = getScreenToWorld();                  final AffineTransform at = getScreenToWorld();
2050                  final Point2D geoO = at.transform(new Point2D.Double(ox, oy), null);                  final Point2D geoO = at.transform(new Point2D.Double(ox, oy), null);
2051                  final Point2D geoP = at.transform(new Point2D.Double(px, py), null);                  final Point2D geoP = at.transform(new Point2D.Double(px, py), null);
2052                  return new Envelope(geoO.getX(), geoP.getX(), geoO.getY(), geoP.getY());                  
2053                    // Mmmmm... don't really understand why its x,x,y,y
2054    //              return new Envelope(geoO.getX(), geoP.getX(), geoO.getY(), geoP.getY());
2055                    return new Envelope( new Coordinate(geoO.getX(), geoO.getY()), new Coordinate(geoP.getX(), geoP.getY()));
2056          }          }
2057    
2058          /**          /**
# Line 2147  public class XMapPane extends JPanel { Line 2168  public class XMapPane extends JPanel {
2168    
2169                  // Paint a logo to the bottom right if available                  // Paint a logo to the bottom right if available
2170                  if (mapImage != null) {                  if (mapImage != null) {
2171                          graphics.drawImage(mapImage, getBounds().width                          Rectangle visibleRect = getVisibleRect();
2172                                          - mapImage.getWidth() - 10, getBounds().height                          graphics.drawImage(mapImage, visibleRect.width
2173                                            - mapImage.getWidth() - 10, getVisibleRect().height
2174                                          - mapImage.getHeight() - 10, null);                                          - mapImage.getHeight() - 10, null);
2175                  }                  }
2176                    
                   
2177                  int y = 17;                  int y = 17;
2178    
2179                  // If the rendering process is still running, indicate this is the image                  // If the rendering process is still running, indicate this is the image
2180                  if (forceWait || bgExecuter != null && bgExecuter.isRunning()                  if (forceWait || bgExecuter != null && bgExecuter.isRunning()
2181                                  || localExecuter != null && localExecuter.isRunning()) {                                  || localExecuter != null && localExecuter.isRunning()) {
2182                            
2183                          y+=8;                          y += 8;
2184    
2185                          final Color c = graphics.getColor();                          final Color c = graphics.getColor();
2186                          graphics.setFont(waitFont);                          graphics.setFont(waitFont);
 //                      String waitStr = "Wait..."; // i8n  
2187    
2188                          graphics.setColor(getMapBackgroundColor());                          graphics.setColor(getMapBackgroundColor());
2189                          graphics.drawString(waitMsg, 5, y);                          graphics.drawString(waitMsg, 5, y);
2190                          graphics.setColor(getMapBackgroundColor());                          graphics.setColor(getMapBackgroundColor());
2191                          graphics.drawString(waitMsg, 7, y+2);                          graphics.drawString(waitMsg, 7, y + 2);
2192                          graphics.setColor(Color.BLACK);                          graphics.setColor(Color.BLACK);
2193                          graphics.drawString(waitMsg, 6, y+1);                          graphics.drawString(waitMsg, 6, y + 1);
2194    
2195                          graphics.setColor(c);                          graphics.setColor(c);
2196                            
2197                          y += 24;                          y += 24;
2198                  }                  }
2199    
# Line 2329  public class XMapPane extends JPanel { Line 2349  public class XMapPane extends JPanel {
2349                  newMapArea.expandBy((mapArea.getWidth() * zoomFaktor - mapArea                  newMapArea.expandBy((mapArea.getWidth() * zoomFaktor - mapArea
2350                                  .getWidth()) / 2., (mapArea.getHeight() * zoomFaktor - mapArea                                  .getWidth()) / 2., (mapArea.getHeight() * zoomFaktor - mapArea
2351                                  .getHeight()) / 2.);                                  .getHeight()) / 2.);
2352                    
2353                  // Move the newMapArea above the new center  // TODO we actually want that
2354                  newMapArea.translate(gcenter.getX() - mapArea.centre().x, gcenter  //              // Move the newMapArea above the new center
2355                                  .getY()  //              newMapArea.translate(gcenter.getX() - mapArea.centre().x, gcenter
2356                                  - mapArea.centre().y);  //                              .getY()
2357    //                              - mapArea.centre().y);
2358    
2359                  setMapArea(newMapArea);                  setMapArea(newMapArea);
2360          }          }

Legend:
Removed from v.533  
changed lines
  Added in v.540

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26