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

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

Legend:

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

    r30737 r30859  
    4343
    4444import org.openstreetmap.josm.Main;
     45import org.openstreetmap.josm.actions.mapmode.MapMode;
    4546import org.openstreetmap.josm.command.AddCommand;
    4647import org.openstreetmap.josm.command.ChangeCommand;
     
    4849import org.openstreetmap.josm.command.Command;
    4950import org.openstreetmap.josm.command.SequenceCommand;
    50 import org.openstreetmap.josm.actions.mapmode.MapMode;
    5151import org.openstreetmap.josm.data.coor.EastNorth;
    5252import org.openstreetmap.josm.data.osm.Node;
     
    6565public class Address extends MapMode implements MouseListener, MouseMotionListener, ActionListener {
    6666    private static final long serialVersionUID = 1L;
    67    
     67
    6868    // perhaps make all these tags configurable in the future
    6969    private String tagHighway = "highway";
     
    7676    private String relationAddrStreetRole = "street";
    7777    private String relationMemberHouse = "house";
    78    
     78
    7979    private JRadioButton plus_one = new JRadioButton("+1", false);
    8080    private JRadioButton plus_two = new JRadioButton("+2", true); // enable this by default
     
    9393
    9494    public Address(MapFrame mapFrame) {
    95         super(tr("Add address"), "buildings", 
     95        super(tr("Add address"), "buildings",
    9696                tr("Helping tool for tag address"),
    9797                Shortcut.registerShortcut("mapmode:cadastre-fr-buildings", tr("Mode: {0}", tr("CadastreFR - Buildings")), KeyEvent.VK_E, Shortcut.DIRECT),
     
    153153                    try {
    154154                        // add new address
    155                         Integer.parseInt(num); 
     155                        Integer.parseInt(num);
    156156                        inputNumber.setText(num);
    157157                        applyInputNumberChange();
    158158                    } catch (NumberFormatException en) {
    159                         System.out.println("Unable to parse house number \"" + num + "\"");
     159                        Main.warn("Unable to parse house number \"" + num + "\"");
    160160                    }
    161161                }
     
    202202                setNewSelection(mouseOnExistingWays.get(0));
    203203            } else if (mouseOnExistingWays.size() == 0) {
    204                 // clicked a non highway and not a node => add the new address 
     204                // clicked a non highway and not a node => add the new address
    205205                if (inputStreet.getText().equals("") || inputNumber.getText().equals("")) {
    206206                    Toolkit.getDefaultToolkit().beep();
     
    221221
    222222    }
    223    
     223
    224224    private Way findWayInRelationAddr(Node n) {
    225225        List<OsmPrimitive> l = n.getReferrers();
     
    238238        return null;
    239239    }
    240    
     240
    241241    private void addAddrToPolygon(List<Way> mouseOnExistingBuildingWays, Collection<Command> cmds) {
    242242        for (Way w:mouseOnExistingBuildingWays) {
     
    244244        }
    245245    }
    246    
     246
    247247    private void addAddrToPrimitive(OsmPrimitive osm, Collection<Command> cmds) {
    248248        // add the current tag addr:housenumber in node and member in relation (if so configured)
     
    251251                revertInputNumberChange();
    252252            } catch (NumberFormatException en) {
    253                 System.out.println("Unable to parse house number \"" + inputNumber.getText() + "\"");
     253                Main.warn("Unable to parse house number \"" + inputNumber.getText() + "\"");
    254254            }
    255255
     
    263263            setNewSelection(osm);
    264264        } catch (NumberFormatException en) {
    265             System.out.println("Unable to parse house number \"" + inputNumber.getText() + "\"");
    266         }
    267     }
    268    
     265                Main.warn("Unable to parse house number \"" + inputNumber.getText() + "\"");
     266        }
     267    }
     268
    269269    private Relation findRelationAddr(Way w) {
    270270        List<OsmPrimitive> l = w.getReferrers();
     
    276276        return null;
    277277    }
    278    
     278
    279279    private void addStreetNameOrRelation(OsmPrimitive osm, Collection<Command> cmds) {
    280280        if (Main.pref.getBoolean("cadastrewms.addr.dontUseRelation", false)) {
     
    339339        return n;
    340340    }
    341    
     341
    342342    private static void adjustNode(Collection<Pair<Node,Node>> segs, Node n) {
    343343
     
    395395        }
    396396    }
    397    
     397
    398398    static double det(double a, double b, double c, double d) {
    399399        return a * d - b * c;
     
    422422        return Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR);
    423423    }
    424    
     424
    425425    private void applyInputNumberChange() {
    426426        Integer num = Integer.parseInt(inputNumber.getText());
     
    435435        inputNumber.setText(num.toString());
    436436    }
    437    
     437
    438438    private void revertInputNumberChange() {
    439439        Integer num = Integer.parseInt(inputNumber.getText());
     
    448448        inputNumber.setText(num.toString());
    449449    }
    450    
     450
    451451    private void createDialog() {
    452452        ImageIcon iconLink = ImageProvider.get(null, "Mf_relation.png");
     
    466466        clearButton = new JButton("Clear");
    467467        clearButton.addActionListener(new ActionListener() {
    468             public void actionPerformed(ActionEvent e) {
     468            @Override
     469                        public void actionPerformed(ActionEvent e) {
    469470                inputNumber.setText("");
    470471                inputStreet.setText("");
     
    491492        p.add(plus_two, GBC.std().insets(0, 0, 10, 0));
    492493        p.add(clearButton, GBC.eol().fill(GBC.HORIZONTAL).insets(0, 0, 0, 0));
    493    
     494
    494495        final Object[] options = {};
    495496        final JOptionPane pane = new JOptionPane(p,
     
    516517                Main.map.selectMapMode((MapMode)Main.map.getDefaultButtonAction());
    517518            }
    518             public void windowClosed(WindowEvent e) {}
    519             public void windowActivated(WindowEvent arg0) {}
    520             public void windowDeactivated(WindowEvent arg0) {}
    521             public void windowDeiconified(WindowEvent arg0) {}
    522             public void windowIconified(WindowEvent arg0) {}
    523             public void windowOpened(WindowEvent arg0) {}
     519            @Override
     520                        public void windowClosed(WindowEvent e) {}
     521            @Override
     522                        public void windowActivated(WindowEvent arg0) {}
     523            @Override
     524                        public void windowDeactivated(WindowEvent arg0) {}
     525            @Override
     526                        public void windowDeiconified(WindowEvent arg0) {}
     527            @Override
     528                        public void windowIconified(WindowEvent arg0) {}
     529            @Override
     530                        public void windowOpened(WindowEvent arg0) {}
    524531        });
    525532        String bounds = Main.pref.get("cadastrewms.addr.bounds",null);
     
    530537        }
    531538}
    532    
     539
    533540    private void setSelectedWay(Way w) {
    534541        this.selectedWay = w;
     
    539546        link.repaint();
    540547    }
    541    
     548
    542549    private void setNewSelection(OsmPrimitive osm) {
    543550        Collection<OsmPrimitive> newSelection = new LinkedList<>(Main.main.getCurrentDataSet().getSelected());
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CacheControl.java

    r30738 r30859  
    9292            }
    9393            if (size > (long)cacheSize*1024*1024) {
    94                 System.out.println("Delete oldest file  \""+ files[oldestFile].getName()
     94                Main.info("Delete oldest file  \""+ files[oldestFile].getName()
    9595                        + "\" in cache dir to stay under the limit of " + cacheSize + " MB.");
    9696                files[oldestFile].delete();
     
    126126            }
    127127        } catch (Exception e) {
    128             e.printStackTrace(System.out);
     128            Main.error(e);
    129129        }
    130130        return false;
     
    135135            delete(new File(CadastrePlugin.cacheDir + wmsLayer.getName() + "." + WMSFileExtension()));
    136136        } catch (Exception e) {
    137             e.printStackTrace(System.out);
     137                Main.error(e);
    138138        }
    139139    }
    140140
    141141    private void delete(File file) {
    142         System.out.println("Delete file "+file);
     142        Main.info("Delete file "+file);
    143143        if (file.exists())
    144144            file.delete();
     
    155155            successfulRead = wmsLayer.read(file, ois, currentLambertZone);
    156156        } catch (Exception ex) {
    157             ex.printStackTrace(System.out);
     157            Main.error(ex);
    158158            JOptionPane.showMessageDialog(Main.parent, tr("Error loading file.\nProbably an old version of the cache file."), tr("Error"), JOptionPane.ERROR_MESSAGE);
    159159            return false;
     
    211211            }
    212212            try {wait();} catch (InterruptedException e) {
    213                 e.printStackTrace(System.out);
     213                Main.error(e);
    214214            }
    215215        }
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreGrabber.java

    r30738 r30859  
    1313import javax.imageio.ImageIO;
    1414
     15import org.openstreetmap.josm.Main;
    1516import org.openstreetmap.josm.data.coor.EastNorth;
    1617import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
     
    5556        str += (int)(cRasterX*(wmsLayer.communeBBox.max.getY() - wmsLayer.communeBBox.min.getY())/(wmsLayer.communeBBox.max.getX() - wmsLayer.communeBBox.min.getX()));
    5657        str += "&exception=application/vnd.ogc.se_inimage&styles="; // required for raster images
    57         System.out.println("URL="+str);
     58        Main.info("URL="+str);
    5859        return new URL(str.replace(" ", "%20"));
    5960    }
     
    7374        str += "&exception=application/vnd.ogc.se_inimage"; // works also without (but slower ?)
    7475        str += "&styles=" + styles;
    75         System.out.println("URL="+str);
     76        Main.info("URL="+str);
    7677        return new URL(str.replace(" ", "%20"));
    7778    }
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreInterface.java

    r30738 r30859  
    115115                urlConn.connect();
    116116                if (urlConn.getResponseCode() == HttpURLConnection.HTTP_OK) {
    117                     System.out.println("GET "+searchFormURL);
     117                    Main.info("GET "+searchFormURL);
    118118                    BufferedReader in = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
    119119                    while(in.readLine() != null) {}  // read the buffer otherwise we sent POST too early
     
    124124                            cookie = cookie.substring(0, cookie.indexOf(";"));
    125125                            cookieTimestamp = new Date().getTime();
    126                             System.out.println("received cookie=" + cookie + " at " + new Date(cookieTimestamp));
     126                            Main.info("received cookie=" + cookie + " at " + new Date(cookieTimestamp));
    127127                            cookied = true;
    128128                        }
    129129                    }
    130130                } else {
    131                     System.out.println("Request to home page failed. Http error:"+urlConn.getResponseCode()+". Try again "+retries+" times");
     131                    Main.warn("Request to home page failed. Http error:"+urlConn.getResponseCode()+". Try again "+retries+" times");
    132132                    CadastrePlugin.safeSleep(3000);
    133133                    retries --;
     
    135135            }
    136136        } catch (MalformedURLException e) {
    137             throw (IOException) new IOException(
    138                 "Illegal url.").initCause(e);
     137            throw new IOException("Illegal url.", e);
    139138        }
    140139    }
     
    148147        long now = new Date().getTime();
    149148        if ((now - cookieTimestamp) > cCookieExpiration) {
    150             System.out.println("cookie received at "+new Date(cookieTimestamp)+" expired (now is "+new Date(now)+")");
     149            Main.info("cookie received at "+new Date(cookieTimestamp)+" expired (now is "+new Date(now)+")");
    151150            return true;
    152151        }
     
    222221                throw new IOException("Cannot open Cadastre interface. GET response:"+urlConn.getResponseCode());
    223222            }
    224             System.out.println("GET "+interfaceURL);
     223            Main.info("GET "+interfaceURL);
    225224            BufferedReader in = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
    226225            // read the buffer otherwise we sent POST too early
     
    305304                    lines = lines.substring(lines.indexOf(cInterfaceVector),lines.length());
    306305                    lines = lines.substring(0, lines.indexOf("'"));
    307                     System.out.println("interface ref.:"+lines);
     306                    Main.info("interface ref.:"+lines);
    308307                    return lines;
    309308                } else if (wmsLayer.isRaster() && lines.indexOf(cInterfaceRasterTA) != -1) { // "afficherCarteTa.do"
     
    320319                                wmsLayer.setCodeCommune(listOfFeuilles.elementAt(res).ref);
    321320                                lines = buildRasterFeuilleInterfaceRef(listOfFeuilles.elementAt(res).ref);
    322                                 System.out.println("interface ref.:"+lines);
     321                                Main.info("interface ref.:"+lines);
    323322                                return lines;
    324323                            }
     
    351350                    String lov = new String(input.substring(i+c0ptionListStart.length()-1, j));
    352351                    if (lov.indexOf(">") != -1) {
    353                         System.out.println("parse "+lov);
     352                        Main.info("parse "+lov);
    354353                        listOfCommunes.add(lov);
    355354                    } else
    356                         System.err.println("unable to parse commune string:"+lov);
     355                        Main.error("unable to parse commune string:"+lov);
    357356                }
    358357                input = input.substring(j+cOptionListEnd.length());
     
    481480            throw new IOException("Cannot get Cadastre response.");
    482481        }
    483         System.out.println("GET "+searchFormURL);
     482        Main.info("GET "+searchFormURL);
    484483        try (BufferedReader in = new BufferedReader(new InputStreamReader(urlConn.getInputStream()))) {
    485484            while ((ln = in.readLine()) != null) {
     
    541540//                wmsLayer.Y0 = Y0;
    542541//            }
    543 //            System.out.println("parse georef:"+unknown_yet+","+angle+","+scale_origin+","+dpi+","+fX+","+
     542//            Main.info("parse georef:"+unknown_yet+","+angle+","+scale_origin+","+dpi+","+fX+","+
    544543//                    fY+","+X0+","+Y0);
    545544//        }
     
    550549            for (Layer l : Main.map.mapView.getAllLayers()) {
    551550                if (l instanceof WMSLayer && l.getName().equals(wmsLayer.getName()) && (l != wmsLayer)) {
    552                     System.out.println("Try to grab into a new layer when "+wmsLayer.getName()+" is already opened.");
     551                        Main.info("Try to grab into a new layer when "+wmsLayer.getName()+" is already opened.");
    553552                    // remove the duplicated layer
    554553                    Main.main.removeLayer(wmsLayer);
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java

    r30858 r30859  
    451451                dialog.setAlwaysOnTop(true);
    452452            } catch(SecurityException e) {
    453                 System.out.println(tr("Warning: failed to put option pane dialog always on top. Exception was: {0}", e.toString()));
     453                Main.warn(tr("Warning: failed to put option pane dialog always on top. Exception was: {0}", e.toString()));
    454454            }
    455455        }
     
    490490        } catch (NumberFormatException e) {}
    491491        if (srcYear.equals("AAAA") || (year != null && year < currentYear)) {
    492             System.out.println("Replace source year "+srcYear+" by current year "+currentYear);
     492                Main.info("Replace source year "+srcYear+" by current year "+currentYear);
    493493            src = src.substring(0, src.lastIndexOf(" ")+1)+currentYear;
    494494            Main.pref.put("cadastrewms.source", src);
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGBuilding.java

    r30738 r30859  
    6868            }
    6969        } catch (DuplicateLayerException e) {
    70             System.err.println("removed a duplicated layer");
     70                Main.warn("removed a duplicated layer");
    7171        } catch (WMSException e) {
    7272            errorMessage = e.getMessage();
     
    9191            return true;
    9292        }
    93         System.out.println("Unable to parse SVG data (viewBox)");
     93        Main.warn("Unable to parse SVG data (viewBox)");
    9494        return false;
    9595    }
     
    233233        str += "&styles=";
    234234        str += "LS2_90";
    235         System.out.println("URL="+str);
     235        Main.info("URL="+str);
    236236        return new URL(str.replace(" ", "%20"));
    237237    }
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGTask.java

    r30738 r30859  
    7474            }
    7575        } catch (DuplicateLayerException e) {
    76             System.err.println("removed a duplicated layer");
     76                Main.warn("removed a duplicated layer");
    7777        } catch (WMSException e) {
    7878            errorMessage = e.getMessage();
     
    9797            return true;
    9898        }
    99         System.out.println("Unable to parse SVG data (viewBox)");
     99        Main.warn("Unable to parse SVG data (viewBox)");
    100100        return false;
    101101    }
     
    188188        str += "&styles=";
    189189        str += "COMMUNE_90";
    190         System.out.println("URL="+str);
     190        Main.info("URL="+str);
    191191        return new URL(str.replace(" ", "%20"));
    192192    }
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadWMSPlanImage.java

    r26509 r30859  
    1616
    1717public class DownloadWMSPlanImage {
    18    
     18
    1919    private Future<Task> task = null;
    2020    private WMSLayer wmsLayer;
     
    2222    private static boolean dontGeoreference = false;
    2323    private static String errorMessage;
    24    
     24
    2525    private class Task extends PleaseWaitRunnable {
    2626        public Task(WMSLayer wmsLayer, Bounds bounds) {
     
    8585            } catch (DuplicateLayerException e) {
    8686                // we tried to grab onto a duplicated layer (removed)
    87                 System.err.println("removed a duplicated layer");
     87                Main.warn("removed a duplicated layer");
    8888            } catch (WMSException e) {
    8989                errorMessage = e.getMessage();
     
    9191            }
    9292        }
    93        
     93
    9494        @Override
    9595        protected void cancel() {
     
    102102        }
    103103    }
    104    
     104
    105105    public void download(WMSLayer wmsLayer) {
    106106        MapView mv = Main.map.mapView;
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadWMSVectorImage.java

    r29669 r30859  
    5959        } catch (DuplicateLayerException e) {
    6060            // we tried to grab onto a duplicated layer (removed)
    61             System.err.println("removed a duplicated layer");
     61                Main.warn("removed a duplicated layer");
    6262        } catch (WMSException e) {
    6363            errorMessage = e.getMessage();
  • 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}
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionLoadFromCache.java

    r28887 r30859  
    22package cadastre_fr;
    33
     4import static org.openstreetmap.josm.tools.I18n.marktr;
    45import static org.openstreetmap.josm.tools.I18n.tr;
    5 import static org.openstreetmap.josm.tools.I18n.marktr;
    66
    77import java.awt.event.ActionEvent;
    88import java.io.File;
     9
    910import javax.swing.JFileChooser;
    1011import javax.swing.JOptionPane;
     
    2324    }
    2425
    25     public void actionPerformed(ActionEvent e) {
     26    @Override
     27        public void actionPerformed(ActionEvent e) {
    2628        JFileChooser fc = createAndOpenFileChooser();
    2729        if (fc == null)
     
    5658                                continue nextFile;
    5759                            } else
    58                                 System.out.println("Load cache " + filename);
     60                                Main.info("Load cache " + filename);
    5961                        }
    6062                    } catch (NumberFormatException ex) {
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionNewLocation.java

    r30532 r30859  
    5252    }
    5353
    54     public void actionPerformed(ActionEvent e) {
     54    @Override
     55        public void actionPerformed(ActionEvent e) {
    5556        WMSLayer wmsLayer = addNewLayer(new ArrayList<WMSLayer>());
    5657        if (wmsLayer != null)
     
    116117            wmsLayer.setDepartement(codeDepartement);
    117118            CadastrePlugin.addWMSLayer(wmsLayer);
    118             System.out.println("Add new layer with Location:" + inputTown.getText());
     119            Main.info("Add new layer with Location:" + inputTown.getText());
    119120        } else if (existingLayers != null && existingLayers.size() > 0 && Main.map.mapView.getActiveLayer() instanceof WMSLayer) {
    120121            wmsLayer = (WMSLayer)Main.map.mapView.getActiveLayer();
     
    123124        return wmsLayer;
    124125    }
    125 
    126126}
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionRefineGeoRef.java

    r30701 r30859  
    66import java.awt.event.ActionEvent;
    77
     8import org.openstreetmap.josm.Main;
    89import org.openstreetmap.josm.actions.JosmAction;
    910
     
    2324    @Override
    2425    public void actionPerformed(ActionEvent arg0) {
    25         if(!wmsLayer.isRaster())
    26         {
    27             System.out.println("MenuActionRefineGeoRef called for unexpected layer type");
     26        if(!wmsLayer.isRaster()) {
     27            Main.info("MenuActionRefineGeoRef called for unexpected layer type");
    2828            return;
    2929        }
     
    3636        rasterImageGeoreferencer.startGeoreferencing(wmsLayer);
    3737    }
    38 
    3938}
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionSaveRasterAs.java

    r29733 r30859  
    22package cadastre_fr;
    33
     4import static org.openstreetmap.josm.tools.I18n.marktr;
    45import static org.openstreetmap.josm.tools.I18n.tr;
    5 import static org.openstreetmap.josm.tools.I18n.marktr;
    66
    77import java.awt.event.ActionEvent;
     
    3030
    3131    public static String name = marktr("Save image as...");
    32    
     32
    3333    private static final long serialVersionUID = 1L;
    34    
     34
    3535    private WMSLayer wmsLayer;
    36    
     36
    3737    public class FiltrePng extends FileFilter {
    3838        @Override
    3939        public boolean accept(File file) {
    40             if (file.isDirectory()) { 
     40            if (file.isDirectory()) {
    4141                return true;
    42             } 
     42            }
    4343            return file.getName().toLowerCase().endsWith(".png");
    4444        }
     
    5252        @Override
    5353        public boolean accept(File file) {
    54             if (file.isDirectory()) { 
     54            if (file.isDirectory()) {
    5555                return true;
    56             } 
     56            }
    5757            return file.getName().toLowerCase().endsWith(".tif");
    5858        }
     
    7171    }
    7272
    73     public void actionPerformed(ActionEvent arg0) {
     73    @Override
     74        public void actionPerformed(ActionEvent arg0) {
    7475        File file;
    7576        JFileChooser fc = new JFileChooser();
     
    8081        if (returnVal == JFileChooser.APPROVE_OPTION) {
    8182            file = fc.getSelectedFile();
    82             BufferedImage bi = wmsLayer.getImage(0).image; 
     83            BufferedImage bi = wmsLayer.getImage(0).image;
    8384            if (fc.getFileFilter().equals(filtrePng))
    8485            {
     
    101102            {
    102103                boolean alpha = bi.getColorModel().hasAlpha();
    103                 System.out.println("image with alpha channel : " + alpha);
     104                Main.info("image with alpha channel : " + alpha);
    104105                try {
    105106                    double x = wmsLayer.getImage(0).min.east();
    106107                    double y = wmsLayer.getImage(0).min.north();
    107                     Envelope2D bbox = new Envelope2D(CRS.decode("EPSG:27561"), 
    108                             x, y, 
     108                    Envelope2D bbox = new Envelope2D(CRS.decode("EPSG:27561"),
     109                            x, y,
    109110                            wmsLayer.getImage(0).max.east()-x, wmsLayer.getImage(0).max.north()-y);
    110111                    GridCoverageFactory factory = new GridCoverageFactory();
     
    122123                                    .setValue(wp);
    123124
    124                     gtwriter.write(coverage, (GeneralParameterValue[]) params.values().toArray(new GeneralParameterValue[1]));
     125                    gtwriter.write(coverage, params.values().toArray(new GeneralParameterValue[1]));
    125126                    gtwriter.dispose();
    126                     coverage.dispose(true); 
     127                    coverage.dispose(true);
    127128                } catch (Exception e) {
    128129                    // TODO Auto-generated catch block
    129130                    e.printStackTrace();
    130                 } 
     131                }
    131132            }
    132133        }
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/RasterImageGeoreferencer.java

    r29714 r30859  
    9191  }
    9292
    93  
     93
    9494  public boolean isRunning()
    9595  {
     
    9797  }
    9898
    99   public void mouseClicked(MouseEvent e) {
     99  @Override
     100public void mouseClicked(MouseEvent e) {
    100101      if (System.currentTimeMillis() - mouseClickedTime < initialClickDelay) {
    101           System.out.println("mouse click bounce detected");
     102          Main.info("mouse click bounce detected");
    102103          return; // mouse click anti-bounce
    103104      }
     
    108109      if (ignoreMouseClick) return; // In case we are currently just allowing zooming to read lambert coordinates
    109110      EastNorth ea = Main.getProjection().latlon2eastNorth(Main.map.mapView.getLatLon(e.getX(), e.getY()));
    110       System.out.println("clic:"+countMouseClicked+" ,"+ea+", mode:"+mode);
     111      Main.info("click:"+countMouseClicked+" ,"+ea+", mode:"+mode);
    111112      if (clickOnTheMap) {
    112113          clickOnTheMap = false;
     
    117118                  || ea.north() < wmsLayer.getImage(0).min.north() || ea.north() > wmsLayer.getImage(0).max.north())
    118119          {
    119               System.out.println("ignore clic outside the image");
     120              Main.info("ignore click outside the image");
    120121              return;
    121122          }
     
    182183                 tr("Ooops. I failed to catch all coordinates\n"+
    183184                    "correctly. Retry please."));
    184          System.out.println("failed to transform: one coordinate missing:"
     185         Main.warn("failed to transform: one coordinate missing:"
    185186                    +"org1="+org1+", org2="+org2+", dst1="+dst1+", dst2="+dst2);
    186187         return;
     
    249250     dialog.setVisible(true);
    250251     pane.addPropertyChangeListener(new PropertyChangeListener() {
    251          public void propertyChange(PropertyChangeEvent evt) {
     252         @Override
     253                public void propertyChange(PropertyChangeEvent evt) {
    252254             if (JOptionPane.VALUE_PROPERTY.equals(evt.getPropertyName())) {
    253255                 ignoreMouseClick = false;
     
    352354 }
    353355
    354  public void mouseEntered(MouseEvent arg0) {
    355  }
    356 
    357  public void mouseExited(MouseEvent arg0) {
    358  }
    359 
    360  public void mousePressed(MouseEvent arg0) {
    361  }
    362 
    363  public void mouseReleased(MouseEvent arg0) {
     356 @Override
     357public void mouseEntered(MouseEvent arg0) {
     358 }
     359
     360 @Override
     361public void mouseExited(MouseEvent arg0) {
     362 }
     363
     364 @Override
     365public void mousePressed(MouseEvent arg0) {
     366 }
     367
     368 @Override
     369public void mouseReleased(MouseEvent arg0) {
    364370 }
    365371
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java

    r30738 r30859  
    9393
    9494    private Action cancelGrab;
    95    
    96     private Action refineGeoRef; 
     95
     96    private Action refineGeoRef;
    9797
    9898    @SuppressWarnings("serial")
     
    107107            Main.map.mapView.repaint();
    108108        }
    109        
    110     }
    111    
     109
     110    }
     111
    112112    public boolean adjustModeEnabled;
    113113
    114114    public GrabThread grabThread;
    115    
     115
    116116    public WMSLayer() {
    117117        this(tr("Blank Layer"), "", -1);
     
    138138        images = null;
    139139        dividedBbox = null;
    140         System.out.println("Layer "+location+" destroyed");
     140        Main.info("Layer "+location+" destroyed");
    141141    }
    142142
     
    173173    /**
    174174     * Divides the bounding box in smaller squares. Their size (and quantity) is configurable in Preferences.
    175      * 
     175     *
    176176     * @param b      the original bbox, usually the current bbox on screen
    177177     * @param factor 1 = source bbox 1:1
     
    326326                cancelGrab,
    327327                refineGeoRef,
    328                 resetOffset, 
     328                resetOffset,
    329329                new LayerListPopup.InfoAction(this),
    330330
     
    527527            }
    528528        }
    529         System.out.println("Cache loaded for location "+location+" with "+images.size()+" images");
     529        Main.info("Cache loaded for location "+location+" with "+images.size()+" images");
    530530        return true;
    531531    }
     
    593593        return communeBBox;
    594594    }
    595    
     595
    596596    public EastNorthBound getFirstViewFromCacheBBox() {
    597597        if (isRaster) {
     
    604604        for (GeorefImage image:images){
    605605            min_x = image.min.east() < min_x ? image.min.east() : min_x;
    606             max_x = image.max.east() > max_x ? image.max.east() : max_x; 
     606            max_x = image.max.east() > max_x ? image.max.east() : max_x;
    607607            min_y = image.min.north() < min_y ? image.min.north() : min_y;
    608             max_y = image.max.north() > max_y ? image.max.north() : max_y; 
     608            max_y = image.max.north() > max_y ? image.max.north() : max_y;
    609609        }
    610610        EastNorthBound maxGrabbedBBox = new EastNorthBound(new EastNorth(min_x, min_y), new EastNorth(max_x, max_y));
     
    619619     * Method required by ImageObserver when drawing an image
    620620     */
    621     public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
     621    @Override
     622        public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
    622623        return false;
    623624    }
     
    690691            img = this.images.get(index);
    691692        } catch (ArrayIndexOutOfBoundsException e) {
    692             e.printStackTrace(System.out);
     693            Main.error(e);
    693694        }
    694695        imagesLock.unlock();
    695696        return img;
    696697    }
    697    
     698
    698699    public Vector<GeorefImage> getImages() {
    699700        return this.images;
    700701    }
    701    
     702
    702703    public void addImage(GeorefImage img) {
    703704        imagesLock.lock();
     
    705706        imagesLock.unlock();
    706707    }
    707    
     708
    708709    public void setImages(Vector<GeorefImage> images) {
    709710        imagesLock.lock();
     
    711712        imagesLock.unlock();
    712713    }
    713    
     714
    714715    public void clearImages() {
    715716        imagesLock.lock();
Note: See TracChangeset for help on using the changeset viewer.