Package org.dspace.app.iiif.service
Class CanvasService
java.lang.Object
org.dspace.app.iiif.service.AbstractResourceService
org.dspace.app.iiif.service.CanvasService
This service provides methods for creating
Canvases. There should be a single instance of
this service per request. The @RequestScope provides a single instance created and available during
complete lifecycle of the HTTP request.- Author:
- Michael Spalti mspalti@willamette.edu, Andrea Bollini (andrea.bollini at 4science.it)
-
Field Summary
FieldsFields inherited from class org.dspace.app.iiif.service.AbstractResourceService
BITSTREAM_PATH_PREFIX, CLIENT_URL, DEFAULT_CANVAS_HEIGHT, DEFAULT_CANVAS_WIDTH, defaultCanvasHeightFallback, defaultCanvasWidthFallback, DOCUMENT_VIEWING_HINT, IIIF_ENDPOINT, IIIF_LOGO_IMAGE, IMAGE_PATH, IMAGE_SERVICE, SEARCH_URL, THUMBNAIL_PATH -
Constructor Summary
ConstructorsConstructorDescriptionCanvasService(org.dspace.services.ConfigurationService configurationService) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected CanvasGeneratorgetCanvas(Context context, String manifestId, Bitstream bitstream, Bundle bundle, Item item, int count, String mimeType) Creates a singleCanvasGenerator.protected CanvasGeneratorgetRangeCanvasReference(String startCanvas) Ranges expect the Canvas object to have only an identifier.protected voidguessCanvasDimensions(Context context, List<Bundle> bundles) Checks for "iiif.image.width" metadata in IIIF bundles.Methods inherited from class org.dspace.app.iiif.service.AbstractResourceService
getManifestId, setConfiguration, setDefaultCanvasDimensions
-
Field Details
-
BITSTREAM_METADATA_FIELDS
-
-
Constructor Details
-
CanvasService
public CanvasService(org.dspace.services.ConfigurationService configurationService) Constructor.- Parameters:
configurationService- the DSpace configuration service.
-
-
Method Details
-
guessCanvasDimensions
Checks for "iiif.image.width" metadata in IIIF bundles. When bitstream metadata is not found for the first image in the bundle this method updates the default canvas dimensions for the request based on the actual image dimensions, using the IIIF image service. Called once for each manifest.- Parameters:
bundles- IIIF bundles for this item
-
getCanvas
protected CanvasGenerator getCanvas(Context context, String manifestId, Bitstream bitstream, Bundle bundle, Item item, int count, String mimeType) Creates a singleCanvasGenerator.- Parameters:
context- DSpace ContextmanifestId- manifest idbitstream- DSpace bitstreambundle- DSpace bundleitem- DSpace itemcount- the canvas position in the sequence.mimeType- bitstream mimetype- Returns:
- a canvas generator
-
getRangeCanvasReference
Ranges expect the Canvas object to have only an identifier.- Parameters:
startCanvas- the start canvas identifier- Returns:
- canvas generator
-