Ignore:
Timestamp:
2010-04-18T23:40:01+02:00 (16 years ago)
Author:
pieren
Message:

add multi-cache management for buildings

File:
1 edited

Legend:

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

    r20824 r20931  
    9494    public boolean loadCacheIfExist() {
    9595        try {
    96             File file = new File(CadastrePlugin.cacheDir + wmsLayer.getName() + "." + WMSFileExtension());
    97             if (file.exists()) {
    98                 JOptionPane pane = new JOptionPane(
    99                         tr("Location \"{0}\" found in cache.\n"+
    100                         "Load cache first ?\n"+
    101                         "(No = new cache)", wmsLayer.getName()),
    102                         JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION, null);
    103                 // this below is a temporary workaround to fix the "always on top" issue
    104                 JDialog dialog = pane.createDialog(Main.parent, tr("Select Feuille"));
    105                 CadastrePlugin.prepareDialog(dialog);
    106                 dialog.setVisible(true);
    107                 int reply = (Integer)pane.getValue();
    108                 // till here
    109 
    110                 if (reply == JOptionPane.OK_OPTION && loadCache(file, wmsLayer.getLambertZone())) {
    111                     return true;
    112                 } else {
    113                     delete(file);
     96            if (!wmsLayer.isBuildingsOnly()) {
     97                File file = new File(CadastrePlugin.cacheDir + wmsLayer.getName() + "." + WMSFileExtension());
     98                if (file.exists()) {
     99                    JOptionPane pane = new JOptionPane(
     100                            tr("Location \"{0}\" found in cache.\n"+
     101                            "Load cache first ?\n"+
     102                            "(No = new cache)", wmsLayer.getName()),
     103                            JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION, null);
     104                    // this below is a temporary workaround to fix the "always on top" issue
     105                    JDialog dialog = pane.createDialog(Main.parent, tr("Select Feuille"));
     106                    CadastrePlugin.prepareDialog(dialog);
     107                    dialog.setVisible(true);
     108                    int reply = (Integer)pane.getValue();
     109                    // till here
     110   
     111                    if (reply == JOptionPane.OK_OPTION && loadCache(file, wmsLayer.getLambertZone())) {
     112                        return true;
     113                    } else {
     114                        delete(file);
     115                    }
    114116                }
     117            } else {
     118                int i=0;
     119                while (new File(CadastrePlugin.cacheDir + wmsLayer.getName() + "."+i+"."+ WMSFileExtension()).exists())
     120                    i++;
     121                wmsLayer.setName(wmsLayer.getName()+"."+i);
    115122            }
    116123        } catch (Exception e) {
Note: See TracChangeset for help on using the changeset viewer.