source: osm/applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java@ 31257

Last change on this file since 31257 was 31257, checked in by nokutu, 10 years ago

New history dialog

File size: 2.3 KB
Line 
1package org.openstreetmap.josm.plugins.mapillary;
2
3import org.openstreetmap.josm.data.coor.LatLon;
4
5public abstract class MapillaryAbstractImage {
6
7 /** Postion of the picture */
8 public final LatLon latLon;
9 /** Direction of the picture */
10 public final double ca;
11 public boolean isModified = false;
12 /** Temporal position of the picture until it is uplaoded */
13 public LatLon tempLatLon;
14 /**
15 * When the object is being dragged in the map, the temporal position is
16 * stored here
17 */
18 public LatLon movingLatLon;
19 /** Temporal direction of the picture until it is uplaoded */
20 public double tempCa;
21 /**
22 * When the object direction is being moved in the map, the temporal
23 * direction is stored here
24 */
25 protected double movingCa;
26
27 public MapillaryAbstractImage(double lat, double lon, double ca) {
28 this.latLon = new LatLon(lat, lon);
29 this.tempLatLon = this.latLon;
30 this.movingLatLon = this.latLon;
31 this.ca = ca;
32 this.tempCa = ca;
33 this.movingCa = ca;
34 }
35
36 /**
37 * Returns whether the object has been modified or not.
38 *
39 * @return true if the object has been modified; false otherwise.
40 */
41 public boolean isModified() {
42 return this.isModified;
43 }
44
45 /**
46 * Returns a LatLon object containing the coordintes of the object.
47 *
48 * @return The LatLon object with the position of the object.
49 */
50 public LatLon getLatLon() {
51 return movingLatLon;
52 }
53
54 public LatLon getTempLatLon() {
55 return tempLatLon;
56 }
57
58 /**
59 * Moves the image temporally to another position
60 *
61 * @param pos
62 */
63 public void move(double x, double y) {
64 this.movingLatLon = new LatLon(this.tempLatLon.getY() + y,
65 this.tempLatLon.getX() + x);
66 this.isModified = true;
67 }
68
69 /**
70 * Turns the image direction.
71 *
72 * @param ca
73 */
74 public void turn(double ca) {
75 this.movingCa = this.tempCa + ca;
76 this.isModified = true;
77 }
78
79 /**
80 * Called when the mouse button is released, meaning that the picture has
81 * stopped being dragged.
82 */
83 public void stopMoving() {
84 this.tempLatLon = this.movingLatLon;
85 this.tempCa = this.movingCa;
86 }
87
88 /**
89 * Returns the direction towards the image has been taken.
90 *
91 * @return The direction of the image (0 means north and goes clockwise).
92 */
93 public double getCa() {
94 return movingCa;
95 }
96
97 /**
98 * Returns the last fixed direction of the object.
99 *
100 * @return
101 */
102 public double getTempCa() {
103 return tempCa;
104 }
105}
Note: See TracBrowser for help on using the repository browser.