Changeset 29377 in osm for applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetTools.java
- Timestamp:
- 2013-03-20T08:05:48+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetTools.java
r29376 r29377 19 19 public class ImageryOffsetTools { 20 20 public static final String DIALOG_TITLE = tr("Imagery Offset"); 21 public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");22 21 23 22 public static ImageryLayer getTopImageryLayer() { … … 42 41 Projection proj = Main.getProjection(); 43 42 EastNorth offsetCenter = proj.latlon2eastNorth(center); 44 EastNorth centerOffset = offsetCenter.add(-layer.getDx(), -layer.getDy()); // todo: add or substract?43 EastNorth centerOffset = offsetCenter.add(-layer.getDx(), -layer.getDy()); 45 44 LatLon offsetLL = proj.eastNorth2latlon(centerOffset); 46 45 return offsetLL; … … 48 47 49 48 public static void applyLayerOffset( ImageryLayer layer, ImageryOffset offset ) { 49 double[] dxy = calculateOffset(offset); 50 layer.setOffset(dxy[0], dxy[1]); 51 } 52 53 /** 54 * Calculate dx and dy for imagery offset. 55 * @return [dx, dy] 56 */ 57 public static double[] calculateOffset( ImageryOffset offset ) { 50 58 Projection proj = Main.getProjection(); 51 59 EastNorth center = proj.latlon2eastNorth(offset.getPosition()); 52 60 EastNorth offsetPos = proj.latlon2eastNorth(offset.getImageryPos()); 53 layer.setOffset(center.getX() - offsetPos.getX(), center.getY() - offsetPos.getY());61 return new double[] { center.getX() - offsetPos.getX(), center.getY() - offsetPos.getY() }; 54 62 } 55 63
Note:
See TracChangeset
for help on using the changeset viewer.