@Test public void testGetBaseMipmapFile() throws Exception { final MipmapGenerator mipmapGenerator = new MipmapGenerator(baseMipmapDirectory, Utils.JPEG_FORMAT, 0.85f, false); final String sourcePath = "/render_test/saalfeld/raw-data/stack-1/file1.tif"; final String sourceUrl = "file:/render_test/saalfeld/raw-data/stack-1/file1.tif"; final File baseMipmapFile = mipmapGenerator.getMipmapBaseFile(sourceUrl, false); final String expectedFilePath = baseMipmapDirectory.getAbsolutePath() + sourcePath; Assert.assertEquals("invalid file path derived", expectedFilePath, baseMipmapFile.getAbsolutePath()); }
protected File getMipmapBaseFile(final String levelZeroSourceUrl, final boolean createMissingDirectories) throws IllegalArgumentException, IOException { final File sourceFile = getFileForUrlString(levelZeroSourceUrl); final File sourceDirectory = sourceFile.getParentFile().getCanonicalFile(); final File mipmapBaseDirectory = new File(rootDirectory, sourceDirectory.getAbsolutePath()).getCanonicalFile(); if (! mipmapBaseDirectory.exists()) { if (createMissingDirectories) { if (!mipmapBaseDirectory.mkdirs()) { throw new IllegalArgumentException("failed to create mipmap level directory " + mipmapBaseDirectory.getAbsolutePath()); } } } return new File(mipmapBaseDirectory, sourceFile.getName()); }
MipmapGenerator { protected File getMipmapBaseFile(final String levelZeroSourceUrl, final boolean createMissingDirectories) throws IllegalArgumentException, IOException { final File sourceFile = getFileForUrlString(levelZeroSourceUrl); final File sourceDirectory = sourceFile.getParentFile().getCanonicalFile(); final File mipmapBaseDirectory = new File(rootDirectory, sourceDirectory.getAbsolutePath()).getCanonicalFile(); if (! mipmapBaseDirectory.exists()) { if (createMissingDirectories) { if (!mipmapBaseDirectory.mkdirs()) { throw new IllegalArgumentException("failed to create mipmap level directory " + mipmapBaseDirectory.getAbsolutePath()); } } } return new File(mipmapBaseDirectory, sourceFile.getName()); } }
MipmapGenerator { protected File getMipmapBaseFile(final String levelZeroSourceUrl, final boolean createMissingDirectories) throws IllegalArgumentException, IOException { final File sourceFile = getFileForUrlString(levelZeroSourceUrl); final File sourceDirectory = sourceFile.getParentFile().getCanonicalFile(); final File mipmapBaseDirectory = new File(rootDirectory, sourceDirectory.getAbsolutePath()).getCanonicalFile(); if (! mipmapBaseDirectory.exists()) { if (createMissingDirectories) { if (!mipmapBaseDirectory.mkdirs()) { throw new IllegalArgumentException("failed to create mipmap level directory " + mipmapBaseDirectory.getAbsolutePath()); } } } return new File(mipmapBaseDirectory, sourceFile.getName()); } MipmapGenerator(final File rootDirectory,
                           final String format,
                           final float jpegQuality,
                           final boolean consolidateMasks); }
MipmapGenerator { protected File getMipmapBaseFile(final String levelZeroSourceUrl, final boolean createMissingDirectories) throws IllegalArgumentException, IOException { final File sourceFile = getFileForUrlString(levelZeroSourceUrl); final File sourceDirectory = sourceFile.getParentFile().getCanonicalFile(); final File mipmapBaseDirectory = new File(rootDirectory, sourceDirectory.getAbsolutePath()).getCanonicalFile(); if (! mipmapBaseDirectory.exists()) { if (createMissingDirectories) { if (!mipmapBaseDirectory.mkdirs()) { throw new IllegalArgumentException("failed to create mipmap level directory " + mipmapBaseDirectory.getAbsolutePath()); } } } return new File(mipmapBaseDirectory, sourceFile.getName()); } MipmapGenerator(final File rootDirectory,
                           final String format,
                           final float jpegQuality,
                           final boolean consolidateMasks); static void main(final String[] args); void generateMissingMipmapFiles(final TileSpec tileSpec,
                                           final int greatestMipmapLevel); static void generateMipmap(final String sourceUrl,
                                      final int mipmapLevelDelta,
                                      final String format,
                                      final Float jpegQuality,
                                      final OutputStream outputStream); }
MipmapGenerator { protected File getMipmapBaseFile(final String levelZeroSourceUrl, final boolean createMissingDirectories) throws IllegalArgumentException, IOException { final File sourceFile = getFileForUrlString(levelZeroSourceUrl); final File sourceDirectory = sourceFile.getParentFile().getCanonicalFile(); final File mipmapBaseDirectory = new File(rootDirectory, sourceDirectory.getAbsolutePath()).getCanonicalFile(); if (! mipmapBaseDirectory.exists()) { if (createMissingDirectories) { if (!mipmapBaseDirectory.mkdirs()) { throw new IllegalArgumentException("failed to create mipmap level directory " + mipmapBaseDirectory.getAbsolutePath()); } } } return new File(mipmapBaseDirectory, sourceFile.getName()); } MipmapGenerator(final File rootDirectory,
                           final String format,
                           final float jpegQuality,
                           final boolean consolidateMasks); static void main(final String[] args); void generateMissingMipmapFiles(final TileSpec tileSpec,
                                           final int greatestMipmapLevel); static void generateMipmap(final String sourceUrl,
                                      final int mipmapLevelDelta,
                                      final String format,
                                      final Float jpegQuality,
                                      final OutputStream outputStream);  }