Changeset 36071 in osm
- Timestamp:
- 2023-04-19T15:04:07+02:00 (21 months ago)
- Location:
- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/GeotoolsConverter.java
r36025 r36071 75 75 throws IOException, FactoryException, GeoMathTransformException, TransformException, GeoCrsException { 76 76 String[] typeNames = dataStore.getTypeNames(); 77 String typeName = typeNames[0]; 78 79 FeatureSource<?, ?> featureSource = dataStore.getFeatureSource(typeName); 80 FeatureCollection<?, ?> collection = featureSource.getFeatures(); 81 77 if (progressMonitor != null) { 78 progressMonitor.beginTask(tr("Loading shapefile ({0} layers)", typeNames.length), typeNames.length); 79 } 80 try { 81 for (String typeName : typeNames) { 82 FeatureSource<?, ?> featureSource = dataStore.getFeatureSource(typeName); 83 FeatureCollection<?, ?> collection = featureSource.getFeatures(); 84 parseFeatures(progressMonitor != null ? progressMonitor.createSubTaskMonitor(1, false) : null, collection); 85 } 86 } finally { 87 if (progressMonitor != null) { 88 progressMonitor.finishTask(); 89 } 90 } 91 } 92 93 /** 94 * Run the actual conversion process for a collection of features 95 * @param progressMonitor The monitor to show progress on 96 * @param collection The collection to parse 97 * @throws FactoryException See {@link GeographicReader#findMathTransform(Component, boolean)} 98 * @throws GeoMathTransformException See {@link GeographicReader#findMathTransform(Component, boolean)} 99 * @throws TransformException See {@link GeographicReader#createOrGetNode(Point)} 100 * @throws GeoCrsException If the CRS cannot be detected 101 */ 102 private void parseFeatures(ProgressMonitor progressMonitor, FeatureCollection<?, ?> collection) 103 throws FactoryException, GeoMathTransformException, TransformException, GeoCrsException { 82 104 if (progressMonitor != null) { 83 105 progressMonitor.beginTask(tr("Loading shapefile ({0} features)", collection.size()), collection.size()); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/geopackage/GeoPackageReader.java
r36025 r36071 60 60 } catch (FactoryException | GeoCrsException | GeoMathTransformException | TransformException e) { 61 61 throw new IOException(e); 62 } finally { 63 dataStore.dispose(); 62 64 } 63 65 }
Note:
See TracChangeset
for help on using the changeset viewer.