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 |
|
---|
23 | package org.openstreetmap.josm.plugins.piclayer.actions.transform;
|
---|
24 |
|
---|
25 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
26 |
|
---|
27 | import java.awt.event.MouseEvent;
|
---|
28 |
|
---|
29 | import org.openstreetmap.josm.Main;
|
---|
30 | import org.openstreetmap.josm.data.coor.EastNorth;
|
---|
31 | import org.openstreetmap.josm.gui.MapFrame;
|
---|
32 | import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction;
|
---|
33 | import org.openstreetmap.josm.tools.ImageProvider;
|
---|
34 |
|
---|
35 | /**
|
---|
36 | * This class handles the input during shearing of the picture.
|
---|
37 | */
|
---|
38 | @SuppressWarnings("serial")
|
---|
39 | public 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 | }
|
---|