Changeset 29101 in osm for applications


Ignore:
Timestamp:
2012-12-21T00:37:53+01:00 (12 years ago)
Author:
pieren
Message:

#8229 patch from Don-vip going directly to projection preference window if grab action is called in incompatible cadastre proj.

Location:
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CacheControl.java

    r28887 r29101  
    9393
    9494    public boolean loadCacheIfExist() {
     95        if (!CadastrePlugin.isCadastreProjection()) {
     96            CadastrePlugin.askToChangeProjection();
     97        }
    9598        try {
    9699            File file = new File(CadastrePlugin.cacheDir + wmsLayer.getName() + "." + WMSFileExtension());
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java

    r28887 r29101  
    3030import org.openstreetmap.josm.gui.IconToggleButton;
    3131import org.openstreetmap.josm.gui.layer.Layer;
     32import org.openstreetmap.josm.gui.preferences.PreferenceDialog;
    3233import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
     34import org.openstreetmap.josm.gui.preferences.map.MapPreference;
    3335import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
    3436import org.openstreetmap.josm.plugins.Plugin;
     
    479481    }
    480482
     483    public static void askToChangeProjection() {
     484        if (JOptionPane.showConfirmDialog(Main.parent,
     485                tr("To enable the cadastre WMS plugin, change\n"
     486                        + "the current projection to one of the cadastre\n"
     487                        + "projections and retry"), 
     488                        tr("Change the current projection"), JOptionPane.OK_CANCEL_OPTION) 
     489            == JOptionPane.OK_OPTION) {
     490            PreferenceDialog p = new PreferenceDialog(Main.parent);
     491            p.selectPreferencesTabByClass(MapPreference.class);
     492            p.getTabbedPane().getSetting(ProjectionPreference.class).selectProjection(ProjectionPreference.lambert_cc9);
     493            p.setVisible(true);
     494        }
     495        }
    481496}
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadWMSVectorImage.java

    r26823 r29101  
    3737                        if (wmsLayer.grabThread.getCacheControl().loadCacheIfExist()) {
    3838                            Main.map.mapView.zoomTo(wmsLayer.getFirstViewFromCacheBBox().toBounds());
    39                             //Main.map.mapView.repaint();
    4039                            return;
    4140                        }
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrab.java

    r27906 r29101  
    3636                    DownloadWMSVectorImage.download(wmsLayer);
    3737            } else {
    38                 JOptionPane.showMessageDialog(Main.parent,
    39                         tr("To enable the cadastre WMS plugin, change\n"
    40                          + "the current projection to one of the cadastre\n"
    41                          + "projections and retry"));
     38                CadastrePlugin.askToChangeProjection();
    4239            }
    4340        } else
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java

    r27906 r29101  
    9494                Main.worker.execute(this);
    9595            } else {
    96                 JOptionPane.showMessageDialog(Main.parent,
    97                         tr("To enable the cadastre WMS plugin, change\n"
    98                          + "the current projection to one of the cadastre\n"
    99                          + "projections and retry"));
     96                CadastrePlugin.askToChangeProjection();
    10097            }
    10198        }
Note: See TracChangeset for help on using the changeset viewer.