Ignore:
Timestamp:
2015-07-04T22:52:23+02:00 (5 years ago)
Author:
wiktorn
Message:

Basic WMTS support.

  • added information about units and to_meter to EPSG projection definitions (needed for WMTS)
  • added WMTSTileSource and WMTSLayer classes
  • a bit of cleanup of AbstractTileSourceLayer and align so it will work properly with WMTS tile definitions
  • added Imagery Preferences panel for WMTS and icon for button
  • added removal of wms: / tms: / wmts: prefix, if user will paste them into the field
  • CachedFile - added possibility to send custom headers with request
  • added support for unit and to_meter in CustomProjection
  • AbstractTMSTileSource cleanups (change of Coordinate to ICoordinate)
  • moved JCSCachedTileLoaderJob.read() to Utils

Addresses: #10623

Tested with Polish WMTS service proivders, Walonnie needs still some debugging, as it is not working right now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r8567 r8568  
    1414import java.awt.datatransfer.UnsupportedFlavorException;
    1515import java.io.BufferedReader;
     16import java.io.ByteArrayOutputStream;
    1617import java.io.Closeable;
    1718import java.io.File;
     
    13371338        return hasExtension(file.getName(), extensions);
    13381339    }
     1340
     1341    /**
     1342     * Reads the input stream and closes the stream at the end of processing (regardless if an exception was thrown)
     1343     *
     1344     * @param stream
     1345     * @return byte array of data in input stream
     1346     * @throws IOException
     1347     */
     1348    public static byte[] readBytesFromStream(InputStream stream) throws IOException {
     1349        try {
     1350            ByteArrayOutputStream bout = new ByteArrayOutputStream(stream.available());
     1351            byte[] buffer = new byte[2048];
     1352            boolean finished = false;
     1353            do {
     1354                int read = stream.read(buffer);
     1355                if (read >= 0) {
     1356                    bout.write(buffer, 0, read);
     1357                } else {
     1358                    finished = true;
     1359                }
     1360            } while (!finished);
     1361            if (bout.size() == 0)
     1362                return null;
     1363            return bout.toByteArray();
     1364        } finally {
     1365            stream.close();
     1366        }
     1367    }
    13391368}
Note: See TracChangeset for help on using the changeset viewer.