Package org.mycore.iview2.services
Class MCRIView2Tools
java.lang.Object
org.mycore.iview2.services.MCRIView2Tools
Tools class with common methods for IView2.
- Author:
- Thomas Scheffler (yagee)
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
getFilePath
(String derID, String derPath) static FileSystem
getFileSystem
(Path iviewFile) static int
getImageType
(Path iviewFileRoot, ImageReader imageReader, int zoomLevel, int x, int y) static String
getIView2Property
(String propName) short forMCRIView2Tools
getIView2Property(String, String)
defaultProp = nullstatic String
getIView2Property
(String propName, String defaultProp) short forMCRConfiguration2.getString("MCR.Module-iview2." + propName).orElse(defaultProp);
static String
getSupportedMainFile
(String derivateID) static Path
static ImageReader
static BufferedImage
getZoomLevel
(Path iviewFile, int zoomLevel) combines image tiles of specified zoomLevel to one image.static BufferedImage
getZoomLevel
(Path iviewFileRoot, org.mycore.imagetiler.MCRTiledPictureProps imageProperties, ImageReader reader, int zoomLevel) combines image tiles of specified zoomLevel to one image.static boolean
isCompletelyTiled
(String derivateId) Checks for a given derivate id whether all files in that derivate are tiled.static boolean
isDerivateSupported
(String derivateID) static boolean
isFileSupported
(String filename) static boolean
isFileSupported
(Path file) static BufferedImage
readTile
(Path iviewFileRoot, ImageReader imageReader, int zoomLevel, int x, int y)
-
Field Details
-
CONFIG_PREFIX
- See Also:
-
-
Constructor Details
-
MCRIView2Tools
public MCRIView2Tools()
-
-
Method Details
-
getTileDir
- Returns:
- directory for tiles
-
getSupportedMainFile
- Parameters:
derivateID
- ID of derivate- Returns:
- empty String or absolute path to main file of derivate if file is supported.
-
isDerivateSupported
- Parameters:
derivateID
- ID of derivate- Returns:
- true if
getSupportedMainFile(String)
is not an empty String.
-
isFileSupported
- Parameters:
file
- image file- Returns:
- if content type is in property
MCR.Module-iview2.SupportedContentTypes
- Throws:
IOException
- See Also:
-
isFileSupported
- Returns:
- true if the file is supported, false otherwise
-
isCompletelyTiled
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 filezoomLevel
- the zoom level where 0 is thumbnail size- Returns:
- a combined image
- Throws:
IOException
- any IOException while reading tilesJDOMException
- 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 fileimageProperties
- imageProperties, if available or nullzoomLevel
- the zoom level where 0 is thumbnail size- Returns:
- a combined image
- Throws:
IOException
- any IOException while reading tilesJDOMException
- if image properties could not be parsed.
-
getFileSystem
- Throws:
IOException
-
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
short forMCRIView2Tools
getIView2Property(String, String)
defaultProp = null -
getIView2Property
short forMCRConfiguration2.getString("MCR.Module-iview2." + propName).orElse(defaultProp);
- Parameters:
propName
- any suffix- Returns:
- null or property value
-
getFilePath
- Throws:
IOException
-