Changeset 24913 in osm for applications


Ignore:
Timestamp:
2010-12-30T15:21:07+01:00 (14 years ago)
Author:
pieren
Message:

simplified some procedures

Location:
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr
Files:
2 edited

Legend:

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

    r24907 r24913  
    3333        try {
    3434            if (grabber.getWmsInterface().retrieveInterface(wmsLayer)) {
    35                 boolean useFactor = true;
    3635                if (wmsLayer.images.isEmpty()) {
    3736                    // first time we grab an image for this layer
     
    5251                        // set vectorized commune bounding box by opening the standard web window
    5352                        grabber.getWmsInterface().retrieveCommuneBBox(wmsLayer);
    54                         // if it is the first layer, use the communeBBox as grab bbox (and not divided)
    55                         if (Main.map.mapView.getAllLayers().size() == 1 ) {
    56                             bounds = wmsLayer.getCommuneBBox().toBounds();
    57                             Main.map.mapView.zoomTo(bounds);
    58                             useFactor = false;
    59                         }
    6053                    }
    6154                }
    6255                // grab new images from wms server into active layer
    63                 wmsLayer.grab(grabber, bounds, useFactor);
     56                wmsLayer.grab(grabber, bounds);
    6457            }
    6558        } catch (DuplicateLayerException e) {
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java

    r24907 r24913  
    127127
    128128    public void grab(CadastreGrabber grabber, Bounds b) throws IOException {
    129         grab(grabber, b, true);
    130     }
    131 
    132     public void grab(CadastreGrabber grabber, Bounds b, boolean useFactor) throws IOException {
    133129        cancelled = false;
    134         if (useFactor) {
     130        // if it is the first layer, use the communeBBox as grab bbox (and not divided)
     131        if (Main.map.mapView.getAllLayers().size() == 1 ) {
     132            b = this.getCommuneBBox().toBounds();
     133            Main.map.mapView.zoomTo(b);
     134            divideBbox(b, 1);
     135        } else {
    135136            if (isRaster) {
    136137                b = new Bounds(Main.proj.eastNorth2latlon(rasterMin), Main.proj.eastNorth2latlon(rasterMax));
    137138                divideBbox(b, Integer.parseInt(Main.pref.get("cadastrewms.rasterDivider",
    138                         CadastrePreferenceSetting.DEFAULT_RASTER_DIVIDER)), 0);
     139                        CadastrePreferenceSetting.DEFAULT_RASTER_DIVIDER)));
    139140            } else
    140                 divideBbox(b, Integer.parseInt(Main.pref.get("cadastrewms.scale", Scale.X1.toString())), 0);
    141         } else
    142             divideBbox(b, 1, 0);
     141                divideBbox(b, Integer.parseInt(Main.pref.get("cadastrewms.scale", Scale.X1.toString())));
     142        }
    143143
    144144        int lastSavedImage = images.size();
     
    189189     *               4 = configurable size from preferences (100 meters per default) rounded
    190190     *                   allowing grabbing of next contiguous zone
    191      *               5 = use the size provided in next argument optionalSize
    192      * @param optionalSize box size used when factor is 5.
    193      */
    194     private void divideBbox(Bounds b, int factor, int optionalSize) {
     191     */
     192    private void divideBbox(Bounds b, int factor) {
    195193        EastNorth lambertMin = Main.proj.latlon2eastNorth(b.getMin());
    196194        EastNorth lambertMax = Main.proj.latlon2eastNorth(b.getMax());
     
    208206        } else {
    209207            // divide to fixed size squares
    210             int cSquare = factor == 4 ? Integer.parseInt(Main.pref.get("cadastrewms.squareSize", "100")) : optionalSize;
     208            int cSquare = Integer.parseInt(Main.pref.get("cadastrewms.squareSize", "100"));
    211209            minEast = minEast - minEast % cSquare;
    212210            minNorth = minNorth - minNorth % cSquare;
Note: See TracChangeset for help on using the changeset viewer.