-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathopenseadragon-topview.js
More file actions
46 lines (32 loc) · 1014 Bytes
/
openseadragon-topview.js
File metadata and controls
46 lines (32 loc) · 1014 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* Topview
*/
(function($) {
$.TopviewTileSource = function( options ) {
OpenSeadragon.TileSource.apply( this, [options] );
};
$.extend($.TopviewTileSource.prototype, $.TileSource.prototype, {
supports: function( data, url ) {
var test = url.match( /topview.json/ ) != null;
return( test );
},
configure: function( data, url ) {
var options = {};
var topview = data.topviews[0];
options.tilesUrl = "https://search.arch.be" + data.config.tileurl_v2.replace( '{file}', topview.filepath );
options.width = topview.width;
options.height = topview.height;
options.tileWidth = topview.tileWidth;
options.tileHeight = topview.tileHeight;
options.minLevel = 0;
options.maxLevel = topview.layers.length - 1;
options.layers = topview.layers;
return options;
},
getTileUrl: function( level, x, y ) {
var layer = this.layers[ level ];
var tile = layer.starttile + y * layer.cols + x;
return( this.tilesUrl.replace( '{tile}', tile ) );
}
});
}(OpenSeadragon));