Ignore:
Timestamp:
2012-03-12T23:46:51+01:00 (12 years ago)
Author:
donvip
Message:

opendata: download improvements

Location:
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/AbstractDataSetHandler.java

    r28054 r28055  
    3636import org.opengis.referencing.FactoryException;
    3737import org.opengis.referencing.crs.CoordinateReferenceSystem;
     38import org.opengis.referencing.crs.GeographicCRS;
    3839import org.opengis.referencing.datum.GeodeticDatum;
    3940import org.opengis.referencing.operation.MathTransform;
     
    474475       
    475476        public MathTransform findMathTransform(CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS, boolean lenient) throws FactoryException {
    476                 if (sourceCRS instanceof AbstractDerivedCRS && sourceCRS.getName().getCode().equalsIgnoreCase("Lambert_Conformal_Conic")) {
     477                if (sourceCRS instanceof GeographicCRS && sourceCRS.getName().getCode().equalsIgnoreCase("GCS_ETRS_1989")) {
     478                        return CRS.findMathTransform(CRS.decode("EPSG:4258"), targetCRS, lenient);
     479                } else if (sourceCRS instanceof AbstractDerivedCRS && sourceCRS.getName().getCode().equalsIgnoreCase("Lambert_Conformal_Conic")) {
    477480                        List<MathTransform> result = new ArrayList<MathTransform>();
    478481                        AbstractDerivedCRS crs = (AbstractDerivedCRS) sourceCRS;
     
    558561                return setSkipXsdValidationInZipReading;
    559562        }
     563
     564        public void notifyTempFileWritten(File file) {
     565                // Do nothing, let handler overload this method if they need it
     566        }
    560567}
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/archive/ZipReader.java

    r28054 r28055  
    107107                                        throw new IOException("Could not create temp file: " + file.getAbsolutePath());
    108108                                }
     109                                // Write temp file
    109110                                        FileOutputStream fos = new FileOutputStream(file);
    110111                                        byte[] buffer = new byte[8192];
     
    114115                                        }
    115116                                        fos.close();
     117                                        // Allow handler to perform specific treatments (for example, fix invalid .prj files)
     118                                        if (handler != null) {
     119                                                handler.notifyTempFileWritten(file);
     120                                        }
     121                                        // Set last modification date
    116122                                        long time = entry.getTime();
    117123                                        if (time > -1) {
    118124                                                file.setLastModified(time);
    119125                                        }
     126                                        // Test file name to see if it may contain useful data
    120127                                        for (String ext : new String[] {
    121128                                                        CSV_EXT, KML_EXT, KMZ_EXT, XLS_EXT, ODS_EXT, SHP_EXT, MIF_EXT, TAB_EXT
Note: See TracChangeset for help on using the changeset viewer.