Changeset 17556 in osm


Ignore:
Timestamp:
2009-09-09T14:54:46+02:00 (15 years ago)
Author:
petrdlouhy
Message:

Adding ovelapping again.

Location:
applications/editors/josm/plugins/wmsplugin
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/wmsplugin

    • Property svn:ignore
      •  

        old new  
        33build.log
        44build.err
         5dist
  • applications/editors/josm/plugins/wmsplugin/src/wmsplugin/GeorefImage.java

    r17522 r17556  
    11package wmsplugin;
    22
     3import java.awt.Color;
    34import java.awt.Dimension;
    45import java.awt.Graphics;
  • applications/editors/josm/plugins/wmsplugin/src/wmsplugin/Grabber.java

    r17343 r17556  
    1010import org.openstreetmap.josm.Main;
    1111import org.openstreetmap.josm.data.ProjectionBounds;
     12import org.openstreetmap.josm.data.coor.EastNorth;
    1213import org.openstreetmap.josm.data.projection.Projection;
    1314import org.openstreetmap.josm.gui.MapView;
     
    2526    Grabber(ProjectionBounds b, GeorefImage image, MapView mv, WMSLayer layer, CacheFiles cache)
    2627    {
    27         this.b = b;
     28        if (b.min != null && b.max != null && WMSPlugin.doOverlap) {
     29            double eastSize =  b.max.east() - b.min.east();
     30            double northSize =  b.max.north() - b.min.north();
     31   
     32            double eastCoef = WMSPlugin.overlapEast / 100.0;
     33            double northCoef = WMSPlugin.overlapNorth / 100.0;
     34             
     35            this.b = new ProjectionBounds( new EastNorth(b.min.east(),
     36                                            b.min.north()),
     37                                 new EastNorth(b.max.east() + eastCoef * eastSize,
     38                                            b.max.north() + northCoef * northSize));             
     39        } else
     40           this.b = b;
     41
    2842        this.proj = Main.proj;
    2943        this.pixelPerDegree = layer.pixelPerDegree;
     
    3246        this.layer = layer;
    3347        this.cache = cache;
     48
    3449    }
    3550
  • applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPlugin.java

    r17397 r17556  
    4848    static TreeMap<String,String> wmsListDefault = new TreeMap<String,String>();
    4949
     50    static boolean doOverlap = false;
     51    static int overlapEast = 14;
     52    static int overlapNorth = 4;
     53   
    5054    // remember state of menu item to restore on changed preferences
    5155    static private boolean menuEnabled = false;
     
    9094        TreeSet<String> keys = new TreeSet<String>(prefs.keySet());
    9195
     96        // Here we load the settings for "overlap" checkbox and spinboxes.
     97         
     98        try {
     99            doOverlap = Boolean.valueOf(prefs.get("wmsplugin.url.overlap"));             
     100        } catch (Exception e) {} // If sth fails, we drop to default settings.
     101 
     102        try {
     103            overlapEast = Integer.valueOf(prefs.get("wmsplugin.url.overlapEast"));             
     104        } catch (Exception e) {} // If sth fails, we drop to default settings.
     105 
     106        try {
     107            overlapNorth = Integer.valueOf(prefs.get("wmsplugin.url.overlapNorth"));             
     108        } catch (Exception e) {} // If sth fails, we drop to default settings.
     109
    92110        // And then the names+urls of WMS servers
    93111        int prefid = 0;
  • applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPreferenceEditor.java

    r17407 r17556  
    11package wmsplugin;
    22
     3import java.awt.BorderLayout;
     4import java.awt.FlowLayout;
     5import javax.swing.JCheckBox;
     6import javax.swing.JSpinner;
     7import javax.swing.SpinnerNumberModel;
     8import org.openstreetmap.josm.Main;
    39import static org.openstreetmap.josm.tools.I18n.tr;
    410
     
    3238    private HashMap<Integer, WMSInfo> oldValues = new HashMap<Integer, WMSInfo>();
    3339
     40    JCheckBox overlapCheckBox;
     41    JSpinner spinEast;
     42    JSpinner spinNorth;
     43   
    3444    public void addGui(final PreferenceDialog gui) {
    3545        JPanel p = gui.createPreferenceTab("wms", tr("WMS Plugin Preferences"), tr("Modify list of WMS servers displayed in the WMS plugin menu"));
     
    153163        browser.setSelectedItem(Main.pref.get("wmsplugin.browser", "webkit-image {0}"));
    154164        p.add(new JLabel(tr("Downloader:")), GBC.eol().fill(GBC.HORIZONTAL));
    155         p.add(browser, GBC.eol().fill(GBC.HORIZONTAL));
     165        p.add(browser);
     166
     167
     168        //Overlap
     169        p.add(Box.createHorizontalGlue(), GBC.eol().fill(GBC.HORIZONTAL));
     170         
     171        overlapCheckBox = new JCheckBox(tr("Overlap tiles"), WMSPlugin.doOverlap );
     172        JLabel labelEast = new JLabel(tr("% of east:"));
     173        JLabel labelNorth = new JLabel(tr("% of north:"));
     174        spinEast = new JSpinner(new SpinnerNumberModel(WMSPlugin.overlapEast, 1, 50, 1));
     175        spinNorth = new JSpinner(new SpinnerNumberModel(WMSPlugin.overlapNorth, 1, 50, 1));
     176         
     177        JPanel overlapPanel = new JPanel(new FlowLayout());
     178        overlapPanel.add(overlapCheckBox);
     179        overlapPanel.add(labelEast);
     180        overlapPanel.add(spinEast);
     181        overlapPanel.add(labelNorth);
     182        overlapPanel.add(spinNorth);
     183         
     184        p.add(overlapPanel);   
    156185    }
    157186
     
    192221
    193222        if (change) WMSPlugin.refreshMenu();
     223
     224        WMSPlugin.doOverlap = overlapCheckBox.getModel().isSelected();
     225        WMSPlugin.overlapEast = (Integer) spinEast.getModel().getValue();
     226        WMSPlugin.overlapNorth = (Integer) spinNorth.getModel().getValue();
     227         
     228        Main.pref.put("wmsplugin.url.overlap",    String.valueOf(WMSPlugin.doOverlap));
     229        Main.pref.put("wmsplugin.url.overlapEast", String.valueOf(WMSPlugin.overlapEast));
     230        Main.pref.put("wmsplugin.url.overlapNorth", String.valueOf(WMSPlugin.overlapNorth));
    194231
    195232        Main.pref.put("wmsplugin.browser", browser.getEditor().getItem().toString());
Note: See TracChangeset for help on using the changeset viewer.