Changeset 21493 in osm


Ignore:
Timestamp:
2010-05-28T21:22:49+02:00 (15 years ago)
Author:
pieren
Message:

Improve renaming after municipality selection

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

Legend:

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

    r21191 r21493  
    175175                    // commune unknown, prompt the list of communes from
    176176                    // server and try with codeCommune
    177                     wmsLayer.setCodeCommune(selectCommuneDialog());
     177                    String selected = selectMunicipalityDialog(wmsLayer);
     178                    if (selected != null) {
     179                        String newCodeCommune = selected.substring(1, selected.indexOf(">")-2);
     180                        String newLocation = selected.substring(selected.indexOf(">")+1, selected.lastIndexOf(" - "));
     181                        wmsLayer.setCodeCommune(newCodeCommune);
     182                        wmsLayer.setLocation(newLocation);
     183                        Main.pref.put("cadastrewms.codeCommune", newCodeCommune);
     184                        Main.pref.put("cadastrewms.location", newLocation);
     185                    }
    178186                    checkLayerDuplicates(wmsLayer);
    179187                    interfaceRef = postForm(wmsLayer, wmsLayer.getCodeCommune());
     
    381389    }
    382390   
    383     private String selectCommuneDialog() {
     391    private String selectMunicipalityDialog(WMSLayer wmsLayer) {
    384392        JPanel p = new JPanel(new GridBagLayout());
    385393        String[] communeList = new String[listOfCommunes.size() + 1];
     
    401409        if (!Integer.valueOf(JOptionPane.OK_OPTION).equals(pane.getValue()))
    402410            return null;
    403         String result = listOfCommunes.elementAt(inputCommuneList.getSelectedIndex()-1);
    404         return result.substring(1, result.indexOf(">")-2);
     411        return listOfCommunes.elementAt(inputCommuneList.getSelectedIndex()-1);
    405412    }
    406413
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadWMSPlanImage.java

    r20412 r21493  
    2020    private WMSLayer wmsLayer;
    2121    private Bounds bounds;
    22     private boolean dontGeoreference = false;
     22    private static boolean dontGeoreference = false;
    2323    private static String errorMessage;
    2424   
     
    107107        MapView mv = Main.map.mapView;
    108108        Bounds bounds = new Bounds(mv.getLatLon(0, mv.getHeight()), mv.getLatLon(mv.getWidth(), 0));
     109        dontGeoreference = false;
    109110
    110111        //Main.worker.execute(new DownloadWMSPlanImage(wmsLayer, bounds));
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java

    r21202 r21493  
    6464    public void actionInterrupted() {
    6565        actionCompleted();
    66         wmsLayer = null;
     66        if (wmsLayer != null) {
     67            Main.map.mapView.removeLayer(wmsLayer);
     68            wmsLayer = null;
     69        }
    6770    }
    6871
     
    101104        // wait until plan image is fully loaded and joined into one single image
    102105        boolean loadedFromCache = downloadWMSPlanImage.waitFinished();
    103         if (wmsLayer.images.size() == 1 && !loadedFromCache) {
     106        if (loadedFromCache) {
     107            Main.map.repaint();
     108        } else if (wmsLayer.images.size() == 0) {
     109            // action cancelled or image loaded from cache (and already georeferenced)
     110            actionInterrupted();
     111        } else {
    104112            int reply = JOptionPane.CANCEL_OPTION;
    105113            if (wmsLayer.isAlreadyGeoreferenced()) {
     
    120128                    startGeoreferencing();
    121129            }
    122         } else // action cancelled or image loaded from cache (and already georeferenced)
    123             Main.map.repaint();
     130        }
    124131    }
    125132
     
    270277                        JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
    271278                        null, options, options[0]);
     279        countMouseClicked = 0;
    272280        if (selectedValue == 0) { // "Cancel"
    273281                // remove layer
     
    275283            wmsLayer = null;
    276284            Main.map.mapView.removeMouseListener(this);
    277                 return false;
    278         } else
    279             countMouseClicked = 0;
     285            return false;
     286        }
    280287        return true;
    281288    }
Note: See TracChangeset for help on using the changeset viewer.