Changeset 30859 in osm for applications/editors/josm/plugins/cadastre-fr/src
- Timestamp:
- 2014-12-19T17:12:01+01:00 (10 years ago)
- 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 43 43 44 44 import org.openstreetmap.josm.Main; 45 import org.openstreetmap.josm.actions.mapmode.MapMode; 45 46 import org.openstreetmap.josm.command.AddCommand; 46 47 import org.openstreetmap.josm.command.ChangeCommand; … … 48 49 import org.openstreetmap.josm.command.Command; 49 50 import org.openstreetmap.josm.command.SequenceCommand; 50 import org.openstreetmap.josm.actions.mapmode.MapMode;51 51 import org.openstreetmap.josm.data.coor.EastNorth; 52 52 import org.openstreetmap.josm.data.osm.Node; … … 65 65 public class Address extends MapMode implements MouseListener, MouseMotionListener, ActionListener { 66 66 private static final long serialVersionUID = 1L; 67 67 68 68 // perhaps make all these tags configurable in the future 69 69 private String tagHighway = "highway"; … … 76 76 private String relationAddrStreetRole = "street"; 77 77 private String relationMemberHouse = "house"; 78 78 79 79 private JRadioButton plus_one = new JRadioButton("+1", false); 80 80 private JRadioButton plus_two = new JRadioButton("+2", true); // enable this by default … … 93 93 94 94 public Address(MapFrame mapFrame) { 95 super(tr("Add address"), "buildings", 95 super(tr("Add address"), "buildings", 96 96 tr("Helping tool for tag address"), 97 97 Shortcut.registerShortcut("mapmode:cadastre-fr-buildings", tr("Mode: {0}", tr("CadastreFR - Buildings")), KeyEvent.VK_E, Shortcut.DIRECT), … … 153 153 try { 154 154 // add new address 155 Integer.parseInt(num); 155 Integer.parseInt(num); 156 156 inputNumber.setText(num); 157 157 applyInputNumberChange(); 158 158 } catch (NumberFormatException en) { 159 System.out.println("Unable to parse house number \"" + num + "\"");159 Main.warn("Unable to parse house number \"" + num + "\""); 160 160 } 161 161 } … … 202 202 setNewSelection(mouseOnExistingWays.get(0)); 203 203 } 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 205 205 if (inputStreet.getText().equals("") || inputNumber.getText().equals("")) { 206 206 Toolkit.getDefaultToolkit().beep(); … … 221 221 222 222 } 223 223 224 224 private Way findWayInRelationAddr(Node n) { 225 225 List<OsmPrimitive> l = n.getReferrers(); … … 238 238 return null; 239 239 } 240 240 241 241 private void addAddrToPolygon(List<Way> mouseOnExistingBuildingWays, Collection<Command> cmds) { 242 242 for (Way w:mouseOnExistingBuildingWays) { … … 244 244 } 245 245 } 246 246 247 247 private void addAddrToPrimitive(OsmPrimitive osm, Collection<Command> cmds) { 248 248 // add the current tag addr:housenumber in node and member in relation (if so configured) … … 251 251 revertInputNumberChange(); 252 252 } catch (NumberFormatException en) { 253 System.out.println("Unable to parse house number \"" + inputNumber.getText() + "\"");253 Main.warn("Unable to parse house number \"" + inputNumber.getText() + "\""); 254 254 } 255 255 … … 263 263 setNewSelection(osm); 264 264 } 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 269 269 private Relation findRelationAddr(Way w) { 270 270 List<OsmPrimitive> l = w.getReferrers(); … … 276 276 return null; 277 277 } 278 278 279 279 private void addStreetNameOrRelation(OsmPrimitive osm, Collection<Command> cmds) { 280 280 if (Main.pref.getBoolean("cadastrewms.addr.dontUseRelation", false)) { … … 339 339 return n; 340 340 } 341 341 342 342 private static void adjustNode(Collection<Pair<Node,Node>> segs, Node n) { 343 343 … … 395 395 } 396 396 } 397 397 398 398 static double det(double a, double b, double c, double d) { 399 399 return a * d - b * c; … … 422 422 return Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR); 423 423 } 424 424 425 425 private void applyInputNumberChange() { 426 426 Integer num = Integer.parseInt(inputNumber.getText()); … … 435 435 inputNumber.setText(num.toString()); 436 436 } 437 437 438 438 private void revertInputNumberChange() { 439 439 Integer num = Integer.parseInt(inputNumber.getText()); … … 448 448 inputNumber.setText(num.toString()); 449 449 } 450 450 451 451 private void createDialog() { 452 452 ImageIcon iconLink = ImageProvider.get(null, "Mf_relation.png"); … … 466 466 clearButton = new JButton("Clear"); 467 467 clearButton.addActionListener(new ActionListener() { 468 public void actionPerformed(ActionEvent e) { 468 @Override 469 public void actionPerformed(ActionEvent e) { 469 470 inputNumber.setText(""); 470 471 inputStreet.setText(""); … … 491 492 p.add(plus_two, GBC.std().insets(0, 0, 10, 0)); 492 493 p.add(clearButton, GBC.eol().fill(GBC.HORIZONTAL).insets(0, 0, 0, 0)); 493 494 494 495 final Object[] options = {}; 495 496 final JOptionPane pane = new JOptionPane(p, … … 516 517 Main.map.selectMapMode((MapMode)Main.map.getDefaultButtonAction()); 517 518 } 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) {} 524 531 }); 525 532 String bounds = Main.pref.get("cadastrewms.addr.bounds",null); … … 530 537 } 531 538 } 532 539 533 540 private void setSelectedWay(Way w) { 534 541 this.selectedWay = w; … … 539 546 link.repaint(); 540 547 } 541 548 542 549 private void setNewSelection(OsmPrimitive osm) { 543 550 Collection<OsmPrimitive> newSelection = new LinkedList<>(Main.main.getCurrentDataSet().getSelected()); -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CacheControl.java
r30738 r30859 92 92 } 93 93 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() 95 95 + "\" in cache dir to stay under the limit of " + cacheSize + " MB."); 96 96 files[oldestFile].delete(); … … 126 126 } 127 127 } catch (Exception e) { 128 e.printStackTrace(System.out);128 Main.error(e); 129 129 } 130 130 return false; … … 135 135 delete(new File(CadastrePlugin.cacheDir + wmsLayer.getName() + "." + WMSFileExtension())); 136 136 } catch (Exception e) { 137 e.printStackTrace(System.out);137 Main.error(e); 138 138 } 139 139 } 140 140 141 141 private void delete(File file) { 142 System.out.println("Delete file "+file);142 Main.info("Delete file "+file); 143 143 if (file.exists()) 144 144 file.delete(); … … 155 155 successfulRead = wmsLayer.read(file, ois, currentLambertZone); 156 156 } catch (Exception ex) { 157 ex.printStackTrace(System.out);157 Main.error(ex); 158 158 JOptionPane.showMessageDialog(Main.parent, tr("Error loading file.\nProbably an old version of the cache file."), tr("Error"), JOptionPane.ERROR_MESSAGE); 159 159 return false; … … 211 211 } 212 212 try {wait();} catch (InterruptedException e) { 213 e.printStackTrace(System.out);213 Main.error(e); 214 214 } 215 215 } -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreGrabber.java
r30738 r30859 13 13 import javax.imageio.ImageIO; 14 14 15 import org.openstreetmap.josm.Main; 15 16 import org.openstreetmap.josm.data.coor.EastNorth; 16 17 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; … … 55 56 str += (int)(cRasterX*(wmsLayer.communeBBox.max.getY() - wmsLayer.communeBBox.min.getY())/(wmsLayer.communeBBox.max.getX() - wmsLayer.communeBBox.min.getX())); 56 57 str += "&exception=application/vnd.ogc.se_inimage&styles="; // required for raster images 57 System.out.println("URL="+str);58 Main.info("URL="+str); 58 59 return new URL(str.replace(" ", "%20")); 59 60 } … … 73 74 str += "&exception=application/vnd.ogc.se_inimage"; // works also without (but slower ?) 74 75 str += "&styles=" + styles; 75 System.out.println("URL="+str);76 Main.info("URL="+str); 76 77 return new URL(str.replace(" ", "%20")); 77 78 } -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreInterface.java
r30738 r30859 115 115 urlConn.connect(); 116 116 if (urlConn.getResponseCode() == HttpURLConnection.HTTP_OK) { 117 System.out.println("GET "+searchFormURL);117 Main.info("GET "+searchFormURL); 118 118 BufferedReader in = new BufferedReader(new InputStreamReader(urlConn.getInputStream())); 119 119 while(in.readLine() != null) {} // read the buffer otherwise we sent POST too early … … 124 124 cookie = cookie.substring(0, cookie.indexOf(";")); 125 125 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)); 127 127 cookied = true; 128 128 } 129 129 } 130 130 } 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"); 132 132 CadastrePlugin.safeSleep(3000); 133 133 retries --; … … 135 135 } 136 136 } catch (MalformedURLException e) { 137 throw (IOException) new IOException( 138 "Illegal url.").initCause(e); 137 throw new IOException("Illegal url.", e); 139 138 } 140 139 } … … 148 147 long now = new Date().getTime(); 149 148 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)+")"); 151 150 return true; 152 151 } … … 222 221 throw new IOException("Cannot open Cadastre interface. GET response:"+urlConn.getResponseCode()); 223 222 } 224 System.out.println("GET "+interfaceURL);223 Main.info("GET "+interfaceURL); 225 224 BufferedReader in = new BufferedReader(new InputStreamReader(urlConn.getInputStream())); 226 225 // read the buffer otherwise we sent POST too early … … 305 304 lines = lines.substring(lines.indexOf(cInterfaceVector),lines.length()); 306 305 lines = lines.substring(0, lines.indexOf("'")); 307 System.out.println("interface ref.:"+lines);306 Main.info("interface ref.:"+lines); 308 307 return lines; 309 308 } else if (wmsLayer.isRaster() && lines.indexOf(cInterfaceRasterTA) != -1) { // "afficherCarteTa.do" … … 320 319 wmsLayer.setCodeCommune(listOfFeuilles.elementAt(res).ref); 321 320 lines = buildRasterFeuilleInterfaceRef(listOfFeuilles.elementAt(res).ref); 322 System.out.println("interface ref.:"+lines);321 Main.info("interface ref.:"+lines); 323 322 return lines; 324 323 } … … 351 350 String lov = new String(input.substring(i+c0ptionListStart.length()-1, j)); 352 351 if (lov.indexOf(">") != -1) { 353 System.out.println("parse "+lov);352 Main.info("parse "+lov); 354 353 listOfCommunes.add(lov); 355 354 } else 356 System.err.println("unable to parse commune string:"+lov);355 Main.error("unable to parse commune string:"+lov); 357 356 } 358 357 input = input.substring(j+cOptionListEnd.length()); … … 481 480 throw new IOException("Cannot get Cadastre response."); 482 481 } 483 System.out.println("GET "+searchFormURL);482 Main.info("GET "+searchFormURL); 484 483 try (BufferedReader in = new BufferedReader(new InputStreamReader(urlConn.getInputStream()))) { 485 484 while ((ln = in.readLine()) != null) { … … 541 540 // wmsLayer.Y0 = Y0; 542 541 // } 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+","+ 544 543 // fY+","+X0+","+Y0); 545 544 // } … … 550 549 for (Layer l : Main.map.mapView.getAllLayers()) { 551 550 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."); 553 552 // remove the duplicated layer 554 553 Main.main.removeLayer(wmsLayer); -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java
r30858 r30859 451 451 dialog.setAlwaysOnTop(true); 452 452 } 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())); 454 454 } 455 455 } … … 490 490 } catch (NumberFormatException e) {} 491 491 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); 493 493 src = src.substring(0, src.lastIndexOf(" ")+1)+currentYear; 494 494 Main.pref.put("cadastrewms.source", src); -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGBuilding.java
r30738 r30859 68 68 } 69 69 } catch (DuplicateLayerException e) { 70 System.err.println("removed a duplicated layer");70 Main.warn("removed a duplicated layer"); 71 71 } catch (WMSException e) { 72 72 errorMessage = e.getMessage(); … … 91 91 return true; 92 92 } 93 System.out.println("Unable to parse SVG data (viewBox)");93 Main.warn("Unable to parse SVG data (viewBox)"); 94 94 return false; 95 95 } … … 233 233 str += "&styles="; 234 234 str += "LS2_90"; 235 System.out.println("URL="+str);235 Main.info("URL="+str); 236 236 return new URL(str.replace(" ", "%20")); 237 237 } -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGTask.java
r30738 r30859 74 74 } 75 75 } catch (DuplicateLayerException e) { 76 System.err.println("removed a duplicated layer");76 Main.warn("removed a duplicated layer"); 77 77 } catch (WMSException e) { 78 78 errorMessage = e.getMessage(); … … 97 97 return true; 98 98 } 99 System.out.println("Unable to parse SVG data (viewBox)");99 Main.warn("Unable to parse SVG data (viewBox)"); 100 100 return false; 101 101 } … … 188 188 str += "&styles="; 189 189 str += "COMMUNE_90"; 190 System.out.println("URL="+str);190 Main.info("URL="+str); 191 191 return new URL(str.replace(" ", "%20")); 192 192 } -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadWMSPlanImage.java
r26509 r30859 16 16 17 17 public class DownloadWMSPlanImage { 18 18 19 19 private Future<Task> task = null; 20 20 private WMSLayer wmsLayer; … … 22 22 private static boolean dontGeoreference = false; 23 23 private static String errorMessage; 24 24 25 25 private class Task extends PleaseWaitRunnable { 26 26 public Task(WMSLayer wmsLayer, Bounds bounds) { … … 85 85 } catch (DuplicateLayerException e) { 86 86 // we tried to grab onto a duplicated layer (removed) 87 System.err.println("removed a duplicated layer");87 Main.warn("removed a duplicated layer"); 88 88 } catch (WMSException e) { 89 89 errorMessage = e.getMessage(); … … 91 91 } 92 92 } 93 93 94 94 @Override 95 95 protected void cancel() { … … 102 102 } 103 103 } 104 104 105 105 public void download(WMSLayer wmsLayer) { 106 106 MapView mv = Main.map.mapView; -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadWMSVectorImage.java
r29669 r30859 59 59 } catch (DuplicateLayerException e) { 60 60 // we tried to grab onto a duplicated layer (removed) 61 System.err.println("removed a duplicated layer");61 Main.warn("removed a duplicated layer"); 62 62 } catch (WMSException e) { 63 63 errorMessage = e.getMessage(); -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/GrabThread.java
r30737 r30859 28 28 29 29 private CacheControl cacheControl = null; 30 30 31 31 private EastNorthBound currentGrabImage; 32 32 … … 34 34 35 35 /** 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 37 37 * @param moreImages 38 38 */ … … 44 44 this.notify(); 45 45 } 46 System.out.println("Added " + moreImages.size() + " to the grab thread");46 Main.info("Added " + moreImages.size() + " to the grab thread"); 47 47 if (wmsLayer.isRaster()) { 48 48 waitNotification(); … … 56 56 return size; 57 57 } 58 58 59 59 public ArrayList<EastNorthBound> getImagesToGrabCopy() { 60 ArrayList<EastNorthBound> copyList = new ArrayList<>(); 60 ArrayList<EastNorthBound> copyList = new ArrayList<>(); 61 61 lockImagesToGrag.lock(); 62 62 for (EastNorthBound img : imagesToGrab) { … … 67 67 return copyList; 68 68 } 69 70 public void clearImagesToGrab() { 69 70 public void clearImagesToGrab() { 71 71 lockImagesToGrag.lock(); 72 72 imagesToGrab.clear(); 73 73 lockImagesToGrag.unlock(); 74 74 } 75 75 76 76 @Override 77 77 public void run() { … … 92 92 newImage = grabber.grab(wmsLayer, currentGrabImage.min, currentGrabImage.max); 93 93 } 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"); 96 95 setCanceled(true); 97 96 break; 98 97 } catch (OsmTransferException e) { 99 System.out.println("OSM transfer failed");98 Main.error("OSM transfer failed"); 100 99 setCanceled(true); 101 100 break; 102 101 } 103 102 if (grabber.getWmsInterface().downloadCanceled) { 104 System.out.println("Download action canceled by user");103 Main.info("Download action canceled by user"); 105 104 setCanceled(true); 106 105 break; 107 106 } 108 107 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); 125 124 } catch (NullPointerException e) { 126 System.out.println("Layer destroyed. Cancel grab thread");125 Main.info("Layer destroyed. Cancel grab thread"); 127 126 setCanceled(true); 128 127 } 129 128 } 130 129 } 131 System.out.println("grab thread list empty");130 Main.info("grab thread list empty"); 132 131 lockCurrentGrabImage.lock(); 133 132 currentGrabImage = null; … … 163 162 if (cacheControl != null) { 164 163 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."); 167 165 CadastrePlugin.safeSleep(1000); 168 166 } … … 193 191 lockCurrentGrabImage.unlock(); 194 192 } 195 193 196 194 private void paintBox(Graphics g, MapView mv, EastNorthBound img, Color color) { 197 195 Point[] croppedPoint = new Point[5]; … … 206 204 } 207 205 } 208 206 209 207 public boolean isCanceled() { 210 208 return canceled; … … 231 229 wait(); 232 230 } catch (InterruptedException e) { 233 e.printStackTrace(System.out); 234 } 235 } 236 231 Main.error(e); 232 } 233 } 237 234 } -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionLoadFromCache.java
r28887 r30859 2 2 package cadastre_fr; 3 3 4 import static org.openstreetmap.josm.tools.I18n.marktr; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.tools.I18n.marktr;6 6 7 7 import java.awt.event.ActionEvent; 8 8 import java.io.File; 9 9 10 import javax.swing.JFileChooser; 10 11 import javax.swing.JOptionPane; … … 23 24 } 24 25 25 public void actionPerformed(ActionEvent e) { 26 @Override 27 public void actionPerformed(ActionEvent e) { 26 28 JFileChooser fc = createAndOpenFileChooser(); 27 29 if (fc == null) … … 56 58 continue nextFile; 57 59 } else 58 System.out.println("Load cache " + filename);60 Main.info("Load cache " + filename); 59 61 } 60 62 } catch (NumberFormatException ex) { -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionNewLocation.java
r30532 r30859 52 52 } 53 53 54 public void actionPerformed(ActionEvent e) { 54 @Override 55 public void actionPerformed(ActionEvent e) { 55 56 WMSLayer wmsLayer = addNewLayer(new ArrayList<WMSLayer>()); 56 57 if (wmsLayer != null) … … 116 117 wmsLayer.setDepartement(codeDepartement); 117 118 CadastrePlugin.addWMSLayer(wmsLayer); 118 System.out.println("Add new layer with Location:" + inputTown.getText());119 Main.info("Add new layer with Location:" + inputTown.getText()); 119 120 } else if (existingLayers != null && existingLayers.size() > 0 && Main.map.mapView.getActiveLayer() instanceof WMSLayer) { 120 121 wmsLayer = (WMSLayer)Main.map.mapView.getActiveLayer(); … … 123 124 return wmsLayer; 124 125 } 125 126 126 } -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionRefineGeoRef.java
r30701 r30859 6 6 import java.awt.event.ActionEvent; 7 7 8 import org.openstreetmap.josm.Main; 8 9 import org.openstreetmap.josm.actions.JosmAction; 9 10 … … 23 24 @Override 24 25 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"); 28 28 return; 29 29 } … … 36 36 rasterImageGeoreferencer.startGeoreferencing(wmsLayer); 37 37 } 38 39 38 } -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionSaveRasterAs.java
r29733 r30859 2 2 package cadastre_fr; 3 3 4 import static org.openstreetmap.josm.tools.I18n.marktr; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.tools.I18n.marktr;6 6 7 7 import java.awt.event.ActionEvent; … … 30 30 31 31 public static String name = marktr("Save image as..."); 32 32 33 33 private static final long serialVersionUID = 1L; 34 34 35 35 private WMSLayer wmsLayer; 36 36 37 37 public class FiltrePng extends FileFilter { 38 38 @Override 39 39 public boolean accept(File file) { 40 if (file.isDirectory()) { 40 if (file.isDirectory()) { 41 41 return true; 42 } 42 } 43 43 return file.getName().toLowerCase().endsWith(".png"); 44 44 } … … 52 52 @Override 53 53 public boolean accept(File file) { 54 if (file.isDirectory()) { 54 if (file.isDirectory()) { 55 55 return true; 56 } 56 } 57 57 return file.getName().toLowerCase().endsWith(".tif"); 58 58 } … … 71 71 } 72 72 73 public void actionPerformed(ActionEvent arg0) { 73 @Override 74 public void actionPerformed(ActionEvent arg0) { 74 75 File file; 75 76 JFileChooser fc = new JFileChooser(); … … 80 81 if (returnVal == JFileChooser.APPROVE_OPTION) { 81 82 file = fc.getSelectedFile(); 82 BufferedImage bi = wmsLayer.getImage(0).image; 83 BufferedImage bi = wmsLayer.getImage(0).image; 83 84 if (fc.getFileFilter().equals(filtrePng)) 84 85 { … … 101 102 { 102 103 boolean alpha = bi.getColorModel().hasAlpha(); 103 System.out.println("image with alpha channel : " + alpha);104 Main.info("image with alpha channel : " + alpha); 104 105 try { 105 106 double x = wmsLayer.getImage(0).min.east(); 106 107 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, 109 110 wmsLayer.getImage(0).max.east()-x, wmsLayer.getImage(0).max.north()-y); 110 111 GridCoverageFactory factory = new GridCoverageFactory(); … … 122 123 .setValue(wp); 123 124 124 gtwriter.write(coverage, (GeneralParameterValue[])params.values().toArray(new GeneralParameterValue[1]));125 gtwriter.write(coverage, params.values().toArray(new GeneralParameterValue[1])); 125 126 gtwriter.dispose(); 126 coverage.dispose(true); 127 coverage.dispose(true); 127 128 } catch (Exception e) { 128 129 // TODO Auto-generated catch block 129 130 e.printStackTrace(); 130 } 131 } 131 132 } 132 133 } -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/RasterImageGeoreferencer.java
r29714 r30859 91 91 } 92 92 93 93 94 94 public boolean isRunning() 95 95 { … … 97 97 } 98 98 99 public void mouseClicked(MouseEvent e) { 99 @Override 100 public void mouseClicked(MouseEvent e) { 100 101 if (System.currentTimeMillis() - mouseClickedTime < initialClickDelay) { 101 System.out.println("mouse click bounce detected");102 Main.info("mouse click bounce detected"); 102 103 return; // mouse click anti-bounce 103 104 } … … 108 109 if (ignoreMouseClick) return; // In case we are currently just allowing zooming to read lambert coordinates 109 110 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); 111 112 if (clickOnTheMap) { 112 113 clickOnTheMap = false; … … 117 118 || ea.north() < wmsLayer.getImage(0).min.north() || ea.north() > wmsLayer.getImage(0).max.north()) 118 119 { 119 System.out.println("ignore clic outside the image");120 Main.info("ignore click outside the image"); 120 121 return; 121 122 } … … 182 183 tr("Ooops. I failed to catch all coordinates\n"+ 183 184 "correctly. Retry please.")); 184 System.out.println("failed to transform: one coordinate missing:"185 Main.warn("failed to transform: one coordinate missing:" 185 186 +"org1="+org1+", org2="+org2+", dst1="+dst1+", dst2="+dst2); 186 187 return; … … 249 250 dialog.setVisible(true); 250 251 pane.addPropertyChangeListener(new PropertyChangeListener() { 251 public void propertyChange(PropertyChangeEvent evt) { 252 @Override 253 public void propertyChange(PropertyChangeEvent evt) { 252 254 if (JOptionPane.VALUE_PROPERTY.equals(evt.getPropertyName())) { 253 255 ignoreMouseClick = false; … … 352 354 } 353 355 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 357 public void mouseEntered(MouseEvent arg0) { 358 } 359 360 @Override 361 public void mouseExited(MouseEvent arg0) { 362 } 363 364 @Override 365 public void mousePressed(MouseEvent arg0) { 366 } 367 368 @Override 369 public void mouseReleased(MouseEvent arg0) { 364 370 } 365 371 -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java
r30738 r30859 93 93 94 94 private Action cancelGrab; 95 96 private Action refineGeoRef; 95 96 private Action refineGeoRef; 97 97 98 98 @SuppressWarnings("serial") … … 107 107 Main.map.mapView.repaint(); 108 108 } 109 110 } 111 109 110 } 111 112 112 public boolean adjustModeEnabled; 113 113 114 114 public GrabThread grabThread; 115 115 116 116 public WMSLayer() { 117 117 this(tr("Blank Layer"), "", -1); … … 138 138 images = null; 139 139 dividedBbox = null; 140 System.out.println("Layer "+location+" destroyed");140 Main.info("Layer "+location+" destroyed"); 141 141 } 142 142 … … 173 173 /** 174 174 * Divides the bounding box in smaller squares. Their size (and quantity) is configurable in Preferences. 175 * 175 * 176 176 * @param b the original bbox, usually the current bbox on screen 177 177 * @param factor 1 = source bbox 1:1 … … 326 326 cancelGrab, 327 327 refineGeoRef, 328 resetOffset, 328 resetOffset, 329 329 new LayerListPopup.InfoAction(this), 330 330 … … 527 527 } 528 528 } 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"); 530 530 return true; 531 531 } … … 593 593 return communeBBox; 594 594 } 595 595 596 596 public EastNorthBound getFirstViewFromCacheBBox() { 597 597 if (isRaster) { … … 604 604 for (GeorefImage image:images){ 605 605 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; 607 607 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; 609 609 } 610 610 EastNorthBound maxGrabbedBBox = new EastNorthBound(new EastNorth(min_x, min_y), new EastNorth(max_x, max_y)); … … 619 619 * Method required by ImageObserver when drawing an image 620 620 */ 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) { 622 623 return false; 623 624 } … … 690 691 img = this.images.get(index); 691 692 } catch (ArrayIndexOutOfBoundsException e) { 692 e.printStackTrace(System.out);693 Main.error(e); 693 694 } 694 695 imagesLock.unlock(); 695 696 return img; 696 697 } 697 698 698 699 public Vector<GeorefImage> getImages() { 699 700 return this.images; 700 701 } 701 702 702 703 public void addImage(GeorefImage img) { 703 704 imagesLock.lock(); … … 705 706 imagesLock.unlock(); 706 707 } 707 708 708 709 public void setImages(Vector<GeorefImage> images) { 709 710 imagesLock.lock(); … … 711 712 imagesLock.unlock(); 712 713 } 713 714 714 715 public void clearImages() { 715 716 imagesLock.lock();
Note:
See TracChangeset
for help on using the changeset viewer.