Changeset 26823 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/GeorefImage.java
- Timestamp:
- 2011-10-09T23:41:21+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/GeorefImage.java
r24955 r26823 29 29 public EastNorth min; 30 30 public EastNorth max; 31 // offset for vector images temporarily shifted (correcting Cadastre artifacts), in pixels 32 public double deltaEast=0; 33 public double deltaNorth=0; 31 34 // bbox of the georeferenced original image (raster only) (inclined if rotated and before cropping) 32 35 // P[0] is bottom,left then next are clockwise. … … 107 110 return; 108 111 109 Point minPt = nc.getPoint(min), maxPt = nc.getPoint(max); 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)); 110 115 111 116 if (!g.hitClip(minPt.x, maxPt.y, maxPt.x - minPt.x, minPt.y - maxPt.y)) … … 171 176 double maxMaskNorth = (georefImage.max.north() < this.max.north()) ? georefImage.max.north() : this.max.north(); 172 177 if ((maxMaskNorth - minMaskNorth) > 0 && (maxMaskEast - minMaskEast) > 0) { 173 double p ixelPerEast = (max.east() - min.east()) / image.getWidth();174 double p ixelPerNorth = (max.north() - min.north()) / image.getHeight();175 int minXMaskPixel = (int) ((minMaskEast - min.east()) / p ixelPerEast);176 int minYMaskPixel = (int) ((max.north() - maxMaskNorth) / p ixelPerNorth);177 int widthXMaskPixel = Math.abs((int) ((maxMaskEast - minMaskEast) / p ixelPerEast));178 int heightYMaskPixel = Math.abs((int) ((maxMaskNorth - minMaskNorth) / p ixelPerNorth));178 double pxPerEast = (max.east() - min.east()) / image.getWidth(); 179 double pxPerNorth = (max.north() - min.north()) / image.getHeight(); 180 int minXMaskPixel = (int) ((minMaskEast - min.east()) / pxPerEast); 181 int minYMaskPixel = (int) ((max.north() - maxMaskNorth) / pxPerNorth); 182 int widthXMaskPixel = Math.abs((int) ((maxMaskEast - minMaskEast) / pxPerEast)); 183 int heightYMaskPixel = Math.abs((int) ((maxMaskNorth - minMaskNorth) / pxPerNorth)); 179 184 Graphics g = image.getGraphics(); 180 185 for (int x = minXMaskPixel; x < minXMaskPixel + widthXMaskPixel; x++) … … 279 284 } 280 285 } 281 286 282 287 /** 283 288 * Change this image scale by moving the min,max coordinates around an anchor … … 364 369 } 365 370 371 /** 372 * Add a temporary translation (dx, dy) to this image (for vector images only) 373 * @param dx delta added to X image coordinate 374 * @param dy delta added to Y image coordinate 375 */ 376 public void tempShear(double dx, double dy) { 377 this.deltaEast+=dx; 378 this.deltaNorth+=dy; 379 } 366 380 }
Note:
See TracChangeset
for help on using the changeset viewer.
