Changeset 19417 in osm
- Timestamp:
- 2010-01-12T21:26:57+01:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/wmsplugin
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/GeorefImage.java
r18761 r19417 1 1 package wmsplugin; 2 2 3 import java.awt.Color;4 3 import java.awt.Dimension; 5 4 import java.awt.Graphics; … … 19 18 20 19 public class GeorefImage implements Serializable { 21 22 23 24 25 26 20 public BufferedImage image = null; 21 private Image reImg = null; 22 private Dimension reImgHash = new Dimension(0, 0); 23 public EastNorth min, max; 24 public boolean downloadingStarted; 25 public boolean failed = false; 27 26 28 29 30 27 public GeorefImage(boolean downloadingStarted) { 28 this.downloadingStarted = downloadingStarted; 29 } 31 30 32 33 34 35 31 public boolean contains(EastNorth en, double dx, double dy) { 32 return min.east()+dx <= en.east() && en.east() <= max.east()+dx 33 && min.north()+dy <= en.north() && en.north() <= max.north()+dy; 34 } 36 35 37 38 39 40 41 36 public boolean isVisible(NavigatableComponent nc, double dx, double dy) { 37 EastNorth mi = new EastNorth(min.east()+dx, min.north()+dy); 38 EastNorth ma = new EastNorth(max.east()+dx, max.north()+dy); 39 Point minPt = nc.getPoint(mi), maxPt = nc.getPoint(ma); 40 Graphics g = nc.getGraphics(); 42 41 43 44 45 42 return (g.hitClip(minPt.x, maxPt.y, 43 maxPt.x - minPt.x, minPt.y - maxPt.y)); 44 } 46 45 47 48 46 public boolean paint(Graphics g, NavigatableComponent nc, double dx, double dy) { 47 if (image == null || min == null || max == null) return false; 49 48 50 51 52 49 EastNorth mi = new EastNorth(min.east()+dx, min.north()+dy); 50 EastNorth ma = new EastNorth(max.east()+dx, max.north()+dy); 51 Point minPt = nc.getPoint(mi), maxPt = nc.getPoint(ma); 53 52 54 55 56 53 if(!isVisible(nc, dx, dy)){ 54 return false; 55 } 57 56 58 // Width and height flicker about 2 pixels due to rounding errors, typically only 1 59 int width = Math.abs(maxPt.x-minPt.x); 60 int height = Math.abs(minPt.y-maxPt.y); 61 int diffx, diffy; 62 try { 63 diffx = reImgHash.width - width; 64 diffy = reImgHash.height - height; 65 } catch(Exception e) { 66 reImgHash = new Dimension(0, 0); 67 diffx = 99; 68 diffy = 99; 69 } 70 // This happens if you zoom outside the world 71 if(width == 0 || height == 0) 72 return false; 57 // Width and height flicker about 2 pixels due to rounding errors, typically only 1 58 int width = Math.abs(maxPt.x-minPt.x); 59 int height = Math.abs(minPt.y-maxPt.y); 60 int diffx, diffy; 73 61 74 // We still need to re-render if the requested size is larger (otherwise we'll have black lines) 75 // If it's only up to two pixels smaller, just draw the old image, the errors are minimal 76 // but the performance improvements when moving are huge 77 // Zooming is still slow because the images need to be resized 78 if(diffx >= 0 && diffx <= 2 && diffy >= 0 && diffy <= 2 && reImg != null) { 79 /*g.setColor(Color.RED); 62 diffx = reImgHash.width - width; 63 diffy = reImgHash.height - height; 64 // This happens if you zoom outside the world 65 if(width == 0 || height == 0) 66 return false; 67 68 // We still need to re-render if the requested size is larger (otherwise we'll have black lines) 69 // If it's only up to two pixels smaller, just draw the old image, the errors are minimal 70 // but the performance improvements when moving are huge 71 // Zooming is still slow because the images need to be resized 72 if(diffx >= 0 && diffx <= 2 && diffy >= 0 && diffy <= 2 && reImg != null) { 73 /*g.setColor(Color.RED); 80 74 g.drawRect(minPt.x, minPt.y-height, width, height);*/ 81 82 83 75 g.drawImage(reImg, minPt.x, maxPt.y, null); 76 return true; 77 } 84 78 85 79 boolean alphaChannel = Main.pref.getBoolean("wmsplugin.alpha_channel"); 86 80 87 88 89 90 91 92 81 try { 82 if(reImg != null) reImg.flush(); 83 long freeMem = Runtime.getRuntime().maxMemory() - Runtime.getRuntime().totalMemory(); 84 //System.out.println("Free Memory: "+ (freeMem/1024/1024) +" MB"); 85 // Notice that this value can get negative due to integer overflows 86 //System.out.println("Img Size: "+ (width*height*3/1024/1024) +" MB"); 93 87 94 int multipl = alphaChannel ? 4 : 3; 95 // This happens when requesting images while zoomed out and then zooming in 96 // Storing images this large in memory will certainly hang up JOSM. Luckily 97 // traditional rendering is as fast at these zoom levels, so it's no loss. 98 // Also prevent caching if we're out of memory soon 99 if(width > 2000 || height > 2000 || width*height*multipl > freeMem) { 100 fallbackDraw(g, image, minPt, maxPt); 101 } else { 102 // We haven't got a saved resized copy, so resize and cache it 103 reImg = new BufferedImage(width, height, 104 alphaChannel 105 ? BufferedImage.TYPE_INT_ARGB 106 : BufferedImage.TYPE_3BYTE_BGR // This removes alpha 107 ); 108 reImg.getGraphics().drawImage(image, 109 0, 0, width, height, // dest 110 0, 0, image.getWidth(null), image.getHeight(null), // src 111 null); 112 reImg.getGraphics().dispose(); 88 int multipl = alphaChannel ? 4 : 3; 89 // This happens when requesting images while zoomed out and then zooming in 90 // Storing images this large in memory will certainly hang up JOSM. Luckily 91 // traditional rendering is as fast at these zoom levels, so it's no loss. 92 // Also prevent caching if we're out of memory soon 93 if(width > 2000 || height > 2000 || width*height*multipl > freeMem) { 94 fallbackDraw(g, image, minPt, maxPt); 95 } else { 96 // We haven't got a saved resized copy, so resize and cache it 97 reImg = new BufferedImage(width, height, alphaChannel?BufferedImage.TYPE_INT_ARGB:BufferedImage.TYPE_3BYTE_BGR); 98 reImg.getGraphics().drawImage(image, 99 0, 0, width, height, // dest 100 0, 0, image.getWidth(null), image.getHeight(null), // src 101 null); 102 reImg.getGraphics().dispose(); 113 103 114 115 104 reImgHash.setSize(width, height); 105 /*g.setColor(Color.RED); 116 106 g.drawRect(minPt.x, minPt.y-height, width, height);*/ 117 118 119 120 121 122 123 107 g.drawImage(reImg, minPt.x, maxPt.y, null); 108 } 109 } catch(Exception e) { 110 fallbackDraw(g, image, minPt, maxPt); 111 } 112 return true; 113 } 124 114 125 126 127 128 129 130 131 132 115 private void fallbackDraw(Graphics g, Image img, Point min, Point max) { 116 if(reImg != null) reImg.flush(); 117 reImg = null; 118 g.drawImage(img, 119 min.x, max.y, max.x, min.y, // dest 120 0, 0, img.getWidth(null), img.getHeight(null), // src 121 null); 122 } 133 123 134 135 136 137 138 139 image = (BufferedImage)ImageIO.read(ImageIO.createImageInputStream(in));140 141 142 143 144 124 private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { 125 max = (EastNorth) in.readObject(); 126 min = (EastNorth) in.readObject(); 127 boolean hasImage = in.readBoolean(); 128 if (hasImage) 129 image = ImageIO.read(ImageIO.createImageInputStream(in)); 130 else { 131 in.readObject(); // read null from input stream 132 image = null; 133 } 134 } 145 135 146 147 148 149 150 151 152 153 154 155 156 136 private void writeObject(ObjectOutputStream out) throws IOException { 137 out.writeObject(max); 138 out.writeObject(min); 139 if(image == null) { 140 out.writeBoolean(false); 141 out.writeObject(null); 142 } else { 143 out.writeBoolean(true); 144 ImageIO.write(image, "png", ImageIO.createImageOutputStream(out)); 145 } 146 } 157 147 158 159 160 148 public void flushedResizedCachedInstance() { 149 reImg = null; 150 } 161 151 } -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/Map_Rectifier_WMSmenuAction.java
r18761 r19417 3 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 4 5 import java.awt.GridBagConstraints; 5 6 import java.awt.GridBagLayout; 6 7 import java.awt.Toolkit; … … 31 32 * Class that bundles all required information of a rectifier service 32 33 */ 33 public class rectifierService {34 public static class RectifierService { 34 35 private final String name; 35 36 private final String url; … … 45 46 * @param idValidator: regular expression that checks if a given ID is syntactically valid 46 47 */ 47 public rectifierService(String name, String url, String wmsUrl, String urlRegEx, String idValidator) {48 public RectifierService(String name, String url, String wmsUrl, String urlRegEx, String idValidator) { 48 49 this.name = name; 49 50 this.url = url; … … 61 62 * List of available rectifier services. May be extended from the outside 62 63 */ 63 public ArrayList< rectifierService> services = new ArrayList<rectifierService>();64 public ArrayList<RectifierService> services = new ArrayList<RectifierService>(); 64 65 65 66 public Map_Rectifier_WMSmenuAction() { … … 76 77 // Add default services 77 78 services.add( 78 new rectifierService("Metacarta Map Rectifier",79 new RectifierService("Metacarta Map Rectifier", 79 80 "http://labs.metacarta.com/rectifier/", 80 81 "http://labs.metacarta.com/rectifier/wms.cgi?id=__s__&srs=EPSG:4326" … … 89 90 // The RegEx already matches the new URL and old URLs will be forwarded 90 91 // to make the transition as smooth as possible for the users 91 new rectifierService("Geothings Map Warper",92 new RectifierService("Geothings Map Warper", 92 93 "http://warper.geothings.net/", 93 94 "http://warper.geothings.net/maps/wms/__s__?request=GetMap&version=1.1.1" … … 104 105 // Clipboard content gets trimmed, so matching whitespace only ensures that this 105 106 // service will never be selected automatically. 106 services.add(new rectifierService(tr("Custom WMS Link"), "", "", "^\\s+$", ""));107 services.add(new RectifierService(tr("Custom WMS Link"), "", "", "^\\s+$", "")); 107 108 } 108 109 … … 117 118 118 119 JRadioButton firstBtn = null; 119 for( rectifierService s : services) {120 for(RectifierService s : services) { 120 121 JRadioButton serviceBtn = new JRadioButton(s.name); 121 122 if(firstBtn == null) … … 133 134 if(!s.url.equals("")) { 134 135 panel.add(serviceBtn, GBC.std()); 135 panel.add(new UrlLabel(s.url, tr("Visit Homepage")), GBC.eol().anchor(G BC.EAST));136 panel.add(new UrlLabel(s.url, tr("Visit Homepage")), GBC.eol().anchor(GridBagConstraints.EAST)); 136 137 } else 137 panel.add(serviceBtn, GBC.eol().anchor(G BC.WEST));138 panel.add(serviceBtn, GBC.eol().anchor(GridBagConstraints.WEST)); 138 139 } 139 140 … … 143 144 144 145 panel.add(new JLabel(tr("WMS URL or Image ID:")), GBC.eol()); 145 panel.add(tfWmsUrl, GBC.eol().fill(G BC.HORIZONTAL));146 panel.add(tfWmsUrl, GBC.eol().fill(GridBagConstraints.HORIZONTAL)); 146 147 147 148 ExtendedDialog diag = new ExtendedDialog(Main.parent, … … 163 164 String text = tfWmsUrl.getText().trim(); 164 165 // Loop all services until we find the selected one 165 for( rectifierService s : services) {166 for(RectifierService s : services) { 166 167 if(!s.isSelected()) 167 168 continue; -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSAdjustAction.java
r18761 r19417 10 10 import java.awt.event.MouseMotionListener; 11 11 import java.util.List; 12 import java.util.logging.Logger;13 12 14 13 import javax.swing.DefaultComboBoxModel; … … 32 31 33 32 public class WMSAdjustAction extends MapMode implements MouseListener, MouseMotionListener{ 34 static private final Logger logger = Logger.getLogger(WMSAdjustAction.class.getName());35 33 //static private final Logger logger = Logger.getLogger(WMSAdjustAction.class.getName()); 34 36 35 GeorefImage selectedImage; 37 36 boolean mouseDown; … … 45 44 } 46 45 47 48 46 47 49 48 @Override public void enterMode() { 50 super.enterMode(); 49 super.enterMode(); 51 50 if (!hasWMSLayersToAdjust()) { 52 51 warnNoWMSLayers(); … … 108 107 prevEastNorth = null; 109 108 } 110 109 111 110 @Override 112 111 public void mouseEntered(MouseEvent e) { 113 112 } 114 113 115 114 @Override 116 115 public void mouseExited(MouseEvent e) { 117 116 } 118 117 119 118 @Override 120 119 public void mouseMoved(MouseEvent e) { … … 129 128 return (l instanceof WMSLayer) && l.isVisible(); 130 129 } 131 130 132 131 /** 133 132 * the list cell renderer used to render layer list entries 134 * 133 * 135 134 */ 136 135 static public class LayerListCellRenderer extends DefaultListCellRenderer { … … 158 157 159 158 /** 160 * Prompts the user with a list of WMS layers which can be adjusted 161 * 162 * @param adjustableLayers the list of adjustable layers 163 * @return the selected layer; null, if no layer was selected 159 * Prompts the user with a list of WMS layers which can be adjusted 160 * 161 * @param adjustableLayers the list of adjustable layers 162 * @return the selected layer; null, if no layer was selected 164 163 */ 165 164 protected Layer askAdjustLayer(List<? extends Layer> adjustableLayers) { … … 168 167 layerList.setModel(new DefaultComboBoxModel(adjustableLayers.toArray())); 169 168 layerList.setSelectedIndex(0); 170 169 171 170 JPanel pnl = new JPanel(); 172 171 pnl.setLayout(new GridBagLayout()); 173 172 pnl.add(new JLabel(tr("Please select the WMS layer to adjust.")), GBC.eol()); 174 173 pnl.add(layerList, GBC.eol()); 175 174 176 175 ExtendedDialog diag = new ExtendedDialog( 177 Main.parent, 178 tr("Select WMS layer"), 176 Main.parent, 177 tr("Select WMS layer"), 179 178 new String[] { tr("Start adjusting"),tr("Cancel") } 180 179 ); … … 190 189 191 190 /** 192 * Displays a warning message if there are no WMS layers to adjust 193 * 191 * Displays a warning message if there are no WMS layers to adjust 192 * 194 193 */ 195 194 protected void warnNoWMSLayers() { … … 197 196 Main.parent, 198 197 tr("There are currently no WMS layer to adjust."), 199 tr("No layers to adjust"), 198 tr("No layers to adjust"), 200 199 JOptionPane.WARNING_MESSAGE 201 200 ); 202 201 } 203 202 204 203 /** 205 * Replies true if there is at least one WMS layer 206 * 204 * Replies true if there is at least one WMS layer 205 * 207 206 * @return true if there is at least one WMS layer 208 207 */ … … 216 215 protected void updateEnabledState() { 217 216 setEnabled(hasWMSLayersToAdjust()); 218 } 217 } 219 218 } -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSGrabber.java
r19240 r19417 37 37 return url != null && url.contains("{") && url.contains("}"); 38 38 } 39 39 40 40 protected String baseURL; 41 41 private final boolean urlWithPatterns; … … 48 48 } 49 49 50 public void run() { 50 @Override 51 public void run() { 51 52 attempt(); 52 53 mv.repaint(); … … 152 153 } 153 154 154 public boolean loadFromCache(){ 155 @Override 156 public boolean loadFromCache(){ 155 157 URL url = null; 156 158 try{ -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSInfo.java
r15858 r19417 33 33 public int compareTo(WMSInfo in) 34 34 { 35 Integeri = name.compareTo(in.name);35 int i = name.compareTo(in.name); 36 36 if(i == 0) 37 37 i = url.compareTo(in.url); -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayer.java
r19240 r19417 51 51 protected String resolution; 52 52 protected boolean stopAfterPaint = false; 53 protected int ImageSize = 500;53 protected int imageSize = 500; 54 54 protected int dax = 10; 55 55 protected int day = 10; … … 168 168 private ProjectionBounds XYtoBounds (int x, int y) { 169 169 return new ProjectionBounds( 170 new EastNorth( x * ImageSize / pixelPerDegree, y * ImageSize / pixelPerDegree),171 new EastNorth((x + 1) * ImageSize / pixelPerDegree, (y + 1) * ImageSize / pixelPerDegree));170 new EastNorth( x * imageSize / pixelPerDegree, y * imageSize / pixelPerDegree), 171 new EastNorth((x + 1) * imageSize / pixelPerDegree, (y + 1) * imageSize / pixelPerDegree)); 172 172 } 173 173 … … 228 228 return; 229 229 ProjectionBounds bounds = mv.getProjectionBounds(); 230 int bminx= (int)Math.floor (((bounds.min.east() - dx) * pixelPerDegree) / ImageSize );231 int bminy= (int)Math.floor (((bounds.min.north() - dy) * pixelPerDegree) / ImageSize );232 int bmaxx= (int)Math.ceil (((bounds.max.east() - dx) * pixelPerDegree) / ImageSize );233 int bmaxy= (int)Math.ceil (((bounds.max.north() - dy) * pixelPerDegree) / ImageSize );230 int bminx= (int)Math.floor (((bounds.min.east() - dx) * pixelPerDegree) / imageSize ); 231 int bminy= (int)Math.floor (((bounds.min.north() - dy) * pixelPerDegree) / imageSize ); 232 int bmaxx= (int)Math.ceil (((bounds.max.east() - dx) * pixelPerDegree) / imageSize ); 233 int bmaxy= (int)Math.ceil (((bounds.max.north() - dy) * pixelPerDegree) / imageSize ); 234 234 235 235 if((bmaxx - bminx > dax) || (bmaxy - bminy > day)){ … … 385 385 oos.writeInt(dax); 386 386 oos.writeInt(day); 387 oos.writeInt( ImageSize);387 oos.writeInt(imageSize); 388 388 oos.writeDouble(pixelPerDegree); 389 389 oos.writeObject(getName()); … … 423 423 dax = ois.readInt(); 424 424 day = ois.readInt(); 425 ImageSize = ois.readInt();425 imageSize = ois.readInt(); 426 426 pixelPerDegree = ois.readDouble(); 427 427 setName((String)ois.readObject()); -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPreferenceEditor.java
r19306 r19417 1 1 package wmsplugin; 2 2 3 import java.awt.BorderLayout;4 import java.awt.FlowLayout;5 import javax.swing.JCheckBox;6 import javax.swing.JSpinner;7 import javax.swing.SpinnerNumberModel;8 import org.openstreetmap.josm.Main;9 3 import static org.openstreetmap.josm.tools.I18n.tr; 10 4 11 5 import java.awt.Dimension; 12 6 import java.awt.FlowLayout; 7 import java.awt.GridBagConstraints; 13 8 import java.awt.GridBagLayout; 14 9 import java.awt.event.ActionEvent; … … 19 14 import javax.swing.Box; 20 15 import javax.swing.JButton; 16 import javax.swing.JCheckBox; 21 17 import javax.swing.JComboBox; 22 18 import javax.swing.JLabel; … … 24 20 import javax.swing.JPanel; 25 21 import javax.swing.JScrollPane; 22 import javax.swing.JSpinner; 26 23 import javax.swing.JTable; 27 24 import javax.swing.JTextField; 25 import javax.swing.SpinnerNumberModel; 28 26 import javax.swing.table.DefaultTableModel; 29 27 30 28 import org.openstreetmap.josm.Main; 31 import org.openstreetmap.josm.gui.preferences.PreferenceDialog;32 29 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 33 30 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; … … 42 39 JSpinner spinEast; 43 40 JSpinner spinNorth; 44 41 45 42 public void addGui(final PreferenceTabbedPane gui) { 46 43 JPanel p = gui.createPreferenceTab("wms", tr("WMS Plugin Preferences"), tr("Modify list of WMS servers displayed in the WMS plugin menu")); … … 49 46 final JTable list = new JTable(model); 50 47 JScrollPane scroll = new JScrollPane(list); 51 p.add(scroll, GBC.eol().fill(G BC.BOTH));48 p.add(scroll, GBC.eol().fill(GridBagConstraints.BOTH)); 52 49 scroll.setPreferredSize(new Dimension(200,200)); 53 50 … … 82 79 JTextField key = new JTextField(40); 83 80 JTextField value = new JTextField(40); 84 p.add(key, GBC.eop().insets(5,0,0,0).fill(G BC.HORIZONTAL));81 p.add(key, GBC.eop().insets(5,0,0,0).fill(GridBagConstraints.HORIZONTAL)); 85 82 p.add(new JLabel(tr("WMS URL")), GBC.std().insets(0,0,5,0)); 86 p.add(value, GBC.eol().insets(5,0,0,0).fill(G BC.HORIZONTAL));83 p.add(value, GBC.eol().insets(5,0,0,0).fill(GridBagConstraints.HORIZONTAL)); 87 84 int answer = JOptionPane.showConfirmDialog( 88 gui, p, 89 tr("Enter a menu name and WMS URL"), 85 gui, p, 86 tr("Enter a menu name and WMS URL"), 90 87 JOptionPane.OK_CANCEL_OPTION, 91 88 JOptionPane.QUESTION_MESSAGE); … … 118 115 if (lines.length == 0) { 119 116 JOptionPane.showMessageDialog( 120 gui, 117 gui, 121 118 tr("Please select at least one row to copy."), 122 119 tr("Information"), … … 125 122 return; 126 123 } 127 124 128 125 outer: for(int i = 0; i < lines.length; i++) { 129 126 String c1 = modeldef.getValueAt(lines[i], 0).toString(); 130 127 String c2 = modeldef.getValueAt(lines[i], 1).toString(); 131 128 132 129 // Check if an entry with exactly the same values already 133 130 // exists 134 131 for(int j = 0; j < model.getRowCount(); j++) { 135 if(c1.equals(model.getValueAt(j, 0).toString()) 132 if(c1.equals(model.getValueAt(j, 0).toString()) 136 133 && c2.equals(model.getValueAt(j, 1).toString())) { 137 134 // Select the already existing row so the user has … … 142 139 } 143 140 } 144 141 145 142 model.addRow(new String[] {c1, c2}); 146 143 int lastLine = model.getRowCount() - 1; … … 152 149 153 150 p.add(buttonPanel); 154 p.add(Box.createHorizontalGlue(), GBC.eol().fill(G BC.HORIZONTAL));151 p.add(Box.createHorizontalGlue(), GBC.eol().fill(GridBagConstraints.HORIZONTAL)); 155 152 // Add default item list 156 p.add(scrolldef, GBC.eol().insets(0,5,0,0).fill(G BC.BOTH));157 153 p.add(scrolldef, GBC.eol().insets(0,5,0,0).fill(GridBagConstraints.BOTH)); 154 158 155 browser = new JComboBox(new String[]{ 159 156 "webkit-image {0}", … … 163 160 browser.setEditable(true); 164 161 browser.setSelectedItem(Main.pref.get("wmsplugin.browser", "webkit-image {0}")); 165 p.add(new JLabel(tr("Downloader:")), GBC.eol().fill(G BC.HORIZONTAL));162 p.add(new JLabel(tr("Downloader:")), GBC.eol().fill(GridBagConstraints.HORIZONTAL)); 166 163 p.add(browser); 167 164 168 165 169 166 //Overlap 170 p.add(Box.createHorizontalGlue(), GBC.eol().fill(G BC.HORIZONTAL));171 172 overlapCheckBox = new JCheckBox(tr("Overlap tiles"), WMSPlugin.doOverlap ); 173 JLabel labelEast = new JLabel(tr("% of east:")); 174 JLabel labelNorth = new JLabel(tr("% of north:")); 175 spinEast = new JSpinner(new SpinnerNumberModel(WMSPlugin.overlapEast, 1, 50, 1)); 176 spinNorth = new JSpinner(new SpinnerNumberModel(WMSPlugin.overlapNorth, 1, 50, 1)); 177 178 JPanel overlapPanel = new JPanel(new FlowLayout()); 179 overlapPanel.add(overlapCheckBox); 180 overlapPanel.add(labelEast); 181 overlapPanel.add(spinEast); 182 overlapPanel.add(labelNorth); 183 overlapPanel.add(spinNorth); 184 185 p.add(overlapPanel); 167 p.add(Box.createHorizontalGlue(), GBC.eol().fill(GridBagConstraints.HORIZONTAL)); 168 169 overlapCheckBox = new JCheckBox(tr("Overlap tiles"), WMSPlugin.doOverlap ); 170 JLabel labelEast = new JLabel(tr("% of east:")); 171 JLabel labelNorth = new JLabel(tr("% of north:")); 172 spinEast = new JSpinner(new SpinnerNumberModel(WMSPlugin.overlapEast, 1, 50, 1)); 173 spinNorth = new JSpinner(new SpinnerNumberModel(WMSPlugin.overlapNorth, 1, 50, 1)); 174 175 JPanel overlapPanel = new JPanel(new FlowLayout()); 176 overlapPanel.add(overlapCheckBox); 177 overlapPanel.add(labelEast); 178 overlapPanel.add(spinEast); 179 overlapPanel.add(labelNorth); 180 overlapPanel.add(spinNorth); 181 182 p.add(overlapPanel); 186 183 } 187 184 … … 223 220 if (change) WMSPlugin.refreshMenu(); 224 221 225 WMSPlugin.doOverlap = overlapCheckBox.getModel().isSelected(); 226 WMSPlugin.overlapEast = (Integer) spinEast.getModel().getValue(); 227 WMSPlugin.overlapNorth = (Integer) spinNorth.getModel().getValue(); 228 229 Main.pref.put("wmsplugin.url.overlap", String.valueOf(WMSPlugin.doOverlap)); 230 Main.pref.put("wmsplugin.url.overlapEast", String.valueOf(WMSPlugin.overlapEast)); 231 Main.pref.put("wmsplugin.url.overlapNorth", String.valueOf(WMSPlugin.overlapNorth)); 222 WMSPlugin.doOverlap = overlapCheckBox.getModel().isSelected(); 223 WMSPlugin.overlapEast = (Integer) spinEast.getModel().getValue(); 224 WMSPlugin.overlapNorth = (Integer) spinNorth.getModel().getValue(); 225 226 Main.pref.put("wmsplugin.url.overlap", String.valueOf(WMSPlugin.doOverlap)); 227 Main.pref.put("wmsplugin.url.overlapEast", String.valueOf(WMSPlugin.overlapEast)); 228 Main.pref.put("wmsplugin.url.overlapNorth", String.valueOf(WMSPlugin.overlapNorth)); 232 229 233 230 Main.pref.put("wmsplugin.browser", browser.getEditor().getItem().toString());
Note:
See TracChangeset
for help on using the changeset viewer.