Changeset 33144 in osm for applications/editors/josm/plugins/piclayer/src
- Timestamp:
- 2017-02-15T11:10:44+01:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/LoadPictureCalibrationFromWorldAction.java
r32675 r33144 19 19 20 20 public LoadPictureCalibrationFromWorldAction(PicLayerAbstract layer) { 21 super(tr(" LoadWorld File Calibration..."), null, tr("Loads calibration data from a world file"), null, false);21 super(tr("Import World File Calibration..."), null, tr("Loads calibration data from a world file"), null, false); 22 22 23 23 this.layer = layer; -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/layer/PicLayerAbstract.java
r32675 r33144 56 56 import org.openstreetmap.josm.plugins.piclayer.actions.ResetCalibrationAction; 57 57 import org.openstreetmap.josm.plugins.piclayer.actions.SavePictureCalibrationAction; 58 import org.openstreetmap.josm.plugins.piclayer.actions.SavePictureCalibrationToWorldAction; 58 59 import org.openstreetmap.josm.plugins.piclayer.transform.PictureTransform; 59 60 … … 212 213 new SavePictureCalibrationAction(this), 213 214 new LoadPictureCalibrationAction(this), 215 SeparatorLayerAction.INSTANCE, 216 new SavePictureCalibrationToWorldAction(this), 214 217 new LoadPictureCalibrationFromWorldAction(this), 215 218 SeparatorLayerAction.INSTANCE, … … 498 501 } 499 502 503 public void saveWorldFile(double[] values) { 504 double[] matrix = new double[6]; 505 transformer.getTransform().getMatrix(matrix); 506 double a00 = matrix[0], a01 = matrix[2], a02 = matrix[4]; 507 double a10 = matrix[1], a11 = matrix[3], a12 = matrix[5]; 508 int w = image.getWidth(null); 509 int h = image.getHeight(null); 510 EastNorth imagePosition = transformer.getImagePosition(); 511 // piclayer calibration stores 9 parameters 512 // worldfile has 6 parameters 513 // only 6 parameters needed, so write it in a way that 514 // eliminates the 3 redundant parameters 515 double qx = initialImageScale / 100 / getMetersPerEasting(imagePosition); 516 double qy = -initialImageScale / 100 / getMetersPerNorthing(imagePosition); 517 double sx = qx * a00; 518 double sy = qy * a11; 519 double rx = qx * a01; 520 double ry = qy * a10; 521 double dx = imagePosition.getX() + qx * a02 - sx * w / 2 - rx * h / 2; 522 double dy = imagePosition.getY() + qy * a12 - ry * w / 2 - sy * h / 2; 523 values[0] = sx; 524 values[1] = ry; 525 values[2] = rx; 526 values[3] = sy; 527 values[4] = dx; 528 values[5] = dy; 529 } 530 500 531 public Point2D transformPoint(Point p) throws NoninvertibleTransformException { 501 532 // Position image at the right graphical place
Note:
See TracChangeset
for help on using the changeset viewer.