Class MCRIView2Tools

java.lang.Object
org.mycore.iview2.services.MCRIView2Tools

public class MCRIView2Tools extends Object
Tools class with common methods for IView2.
Author:
Thomas Scheffler (yagee)
  • Field Details

  • Constructor Details

    • MCRIView2Tools

      public MCRIView2Tools()
  • Method Details

    • getTileDir

      public static Path getTileDir()
      Returns:
      directory for tiles
    • getSupportedMainFile

      public static String getSupportedMainFile(String derivateID)
      Parameters:
      derivateID - ID of derivate
      Returns:
      empty String or absolute path to main file of derivate if file is supported.
    • isDerivateSupported

      public static boolean isDerivateSupported(String derivateID)
      Parameters:
      derivateID - ID of derivate
      Returns:
      true if getSupportedMainFile(String) is not an empty String.
    • isFileSupported

      public static boolean isFileSupported(Path file) throws IOException
      Parameters:
      file - image file
      Returns:
      if content type is in property MCR.Module-iview2.SupportedContentTypes
      Throws:
      IOException
      See Also:
    • isFileSupported

      public static boolean isFileSupported(String filename)
      Returns:
      true if the file is supported, false otherwise
    • isCompletelyTiled

      public static boolean isCompletelyTiled(String derivateId)
      Checks for a given derivate id whether all files in that derivate are tiled.
      Returns:
      true if all files in belonging to the derivate are tiled, false otherwise
    • getZoomLevel

      public static BufferedImage getZoomLevel(Path iviewFile, int zoomLevel) throws IOException, JDOMException
      combines image tiles of specified zoomLevel to one image.
      Parameters:
      iviewFile - .iview2 file
      zoomLevel - the zoom level where 0 is thumbnail size
      Returns:
      a combined image
      Throws:
      IOException - any IOException while reading tiles
      JDOMException - if image properties could not be parsed.
    • getZoomLevel

      public static BufferedImage getZoomLevel(Path iviewFileRoot, org.mycore.imagetiler.MCRTiledPictureProps imageProperties, ImageReader reader, int zoomLevel) throws IOException, JDOMException
      combines image tiles of specified zoomLevel to one image.
      Parameters:
      iviewFileRoot - root directory of .iview2 file
      imageProperties - imageProperties, if available or null
      zoomLevel - the zoom level where 0 is thumbnail size
      Returns:
      a combined image
      Throws:
      IOException - any IOException while reading tiles
      JDOMException - if image properties could not be parsed.
    • getFileSystem

      public static FileSystem getFileSystem(Path iviewFile) throws IOException
      Throws:
      IOException
    • getTileImageReader

      public static ImageReader getTileImageReader()
    • readTile

      public static BufferedImage readTile(Path iviewFileRoot, ImageReader imageReader, int zoomLevel, int x, int y) throws IOException
      Throws:
      IOException
    • getImageType

      public static int getImageType(Path iviewFileRoot, ImageReader imageReader, int zoomLevel, int x, int y) throws IOException
      Throws:
      IOException
    • getIView2Property

      public static String getIView2Property(String propName)
    • getIView2Property

      public static String getIView2Property(String propName, String defaultProp)
      short for MCRConfiguration2.getString("MCR.Module-iview2." + propName).orElse(defaultProp);
      Parameters:
      propName - any suffix
      Returns:
      null or property value
    • getFilePath

      public static String getFilePath(String derID, String derPath) throws IOException
      Throws:
      IOException