Compare commits

..

No commits in common. "6494b49d6766a07fddf11461be14328c34df1bb9" and "9988fcebc1ff7c7afec96d2a66e91458788eff46" have entirely different histories.

57 changed files with 24 additions and 84 deletions

View File

@ -51,11 +51,8 @@ $.IIIFTileSource = function( options ){
$.extend( true, this, options ); $.extend( true, this, options );
/* Normalizes v3-style 'id' keys to an "_id" internal property */ if ( !( this.height && this.width && this['@id'] ) ) {
this._id = this["@id"] || this["id"] || this['identifier'] || null; throw new Error( 'IIIF required parameters not provided.' );
if ( !( this.height && this.width && this._id) ) {
throw new Error( 'IIIF required parameters (width, height, or id) not provided.' );
} }
options.tileSizePerScaleFactor = {}; options.tileSizePerScaleFactor = {};
@ -150,7 +147,7 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
* this tile source. * this tile source.
* @function * @function
* @param {Object|Array} data * @param {Object|Array} data
* @param {String} [url] - url * @param {String} optional - url
*/ */
supports: function( data, url ) { supports: function( data, url ) {
@ -183,29 +180,23 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
}, },
/** /**
* A static function used to prepare an incoming IIIF Image API info.json
* response for processing by the tile handler. Normalizes data for all
* versions of IIIF (1.0, 1.1, 2.x, 3.x) and returns a data object that
* may be passed to the IIIFTileSource.
* *
* @function * @function
* @static
* @param {Object} data - the raw configuration * @param {Object} data - the raw configuration
* @param {String} url - the url configuration was retrieved from * @param {String} url - the url configuration was retrieved from
* @param {String} postData - HTTP POST data in k=v&k2=v2... form or null * @param {String} postData - HTTP POST data in k=v&k2=v2... form or null
* @return {Object} A normalized IIIF data object * @example <caption>IIIF 1.1 Info Looks like this</caption>
* @example <caption>IIIF 2.x Info Looks like this</caption>
* { * {
* "@context": "http://iiif.io/api/image/2/context.json", * "@context" : "http://library.stanford.edu/iiif/image-api/1.1/context.json",
* "@id": "http://iiif.example.com/prefix/1E34750D-38DB-4825-A38A-B60A345E591C", * "@id" : "http://iiif.example.com/prefix/1E34750D-38DB-4825-A38A-B60A345E591C",
* "protocol": "http://iiif.io/api/image", * "width" : 6000,
* "height": 1024, * "height" : 4000,
* "width": 775, * "scale_factors" : [ 1, 2, 4 ],
* "tiles" : [{"width":256, "scaleFactors":[1,2,4,8]}], * "tile_width" : 1024,
* "profile": ["http://iiif.io/api/image/2/level1.json", { * "tile_height" : 1024,
* "qualities": [ "native", "bitonal", "grey", "color" ], * "formats" : [ "jpg", "png" ],
* "formats": [ "jpg", "png", "gif" ] * "qualities" : [ "native", "grey" ],
* }] * "profile" : "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0"
* } * }
*/ */
configure: function( data, url, postData ){ configure: function( data, url, postData ){
@ -213,13 +204,13 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
if ( !$.isPlainObject(data) ) { if ( !$.isPlainObject(data) ) {
var options = configureFromXml10( data ); var options = configureFromXml10( data );
options['@context'] = "http://iiif.io/api/image/1.0/context.json"; options['@context'] = "http://iiif.io/api/image/1.0/context.json";
options["@id"] = url.replace('/info.xml', ''); options['@id'] = url.replace('/info.xml', '');
options.version = 1; options.version = 1;
return options; return options;
} else { } else {
if ( !data['@context'] ) { if ( !data['@context'] ) {
data['@context'] = 'http://iiif.io/api/image/1.0/context.json'; data['@context'] = 'http://iiif.io/api/image/1.0/context.json';
data["@id"] = url.replace('/info.json', ''); data['@id'] = url.replace('/info.json', '');
data.version = 1; data.version = 1;
} else { } else {
var context = data['@context']; var context = data['@context'];
@ -248,8 +239,10 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
$.console.error('Data has a @context property which contains no known IIIF context URI.'); $.console.error('Data has a @context property which contains no known IIIF context URI.');
} }
} }
if ( !data['@id'] && data['id'] ) {
if (data.preferredFormats) { data['@id'] = data['id'];
}
if(data.preferredFormats) {
for (var f = 0; f < data.preferredFormats.length; f++ ) { for (var f = 0; f < data.preferredFormats.length; f++ ) {
if ( OpenSeadragon.imageFormatSupported(data.preferredFormats[f]) ) { if ( OpenSeadragon.imageFormatSupported(data.preferredFormats[f]) ) {
data.tileFormat = data.preferredFormats[f]; data.tileFormat = data.preferredFormats[f];
@ -438,7 +431,7 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
iiifSize = iiifSizeW + ","; iiifSize = iiifSizeW + ",";
} }
} }
uri = [ this._id, iiifRegion, iiifSize, IIIF_ROTATION, iiifQuality ].join( '/' ); uri = [ this['@id'], iiifRegion, iiifSize, IIIF_ROTATION, iiifQuality ].join( '/' );
return uri; return uri;
}, },
@ -489,7 +482,7 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
var levels = []; var levels = [];
for(var i = 0; i < options.sizes.length; i++) { for(var i = 0; i < options.sizes.length; i++) {
levels.push({ levels.push({
url: options._id + '/full/' + options.sizes[i].width + ',' + url: options['@id'] + '/full/' + options.sizes[i].width + ',' +
(options.version === 3 ? options.sizes[i].height : '') + (options.version === 3 ? options.sizes[i].height : '') +
'/0/default.' + options.tileFormat, '/0/default.' + options.tileFormat,
width: options.sizes[i].width, width: options.sizes[i].width,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 678 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

View File

@ -1,15 +0,0 @@
{
"@context": "http://iiif.io/api/image/3/context.json",
"id": "http://localhost:8000/test/data/iiif_3_0_sizes",
"protocol": "http://iiif.io/api/image",
"width": 6976,
"height": 5074,
"profile": "level0",
"sizes" : [
{"width" : 400, "height" : 291},
{"width" : 800, "height" : 582},
{"width" : 1600, "height" : 1164},
{"width" : 3200, "height": 2328},
{"width" : 6976, "height": 5074}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 716 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 712 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 633 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 663 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 675 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 683 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

View File

@ -1,11 +0,0 @@
{
"@context": "http://iiif.io/api/image/3/context.json",
"id": "http://localhost:8000/test/data/iiif_3_0_tiled",
"protocol": "http://iiif.io/api/image",
"height": 1024,
"width": 775,
"tiles" : [{"width":256, "scaleFactors":[1,2,4,8]}],
"profile": "level2",
"extraQualities": ["bitonal", "grey", "color"],
"extraFormats": ["jpg", "png", "gif" ]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 716 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 712 B

View File

@ -1,11 +0,0 @@
{
"@context": "http://iiif.io/api/image/3/context.json",
"id": "http://localhost:8000/test/data/iiif_3_0_tiled_sf1",
"protocol": "http://iiif.io/api/image",
"height": 1024,
"width": 775,
"tiles" : [{"width": 256, "scaleFactors": [1]}],
"profile": "level2",
"extraQualities": ["bitonal", "grey", "color"],
"extraFormats": ["jpg", "png", "gif" ]
}

View File

@ -151,20 +151,6 @@
'}', assert); '}', assert);
}); });
QUnit.test('IIIF 3.0 JSON', function(assert) {
testOpenUrl('iiif_3_0_tiled/info.json', assert);
});
// ----------
QUnit.test('IIIF 3.0 JSON scaleFactors [1]', function(assert) {
testOpenUrl('iiif_3_0_tiled_sf1/info.json', assert);
});
// ----------
QUnit.test('IIIF 3.0 JSON, sizes array only', function(assert) {
testOpenUrl('iiif_3_0_sizes/info.json', assert);
});
// ---------- // ----------
QUnit.test('ImageTileSource', function(assert) { QUnit.test('ImageTileSource', function(assert) {
testOpen({ testOpen({

View File

@ -143,9 +143,7 @@
"profile": "level1" "profile": "level1"
}; };
QUnit.module('IIIF'); QUnit.test('IIIFTileSource.configure determins correct version', function(assert) {
QUnit.test('IIIFTileSource.configure determines correct version', function(assert) {
var options1_0xml = configure(infoXml10level0); var options1_0xml = configure(infoXml10level0);
assert.ok(options1_0xml.version); assert.ok(options1_0xml.version);
assert.equal(options1_0xml.version, 1, 'Version is 1 for version 1.0 info.xml'); assert.equal(options1_0xml.version, 1, 'Version is 1 for version 1.0 info.xml');

View File

@ -26,7 +26,6 @@
<script src="/test/modules/basic.js"></script> <script src="/test/modules/basic.js"></script>
<script src="/test/modules/strings.js"></script> <script src="/test/modules/strings.js"></script>
<script src="/test/modules/formats.js"></script> <script src="/test/modules/formats.js"></script>
<script src="/test/modules/iiif.js"></script>
<script src="/test/modules/utils.js"></script> <script src="/test/modules/utils.js"></script>
<script src="/test/modules/events.js"></script> <script src="/test/modules/events.js"></script>
<script src="/test/modules/units.js"></script> <script src="/test/modules/units.js"></script>
@ -47,6 +46,7 @@
<script src="/test/modules/ajax-tiles.js"></script> <script src="/test/modules/ajax-tiles.js"></script>
<script src="/test/modules/ajax-post-data.js"></script> <script src="/test/modules/ajax-post-data.js"></script>
<script src="/test/modules/imageloader.js"></script> <script src="/test/modules/imageloader.js"></script>
<script src="/test/modules/iiif.js"></script>
<!--The navigator tests are the slowest (for now; hopefully they can be sped up) <!--The navigator tests are the slowest (for now; hopefully they can be sped up)
so we put them last. --> so we put them last. -->
<script src="/test/modules/navigator.js"></script> <script src="/test/modules/navigator.js"></script>