Changeset 18271 in osm for applications/editors/josm/plugins/cadastre-fr
- Timestamp:
- 2009-10-24T20:06:29+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreInterface.java
r17215 r18271 398 398 } 399 399 400 public EastNorthBound retrieveCommuneBBox() throws IOException { 400 /** 401 * Retrieve the bounding box size in pixels of the whole commune (point 0,0 at top, left corner) 402 * and store it in given wmsLayer 403 * In case of raster image, we also check in the same http request if the image is already georeferenced 404 * and store the result in the wmsLayer as well. 405 * @param wmsLayer the WMSLayer where the commune data and images are stored 406 * @throws IOException 407 */ 408 public void retrieveCommuneBBox(WMSLayer wmsLayer) throws IOException { 401 409 if (interfaceRef == null) 402 return null;410 return; 403 411 String ln = null; 404 412 String line = null; … … 421 429 in.close(); 422 430 urlConn.disconnect(); 423 return parseBBoxCommune(line); 424 } 425 426 private EastNorthBound parseBBoxCommune(String input) { 431 parseBBoxCommune(wmsLayer, line); 432 if (wmsLayer.isRaster() && !wmsLayer.isAlreadyGeoreferenced()) { 433 parseGeoreferences(wmsLayer, line); 434 } 435 } 436 437 private void parseBBoxCommune(WMSLayer wmsLayer, String input) { 427 438 if (input.indexOf(cBBoxCommunStart) != -1) { 428 439 input = input.substring(input.indexOf(cBBoxCommunStart)); … … 435 446 int l = input.indexOf(cBBoxCommunEnd, k+1); 436 447 double maxy = Double.parseDouble(input.substring(k+1, l)); 437 return new EastNorthBound(new EastNorth(minx,miny), new EastNorth(maxx,maxy)); 438 } 439 return null; 448 wmsLayer.setCommuneBBox( new EastNorthBound(new EastNorth(minx,miny), new EastNorth(maxx,maxy))); 449 } 450 } 451 452 private void parseGeoreferences(WMSLayer wmsLayer, String input) { 453 if (input.lastIndexOf(cBBoxCommunStart) != -1) { 454 input = input.substring(input.lastIndexOf(cBBoxCommunStart)); 455 input = input.substring(input.indexOf(cBBoxCommunEnd)+cBBoxCommunEnd.length()); 456 int i = input.indexOf(","); 457 int j = input.indexOf(",", i+1); 458 double angle = Double.parseDouble(input.substring(i+1, j)); 459 int k = input.indexOf(",", j+1); 460 double scale_origin = Double.parseDouble(input.substring(j+1, k)); 461 int l = input.indexOf(",", k+1); 462 double dpi = Double.parseDouble(input.substring(k+1, l)); 463 int m = input.indexOf(",", l+1); 464 double fX = Double.parseDouble(input.substring(l+1, m)); 465 int n = input.indexOf(",", m+1); 466 double fY = Double.parseDouble(input.substring(m+1, n)); 467 int o = input.indexOf(",", n+1); 468 double X0 = Double.parseDouble(input.substring(n+1, o)); 469 int p = input.indexOf(",", o+1); 470 double Y0 = Double.parseDouble(input.substring(o+1, p)); 471 if (X0 != 0.0 && Y0 != 0) { 472 wmsLayer.setAlreadyGeoreferenced(true); 473 wmsLayer.fX = fX; 474 wmsLayer.fY = fY; 475 wmsLayer.angle = angle; 476 wmsLayer.X0 = X0; 477 wmsLayer.Y0 = Y0; 478 } 479 System.out.println("parse georef:"+angle+","+scale_origin+","+dpi+","+fX+","+ 480 fY+","+X0+","+Y0); 481 } 440 482 } 441 483 -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java
r18256 r18271 76 76 * - fixed bug of raster image loaded from cache not working on Java1.6 77 77 * - improve mouse click bounce detection during georeferencing process 78 * 1.4 17-Oct-2009 - add support for new Lambert CC 9 Zones projection 78 * 1.4 23-Oct-2009 - add support for new Lambert CC 9 Zones projection 79 * - add optional crosspieces display on raster image layers 80 * - add automatic raster images georeferencing when WMS provides data 81 * - re-implement manual adjustment mode in raster image layer 79 82 */ 80 83 public class CadastrePlugin extends Plugin { -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadWMSPlanImage.java
r17181 r18271 57 57 if (wmsLayer.isRaster()) { 58 58 // set raster image commune bounding box based on current view (before adjustment) 59 wmsLayer.setCommuneBBox( grabber.getWmsInterface().retrieveCommuneBBox());59 grabber.getWmsInterface().retrieveCommuneBBox(wmsLayer); 60 60 wmsLayer.setRasterBounds(bounds); 61 61 // grab new images from wms server into active layer -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadWMSVectorImage.java
r18207 r18271 44 44 } else { 45 45 // set vectorized commune bounding box by opening the standard web window 46 wmsLayer.setCommuneBBox( grabber.getWmsInterface().retrieveCommuneBBox());46 grabber.getWmsInterface().retrieveCommuneBBox(wmsLayer); 47 47 // if it is the first layer, use the communeBBox as grab bbox 48 48 if (Main.proj instanceof LambertCC9Zones && Main.map.mapView.getAllLayers().size() == 1 ) { -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java
r17702 r18271 94 94 boolean loadedFromCache = downloadWMSPlanImage.waitFinished(); 95 95 if (wmsLayer.images.size() == 1 && !loadedFromCache) { 96 mouseClickedTime = System.currentTimeMillis(); 97 Main.map.mapView.addMouseListener(this); 98 if (Main.pref.getBoolean("cadastrewms.noImageCropping", false) == false) 99 startCropping(); 100 else 101 startGeoreferencing(); 96 int reply = JOptionPane.CANCEL_OPTION; 97 if (wmsLayer.isAlreadyGeoreferenced()) { 98 reply = JOptionPane.showConfirmDialog(null, 99 tr("This image contains georeference data.\n"+ 100 "Do you want to use them ?"), 101 null, 102 JOptionPane.YES_NO_OPTION); 103 } 104 if (reply == JOptionPane.OK_OPTION) { 105 transformGeoreferencedImg(); 106 } else { 107 mouseClickedTime = System.currentTimeMillis(); 108 Main.map.mapView.addMouseListener(this); 109 if (Main.pref.getBoolean("cadastrewms.noImageCropping", false) == false) 110 startCropping(); 111 else 112 startGeoreferencing(); 113 } 102 114 } else // action cancelled or image loaded from cache (and already georeferenced) 103 115 Main.map.repaint(); … … 310 322 } 311 323 324 private void transformGeoreferencedImg() { 325 georefpoint1 = new EastNorth(wmsLayer.X0, wmsLayer.Y0); 326 georefpoint2 = new EastNorth(wmsLayer.X0+wmsLayer.fX*wmsLayer.communeBBox.max.getX(), 327 wmsLayer.Y0+wmsLayer.fY*wmsLayer.communeBBox.max.getX()); 328 ea1 = new EastNorth(wmsLayer.images.get(0).min.east(), wmsLayer.images.get(0).max.north()); 329 EastNorth ea2 = wmsLayer.images.get(0).max; 330 affineTransform(ea1, ea2, georefpoint1, georefpoint2); 331 wmsLayer.saveNewCache(); 332 Main.map.mapView.repaint(); 333 } 334 312 335 public void mouseEntered(MouseEvent arg0) { 313 336 } -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java
r18256 r18271 64 64 65 65 private boolean isRaster = false; 66 67 private boolean isAlreadyGeoreferenced = false; 68 69 public double X0, Y0, angle, fX, fY; 66 70 67 71 private EastNorth rasterMin; … … 320 324 if (saveAsPng != null) 321 325 saveAsPng.setEnabled(isRaster); 326 } 327 328 public boolean isAlreadyGeoreferenced() { 329 return isAlreadyGeoreferenced; 330 } 331 332 public void setAlreadyGeoreferenced(boolean isAlreadyGeoreferenced) { 333 this.isAlreadyGeoreferenced = isAlreadyGeoreferenced; 322 334 } 323 335
Note:
See TracChangeset
for help on using the changeset viewer.