Changeset 20211 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java
- Timestamp:
- 2010-02-28T16:29:31+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java
r19949 r20211 54 54 /** 55 55 * v1 to v2 = not supported 56 * v2 to v3 = add 4 more EastNorth coordinates in GeorefImages 57 */ 58 protected final int serializeFormatVersion = 3; 56 * v2 to v3 = add 4 more EastNorth coordinates in GeorefImages 57 * v3 to v4 = add original raster image width and height 58 */ 59 protected final int serializeFormatVersion = 4; 59 60 60 61 public static int currentFormat; … … 535 536 EastNorth adj2 = new EastNorth(en1.east() > en2.east() ? en1.east() : en2.east(), 536 537 en1.north() > en2.north() ? en1.north() : en2.north()); 537 // s1 and s2 have 0,0 at top, left where all EastNorth coord. have 0,0 at bottom, left 538 int sx1 = (int)((adj1.getX() - images.get(0).min.getX())*images.get(0).getPixelPerEast()); 539 int sy1 = (int)((images.get(0).max.getY() - adj2.getY())*images.get(0).getPixelPerNorth()); 540 int sx2 = (int)((adj2.getX() - images.get(0).min.getX())*images.get(0).getPixelPerEast()); 541 int sy2 = (int)((images.get(0).max.getY() - adj1.getY())*images.get(0).getPixelPerNorth()); 542 int newWidth = Math.abs(sx2 - sx1); 543 int newHeight = Math.abs(sy2 - sy1); 544 BufferedImage new_img = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_ARGB); 545 Graphics g = new_img.getGraphics(); 546 g.drawImage(images.get(0).image, 0, 0, newWidth-1, newHeight-1, 547 sx1, sy1, sx2, sy2, 548 this); 549 images.set(0, new GeorefImage(new_img, adj1, adj2)); 550 // important: update the layer georefs ! 538 images.get(0).crop(adj1, adj2); 539 // update the layer georefs 551 540 rasterMin = adj1; 552 541 rasterMax = adj2; 542 setCommuneBBox(new EastNorthBound(new EastNorth(0,0), new EastNorth(images.get(0).image.getWidth()-1,images.get(0).image.getHeight()-1))); 553 543 rasterRatio = (rasterMax.getX()-rasterMin.getX())/(communeBBox.max.getX() - communeBBox.min.getX()); 554 setCommuneBBox(new EastNorthBound(new EastNorth(0,0), new EastNorth(newWidth-1,newHeight-1)));555 544 } 556 545 … … 581 570 public void displace(double dx, double dy) { 582 571 this.rasterMin = new EastNorth(rasterMin.east() + dx, rasterMin.north() + dy); 572 this.rasterMax = new EastNorth(rasterMax.east() + dx, rasterMax.north() + dy); 583 573 images.get(0).shear(dx, dy); 584 574 } … … 586 576 public void resize(EastNorth rasterCenter, double proportion) { 587 577 this.rasterMin = rasterMin.interpolate(rasterCenter, proportion); 578 this.rasterMax = rasterMax.interpolate(rasterCenter, proportion); 588 579 images.get(0).scale(rasterCenter, proportion); 589 580 } … … 591 582 public void rotate(EastNorth rasterCenter, double angle) { 592 583 this.rasterMin = rasterMin.rotate(rasterCenter, angle); 584 this.rasterMax = rasterMax.rotate(rasterCenter, angle); 585 // double proportion = dst1.distance(dst2)/org1.distance(org2); 593 586 images.get(0).rotate(rasterCenter, angle); 587 this.angle += angle; 594 588 } 595 589
Note:
See TracChangeset
for help on using the changeset viewer.