Changeset 30795 in osm for applications/editors/josm/plugins/opendata/src/org
- Timestamp:
- 2014-11-12T01:51:41+01:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/actions/OpenLinkAction.java
r30723 r30795 10 10 import javax.swing.Action; 11 11 12 import org.openstreetmap.josm.Main; 12 13 import org.openstreetmap.josm.actions.JosmAction; 13 14 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; … … 15 16 import org.openstreetmap.josm.tools.OpenBrowser; 16 17 17 @SuppressWarnings("serial")18 18 public class OpenLinkAction extends JosmAction { 19 19 … … 29 29 public void actionPerformed(ActionEvent e) { 30 30 try { 31 System.out.println("Opening "+url);31 Main.info("Opening "+url); 32 32 OpenBrowser.displayUrl(url.toURI()); 33 33 } catch (URISyntaxException e1) { 34 34 try { 35 System.err.println(e1.getLocalizedMessage());35 Main.error(e1.getLocalizedMessage()); 36 36 int index = e1.getIndex(); 37 37 if (index > -1) { … … 39 39 s = url.toString().replace(s, URLEncoder.encode(s, OdConstants.UTF8)); 40 40 URI uri = new URI(s); 41 System.out.println("Opening "+uri);41 Main.info("Opening "+uri); 42 42 OpenBrowser.displayUrl(uri); 43 43 } 44 44 } catch (Exception e2) { 45 e2.printStackTrace();45 Main.error(e2); 46 46 } 47 47 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/NeptuneReader.java
r30738 r30795 134 134 p.put("ref:neptune", object.getObjectId()); 135 135 if (tridentObjects.put(object.getObjectId(), p) != null) { 136 System.err.println("Trident object duplicated !!! : "+object.getObjectId());136 Main.error("Trident object duplicated !!! : "+object.getObjectId()); 137 137 } 138 138 } … … 151 151 return n; 152 152 } 153 /* 154 private Node createStopPosition(StopPointType stop) { 155 Node n = createNode(createLatLon(stop)); 156 n.put(OSM_PUBLIC_TRANSPORT, OSM_STOP_POSITION); 157 linkTridentObjectToOsmPrimitive(stop, n); 158 n.put("name", stop.getName()); 159 return n; 160 } 161 */ 153 162 154 protected Relation createRelation(String type){ 163 155 Relation r = new Relation(); … … 199 191 r.put(OSM_ROUTE_MASTER, OSM_TROLLEYBUS); break; 200 192 default: 201 System.err.println("Unsupported transport mode: "+line.getTransportModeName());193 Main.warn("Unsupported transport mode: "+line.getTransportModeName()); 202 194 } 203 195 r.put("ref", line.getNumber()); … … 265 257 StopArea child = findStopArea(childId); 266 258 if (child == null) { 267 System.err.println("Cannot find StopArea: "+childId);259 Main.warn("Cannot find StopArea: "+childId); 268 260 } else { 269 261 if (child.getStopAreaExtension().getAreaType().equals(ChouetteAreaType.BOARDING_POSITION)) { … … 272 264 StopPoint grandchild = findStopPoint(grandchildId); 273 265 if (grandchild == null) { 274 System.err.println("Cannot find StopPoint: "+grandchildId);266 Main.warn("Cannot find StopPoint: "+grandchildId); 275 267 } else { 276 268 if (grandchild.getLongLatType().equals(LongLatTypeType.WGS_84)) { … … 278 270 stopArea.addMember(new RelationMember(OSM_PLATFORM, platform)); 279 271 } else { 280 System.err.println("Unsupported long/lat type: "+grandchild.getLongLatType());272 Main.warn("Unsupported long/lat type: "+grandchild.getLongLatType()); 281 273 } 282 274 } 283 275 } else { 284 System.err.println("Unsupported grandchild: "+grandchildId);276 Main.warn("Unsupported grandchild: "+grandchildId); 285 277 } 286 278 } … … 288 280 AreaCentroid areaCentroid = findAreaCentroid(centroidId); 289 281 if (areaCentroid == null) { 290 System.err.println("Cannot find AreaCentroid: "+centroidId);282 Main.warn("Cannot find AreaCentroid: "+centroidId); 291 283 } else if (!areaCentroid.getLongLatType().equals(LongLatTypeType.WGS_84)) { 292 System.err.println("Unsupported long/lat type: "+areaCentroid.getLongLatType());284 Main.warn("Unsupported long/lat type: "+areaCentroid.getLongLatType()); 293 285 } else { 294 286 for (RelationMember member : stopArea.getMembers()) { … … 300 292 } 301 293 } else { 302 System.err.println("Unsupported child type: "+child.getStopAreaExtension().getAreaType());294 Main.warn("Unsupported child type: "+child.getStopAreaExtension().getAreaType()); 303 295 } 304 296 } … … 307 299 StopPoint child = findStopPoint(childId); 308 300 if (child == null) { 309 System.err.println("Cannot find StopPoint: "+childId);301 Main.warn("Cannot find StopPoint: "+childId); 310 302 } else { 311 303 // TODO … … 333 325 PTLinkType ptlink = findPtLink(id); 334 326 if (ptlink == null) { 335 System.err.println("Cannot find PTLinkType: "+id);327 Main.warn("Cannot find PTLinkType: "+id); 336 328 } else { 337 329 /*StopPoint start = findStopPoint(ptlink.getStartOfLink()); … … 340 332 OsmPrimitive end = tridentObjects.get(ptlink.getEndOfLink()); 341 333 if (start == null) { 342 System.err.println("Cannot find start StopPoint: "+ptlink.getStartOfLink());334 Main.warn("Cannot find start StopPoint: "+ptlink.getStartOfLink()); 343 335 } else if (start.get(OSM_PUBLIC_TRANSPORT).equals(OSM_STOP) || start.get(OSM_PUBLIC_TRANSPORT).equals(OSM_PLATFORM)) { 344 336 addStopToRoute(route, start); … … 346 338 347 339 if (end == null) { 348 System.err.println("Cannot find end StopPoint: "+ptlink.getEndOfLink());340 Main.warn("Cannot find end StopPoint: "+ptlink.getEndOfLink()); 349 341 } else if (end.get(OSM_PUBLIC_TRANSPORT).equals(OSM_STOP) || end.get(OSM_PUBLIC_TRANSPORT).equals(OSM_PLATFORM)) { 350 342 addStopToRoute(route, end); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/NetworkReader.java
r30723 r30795 11 11 import java.util.regex.Pattern; 12 12 13 import org.openstreetmap.josm.Main; 13 14 import org.openstreetmap.josm.data.osm.DataSet; 14 15 import org.openstreetmap.josm.gui.progress.ProgressMonitor; … … 109 110 //return CsvReader.class;//FIXME, can also be .tar.gz 110 111 } else { 111 System.err.println("Unsupported content type: "+contentType);112 Main.warn("Unsupported content type: "+contentType); 112 113 } 113 114 return null; -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/archive/ArchiveReader.java
r30568 r30795 120 120 } 121 121 } catch (IllegalArgumentException e) { 122 System.err.println(e.getMessage());122 Main.error(e.getMessage()); 123 123 } finally { 124 124 OdUtils.deleteDir(temp); … … 168 168 from = NeptuneReader.parseDataSet(in, handler, instance); 169 169 } else { 170 System.err.println("Unsupported XML file: "+f.getName());170 Main.warn("Unsupported XML file: "+f.getName()); 171 171 } 172 173 172 } else { 174 System.err.println("Unsupported file extension: "+f.getName());173 Main.warn("Unsupported file extension: "+f.getName()); 175 174 } 176 175 return from; -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/AbstractMapInfoReader.java
r30723 r30795 12 12 import java.util.List; 13 13 14 import org.openstreetmap.josm.Main; 14 15 import org.openstreetmap.josm.io.AbstractReader; 15 16 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; … … 67 68 return Charset.forName(OdConstants.MAC_ROMAN); 68 69 } else { 69 System.err.println("Line "+lineNum+". Unknown charset detected: "+line);70 Main.error("Line "+lineNum+". Unknown charset detected: "+line); 70 71 return Charset.forName(words[index]); 71 72 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/DefaultShpHandler.java
r30723 r30795 102 102 result.add(CRS.findMathTransform(CRS.decode(p.toCode()), targetCRS, lenient)); 103 103 } catch (FactoryException e) { 104 System.err.println(e.getMessage());104 Main.error(e.getMessage()); 105 105 } 106 106 } … … 113 113 if (!result.isEmpty()) { 114 114 if (result.size() > 1) { 115 System.err.println("Found multiple projections !"); // TODO: something115 Main.warn("Found multiple projections !"); // TODO: something 116 116 } 117 117 return result.get(0); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/GeographicReader.java
r30723 r30795 152 152 w.addNode(createOrGetNode(ls.getPointN(i))); 153 153 } catch (Exception e) { 154 System.err.println(e.getMessage());154 Main.error(e.getMessage()); 155 155 } 156 156 } … … 278 278 } catch (FactoryException ex) { 279 279 // Silently ignore exceptions 280 //System.err.println("Warning: cannot decode "+code+". "+ex.getMessage());281 280 } 282 281 } … … 292 291 transform = CRS.findMathTransform(newCRS, wgs84, false); 293 292 } catch (OperationNotFoundException ex) { 294 System.err.println(newCRS.getName()+": "+e.getMessage());293 Main.warn(newCRS.getName()+": "+e.getMessage()); 295 294 } 296 295 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/ShpReader.java
r30723 r30795 124 124 int nGeometries = mp.getNumGeometries(); 125 125 if (nGeometries < 1) { 126 System.err.println("Error:empty geometry collection found");126 Main.error("empty geometry collection found"); 127 127 } else { 128 128 Relation r = null; … … 151 151 readNonGeometricAttributes(feature, createOrGetNode((Point) g)); 152 152 } else { 153 System.err.println("Error:unsupported geometry : "+g);153 Main.error("unsupported geometry : "+g); 154 154 } 155 155 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/TabReader.java
r30723 r30795 16 16 import org.geotools.data.shapefile.dbf.DbaseFileReader.Row; 17 17 import org.geotools.data.shapefile.files.TabFiles; 18 import org.openstreetmap.josm.Main; 18 19 import org.openstreetmap.josm.data.osm.DataSet; 19 20 import org.openstreetmap.josm.gui.progress.ProgressMonitor; … … 82 83 doParse(columns.toArray(new String[0]), instance); 83 84 } catch (IOException e) { 84 System.err.println(e.getMessage());85 Main.error(e.getMessage()); 85 86 } 86 87 return ds; … … 104 105 parseColumns(words); 105 106 } else if (!line.isEmpty()) { 106 System.err.println("Line "+lineNum+". Unknown clause in header: "+line);107 Main.warn("Line "+lineNum+". Unknown clause in header: "+line); 107 108 } 108 109 } … … 117 118 datCharset = parseCharset(words, 3); 118 119 } else { 119 System.err.println("Line "+lineNum+". Unknown Type clause in header: "+line);120 Main.warn("Line "+lineNum+". Unknown Type clause in header: "+line); 120 121 } 121 122 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/SpreadSheetReader.java
r30723 r30795 203 203 } 204 204 } catch (ParseException e) { 205 System.err.println("Warning:Parsing error on line "+lineNumber+": "+e.getMessage());205 Main.warn("Parsing error on line "+lineNumber+": "+e.getMessage()); 206 206 } 207 207 } … … 213 213 n.setCoor(c.proj != null && !handlerOK ? c.proj.eastNorth2latlon(en) : handler.getCoor(en, fields)); 214 214 } else { 215 System.err.println("Warning:Skipping line "+lineNumber+" because no valid coordinates have been found at columns "+c);215 Main.warn("Skipping line "+lineNumber+" because no valid coordinates have been found at columns "+c); 216 216 } 217 217 if (n.getCoor() != null) { -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/XlsReader.java
r30723 r30795 44 44 Throwable ex = e.getException(); 45 45 if (ex != null && ex.getMessage() != null) { 46 System.err.println(ex.getClass()+": "+ex.getMessage());46 Main.error(ex.getClass()+": "+ex.getMessage()); 47 47 } 48 48 throw new IOException(e); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/layers/OdOsmDataLayer.java
r30723 r30795 38 38 nodes = ((Way) p).getNodes(); 39 39 } 40 //data.removePrimitive(p);41 40 if (nodes != null) { 42 41 for (Node n : nodes) { … … 49 48 50 49 if (refferingAllowedWays.isEmpty()) { 51 //data.removePrimitive(n);52 50 data.addSelected(n); 53 51 } 54 52 } 55 53 } 56 /*for (OsmPrimitive referrer : p.getReferrers()) {57 System.out.println(referrer);58 }*/59 54 } 60 55 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ModuleDownloadTask.java
r30532 r30795 16 16 import java.util.LinkedList; 17 17 18 import org.openstreetmap.josm.Main; 18 19 import org.openstreetmap.josm.data.Version; 19 20 import org.openstreetmap.josm.gui.PleaseWaitRunnable; … … 94 95 if (pi.downloadlink == null) { 95 96 String msg = tr("Warning: Cannot download module ''{0}''. Its download link is not known. Skipping download.", pi.name); 96 System.err.println(msg);97 Main.warn(msg); 97 98 throw new ModuleDownloadException(msg); 98 99 } … … 116 117 } catch(MalformedURLException e) { 117 118 String msg = tr("Warning: Cannot download module ''{0}''. Its download link ''{1}'' is not a valid URL. Skipping download.", pi.name, pi.downloadlink); 118 System.err.println(msg);119 Main.warn(msg); 119 120 throw new ModuleDownloadException(msg); 120 121 } catch (IOException e) { -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ModuleHandler.java
r30731 r30795 134 134 if (policy.equals("never")) { 135 135 if ("opendata.modulemanager.time-based-update.policy".equals(togglePreferenceKey)) { 136 System.out.println(tr("Skipping module update after elapsed update interval. Automatic update at startup is disabled."));136 Main.info(tr("Skipping module update after elapsed update interval. Automatic update at startup is disabled.")); 137 137 } 138 138 return false; … … 141 141 if (policy.equals("always")) { 142 142 if ("opendata.modulemanager.time-based-update.policy".equals(togglePreferenceKey)) { 143 System.out.println(tr("Running module update after elapsed update interval. Automatic update at startup is disabled."));143 Main.info(tr("Running module update after elapsed update interval. Automatic update at startup is disabled.")); 144 144 } 145 145 return true; … … 147 147 148 148 if (!policy.equals("ask")) { 149 System.err.println(tr("Unexpected value ''{0}'' for preference ''{1}''. Assuming value ''ask''.", policy, togglePreferenceKey));149 Main.warn(tr("Unexpected value ''{0}'' for preference ''{1}''. Assuming value ''ask''.", policy, togglePreferenceKey)); 150 150 } 151 151 int ret = HelpAwareOptionPane.showOptionDialog( … … 227 227 Class<? extends Module> klass = module.loadClass(moduleClassLoader); 228 228 if (klass != null) { 229 System.out.println(tr("loading module ''{0}'' (version {1})", module.name, module.localversion));229 Main.info(tr("loading module ''{0}'' (version {1})", module.name, module.localversion)); 230 230 Module mod = module.load(klass); 231 231 if (moduleList.add(mod)) { … … 437 437 modules = buildListOfModulesToLoad(parent); 438 438 } catch(ExecutionException e) { 439 System.out.println(tr("Warning: failed to download module information list"));439 Main.warn(tr("Warning: failed to download module information list")); 440 440 e.printStackTrace(); 441 441 // don't abort in case of error, continue with downloading modules below 442 442 } catch(InterruptedException e) { 443 System.out.println(tr("Warning: failed to download module information list"));443 Main.warn(tr("Warning: failed to download module information list")); 444 444 e.printStackTrace(); 445 445 // don't abort in case of error, continue with downloading modules below … … 561 561 if (module.exists()) { 562 562 if (!module.delete() && dowarn) { 563 System.err.println(tr("Warning: failed to delete outdated module ''{0}''.", module.toString()));564 System.err.println(tr("Warning: failed to install already downloaded module ''{0}''. Skipping installation. JOSM is still going to load the old module version.", moduleName));563 Main.warn(tr("Warning: failed to delete outdated module ''{0}''.", module.toString())); 564 Main.warn(tr("Warning: failed to install already downloaded module ''{0}''. Skipping installation. JOSM is still going to load the old module version.", moduleName)); 565 565 continue; 566 566 } 567 567 } 568 568 if (!updatedModule.renameTo(module) && dowarn) { 569 System.err.println(tr("Warning: failed to install module ''{0}'' from temporary download file ''{1}''. Renaming failed.", module.toString(), updatedModule.toString()));570 System.err.println(tr("Warning: failed to install already downloaded module ''{0}''. Skipping installation. JOSM is still going to load the old module version.", moduleName));569 Main.warn(tr("Warning: failed to install module ''{0}'' from temporary download file ''{1}''. Renaming failed.", module.toString(), updatedModule.toString())); 570 Main.warn(tr("Warning: failed to install already downloaded module ''{0}''. Skipping installation. JOSM is still going to load the old module version.", moduleName)); 571 571 } 572 572 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ModuleInformation.java
r30738 r30795 115 115 * update site. 116 116 * 117 * @param other the module information object retrieved from the update 118 * site 117 * @param other the module information object retrieved from the update site 119 118 */ 120 119 public void updateFromModuleSite(ModuleInformation other) { … … 149 148 URL url = new URL(s); 150 149 } catch (MalformedURLException e) { 151 System.out.println(tr("Invalid URL ''{0}'' in module {1}", s, name));150 Main.error(tr("Invalid URL ''{0}'' in module {1}", s, name)); 152 151 s = null; 153 152 } … … 155 154 link = s; 156 155 s = attr.getValue(lang+"Module-Description"); 157 if(s == null) 158 { 156 if(s == null) { 159 157 s = attr.getValue("Module-Description"); 160 158 if(s != null) { … … 173 171 icon = extractIcon(iconPath, OdPlugin.getInstance().getPluginInformation().file, true); 174 172 } 173 if (icon == null) { 174 Main.error("Unable to load module icon: "+iconPath); 175 } 175 176 } 176 177 -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ReadLocalModuleInformationTask.java
r30532 r30795 14 14 import java.util.Map; 15 15 16 import org.openstreetmap.josm.Main; 16 17 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 17 18 import org.openstreetmap.josm.gui.progress.ProgressMonitor; … … 78 79 File[] siteCacheFiles = modulesDirectory.listFiles( 79 80 new FilenameFilter() { 81 @Override 80 82 public boolean accept(File dir, String name) { 81 83 return name.matches("^([0-9]+-)?site.*\\.txt$"); … … 93 95 processLocalModuleInformationFile(f); 94 96 } catch (ModuleListParseException e) { 95 System.err.println(tr("Warning: Failed to scan file ''{0}'' for module information. Skipping.", fname));97 Main.warn(tr("Warning: Failed to scan file ''{0}'' for module information. Skipping.", fname)); 96 98 e.printStackTrace(); 97 99 } … … 103 105 File[] siteCacheFiles = modulesDirectory.listFiles( 104 106 new FilenameFilter() { 107 @Override 105 108 public boolean accept(File dir, String name) { 106 109 return name.matches("^([0-9]+-)?site.*modules-icons\\.zip$"); … … 131 134 File[] moduleFiles = modulesDirectory.listFiles( 132 135 new FilenameFilter() { 136 @Override 133 137 public boolean accept(File dir, String name) { 134 138 return name.endsWith(".jar") || name.endsWith(".jar.new"); … … 152 156 } 153 157 } catch(ModuleException e){ 154 System.err.println(tr("Warning: Failed to scan file ''{0}'' for module information. Skipping.", fname));158 Main.warn(tr("Warning: Failed to scan file ''{0}'' for module information. Skipping.", fname)); 155 159 e.printStackTrace(); 156 160 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ReadRemoteModuleInformationTask.java
r30738 r30795 278 278 availableModules.addAll(new ModuleListParser().parse(in)); 279 279 } catch(UnsupportedEncodingException e) { 280 System.err.println(tr("Failed to parse module list document from site ''{0}''. Skipping site. Exception was: {1}", site, e.toString()));280 Main.error(tr("Failed to parse module list document from site ''{0}''. Skipping site. Exception was: {1}", site, e.toString())); 281 281 e.printStackTrace(); 282 282 } catch(ModuleListParseException e) { 283 System.err.println(tr("Failed to parse module list document from site ''{0}''. Skipping site. Exception was: {1}", site, e.toString()));283 Main.error(tr("Failed to parse module list document from site ''{0}''. Skipping site. Exception was: {1}", site, e.toString())); 284 284 e.printStackTrace(); 285 285 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/util/NamesFrUtils.java
r30738 r30795 158 158 return label; 159 159 } else { 160 System.err.println("Warning:unknown street label: "+label);160 Main.warn("unknown street label: "+label); 161 161 return label; 162 162 }
Note:
See TracChangeset
for help on using the changeset viewer.