1// Name: Seadragon.Seadragon.TileSource.debug.js 2// Assembly: AjaxControlToolkit 3// Version: 4.5.7.1213 4// FileVersion: 4.5.7.1213 5// (c) 2010 CodePlex Foundation 6Type.registerNamespace('Sys.Extended.UI.Seadragon'); 7 8 9Sys.Extended.UI.Seadragon.TileSource = function(width, height, tileSize, tileOverlap, minLevel, maxLevel) { 10 this.aspectRatio = width / height; 11 this.dimensions = new Sys.Extended.UI.Seadragon.Point(width, height); 12 this.minLevel = minLevel ? minLevel : 0; 13 this.maxLevel = maxLevel ? maxLevel : 14 Math.ceil(Math.log(Math.max(width, height)) / Math.log(2)); 15 this.tileSize = tileSize ? tileSize : 0; 16 this.tileOverlap = tileOverlap ? tileOverlap : 0; 17}; 18Sys.Extended.UI.Seadragon.TileSource.prototype = { 19 getLevelScale: function(level) { 20 return 1 / (1 << (this.maxLevel - level)); 21 }, 22 23 getNumTiles: function(level) { 24 var scale = this.getLevelScale(level); 25 var x = Math.ceil(scale * this.dimensions.x / this.tileSize); 26 var y = Math.ceil(scale * this.dimensions.y / this.tileSize); 27 28 return new Sys.Extended.UI.Seadragon.Point(x, y); 29 }, 30 31 getPixelRatio: function(level) { 32 var imageSizeScaled = this.dimensions.times(this.getLevelScale(level)); 33 var rx = 1.0 / imageSizeScaled.x; 34 var ry = 1.0 / imageSizeScaled.y; 35 36 return new Sys.Extended.UI.Seadragon.Point(rx, ry); 37 }, 38 39 getTileAtPoint: function(level, point) { 40 var pixel = point.times(this.dimensions.x).times(this.getLevelScale(level)); 41 42 var tx = Math.floor(pixel.x / this.tileSize); 43 var ty = Math.floor(pixel.y / this.tileSize); 44 45 return new Sys.Extended.UI.Seadragon.Point(tx, ty); 46 }, 47 48 getTileBounds: function(level, x, y) { 49 var dimensionsScaled = this.dimensions.times(this.getLevelScale(level)); 50 51 var px = (x === 0) ? 0 : this.tileSize * x - this.tileOverlap; 52 var py = (y === 0) ? 0 : this.tileSize * y - this.tileOverlap; 53 54 var sx = this.tileSize + (x === 0 ? 1 : 2) * this.tileOverlap; 55 var sy = this.tileSize + (y === 0 ? 1 : 2) * this.tileOverlap; 56 57 sx = Math.min(sx, dimensionsScaled.x - px); 58 sy = Math.min(sy, dimensionsScaled.y - py); 59 60 var scale = 1.0 / dimensionsScaled.x; 61 return new Sys.Extended.UI.Seadragon.Rect(px * scale, py * scale, sx * scale, sy * scale); 62 }, 63 64 getTileUrl: function(level, x, y) { 65 throw new Error("Method not implemented."); 66 }, 67 68 tileExists: function(level, x, y) { 69 var numTiles = this.getNumTiles(level); 70 return level >= this.minLevel && level <= this.maxLevel && 71 x >= 0 && y >= 0 && x < numTiles.x && y < numTiles.y; 72 } 73}; 74Sys.Extended.UI.Seadragon.TileSource.registerClass('Sys.Extended.UI.Seadragon.TileSource', null, Sys.IDisposable);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.