Changeset 34646 in osm for applications/editors/josm/plugins
- Timestamp:
- 2018-09-14T21:59:49+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/actions/OpenLinkAction.java
r33518 r34646 3 3 4 4 import java.awt.event.ActionEvent; 5 import java.io.IOException; 5 6 import java.net.URI; 6 7 import java.net.URISyntaxException; … … 42 43 OpenBrowser.displayUrl(uri); 43 44 } 44 } catch ( Exception e2) {45 } catch (IOException | URISyntaxException e2) { 45 46 Logging.error(e2); 46 47 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/SimpleDataSetHandler.java
r32545 r34646 40 40 Tag tag; 41 41 String[] kv = relevantTag.split("="); 42 if (kv != null && kv.length == 2) {42 if (kv.length == 2) { 43 43 tag = new Tag(kv[0], kv[1]); 44 44 } else { … … 48 48 } 49 49 50 public SimpleDataSetHandler(boolean relevantUnion, String 50 public SimpleDataSetHandler(boolean relevantUnion, String... relevantTags) { 51 51 addRelevantTag(relevantTags); 52 52 this.relevantUnion = relevantUnion; 53 53 } 54 54 55 public SimpleDataSetHandler(String 55 public SimpleDataSetHandler(String... relevantTags) { 56 56 this(false, relevantTags); 57 57 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ChooserLauncher.java
r34452 r34646 21 21 public void run() { 22 22 Component parent = progressMonitor == null ? MainApplication.getMainFrame() : progressMonitor.getWindowParent(); 23 ProjectionChooser dialog = (ProjectionChooser)new ProjectionChooser(parent).showDialog();23 ProjectionChooser dialog = new ProjectionChooser(parent).showDialog(); 24 24 if (dialog.getValue() == 1) { 25 25 proj = dialog.getProjection(); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ModulePreference.java
r34452 r34646 98 98 99 99 private JTextField tfFilter; 100 private ModuleListPanel pnlModulePreferences;101 private ModulePreferencesModel model;100 private final ModulePreferencesModel model = new ModulePreferencesModel(); 101 private final ModuleListPanel pnlModulePreferences = new ModuleListPanel(model); 102 102 private JScrollPane spModulePreferences; 103 103 … … 140 140 JPanel pnl = new JPanel(new BorderLayout()); 141 141 pnl.add(buildSearchFieldPanel(), BorderLayout.NORTH); 142 model = new ModulePreferencesModel(); 143 spModulePreferences = new JScrollPane(pnlModulePreferences = new ModuleListPanel(model)); 142 spModulePreferences = new JScrollPane(pnlModulePreferences); 144 143 spModulePreferences.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); 145 144 spModulePreferences.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ProjectionChooser.java
r33595 r34646 158 158 } 159 159 } 160 161 @Override 162 public ProjectionChooser showDialog() { 163 super.showDialog(); 164 return this; 165 } 160 166 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/GeographicReader.java
r34452 r34646 267 267 Datum datum1 = ((AbstractSingleCRS) crs1).getDatum(); 268 268 Datum datum2 = ((AbstractSingleCRS) crs2).getDatum(); 269 if (!compareDebug("datum", datum1, datum2) ) {269 if (!compareDebug("datum", datum1, datum2) && datum1 instanceof AbstractIdentifiedObject) { 270 270 AbstractIdentifiedObject adatum1 = (AbstractIdentifiedObject) datum1; 271 271 AbstractIdentifiedObject adatum2 = (AbstractIdentifiedObject) datum2; -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/KmlKmzImporter.java
r32545 r34646 13 13 import org.openstreetmap.josm.plugins.opendata.core.io.AbstractImporter; 14 14 15 /** 16 * Keyhole Markup Language (KML/KMZ) importer. 17 */ 15 18 public class KmlKmzImporter extends AbstractImporter { 16 19 … … 27 30 throws IllegalDataException { 28 31 try { 29 if (file .getName().toLowerCase().endsWith(OdConstants.KML_EXT)) {32 if (file != null && file.getName().toLowerCase().endsWith(OdConstants.KML_EXT)) { 30 33 return KmlReader.parseDataSet(in, instance); 31 34 } else { -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/MifReader.java
r34153 r34646 60 60 private File file; 61 61 private InputStream stream; 62 pr otectedCharset charset;63 pr otectedBufferedReader midReader;62 private Charset charset; 63 private BufferedReader midReader; 64 64 65 65 private Character delimiter = '\t'; … … 166 166 params += param(Param.lat_0, originLat); 167 167 break; 168 default: 169 Logging.trace("originLat not set for " + proj); 168 170 } 169 171 … … 182 184 params += param(Param.lat_1, stdP1); 183 185 break; 186 default: 187 Logging.trace("stdP1 not set for " + proj); 184 188 } 185 189 … … 193 197 params += param(Param.lat_2, stdP2); 194 198 break; 199 default: 200 Logging.trace("stdP2 not set for " + proj); 195 201 } 196 202 … … 216 222 params += param(Param.k_0, scaleFactor); 217 223 break; 224 default: 225 Logging.trace("scaleFactor not set for " + proj); 218 226 } 219 227 … … 249 257 params += param(Param.y_0, falseNorthing); 250 258 break; 259 default: 260 Logging.trace("falseEasting/falseNorthing not set for " + proj); 251 261 } 252 262 … … 257 267 Double.parseDouble(words[8+offset]); 258 268 // TODO: what's proj4 parameter ? 269 default: 270 Logging.trace("range not set for " + proj); 259 271 } 260 272 … … 276 288 } 277 289 break; 290 default: 291 Logging.trace("josmProj not set for " + proj); 278 292 } 279 293 … … 592 606 } 593 607 594 pr otectedvoid readAttributes(OsmPrimitive p) throws IOException {608 private void readAttributes(OsmPrimitive p) throws IOException { 595 609 if (midReader != null) { 596 610 String midLine = midReader.readLine(); … … 613 627 } 614 628 615 pr otectedNode createNode(String x, String y) {629 private Node createNode(String x, String y) { 616 630 Node node = new Node(josmProj.eastNorth2latlon(new EastNorth(Double.parseDouble(x), Double.parseDouble(y)))); 617 631 ds.addPrimitive(node); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/MifTabImporter.java
r33613 r34646 14 14 import org.openstreetmap.josm.plugins.opendata.core.io.AbstractImporter; 15 15 16 /** 17 * MapInfo (MIF/TAB) importer. 18 */ 16 19 public class MifTabImporter extends AbstractImporter { 17 20 … … 28 31 throws IllegalDataException { 29 32 try { 30 if (file .getName().toLowerCase().endsWith(OdConstants.MIF_EXT)) {33 if (file != null && file.getName().toLowerCase().endsWith(OdConstants.MIF_EXT)) { 31 34 return MifReader.parseDataSet(in, file, handler, instance); 32 35 } else { -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/ShpImporter.java
r30723 r34646 14 14 import org.openstreetmap.josm.plugins.opendata.core.io.AbstractImporter; 15 15 16 /** 17 * Shapefile (SHP) importer. 18 */ 16 19 public class ShpImporter extends AbstractImporter { 17 20 18 21 public static final ExtensionFileFilter SHP_FILE_FILTER = new ExtensionFileFilter( 19 22 OdConstants.SHP_EXT, OdConstants.SHP_EXT, tr("Shapefiles") + " (*."+OdConstants.SHP_EXT+")"); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/OdsDocument.java
r34452 r34646 9 9 import java.util.zip.ZipInputStream; 10 10 11 import javax.xml.parsers.ParserConfigurationException; 12 11 13 import org.jopendocument.io.SaxContentUnmarshaller; 12 14 import org.jopendocument.model.OpenDocument; … … 14 16 import org.openstreetmap.josm.tools.XmlUtils; 15 17 import org.xml.sax.InputSource; 18 import org.xml.sax.SAXException; 16 19 import org.xml.sax.XMLReader; 17 20 … … 51 54 } 52 55 53 } catch ( Exception e) {56 } catch (IOException | SAXException | ParserConfigurationException e) { 54 57 Logging.error(e); 55 58 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ModuleHandler.java
r34452 r34646 175 175 Config.getPref().put(togglePreferenceKey, "never"); 176 176 break; 177 default: 178 Logging.trace(Integer.toString(ret)); 177 179 } 178 180 } else { -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ModuleInformation.java
r34452 r34646 139 139 } 140 140 141 @SuppressWarnings("unused") 141 142 private void scanManifest(Manifest manifest) { 142 143 String lang = LanguageInfo.getLanguageCodeManifest(); … … 149 150 if (s != null) { 150 151 try { 151 @SuppressWarnings("unused") 152 URL url = new URL(s); 152 new URL(s); 153 153 } catch (MalformedURLException e) { 154 154 Logging.error(tr("Invalid URL ''{0}'' in module {1}", s, name)); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ModuleListParser.java
r34196 r34646 101 101 url = x[1]; 102 102 manifest = new StringBuilder(); 103 104 103 } 105 104 if (name != null) { 106 105 ModuleInformation info = createInfo(name, url, manifest.toString()); 107 if (info != null) { 108 for (Module module : ModuleHandler.moduleList) { 109 if (module.getModuleInformation().name.equals(info.getName())) { 110 info.localversion = module.getModuleInformation().localversion; 111 } 106 for (Module module : ModuleHandler.moduleList) { 107 if (module.getModuleInformation().name.equals(info.getName())) { 108 info.localversion = module.getModuleInformation().localversion; 112 109 } 113 ret.add(info);114 110 } 111 ret.add(info); 115 112 } 116 113 return ret; -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/util/NamesFrUtils.java
r33518 r34646 16 16 import org.openstreetmap.josm.tools.Logging; 17 17 18 /** 19 * Utilities for French names. 20 */ 18 21 public abstract class NamesFrUtils { 19 22 … … 36 39 SimpleDataSetHandler.class.getResourceAsStream(OdConstants.DICTIONARY_FR), OdConstants.UTF8))) { 37 40 String line = reader.readLine(); // Skip first line 41 Logging.trace(line); 38 42 while ((line = reader.readLine()) != null) { 39 43 String[] tab = line.split(";"); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/util/OdUtils.java
r34452 r34646 34 34 if (append) { 35 35 int index = result.size()-1; 36 if (split[i].endsWith("\"") && StringUtils.countMatches(split[i], "\"") % 2 == 1) {36 if (split[i].endsWith("\"") && StringUtils.countMatches(split[i], "\"") % 2 != 0) { 37 37 append = false; 38 38 }
Note:
See TracChangeset
for help on using the changeset viewer.