Ignore:
Timestamp:
2009-02-05T01:00:53+01:00 (16 years ago)
Author:
pieren
Message:

Add municipality boundary import from SVG data delivered by cadastre WMS.

Location:
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr
Files:
4 added
9 edited

Legend:

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

    r13497 r13545  
    117117        } catch (Exception ex) {
    118118            ex.printStackTrace(System.out);
    119             JOptionPane
    120                     .showMessageDialog(Main.parent, tr("Error loading file"), tr("Error"), JOptionPane.ERROR_MESSAGE);
     119            JOptionPane.showMessageDialog(Main.parent, tr("Error loading file"), tr("Error"), JOptionPane.ERROR_MESSAGE);
    121120            return false;
    122121        }
     
    125124
    126125
    127     public boolean existCache() {
    128         try {
    129             /*
    130             File pathname = new File(CadastrePlugin.cacheDir);
    131             String[] fileNames = pathname.list();
    132             for (String fileName : fileNames) {
    133                 System.out.println("check file:"+fileName);
    134                 //WMSLayer cached = new WMSLayer(new File(cacheDir+fileName));
    135             }*/
    136         } catch (Exception e) {
    137             e.printStackTrace(System.out);
    138         }
    139         return false;
    140     }
    141    
    142126    public synchronized void saveCache(GeorefImage image) {
    143127        imagesLock.lock();
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java

    r13497 r13545  
    6464 *                 - minor fixes due to changes in JOSM core classes
    6565 *                 - first draft of raster image support
    66  * 0.9 draft       - grab vectorized full commune bbox and save it in cache
     66 * 0.9 05-Feb-2009 - grab vectorized full commune bbox, save in file, convert to OSM way
     67 *                   and simplify
    6768 */
    6869public class CadastrePlugin extends Plugin {
     
    151152            JMenuItem menuLambertZone = new JMenuItem(new MenuActionLambertZone());
    152153            JMenuItem menuLoadFromCache = new JMenuItem(new MenuActionLoadFromCache());
     154            JMenuItem menuActionBoundaries = new JMenuItem(new MenuActionBoundaries());
    153155           
    154156            cadastreJMenu.add(menuGrab);
     
    158160            cadastreJMenu.add(menuLambertZone);
    159161            cadastreJMenu.add(menuLoadFromCache);
     162            cadastreJMenu.add(menuActionBoundaries);
    160163        }
    161164        setEnabledAll(menuEnabled);
     
    187190            JMenuItem item = cadastreJMenu.getItem(i);
    188191            if (item != null)
    189                 if (item.getText().equals(MenuActionGrab.name))
     192                if (item.getText().equals(MenuActionGrab.name) ||
     193                    item.getText().equals(MenuActionBoundaries.name)) {
    190194                    item.setEnabled(isEnabled);
    191                 else if (item.getText().equals(MenuActionLambertZone.name))
     195                } else if (item.getText().equals(MenuActionLambertZone.name)) {
    192196                    item.setEnabled(!isEnabled);
     197                }
    193198        }
    194199        menuEnabled = isEnabled;
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CheckSourceUploadHook.java

    r13497 r13545  
    4646            }
    4747            if (!sel.isEmpty()) {
    48                 return displaySource(sel);
     48                displaySource(sel);
    4949            }
    5050        }
     
    7070     * source="cadastre.." if it is approved.
    7171     * @param sel the list of elements added without a key "source"
    72      * @return true if it is accepted by user
    7372     */
    74     private boolean displaySource(Collection<OsmPrimitive> sel)
     73    private void displaySource(Collection<OsmPrimitive> sel)
    7574    {
    76         boolean bContinue = true;
    7775        if (!sel.isEmpty()) {
    7876            JPanel p = new JPanel(new GridBagLayout());
     
    8381            l.setVisibleRowCount(l.getModel().getSize() < 6 ? l.getModel().getSize() : 10);
    8482            p.add(new JScrollPane(l), GBC.eol().fill());
    85             bContinue = JOptionPane.showConfirmDialog(Main.parent, p, tr("Add \"source=...\" to elements?"),
     83            boolean bContinue = JOptionPane.showConfirmDialog(Main.parent, p, tr("Add \"source=Cadastre...\" to ?"),
    8684                    JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
    8785            if (bContinue)
    8886                Main.main.undoRedo.add(new ChangePropertyCommand(sel, "source", CadastrePlugin.source));
    8987        }
    90         return bContinue;
    9188               
    9289    }   
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadWMSTask.java

    r13497 r13545  
    6060    @Override
    6161    protected void finish() {
    62         //wmsLayer.saveToCache();
    6362    }
    6463
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/EastNorthBound.java

    r13497 r13545  
    1414        this.max = max;
    1515    }
     16
     17    public boolean contains(EastNorth eastNorth) {
     18        if (eastNorth.east() < min.east() || eastNorth.north() < min.north())
     19            return false;
     20        if (eastNorth.east() > max.east() || eastNorth.north() > max.north())
     21            return false;
     22        return true;
     23    }
     24
    1625    @Override public String toString() {
    1726        return "EastNorthBound[" + min.east() + "," + min.north() + "," + max.east() + "," + max.north() + "]";
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/ImageModifier.java

    r13497 r13545  
    2828    public ImageModifier(BufferedImage bi) {
    2929        bufferedImage = bi;
     30        System.out.println("cadastrewms.alterColors="+Main.pref.getBoolean("cadastrewms.alterColors"));
     31        System.out.println("cadastrewms.backgroundTransparent="+Main.pref.getBoolean("cadastrewms.backgroundTransparent"));
    3032        if (Main.pref.getBoolean("cadastrewms.alterColors")) {
    3133            changeColors();
     
    4749        int josmBackgroundColor = ColorHelper.html2color(Main.pref.get("color.background", "#FFFFFF")).getRGB();
    4850        boolean invertGrey = (Main.pref.getBoolean("cadastrewms.invertGrey"));
     51        System.out.println("cadastrewms.invertGrey="+invertGrey);
     52        System.out.println("color.background="+Main.pref.get("color.background", "#FFFFFF"));
    4953        for (int x = 0; x < w; x++) {
    5054            for (int y = 0; y < h; y++) {
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionNewLocation.java

    r13497 r13545  
    4848            String codeCommune = "";
    4949            boolean resetCookie = false;
    50             JLabel labelSectionNewLocation = new JLabel(tr("Add new layer"));
     50            JLabel labelSectionNewLocation = new JLabel(tr("Add a new layer"));
    5151            JPanel p = new JPanel(new GridBagLayout());
    5252            JLabel labelLocation = new JLabel(tr("Location"));
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSDownloadAction.java

    r13497 r13545  
    55import java.awt.event.ActionEvent;
    66import java.util.ArrayList;
     7
     8import javax.swing.JOptionPane;
    79
    810import org.openstreetmap.josm.Main;
     
    1416    private static final long serialVersionUID = 1L;
    1517
    16     //private String layerName;
    17        
    1818        public WMSDownloadAction(String layerName) {
    1919                super(layerName, "wmsmenu", tr("Download WMS tile from {0}",layerName), null, false);
     
    3838            if (existingWMSlayers.size() == 1)
    3939                return existingWMSlayers.get(0);
    40             return new MenuActionNewLocation().addNewLayer(existingWMSlayers);
     40            if (existingWMSlayers.size() == 0)
     41                return new MenuActionNewLocation().addNewLayer(existingWMSlayers);
     42            JOptionPane.showMessageDialog(Main.parent,
     43                    tr("More than one WMS layer present\nSelect one of them first, then retry"));
    4144        }
    4245        return null;
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java

    r13497 r13545  
    180180    @Override
    181181    public String getToolTipText() {
    182         return tr("WMS layer ({0}), {1} tile(s) loaded", name, images.size());
     182        String str = tr("WMS layer ({0}), {1} tile(s) loaded", name, images.size());
     183        if (isRaster) {
     184            str += "\n"+tr("Is not vectorized.");
     185            str += "\n"+tr("Raster center: {0}", rasterCenter);
     186        } else
     187            str += "\n"+tr("Is vectorized.");
     188            str += "\n"+tr("Commune bbox: {0}", communeBBox);
     189        return str;
    183190    }
    184191
Note: See TracChangeset for help on using the changeset viewer.