Class: IIIFManifest::ManifestBuilder::ImageBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/iiif_manifest/manifest_builder/image_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(display_image, iiif_annotation_factory:, resource_builder_factory:) ⇒ ImageBuilder

Returns a new instance of ImageBuilder.



5
6
7
8
9
10
# File 'lib/iiif_manifest/manifest_builder/image_builder.rb', line 5

def initialize(display_image, iiif_annotation_factory:, resource_builder_factory:)
  @display_image = display_image
  @iiif_annotation_factory = iiif_annotation_factory
  @resource_builder_factory = resource_builder_factory
  build_resource
end

Instance Attribute Details

#display_imageObject (readonly)

Returns the value of attribute display_image.



4
5
6
# File 'lib/iiif_manifest/manifest_builder/image_builder.rb', line 4

def display_image
  @display_image
end

#iiif_annotation_factoryObject (readonly)

Returns the value of attribute iiif_annotation_factory.



4
5
6
# File 'lib/iiif_manifest/manifest_builder/image_builder.rb', line 4

def iiif_annotation_factory
  @iiif_annotation_factory
end

#resource_builder_factoryObject (readonly)

Returns the value of attribute resource_builder_factory.



4
5
6
# File 'lib/iiif_manifest/manifest_builder/image_builder.rb', line 4

def resource_builder_factory
  @resource_builder_factory
end

Instance Method Details

#apply(canvas) ⇒ Object



12
13
14
15
16
17
# File 'lib/iiif_manifest/manifest_builder/image_builder.rb', line 12

def apply(canvas)
  annotation['on'] = canvas['@id']
  canvas['width'] = annotation.resource['width']
  canvas['height'] = annotation.resource['height']
  canvas.images += [annotation]
end