Class: GeoblacklightAdmin::ItemViewer

Inherits:
Object
  • Object
show all
Defined in:
app/services/geoblacklight_admin/item_viewer.rb

Instance Method Summary collapse

Constructor Details

#initialize(references) ⇒ ItemViewer

Returns a new instance of ItemViewer.



5
6
7
8
# File 'app/services/geoblacklight_admin/item_viewer.rb', line 5

def initialize(references)
  @references = references
  @keys = references.keys.collect { |k| reference_uri_2_key(k) }
end

Instance Method Details

#reference_uri_2_key(value) ⇒ Object



18
19
20
# File 'app/services/geoblacklight_admin/item_viewer.rb', line 18

def reference_uri_2_key(value)
  Geoblacklight::Constants::URI.key(value)
end

#viewer_endpointObject



14
15
16
# File 'app/services/geoblacklight_admin/item_viewer.rb', line 14

def viewer_endpoint
  @references[viewer_protocol_2_endpoint]
end

#viewer_preferenceObject



26
27
28
29
# File 'app/services/geoblacklight_admin/item_viewer.rb', line 26

def viewer_preference
  [:cog, :pmtiles, :oembed, :index_map, :tilejson, :xyz, :wmts, :tms, :wms, :iiif_manifest, :iiif, :tiled_map_layer, :dynamic_map_layer,
    :image_map_layer, :feature_layer]
end

#viewer_protocolObject



10
11
12
# File 'app/services/geoblacklight_admin/item_viewer.rb', line 10

def viewer_protocol
  viewer_preference.find { |vp| @keys.include?(vp) } || :map
end

#viewer_protocol_2_endpointObject



22
23
24
# File 'app/services/geoblacklight_admin/item_viewer.rb', line 22

def viewer_protocol_2_endpoint
  Geoblacklight::Constants::URI[viewer_protocol]
end