Changeset 3775 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2011-01-06T21:46:51+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/OffsetBookmark.java
r3734 r3775 12 12 13 13 import org.openstreetmap.josm.Main; 14 import org.openstreetmap.josm.data.coor.LatLon; 14 15 import org.openstreetmap.josm.data.projection.Projection; 15 16 import org.openstreetmap.josm.gui.layer.ImageryLayer; … … 22 23 public String name; 23 24 public double dx, dy; 25 public double centerX, centerY; 24 26 25 27 public boolean isUsable(ImageryLayer layer) { … … 27 29 layer.getInfo().getName().equals(layerName); 28 30 } 31 29 32 public OffsetBookmark(Projection proj, String layerName, String name, double dx, double dy) { 33 this(proj, layerName, name, dx, dy, 0, 0); 34 } 35 36 public OffsetBookmark(Projection proj, String layerName, String name, double dx, double dy, double centerX, double centerY) { 30 37 this.proj = proj; 31 38 this.layerName = layerName; … … 33 40 this.dx = dx; 34 41 this.dy = dy; 42 this.centerX = centerX; 43 this.centerY = centerY; 35 44 } 36 45 … … 50 59 this.dx = Double.valueOf(array.get(3)); 51 60 this.dy = Double.valueOf(array.get(4)); 61 if (array.size() >= 7) { 62 this.centerX = Double.valueOf(array.get(5)); 63 this.centerY = Double.valueOf(array.get(6)); 64 } 52 65 } 53 66 … … 59 72 res.add(String.valueOf(dx)); 60 73 res.add(String.valueOf(dy)); 74 if (this.centerX != 0 || this.centerY != 0) { 75 res.add(String.valueOf(centerX)); 76 res.add(String.valueOf(centerY)); 77 } 61 78 return res; 62 79 } … … 86 103 87 104 public static void bookmarkOffset(String name, ImageryLayer layer) { 105 LatLon center; 106 if (Main.map != null && Main.map.mapView != null) { 107 center = Main.proj.eastNorth2latlon(Main.map.mapView.getCenter()); 108 } else { 109 center = new LatLon(0,0); 110 } 88 111 OffsetBookmark nb = new OffsetBookmark( 89 112 Main.proj, layer.getInfo().getName(), 90 name, layer.getDx(), layer.getDy() );113 name, layer.getDx(), layer.getDy(), center.lon(), center.lat()); 91 114 for (ListIterator<OffsetBookmark> it = allBookmarks.listIterator();it.hasNext();) { 92 115 OffsetBookmark b = it.next();
Note:
See TracChangeset
for help on using the changeset viewer.