Changeset 32139 in osm for applications/editors/josm/plugins/opendata
- Timestamp:
- 2016-04-02T15:00:31+02:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/opendata
- Files:
-
- 6 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/GeographicReader.java
r31655 r32139 101 101 102 102 protected Node createOrGetNode(Point p, String ele) throws MismatchedDimensionException, TransformException { 103 if (!p.isValid()) { 104 throw new IllegalArgumentException("Invalid point: " + p); 105 } 103 106 Point p2 = (Point) JTS.transform(p, transform); 104 107 LatLon key = new LatLon(p2.getY(), p2.getX()); … … 157 160 try { 158 161 tempWay.addNode(createOrGetNode(ls.getPointN(i))); 159 } catch ( Exception e) {160 Main.error( e.getMessage());162 } catch (TransformException | IllegalArgumentException e) { 163 Main.error("Exception for " + ls + ": " + e.getClass().getName() + ": " + e.getMessage()); 161 164 } 162 165 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/ShpReader.java
r31655 r32139 241 241 } 242 242 } 243 } catch (Throwable e) {244 e.printStackTrace();245 243 } finally { 246 244 iterator.close(); … … 254 252 e.printStackTrace(); 255 253 throw e; 256 } catch ( Throwable t) {257 t.printStackTrace();258 throw new IOException( t);254 } catch (Exception e) { 255 e.printStackTrace(); 256 throw new IOException(e); 259 257 } 260 258 return ds; -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/layers/OdDataLayer.java
r31116 r32139 10 10 11 11 import javax.swing.Action; 12 import javax.swing.Icon;13 12 14 13 import org.openstreetmap.josm.Main; 15 14 import org.openstreetmap.josm.data.Bounds; 15 import org.openstreetmap.josm.data.coor.LatLon; 16 16 import org.openstreetmap.josm.data.osm.DataSet; 17 17 import org.openstreetmap.josm.data.osm.Node; … … 20 20 import org.openstreetmap.josm.gui.layer.Layer; 21 21 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 22 import org.openstreetmap.josm.tools.ImageProvider;23 22 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; 24 23 import org.openstreetmap.josm.plugins.opendata.core.actions.OpenLinkAction; … … 28 27 import org.openstreetmap.josm.plugins.opendata.core.licenses.License; 29 28 import org.openstreetmap.josm.plugins.opendata.core.util.OdUtils; 29 import org.openstreetmap.josm.tools.ImageProvider; 30 30 31 31 public class OdDataLayer extends OsmDataLayer implements OdLayer, LayerChangeListener { … … 43 43 this.handler = handler; 44 44 for (Node node : data.getNodes()) { 45 if (this.bounds == null) { 46 this.bounds = new Bounds(node.getCoor()); 47 } else { 48 this.bounds.extend(node.getCoor()); 45 LatLon ll = node.getCoor(); 46 if (ll != null) { 47 if (this.bounds == null) { 48 this.bounds = new Bounds(ll); 49 } else { 50 this.bounds.extend(ll); 51 } 49 52 } 50 53 } -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/geographic/ShpReaderTest.java
r30573 r32139 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.plugins.opendata.core.io.geographic; 3 4 import static org.junit.Assert.assertNotNull; 3 5 4 6 import java.io.File; … … 14 16 import org.openstreetmap.josm.JOSMFixture; 15 17 import org.openstreetmap.josm.TestUtils; 18 import org.openstreetmap.josm.data.osm.Node; 16 19 import org.openstreetmap.josm.plugins.opendata.core.io.NonRegFunctionalTests; 17 20 … … 28 31 JOSMFixture.createUnitTestFixture().init(); 29 32 } 30 33 34 /** 35 * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/12714">#12714/a> 36 * @throws IOException if an error occurs during reading 37 */ 38 @Test 39 public void testTicket12714() throws IOException, XMLStreamException, FactoryConfigurationError { 40 File file = new File(TestUtils.getRegressionDataFile(12714, "linhas.shp")); 41 try (InputStream is = new FileInputStream(file)) { 42 for (Node n : ShpReader.parseDataSet(is, file, null, null).getNodes()) { 43 assertNotNull(n.toString(), n.getCoor()); 44 } 45 } 46 } 47 31 48 /** 32 49 * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/10214">#10214</a>
Note:
See TracChangeset
for help on using the changeset viewer.