Changeset 29493 in osm for applications/editors
- Timestamp:
- 2013-04-14T15:54:06+02:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/opendata
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/ToulouseConstants.java
r28893 r29493 22 22 23 23 /** 24 * Sources 24 * Sources and Refs 25 25 */ 26 26 public static final String SOURCE_GRAND_TOULOUSE = "GrandToulouse"; 27 27 public static final String SOURCE_TOULOUSE_METROPOLE = "ToulouseMetropole"; 28 28 public static final String SOURCE_TISSEO = "Tisséo SMTC"; 29 public static final String REF_TOULOUSE_METROPOLE = "ref:FR:ToulouseMetropole"; 29 30 30 31 /** -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/ToulouseModule.java
r28699 r29493 61 61 import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.transport.PistesCyclablesHandler; 62 62 import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.transport.ReseauTisseoHandler; 63 import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.transport.StationsAutoPartageHandler; 63 64 import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.transport.TramwayStationHandler; 64 65 import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.transport.VeloToulouseHandler; … … 112 113 handlers.add(ChantiersLineairesHandler.class); 113 114 handlers.add(InstallationSportiveToulouseHandler.class); 115 handlers.add(StationsAutoPartageHandler.class); 114 116 } 115 117 -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/PMRHandler.java
r28554 r29493 46 46 n.remove("code_insee"); 47 47 n.remove("color"); 48 replace(n, "id_PMR", "ref:grandtoulouse");48 replace(n, "id_PMR", REF_TOULOUSE_METROPOLE); 49 49 } 50 50 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/urbanisme/SanisetteHandler.java
r28554 r29493 43 43 n.put("operator", "JCDecaux"); 44 44 n.put("opening_hours", "24/7"); 45 replace(n, "numero", "ref:grandtoulouse");45 replace(n, "numero", REF_TOULOUSE_METROPOLE); 46 46 replace(n, "PMR", "wheelchair", new String[]{"true", "false"}, new String[]{"yes", "no"}); 47 47 String valide = n.get("emplacement_valide"); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/OdConstants.java
r29299 r29493 60 60 public static final String PREF_MAXDISTANCE = "opendata.maxdistance"; 61 61 public static final double DEFAULT_MAXDISTANCE = 10; 62 63 public static final String PREF_TOLERANCE = "opendata.spreadsheet.tolerance"; 64 public static final double DEFAULT_TOLERANCE = 0.1; 62 65 63 66 public static final String PREF_MODULES = "opendata.modules"; -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/SpreadSheetReader.java
r29299 r29493 72 72 73 73 public static class CoordinateColumns { 74 public Projection proj = null; 74 75 public int xCol = -1; 75 76 public int yCol = -1; … … 77 78 return xCol > -1 && yCol > -1; 78 79 } 79 @Override 80 public String toString() { 81 return "[xCol=" + xCol + ", yCol=" + yCol + "]"; 80 @Override public String toString() { 81 return "CoordinateColumns [proj=" + proj + ", xCol=" + xCol + ", yCol=" + yCol + "]"; 82 82 } 83 83 } … … 112 112 } 113 113 114 Projection proj = null;115 114 final List<CoordinateColumns> columns = new ArrayList<CoordinateColumns>(); 116 115 … … 119 118 if (col.isOk()) { 120 119 columns.add(col); 121 if ( proj == null) {122 proj = pp.getProjection(header[col.xCol], header[col.yCol]);120 if (col.proj == null) { 121 col.proj = pp.getProjection(header[col.xCol], header[col.yCol]); 123 122 } 124 123 } … … 128 127 final boolean handlerOK = handler != null && handler.handlesProjection(); 129 128 130 if (proj != null) { 129 boolean projFound = false; 130 131 for (CoordinateColumns c : columns) { 132 if (c.proj != null) { 133 projFound = true; 134 break; 135 } 136 } 137 138 if (projFound) { 131 139 // projection identified, do nothing 132 140 } else if (!columns.isEmpty()) { … … 137 145 return null; // User clicked Cancel 138 146 } 139 proj = dialog.getProjection(); 147 Projection proj = dialog.getProjection(); 148 for (CoordinateColumns c : columns) { 149 c.proj = proj; 150 } 140 151 } 141 152 … … 149 160 message += "; "; 150 161 } 151 message += header[c.xCol]+", "+header[c.yCol];152 } 153 154 System.out.println("Loading data using projection "+proj+" ("+message+")");162 message += c.proj + "("+header[c.xCol]+", "+header[c.yCol]+")"; 163 } 164 165 System.out.println("Loading data using projections "+message); 155 166 156 167 final DataSet ds = new DataSet(); … … 204 215 } 205 216 } 217 Node firstNode = null; 206 218 for (CoordinateColumns c : columns) { 207 219 Node n = nodes.get(c); 208 220 EastNorth en = ens.get(c); 209 221 if (en.isValid()) { 210 n.setCoor( proj != null && !handlerOK ?proj.eastNorth2latlon(en) : handler.getCoor(en, fields));222 n.setCoor(c.proj != null && !handlerOK ? c.proj.eastNorth2latlon(en) : handler.getCoor(en, fields)); 211 223 } else { 212 224 System.err.println("Warning: Skipping line "+lineNumber+" because no valid coordinates have been found at columns "+c); 213 225 } 214 226 if (n.getCoor() != null) { 215 ds.addPrimitive(n); 227 if (firstNode == null) { 228 firstNode = n; 229 } 230 if (n == firstNode || n.getCoor().greatCircleDistance(firstNode.getCoor()) > Main.pref.getDouble(PREF_TOLERANCE, DEFAULT_TOLERANCE)) { 231 ds.addPrimitive(n); 232 } else { 233 nodes.remove(c); 234 } 216 235 } 217 236 }
Note:
See TracChangeset
for help on using the changeset viewer.