source: osm/applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ShearPictureAction.java@ 27403

Last change on this file since 27403 was 27403, checked in by larry0ua, 13 years ago

'PicLayer - now all actions are shown in history and user can undo/redo changes'

  • Property svn:eol-style set to native
File size: 2.7 KB
Line 
1/***************************************************************************
2 * *
3 * Copyright (C) 2011 Patrick "Petschge" Kilian, based on code *
4 * (c) 2009 by Tomasz Stelmach *
5 * http://www.stelmach-online.net/ *
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the *
19 * Free Software Foundation, Inc., *
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21 ***************************************************************************/
22
23package org.openstreetmap.josm.plugins.piclayer.actions.transform;
24
25import static org.openstreetmap.josm.tools.I18n.tr;
26
27import java.awt.event.MouseEvent;
28
29import org.openstreetmap.josm.Main;
30import org.openstreetmap.josm.data.coor.EastNorth;
31import org.openstreetmap.josm.gui.MapFrame;
32import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction;
33import org.openstreetmap.josm.tools.ImageProvider;
34
35/**
36 * This class handles the input during shearing of the picture.
37 */
38@SuppressWarnings("serial")
39public class ShearPictureAction extends GenericPicTransformAction {
40
41 /**
42 * Constructor
43 */
44 public ShearPictureAction(MapFrame frame) {
45 super(tr("PicLayer shear"), tr("Sheared"), "shear", tr("Drag to shear the picture"), frame, ImageProvider.getCursor("crosshair", null));
46 }
47
48 @Override
49 protected void doAction(MouseEvent e) {
50 EastNorth eastNorth = Main.map.mapView.getEastNorth(e.getX(),e.getY());
51 currentLayer.shearPictureBy(
52 1000* (eastNorth.east() - prevEastNorth.east()),
53 1000* (eastNorth.north() - prevEastNorth.north())
54 );
55 }
56
57}
Note: See TracBrowser for help on using the repository browser.