Changeset 29653 in osm for applications/editors/josm


Ignore:
Timestamp:
2013-06-12T22:43:44+02:00 (11 years ago)
Author:
donvip
Message:

[josm_opendata] update Toulouse module + plugin robustness

Location:
applications/editors/josm/plugins/opendata
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/ToulouseConstants.java

    r29493 r29653  
    5959    public static final DataSetCategory CAT_ENVIRONNEMENT = new DataSetCategory("Environnement", "");
    6060    public static final DataSetCategory CAT_PATRIMOINE = new DataSetCategory("Patrimoine", "");
     61    public static final DataSetCategory CAT_SERVICES = new DataSetCategory("Services", "");
    6162    public static final DataSetCategory CAT_SPORT = new DataSetCategory("Sport", "");
    6263    public static final DataSetCategory CAT_TOPOGRAPHIE = new DataSetCategory("Topographie", "");
  • applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/ToulouseModule.java

    r29493 r29653  
    5151import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.patrimoine.Parcelles1680Handler;
    5252import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.patrimoine.Parcelles1830Handler;
     53import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.services.MarchesPleinVentHandler;
    5354import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.sport.InstallationSportiveBalmaHandler;
    5455import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.sport.InstallationSportiveToulouseHandler;
     
    114115        handlers.add(InstallationSportiveToulouseHandler.class);
    115116        handlers.add(StationsAutoPartageHandler.class);
     117        handlers.add(MarchesPleinVentHandler.class);
    116118    }
    117119   
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/OdConstants.java

    r29493 r29653  
    129129     * Coordinates fields
    130130     */
    131     public static final String X_STRING = "X|LON|LONGI|LONGITUDE.*|EASTING";
    132     public static final String Y_STRING = "Y|LAT|LATI|LATITUDE.*|NORTHING";
     131    public static final String X_STRING = "X|LON|LONGI|.*LONGITUDE.*|EASTING";
     132    public static final String Y_STRING = "Y|LAT|LATI|.*LATITUDE.*|NORTHING";
    133133   
    134134    // The list of all ProjectionPatterns (filled at each constructor call)
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/SpreadSheetReader.java

    r29493 r29653  
    183183                        }
    184184                       
    185                         for (int i = 0; i<fields.length; i++) {
     185                        if (fields.length > header.length) {
     186                            Main.warn(tr("Invalid file. Bad length on line {0}. Expected {1} columns, got {2}.", lineNumber, header.length, fields.length));
     187                            Main.warn(Arrays.toString(fields));
     188                        }
     189                       
     190                        for (int i = 0; i<Math.min(fields.length, header.length); i++) {
    186191                                try {
    187                                         if (i >= header.length) {
    188                                                 throw new IllegalArgumentException(tr("Invalid file. Bad length on line {0}. Expected {1} columns, got {2}.", lineNumber, header.length, i+1));
    189                                         } else {
    190                                             boolean coordinate = false;
    191                                             for (CoordinateColumns c : columns) {
    192                                                 EastNorth en = ens.get(c);
    193                                 if (i == c.xCol) {
    194                                     coordinate = true;
    195                                     en.setLocation(parseDouble(fields[i]), en.north());
    196                                     if (handler != null) {
    197                                         handler.setXCol(i);
    198                                     }
    199                                 } else if (i == c.yCol) {
    200                                 coordinate = true;
    201                                     en.setLocation(en.east(), parseDouble(fields[i]));
    202                                     if (handler != null) {
    203                                         handler.setYCol(i);
    204                                     }
    205                                 }                                               
    206                                             }
    207                             if (!coordinate) {
    208                                 if (!fields[i].isEmpty()) {
    209                                     nodes.values().iterator().next().put(header[i], fields[i]);
    210                                 }
    211                             }
    212                                         }
     192                                    boolean coordinate = false;
     193                                    for (CoordinateColumns c : columns) {
     194                                        EastNorth en = ens.get(c);
     195                        if (i == c.xCol) {
     196                            coordinate = true;
     197                            en.setLocation(parseDouble(fields[i]), en.north());
     198                            if (handler != null) {
     199                                handler.setXCol(i);
     200                            }
     201                        } else if (i == c.yCol) {
     202                            coordinate = true;
     203                            en.setLocation(en.east(), parseDouble(fields[i]));
     204                            if (handler != null) {
     205                                handler.setYCol(i);
     206                            }
     207                        }                                               
     208                                    }
     209                    if (!coordinate) {
     210                        if (!fields[i].isEmpty()) {
     211                            nodes.values().iterator().next().put(header[i], fields[i]);
     212                        }
     213                    }
    213214                                } catch (ParseException e) {
    214215                                        System.err.println("Warning: Parsing error on line "+lineNumber+": "+e.getMessage());
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/AbstractModule.java

    r28896 r29653  
    134134                                        result.add(handlerClass.newInstance());
    135135                                } catch (Throwable t) {
    136                                         System.err.println(t.getClass().getName()+": "+t.getMessage());
     136                                        System.err.println("Cannot instantiate "+handlerClass+" because of "+t.getClass().getName()+": "+t.getMessage());
    137137                                }
    138138                        }
Note: See TracChangeset for help on using the changeset viewer.