Changeset 18271 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreInterface.java
- Timestamp:
- 2009-10-24T20:06:29+02:00 (17 years ago)
- File:
-
- 1 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
Note:
See TracChangeset
for help on using the changeset viewer.
