Ignore:
Timestamp:
2011-10-12T00:39:26+02:00 (14 years ago)
Author:
pieren
Message:

Fixed issues with new offset in grabbing vector images

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java

    r26823 r26835  
    8585    private double rasterRatio;
    8686
     87    // offset for vector images temporarily shifted (correcting Cadastre artifacts), in pixels
     88    public double deltaEast=0;
     89    public double deltaNorth=0;
     90
    8791    private Action saveAsPng;
    8892
     
    9195    @SuppressWarnings("serial")
    9296    class ResetOffsetActionMenu extends JosmAction {
    93         private WMSLayer wmsLayer;
    94         public ResetOffsetActionMenu(WMSLayer wmsLayer) {
     97        public ResetOffsetActionMenu() {
    9598            super(tr("Reset offset"), null, tr("Reset offset (only vector images)"), null, false);
    96             this.wmsLayer = wmsLayer;
    9799        }
    98100        @Override
    99101        public void actionPerformed(ActionEvent arg0) {
    100             for (GeorefImage img:wmsLayer.images) {
    101                 img.deltaEast = 0;
    102                 img.deltaNorth = 0;
    103             }
     102            deltaEast = 0;
     103            deltaNorth = 0;
    104104            Main.map.mapView.repaint();
    105105        }
     
    180180        EastNorth lambertMin = Main.getProjection().latlon2eastNorth(b.getMin());
    181181        EastNorth lambertMax = Main.getProjection().latlon2eastNorth(b.getMax());
    182         double minEast = lambertMin.east();
    183         double minNorth = lambertMin.north();
     182        double minEast = lambertMin.east()+deltaEast;
     183        double minNorth = lambertMin.north()+deltaNorth;
    184184        double dEast = (lambertMax.east() - minEast) / factor;
    185185        double dNorth = (lambertMax.north() - minNorth) / factor;
     
    309309        cancelGrab = new MenuActionCancelGrab(this);
    310310        cancelGrab.setEnabled(!isRaster && grabThread.getImagesToGrabSize() > 0);
    311         Action resetOffset = new ResetOffsetActionMenu(this);
    312         resetOffset.setEnabled(!isRaster && images.size() > 0 && (images.get(0).deltaEast!=0.0 || images.get(0).deltaNorth!=0.0));
     311        Action resetOffset = new ResetOffsetActionMenu();
     312        resetOffset.setEnabled(!isRaster && images.size() > 0 && (deltaEast!=0.0 || deltaNorth!=0.0));
    313313        return new Action[] {
    314314                LayerListDialog.getInstance().createShowHideLayerAction(),
     
    338338            new GeorefImage(null,
    339339            Main.getProjection().latlon2eastNorth(bounds.getMin()),
    340             Main.getProjection().latlon2eastNorth(bounds.getMax()));
     340            Main.getProjection().latlon2eastNorth(bounds.getMax()), this);
    341341        for (GeorefImage img : images) {
    342342            if (img.overlap(georefImage))
     
    509509                        }
    510510                    }
     511                    newImage.wmsLayer = this;
    511512                    this.images.add(newImage);
    512513                }
     
    550551            synchronized(this) {
    551552                images.clear();
    552                 images.add(new GeorefImage(new_img, min, max));
     553                images.add(new GeorefImage(new_img, min, max, this));
    553554            }
    554555        }
     
    626627            images.get(0).shear(dx, dy);
    627628        } else {
    628             for (GeorefImage image:images)
    629                 image.tempShear(dx, dy);
     629            deltaEast+=dx;
     630            deltaNorth+=dy;
    630631        }
    631632    }
Note: See TracChangeset for help on using the changeset viewer.