Changeset 26823 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java
- Timestamp:
- 2011-10-09T23:41:21+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java
r26509 r26823 11 11 import java.awt.RenderingHints; 12 12 import java.awt.Toolkit; 13 import java.awt.event.ActionEvent; 13 14 import java.awt.image.BufferedImage; 14 15 import java.awt.image.ImageObserver; … … 29 30 30 31 import org.openstreetmap.josm.Main; 32 import org.openstreetmap.josm.actions.JosmAction; 31 33 import org.openstreetmap.josm.data.Bounds; 32 34 import org.openstreetmap.josm.data.coor.EastNorth; … … 87 89 private Action cancelGrab; 88 90 91 @SuppressWarnings("serial") 92 class ResetOffsetActionMenu extends JosmAction { 93 private WMSLayer wmsLayer; 94 public ResetOffsetActionMenu(WMSLayer wmsLayer) { 95 super(tr("Reset offset"), null, tr("Reset offset (only vector images)"), null, false); 96 this.wmsLayer = wmsLayer; 97 } 98 @Override 99 public void actionPerformed(ActionEvent arg0) { 100 for (GeorefImage img:wmsLayer.images) { 101 img.deltaEast = 0; 102 img.deltaNorth = 0; 103 } 104 Main.map.mapView.repaint(); 105 } 106 107 } 108 89 109 public boolean adjustModeEnabled; 90 110 … … 213 233 dividedBbox.add(new EastNorthBound(mid, new EastNorth(mid.east()+c, mid.north()+c))); 214 234 } 215 // // simple algorithm to grab all squares216 // minEast = minEast - minEast % cSquare;217 // minNorth = minNorth - minNorth % cSquare;218 // for (int xEast = (int)minEast; xEast < lambertMax.east(); xEast+=cSquare)219 // for (int xNorth = (int)minNorth; xNorth < lambertMax.north(); xNorth+=cSquare) {220 // dividedBbox.add(new EastNorthBound(new EastNorth(xEast, xNorth),221 // new EastNorth(xEast + cSquare, xNorth + cSquare)));222 // }223 235 } 224 236 } … … 297 309 cancelGrab = new MenuActionCancelGrab(this); 298 310 cancelGrab.setEnabled(!isRaster && grabThread.getImagesToGrabSize() > 0); 311 Action resetOffset = new ResetOffsetActionMenu(this); 312 resetOffset.setEnabled(!isRaster && images.size() > 0 && (images.get(0).deltaEast!=0.0 || images.get(0).deltaNorth!=0.0)); 299 313 return new Action[] { 300 314 LayerListDialog.getInstance().createShowHideLayerAction(), … … 303 317 saveAsPng, 304 318 cancelGrab, 319 resetOffset, 305 320 new LayerListPopup.InfoAction(this), 306 321 … … 566 581 return communeBBox; 567 582 } 583 584 public EastNorthBound getFirstViewFromCacheBBox() { 585 if (isRaster) { 586 return communeBBox; 587 } 588 double min_x = Double.MAX_VALUE; 589 double max_x = Double.MIN_VALUE; 590 double min_y = Double.MAX_VALUE; 591 double max_y = Double.MIN_VALUE; 592 for (GeorefImage image:images){ 593 min_x = image.min.east() < min_x ? image.min.east() : min_x; 594 max_x = image.max.east() > max_x ? image.max.east() : max_x; 595 min_y = image.min.north() < min_y ? image.min.north() : min_y; 596 max_y = image.max.north() > max_y ? image.max.north() : max_y; 597 } 598 EastNorthBound maxGrabbedBBox = new EastNorthBound(new EastNorth(min_x, min_y), new EastNorth(max_x, max_y)); 599 return maxGrabbedBBox; 600 } 568 601 569 602 public void setCommuneBBox(EastNorthBound entireCommune) { … … 588 621 589 622 public void displace(double dx, double dy) { 590 this.rasterMin = new EastNorth(rasterMin.east() + dx, rasterMin.north() + dy); 591 this.rasterMax = new EastNorth(rasterMax.east() + dx, rasterMax.north() + dy); 592 images.get(0).shear(dx, dy); 623 if (isRaster) { 624 this.rasterMin = new EastNorth(rasterMin.east() + dx, rasterMin.north() + dy); 625 this.rasterMax = new EastNorth(rasterMax.east() + dx, rasterMax.north() + dy); 626 images.get(0).shear(dx, dy); 627 } else { 628 for (GeorefImage image:images) 629 image.tempShear(dx, dy); 630 } 593 631 } 594 632
Note:
See TracChangeset
for help on using the changeset viewer.
