Changeset 22547 in osm for applications/editors/josm/plugins/cadastre-fr/src
- Timestamp:
- 2010-08-03T08:11:51+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java
r22153 r22547 5 5 6 6 import java.awt.Color; 7 import java.awt.Component;8 7 import java.awt.Graphics; 9 8 import java.awt.Graphics2D; … … 22 21 import java.util.Vector; 23 22 23 import javax.swing.Action; 24 24 import javax.swing.Icon; 25 25 import javax.swing.ImageIcon; 26 import javax.swing.JMenuItem;27 26 import javax.swing.JOptionPane; 28 27 … … 44 43 public class WMSLayer extends Layer implements ImageObserver { 45 44 46 Component[] component = null;47 48 45 private int lambertZone = -1; 49 46 … … 59 56 */ 60 57 protected final int serializeFormatVersion = 4; 61 58 62 59 public static int currentFormat; 63 60 64 61 private static final int cBBoxForBuildings = 50; // hard coded size of grabbed boxes for building layers 65 62 … … 69 66 70 67 private String location = ""; 71 68 72 69 private String departement = ""; 73 70 … … 88 85 private double rasterRatio; 89 86 90 private JMenuItemsaveAsPng;91 87 private Action saveAsPng; 88 92 89 public boolean adjustModeEnabled; 93 90 … … 106 103 } 107 104 108 public void destroy() { 105 @Override 106 public void destroy() { 109 107 // if the layer is currently saving the images in the cache, wait until it's finished 110 108 if (cacheControl != null) { … … 119 117 System.out.println("Layer "+location+" destroyed"); 120 118 } 121 119 122 120 private static String buildName(String location, String codeCommune, boolean buildingOnly) { 123 String ret = new String(location.toUpperCase());121 String ret = location.toUpperCase(); 124 122 if (codeCommune != null && !codeCommune.equals("")) 125 123 ret += "(" + codeCommune + ")"; … … 136 134 grab(grabber, b, true); 137 135 } 138 136 139 137 public void grab(CadastreGrabber grabber, Bounds b, boolean useFactor) throws IOException { 140 138 cancelled = false; … … 225 223 } else { 226 224 // divide to fixed size squares 227 int cSquare = factor == 4 ? Integer.parseInt(Main.pref.get("cadastrewms.squareSize", "100")) : optionalSize; 225 int cSquare = factor == 4 ? Integer.parseInt(Main.pref.get("cadastrewms.squareSize", "100")) : optionalSize; 228 226 minEast = minEast - minEast % cSquare; 229 227 minNorth = minNorth - minNorth % cSquare; … … 286 284 if (this.adjustModeEnabled) { 287 285 WMSAdjustAction.paintAdjustFrames(g, mv); 288 } 286 } 289 287 } 290 288 … … 303 301 304 302 @Override 305 public Component[] getMenuEntries() {306 saveAsPng = new JMenuItem(new MenuActionSaveRasterAs(this));303 public Action[] getMenuEntries() { 304 saveAsPng = new MenuActionSaveRasterAs(this); 307 305 saveAsPng.setEnabled(isRaster); 308 component = new Component[] { new JMenuItem(LayerListDialog.getInstance().createShowHideLayerAction(this)), 309 new JMenuItem(LayerListDialog.getInstance().createDeleteLayerAction(this)), 310 new JMenuItem(new MenuActionLoadFromCache()), 306 return new Action[] { 307 LayerListDialog.getInstance().createShowHideLayerAction(), 308 LayerListDialog.getInstance().createDeleteLayerAction(), 309 new MenuActionLoadFromCache(), 311 310 saveAsPng, 312 new JMenuItem(new LayerListPopup.InfoAction(this)),311 new LayerListPopup.InfoAction(this), 313 312 314 313 }; 315 return component;316 314 } 317 315 … … 443 441 double ratio = rasterSizeY/rasterSizeX; 444 442 // keep same ratio on screen as WMS bbox (stored in communeBBox) 445 rasterMin = new EastNorth(eaMin.getX(), rasterCenter.getY()-(eaMax.getX()-eaMin.getX())*ratio/2); 446 rasterMax = new EastNorth(eaMax.getX(), rasterCenter.getY()+(eaMax.getX()-eaMin.getX())*ratio/2); 443 rasterMin = new EastNorth(eaMin.getX(), rasterCenter.getY()-(eaMax.getX()-eaMin.getX())*ratio/2); 444 rasterMax = new EastNorth(eaMax.getX(), rasterCenter.getY()+(eaMax.getX()-eaMin.getX())*ratio/2); 447 445 rasterRatio = (rasterMax.getX()-rasterMin.getX())/rasterSizeX; 448 446 } … … 598 596 rasterRatio = (rasterMax.getX()-rasterMin.getX())/(communeBBox.max.getX() - communeBBox.min.getX()); 599 597 } 600 598 601 599 public EastNorthBound getCommuneBBox() { 602 600 return communeBBox; … … 640 638 // double proportion = dst1.distance(dst2)/org1.distance(org2); 641 639 images.get(0).rotate(rasterCenter, angle); 642 this.angle += angle; 640 this.angle += angle; 643 641 } 644 642
Note:
See TracChangeset
for help on using the changeset viewer.