Ignore:
Timestamp:
2014-12-19T17:12:01+01:00 (10 years ago)
Author:
donvip
Message:

[josm_cadastre-fr] replace calls to System.out/err by calls to Main.info/warn/error

File:
1 edited

Legend:

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

    r30737 r30859  
    2828
    2929    private CacheControl cacheControl = null;
    30    
     30
    3131    private EastNorthBound currentGrabImage;
    3232
     
    3434
    3535    /**
    36      * Call directly grabber for raster images or prepare thread for vector images 
     36     * Call directly grabber for raster images or prepare thread for vector images
    3737     * @param moreImages
    3838     */
     
    4444            this.notify();
    4545        }
    46         System.out.println("Added " + moreImages.size() + " to the grab thread");
     46        Main.info("Added " + moreImages.size() + " to the grab thread");
    4747        if (wmsLayer.isRaster()) {
    4848            waitNotification();
     
    5656        return size;
    5757    }
    58    
     58
    5959    public ArrayList<EastNorthBound> getImagesToGrabCopy() {
    60         ArrayList<EastNorthBound> copyList = new ArrayList<>(); 
     60        ArrayList<EastNorthBound> copyList = new ArrayList<>();
    6161        lockImagesToGrag.lock();
    6262        for (EastNorthBound img : imagesToGrab) {
     
    6767        return copyList;
    6868    }
    69    
    70     public void clearImagesToGrab() {       
     69
     70    public void clearImagesToGrab() {
    7171        lockImagesToGrag.lock();
    7272        imagesToGrab.clear();
    7373        lockImagesToGrag.unlock();
    7474    }
    75    
     75
    7676    @Override
    7777    public void run() {
     
    9292                        newImage = grabber.grab(wmsLayer, currentGrabImage.min, currentGrabImage.max);
    9393                    } catch (IOException e) {
    94                         System.out
    95                                 .println("Download action canceled by user or server did not respond");
     94                        Main.warn("Download action canceled by user or server did not respond");
    9695                        setCanceled(true);
    9796                        break;
    9897                    } catch (OsmTransferException e) {
    99                         System.out.println("OSM transfer failed");
     98                        Main.error("OSM transfer failed");
    10099                        setCanceled(true);
    101100                        break;
    102101                    }
    103102                    if (grabber.getWmsInterface().downloadCanceled) {
    104                         System.out.println("Download action canceled by user");
     103                        Main.info("Download action canceled by user");
    105104                        setCanceled(true);
    106105                        break;
    107106                    }
    108107                    try {
    109                     if (CadastrePlugin.backgroundTransparent) {
    110                         wmsLayer.imagesLock.lock();
    111                         for (GeorefImage img : wmsLayer.getImages()) {
    112                             if (img.overlap(newImage))
    113                                 // mask overlapping zone in already grabbed image
    114                                 img.withdraw(newImage);
    115                             else
    116                                 // mask overlapping zone in new image only when new image covers completely the
    117                                 // existing image
    118                                 newImage.withdraw(img);
    119                         }
    120                         wmsLayer.imagesLock.unlock();
    121                     }
    122                     wmsLayer.addImage(newImage);
    123                     Main.map.mapView.repaint();
    124                     saveToCache(newImage);
     108                            if (CadastrePlugin.backgroundTransparent) {
     109                                wmsLayer.imagesLock.lock();
     110                                for (GeorefImage img : wmsLayer.getImages()) {
     111                                    if (img.overlap(newImage))
     112                                        // mask overlapping zone in already grabbed image
     113                                        img.withdraw(newImage);
     114                                    else
     115                                        // mask overlapping zone in new image only when new image covers completely the
     116                                        // existing image
     117                                        newImage.withdraw(img);
     118                                }
     119                                wmsLayer.imagesLock.unlock();
     120                            }
     121                            wmsLayer.addImage(newImage);
     122                            Main.map.mapView.repaint();
     123                            saveToCache(newImage);
    125124                    } catch (NullPointerException e) {
    126                         System.out.println("Layer destroyed. Cancel grab thread");
     125                        Main.info("Layer destroyed. Cancel grab thread");
    127126                        setCanceled(true);
    128127                    }
    129128                }
    130129            }
    131             System.out.println("grab thread list empty");
     130            Main.info("grab thread list empty");
    132131            lockCurrentGrabImage.lock();
    133132            currentGrabImage = null;
     
    163162        if (cacheControl != null) {
    164163            while (!cacheControl.isCachePipeEmpty()) {
    165                 System.out
    166                         .println("Try to close a WMSLayer which is currently saving in cache : wait 1 sec.");
     164                Main.info("Try to close a WMSLayer which is currently saving in cache : wait 1 sec.");
    167165                CadastrePlugin.safeSleep(1000);
    168166            }
     
    193191        lockCurrentGrabImage.unlock();
    194192    }
    195    
     193
    196194    private void paintBox(Graphics g, MapView mv, EastNorthBound img, Color color) {
    197195        Point[] croppedPoint = new Point[5];
     
    206204        }
    207205    }
    208    
     206
    209207    public boolean isCanceled() {
    210208        return canceled;
     
    231229            wait();
    232230        } catch (InterruptedException e) {
    233             e.printStackTrace(System.out);
    234         }
    235     }
    236 
     231            Main.error(e);
     232        }
     233    }
    237234}
Note: See TracChangeset for help on using the changeset viewer.