/[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 430 by alfonx, Thu Oct 1 20:22:48 2009 UTC revision 431 by alfonx, Sun Oct 4 16:55:52 2009 UTC
# Line 377  public class JMapPane extends JPanel imp Line 377  public class JMapPane extends JPanel imp
377           */           */
378          private Envelope fixAspectRatio(final Rectangle r, final Envelope mapArea,          private Envelope fixAspectRatio(final Rectangle r, final Envelope mapArea,
379                          boolean grow) {                          boolean grow) {
380                    
381                    if (mapArea == null) {
382                            LOGGER.warn("mapArea has been null in method fixAspectRatio, returning an unmodified ");
383                    }
384    
385                  final double mapWidth = mapArea.getWidth(); /* get the extent of the map */                  final double mapWidth = mapArea.getWidth(); /* get the extent of the map */
386                  final double mapHeight = mapArea.getHeight();                  final double mapHeight = mapArea.getHeight();
# Line 621  public class JMapPane extends JPanel imp Line 625  public class JMapPane extends JPanel imp
625          protected void processDrag(final int x1, final int y1, final int x2,          protected void processDrag(final int x1, final int y1, final int x2,
626                          final int y2, final MouseEvent e) {                          final int y2, final MouseEvent e) {
627    
628    
629                  /****                  /****
630                   * If no layer is availabe we dont want a NullPointerException                   * If no layers exist, we ignore the drag.
631                   */                   */
632                  if (mapArea == null)                  if (context.getLayerCount() <= 0) {
633                          return;                          return;
634                    }
635                    
636                  // System.out.println("processing drag from " + x1 + "," + y1 + " -> "                  // System.out.println("processing drag from " + x1 + "," + y1 + " -> "
637                  // + x2 + "," + y2);                  // + x2 + "," + y2);
638                  if ((x1 == x2) && (y1 == y2)) {                  if ((x1 == x2) && (y1 == y2)) {
# Line 672  public class JMapPane extends JPanel imp Line 678  public class JMapPane extends JPanel imp
678                          final Coordinate ur = new Coordinate(right, top);                          final Coordinate ur = new Coordinate(right, top);
679                          // xulu.sc                          // xulu.sc
680                          // mapArea = fixAspectRatio(this.getBounds(), new Envelope(ll, ur));                          // mapArea = fixAspectRatio(this.getBounds(), new Envelope(ll, ur));
681                            
682    
683                          setMapArea(bestAllowedMapArea(new Envelope(ll, ur)));                          setMapArea(bestAllowedMapArea(new Envelope(ll, ur)));
684                          // xulu.ec                          // xulu.ec
685                  } else if (state == JMapPane.ZoomIn) {                  } else if (state == JMapPane.ZoomIn) {

Legend:
Removed from v.430  
changed lines
  Added in v.431

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26