Changeset 34170 in osm for applications/editors/josm/plugins/piclayer/src/org/openstreetmap
- Timestamp:
- 2018-04-27T00:21:35+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerPlugin.java
r33822 r34170 49 49 JosmAction newLayerFromFileAction = new NewLayerFromFileAction(); 50 50 JosmAction newLayerFromClipboardAction = new NewLayerFromClipboardAction(); 51 51 52 /** 52 * Constructor... 53 * Constructor. 54 * @param info plugin info 53 55 */ 54 56 public PicLayerPlugin(PluginInformation info) { … … 73 75 if (newFrame != null) { 74 76 // Create plugin map modes 75 MovePictureAction movePictureAction = new MovePictureAction( newFrame);76 MovePointAction movePointAction = new MovePointAction( newFrame);77 TransformPointAction transformPointAction = new TransformPointAction( newFrame);78 RemovePointAction removePointAction = new RemovePointAction( newFrame);77 MovePictureAction movePictureAction = new MovePictureAction(); 78 MovePointAction movePointAction = new MovePointAction(); 79 TransformPointAction transformPointAction = new TransformPointAction(); 80 RemovePointAction removePointAction = new RemovePointAction(); 79 81 80 RotatePictureAction rotatePictureAction = new RotatePictureAction( newFrame);81 ScaleXYPictureAction scaleXYPictureAction = new ScaleXYPictureAction( newFrame);82 ScaleXPictureAction scaleXPictureAction = new ScaleXPictureAction( newFrame);83 ScaleYPictureAction scaleYPictureAction = new ScaleYPictureAction( newFrame);84 ShearPictureAction shearPictureAction = new ShearPictureAction( newFrame);82 RotatePictureAction rotatePictureAction = new RotatePictureAction(); 83 ScaleXYPictureAction scaleXYPictureAction = new ScaleXYPictureAction(); 84 ScaleXPictureAction scaleXPictureAction = new ScaleXPictureAction(); 85 ScaleYPictureAction scaleYPictureAction = new ScaleYPictureAction(); 86 ShearPictureAction shearPictureAction = new ShearPictureAction(); 85 87 // Create plugin buttons and add them to the toolbar 86 88 -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/GenericPicTransformAction.java
r33822 r34170 18 18 import org.openstreetmap.josm.tools.Shortcut; 19 19 20 @SuppressWarnings("serial") 20 /** 21 * Superclass of transformation actions. 22 */ 21 23 public abstract class GenericPicTransformAction extends MapMode implements MouseListener, MouseMotionListener { 22 24 … … 35 37 } 36 38 37 public GenericPicTransformAction(String name, String actionName, String iconName, 38 String tooltip, MapFrame mapFrame, Cursor cursor) { 39 public GenericPicTransformAction(String name, String actionName, String iconName, String tooltip, Cursor cursor) { 39 40 super(name, iconName, tooltip, cursor); 40 41 this.actionName = actionName; -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/LoadPictureCalibrationAction.java
r33822 r34170 20 20 * 21 21 */ 22 @SuppressWarnings("serial")23 22 public class LoadPictureCalibrationAction extends JosmAction { 24 23 … … 31 30 /** 32 31 * Constructor 32 * @param owner Owner layer of the action 33 33 */ 34 34 public LoadPictureCalibrationAction(PicLayerAbstract owner) { -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/LoadPictureCalibrationFromWorldAction.java
r33822 r34170 14 14 import org.openstreetmap.josm.plugins.piclayer.layer.PicLayerAbstract; 15 15 16 @SuppressWarnings("serial") 16 /** 17 * Action to import World File Calibration. 18 */ 17 19 public class LoadPictureCalibrationFromWorldAction extends JosmAction { 18 20 -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/ResetCalibrationAction.java
r33822 r34170 11 11 import org.openstreetmap.josm.plugins.piclayer.transform.PictureTransform; 12 12 13 @SuppressWarnings("serial") 13 /** 14 * Action to reset Calibration. 15 */ 14 16 public class ResetCalibrationAction extends JosmAction { 15 17 -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/SavePictureCalibrationAction.java
r33822 r34170 22 22 * TODO Four almost identical classes. Refactoring needed. 23 23 */ 24 @SuppressWarnings("serial")25 24 public class SavePictureCalibrationAction extends JosmAction { 26 25 … … 30 29 /** 31 30 * Constructor 31 * @param owner Owner layer of the action 32 32 */ 33 33 public SavePictureCalibrationAction(PicLayerAbstract owner) { -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/SavePictureCalibrationToWorldAction.java
r33144 r34170 17 17 import org.openstreetmap.josm.plugins.piclayer.layer.PicLayerAbstract; 18 18 19 /** 20 * Action to export World file Calibration. 21 */ 19 22 public class SavePictureCalibrationToWorldAction extends JosmAction { 20 23 … … 55 58 } 56 59 } 57 60 58 61 // Save dialog 59 62 final JFileChooser fc = new JFileChooser(); … … 73 76 for (int i = 0; i < 6; i++) { 74 77 bw.write(Double.toString(values[i])); 75 if (i <5) {78 if (i < 5) { 76 79 bw.newLine(); 77 80 } -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/newlayer/NewLayerFromClipboardAction.java
r33822 r34170 17 17 * the content of the clipboard. 18 18 */ 19 @SuppressWarnings("serial")20 19 public class NewLayerFromClipboardAction extends JosmAction { 21 20 -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/newlayer/NewLayerFromFileAction.java
r33822 r34170 29 29 * Action responsible for creation of new layers based on image files. 30 30 */ 31 @SuppressWarnings("serial")32 31 public class NewLayerFromFileAction extends JosmAction { 33 32 -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/MovePictureAction.java
r33822 r34170 8 8 import org.openstreetmap.josm.data.coor.EastNorth; 9 9 import org.openstreetmap.josm.gui.MainApplication; 10 import org.openstreetmap.josm.gui.MapFrame;11 10 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction; 12 11 import org.openstreetmap.josm.tools.ImageProvider; … … 15 14 * This class handles the input during moving the picture. 16 15 */ 17 @SuppressWarnings("serial")18 16 public class MovePictureAction extends GenericPicTransformAction { 19 17 … … 21 19 * Constructor 22 20 */ 23 public MovePictureAction( MapFrame frame) {21 public MovePictureAction() { 24 22 super(tr("PicLayer move"), tr("Moved"), "move", tr("Drag to move the picture"), 25 frame,ImageProvider.getCursor("crosshair", null));23 ImageProvider.getCursor("crosshair", null)); 26 24 } 27 25 -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/RotatePictureAction.java
r33822 r34170 9 9 10 10 import org.openstreetmap.josm.gui.MainApplication; 11 import org.openstreetmap.josm.gui.MapFrame;12 11 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction; 13 12 import org.openstreetmap.josm.tools.ImageProvider; … … 16 15 * This class handles the input during rotating the picture. 17 16 */ 18 @SuppressWarnings("serial")19 17 public class RotatePictureAction extends GenericPicTransformAction { 20 18 … … 22 20 * Constructor 23 21 */ 24 public RotatePictureAction( MapFrame frame) {22 public RotatePictureAction() { 25 23 super(tr("PicLayer rotate"), tr("Rotated"), "rotate", tr("Drag to rotate the picture"), 26 frame,ImageProvider.getCursor("crosshair", null));24 ImageProvider.getCursor("crosshair", null)); 27 25 } 28 26 -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ScaleXPictureAction.java
r33822 r34170 7 7 8 8 import org.openstreetmap.josm.gui.MainApplication; 9 import org.openstreetmap.josm.gui.MapFrame;10 9 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction; 11 10 import org.openstreetmap.josm.tools.ImageProvider; … … 14 13 * This class handles the input during scaling the picture. 15 14 */ 16 @SuppressWarnings("serial")17 15 public class ScaleXPictureAction extends GenericPicTransformAction { 18 16 … … 20 18 * Constructor 21 19 */ 22 public ScaleXPictureAction( MapFrame frame) {20 public ScaleXPictureAction() { 23 21 super(tr("PicLayer scale X"), tr("Scaled by X"), "scale_x", tr("Drag to scale the picture in the X Axis"), 24 frame,ImageProvider.getCursor("crosshair", null));22 ImageProvider.getCursor("crosshair", null)); 25 23 } 26 24 -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ScaleXYPictureAction.java
r33822 r34170 9 9 10 10 import org.openstreetmap.josm.gui.MainApplication; 11 import org.openstreetmap.josm.gui.MapFrame;12 11 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction; 13 12 import org.openstreetmap.josm.tools.ImageProvider; … … 16 15 * This class handles the input during scaling the picture. 17 16 */ 18 @SuppressWarnings("serial")19 17 public class ScaleXYPictureAction extends GenericPicTransformAction { 20 18 … … 22 20 * Constructor 23 21 */ 24 public ScaleXYPictureAction( MapFrame frame) {22 public ScaleXYPictureAction() { 25 23 super(tr("PicLayer scale"), tr("Scaled"), "scale", tr("Drag to scale the picture in the X and Y Axis"), 26 frame,ImageProvider.getCursor("crosshair", null));24 ImageProvider.getCursor("crosshair", null)); 27 25 } 28 26 -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ScaleYPictureAction.java
r33822 r34170 7 7 8 8 import org.openstreetmap.josm.gui.MainApplication; 9 import org.openstreetmap.josm.gui.MapFrame;10 9 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction; 11 10 import org.openstreetmap.josm.tools.ImageProvider; … … 14 13 * This class handles the input during scaling the picture. 15 14 */ 16 @SuppressWarnings("serial")17 15 public class ScaleYPictureAction extends GenericPicTransformAction { 18 16 … … 20 18 * Constructor 21 19 */ 22 public ScaleYPictureAction( MapFrame frame) {20 public ScaleYPictureAction() { 23 21 super(tr("PicLayer scale Y"), tr("Scaled by Y"), "scale_y", tr("Drag to scale the picture in the Y Axis"), 24 frame,ImageProvider.getCursor("crosshair", null));22 ImageProvider.getCursor("crosshair", null)); 25 23 } 26 24 -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ShearPictureAction.java
r33822 r34170 8 8 import org.openstreetmap.josm.data.coor.EastNorth; 9 9 import org.openstreetmap.josm.gui.MainApplication; 10 import org.openstreetmap.josm.gui.MapFrame;11 10 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction; 12 11 import org.openstreetmap.josm.tools.ImageProvider; … … 15 14 * This class handles the input during shearing of the picture. 16 15 */ 17 @SuppressWarnings("serial")18 16 public class ShearPictureAction extends GenericPicTransformAction { 19 17 … … 21 19 * Constructor 22 20 */ 23 public ShearPictureAction( MapFrame frame) {24 super(tr("PicLayer shear"), tr("Sheared"), "shear", tr("Drag to shear the picture"), frame,ImageProvider.getCursor("crosshair", null));21 public ShearPictureAction() { 22 super(tr("PicLayer shear"), tr("Sheared"), "shear", tr("Drag to shear the picture"), ImageProvider.getCursor("crosshair", null)); 25 23 } 26 24 -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/affine/MovePointAction.java
r33822 r34170 8 8 import java.awt.geom.Point2D; 9 9 10 import org.openstreetmap.josm.gui.MapFrame;11 10 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction; 12 11 import org.openstreetmap.josm.tools.ImageProvider; 13 12 14 // old version - ctrl move point (not transforming picture) 15 @SuppressWarnings("serial") 13 /** 14 * old version - ctrl move point (not transforming picture) 15 */ 16 16 public class MovePointAction extends GenericPicTransformAction { 17 17 18 public MovePointAction( MapFrame frame) {18 public MovePointAction() { 19 19 super(tr("PicLayer Move point"), tr("Point added/moved"), "movepoint", tr("Drag or create point on the picture"), 20 frame,ImageProvider.getCursor("crosshair", null));20 ImageProvider.getCursor("crosshair", null)); 21 21 } 22 22 -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/affine/RemovePointAction.java
r33822 r34170 6 6 import java.awt.event.MouseEvent; 7 7 8 import org.openstreetmap.josm.gui.MapFrame;9 8 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction; 10 9 import org.openstreetmap.josm.tools.ImageProvider; 11 10 12 @SuppressWarnings("serial") 11 /** 12 * Remove point on the picture 13 */ 13 14 public class RemovePointAction extends GenericPicTransformAction { 14 15 15 public RemovePointAction( MapFrame frame) {16 public RemovePointAction() { 16 17 super(tr("PicLayer Remove point"), tr("Point removed"), "removepoint", tr("Remove point on the picture"), 17 frame,ImageProvider.getCursor("crosshair", null));18 ImageProvider.getCursor("crosshair", null)); 18 19 } 19 20 -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/affine/TransformPointAction.java
r33822 r34170 8 8 import java.awt.geom.Point2D; 9 9 10 import org.openstreetmap.josm.gui.MapFrame;11 10 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction; 12 11 import org.openstreetmap.josm.tools.ImageProvider; 13 12 14 @SuppressWarnings("serial") 13 /** 14 * Transform point on the picture 15 */ 15 16 public class TransformPointAction extends GenericPicTransformAction { 16 17 17 public TransformPointAction( MapFrame frame) {18 public TransformPointAction() { 18 19 super(tr("PicLayer Transform point"), tr("Point transformed"), "transformpoint", tr("Transform point on the picture"), 19 frame,ImageProvider.getCursor("crosshair", null));20 ImageProvider.getCursor("crosshair", null)); 20 21 } 21 22 … … 26 27 if (selectedPoint != null) { 27 28 /*if (currentLayer.getTransformer().getOriginPoints().size() < 3) 28 JOptionPane.showMessageDialog(null, tr("You should have 3 checkpoints to transform the image!"), tr("PicLayer"), JOptionPane.ERROR_MESSAGE, null); 29 JOptionPane.showMessageDialog(null, 30 tr("You should have 3 checkpoints to transform the image!"), tr("PicLayer"), JOptionPane.ERROR_MESSAGE, null); 29 31 else*/ 30 32 //{ 31 33 currentLayer.getTransformer().updatePair(selectedPoint, pressed); 32 34 //} 33 35 } -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/layer/PicLayerAbstract.java
r34169 r34170 59 59 60 60 // Initial position of the image in the real world 61 //protected EastNorth initialImagePosition;61 // protected EastNorth initialImagePosition; 62 62 63 63 // Position of the image in the real world … … 133 133 * Initializes the image. Gets the image from a subclass and stores some 134 134 * initial parameters. Throws exception if something fails. 135 * @throws IOException in case of error 135 136 */ 136 137 public void initialize() throws IOException { … … 169 170 * 170 171 * TODO: Replace the IOException by our own exception. 172 * @return created image 173 * @throws IOException in case of error 171 174 */ 172 175 protected abstract Image createImage() throws IOException; … … 176 179 /** 177 180 * To be overridden by subclasses. Returns the user readable name of the layer. 181 * @return the user readable name of the layer 178 182 */ 179 183 public abstract String getPicLayerName(); … … 294 298 295 299 /** 296 * Returns the distance in meter, that corresponds to one unit in east north 297 * space.For normal projections, it is about 1 (but usually changing with298 * latitude).299 * For EPSG:4326, it is the distance from one meridian of full degree to the300 * next (a couple of kilometers).300 * Returns the distance in meter, that corresponds to one unit in east north space. 301 * For normal projections, it is about 1 (but usually changing with latitude). 302 * For EPSG:4326, it is the distance from one meridian of full degree to the next (a couple of kilometers). 303 * @param en east/north 304 * @return the distance in meter, that corresponds to one unit in east north space 301 305 */ 302 306 protected double getMetersPerEasting(EastNorth en) { … … 398 402 /** 399 403 * Loads calibration data from file 400 * @param file The file to read from 404 * @param is The input stream to read from 405 * @throws IOException in case of error 401 406 */ 402 407 public void loadCalibration(InputStream is) throws IOException { … … 550 555 /** 551 556 * Moves the picture. Scaled in EastNorth... 557 * @param x The offset to add in east direction 558 * @param y The offset to add in north direction 552 559 */ 553 560 public void movePictureBy(double x, double y) { -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/transform/PictureTransform.java
r33822 r34170 55 55 56 56 /** 57 * updates pair of points (suppose that other pairs are (origin= >origin) points are the same),57 * updates pair of points (suppose that other pairs are (origin=>origin) points are the same), 58 58 * solves equation, 59 59 * applies transform matrix to the existing cachedTransform
Note:
See TracChangeset
for help on using the changeset viewer.