Changeset 26835 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/GeorefImage.java
- Timestamp:
- 2011-10-12T00:39:26+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/GeorefImage.java
r26823 r26835 29 29 public EastNorth min; 30 30 public EastNorth max; 31 // offset for vector images temporarily shifted (correcting Cadastre artifacts), in pixels32 public double deltaEast=0;33 public double deltaNorth=0;34 31 // bbox of the georeferenced original image (raster only) (inclined if rotated and before cropping) 35 32 // P[0] is bottom,left then next are clockwise. … … 43 40 44 41 public BufferedImage image; 42 public WMSLayer wmsLayer; 45 43 46 44 private double pixelPerEast; 47 45 private double pixelPerNorth; 48 49 public GeorefImage(BufferedImage img, EastNorth min, EastNorth max) { 46 47 48 public GeorefImage(BufferedImage img, EastNorth min, EastNorth max, WMSLayer wmsLayer) { 50 49 image = img; 51 50 … … 63 62 this.imageOriginalHeight = (img == null ? 1 : img.getHeight()); 64 63 this.imageOriginalWidth = (img == null ? 1 : img.getWidth()); 64 this.wmsLayer = wmsLayer; 65 65 updatePixelPer(); 66 66 } … … 111 111 112 112 // apply offsets defined manually when vector images are translated manually (not saved in cache) 113 Point minPt = nc.getPoint(new EastNorth(min.east()+deltaEast, min.north()+deltaNorth)); 114 Point maxPt = nc.getPoint(new EastNorth(max.east()+deltaEast, max.north()+deltaNorth)); 113 double dx=0, dy=0; 114 if (wmsLayer!=null) { 115 dx = wmsLayer.deltaEast; 116 dy = wmsLayer.deltaNorth; 117 } 118 Point minPt = nc.getPoint(new EastNorth(min.east()+dx, min.north()+dy)); 119 Point maxPt = nc.getPoint(new EastNorth(max.east()+dx, max.north()+dy)); 115 120 116 121 if (!g.hitClip(minPt.x, maxPt.y, maxPt.x - minPt.x, minPt.y - maxPt.y)) … … 127 132 Point[] croppedPoint = new Point[5]; 128 133 for (int i=0; i<4; i++) 129 croppedPoint[i] = nc.getPoint(orgCroppedRaster[i]); 134 croppedPoint[i] = nc.getPoint( 135 new EastNorth(orgCroppedRaster[i].east()+dx, orgCroppedRaster[i].north()+dy)); 130 136 croppedPoint[4] = croppedPoint[0]; 131 137 for (int i=0; i<4; i++) { … … 369 375 } 370 376 371 /**372 * Add a temporary translation (dx, dy) to this image (for vector images only)373 * @param dx delta added to X image coordinate374 * @param dy delta added to Y image coordinate375 */376 public void tempShear(double dx, double dy) {377 this.deltaEast+=dx;378 this.deltaNorth+=dy;379 }380 377 }
Note:
See TracChangeset
for help on using the changeset viewer.