Changeset 33148 in osm for applications/editors/josm/plugins
- Timestamp:
- 2017-02-15T12:27:30+01:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ScaleXPictureAction.java
r32675 r33148 23 23 import static org.openstreetmap.josm.tools.I18n.tr; 24 24 25 import java.awt.event.MouseEvent; 26 27 import org.openstreetmap.josm.Main; 25 28 import org.openstreetmap.josm.gui.MapFrame; 29 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction; 30 import org.openstreetmap.josm.tools.ImageProvider; 26 31 27 32 /** … … 29 34 */ 30 35 @SuppressWarnings("serial") 31 public class ScaleXPictureAction extends ScalePictureActionAbstract{36 public class ScaleXPictureAction extends GenericPicTransformAction { 32 37 33 38 /** … … 35 40 */ 36 41 public ScaleXPictureAction(MapFrame frame) { 37 super(tr("PicLayer scale X"), tr("Scaled by X"), "scale_x", tr("Drag to scale the picture in the X Axis"), frame );42 super(tr("PicLayer scale X"), tr("Scaled by X"), "scale_x", tr("Drag to scale the picture in the X Axis"), frame, ImageProvider.getCursor("crosshair", null)); 38 43 } 39 44 40 45 @Override 41 public void doTheScale(double scale) { 42 currentLayer.scalePictureBy(scale, 1.0); 46 protected void doAction(MouseEvent e) { 47 double centerX = Main.map.mapView.getWidth()/2; 48 double dx0 = Math.max(Math.abs(prevMousePoint.getX() - centerX), 10); 49 double dx = Math.abs(e.getX() - centerX); 50 double scaleX = Math.max(dx / dx0, 0.9); 51 currentLayer.scalePictureBy(scaleX, 1.0); 43 52 } 44 53 } -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ScaleXYPictureAction.java
r32675 r33148 23 23 import static org.openstreetmap.josm.tools.I18n.tr; 24 24 25 import java.awt.Point; 26 import java.awt.event.MouseEvent; 27 import java.awt.geom.Point2D; 28 29 import org.openstreetmap.josm.Main; 25 30 import org.openstreetmap.josm.gui.MapFrame; 31 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction; 32 import org.openstreetmap.josm.tools.ImageProvider; 26 33 27 34 /** … … 29 36 */ 30 37 @SuppressWarnings("serial") 31 public class ScaleXYPictureAction extends ScalePictureActionAbstract{38 public class ScaleXYPictureAction extends GenericPicTransformAction { 32 39 33 40 /** … … 35 42 */ 36 43 public ScaleXYPictureAction(MapFrame frame) { 37 super(tr("PicLayer scale"), tr("Scaled"), "scale", tr("Drag to scale the picture in the X and Y Axis"), frame );44 super(tr("PicLayer scale"), tr("Scaled"), "scale", tr("Drag to scale the picture in the X and Y Axis"), frame, ImageProvider.getCursor("crosshair", null)); 38 45 } 39 46 40 47 @Override 41 public void doTheScale(double scale) { 48 protected void doAction(MouseEvent e) { 49 double centerX = Main.map.mapView.getWidth()/2; 50 double centerY = Main.map.mapView.getHeight()/2; 51 double d0 = Math.max(prevMousePoint.distance(centerX, centerY), 10); 52 Point2D mousePoint = new Point(e.getX(), e.getY()); 53 double d = mousePoint.distance(centerX, centerY); 54 double scale = Math.max(d / d0, 0.9); 42 55 currentLayer.scalePictureBy(scale, scale); 43 56 } -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ScaleYPictureAction.java
r32675 r33148 23 23 import static org.openstreetmap.josm.tools.I18n.tr; 24 24 25 import java.awt.event.MouseEvent; 26 27 import org.openstreetmap.josm.Main; 25 28 import org.openstreetmap.josm.gui.MapFrame; 29 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction; 30 import org.openstreetmap.josm.tools.ImageProvider; 26 31 27 32 /** … … 29 34 */ 30 35 @SuppressWarnings("serial") 31 public class ScaleYPictureAction extends ScalePictureActionAbstract{36 public class ScaleYPictureAction extends GenericPicTransformAction { 32 37 33 38 /** … … 35 40 */ 36 41 public ScaleYPictureAction(MapFrame frame) { 37 super(tr("PicLayer scale Y"), tr("Scaled by Y"), "scale_y", tr("Drag to scale the picture in the Y Axis"), frame );42 super(tr("PicLayer scale Y"), tr("Scaled by Y"), "scale_y", tr("Drag to scale the picture in the Y Axis"), frame, ImageProvider.getCursor("crosshair", null)); 38 43 } 39 44 40 45 @Override 41 public void doTheScale(double scale) { 42 currentLayer.scalePictureBy(1.0, scale); 46 protected void doAction(MouseEvent e) { 47 double centerY = Main.map.mapView.getHeight()/2; 48 double dy0 = Math.max(Math.abs(prevMousePoint.getY() - centerY), 10); 49 double dy = Math.abs(e.getY() - centerY); 50 double scaleY = Math.max(dy / dy0, 0.9); 51 currentLayer.scalePictureBy(1.0, scaleY); 43 52 } 44 53 }
Note:
See TracChangeset
for help on using the changeset viewer.