patch for substantial error in computing boundary and home poisition when width is greater that height

This commit is contained in:
thatcher 2012-08-29 20:48:45 -04:00
parent 104a814af0
commit ddedd35db9
8 changed files with 51 additions and 2645 deletions

View File

@ -29,14 +29,15 @@ tiff_list = open( 'tiffs.txt', 'r' )\
.split( '\n' )
for tiff_url in tiff_list:
print tiff_url
parts = re.match(
r'http://lcweb2\.loc\.gov/master/pnp/ppmsca/(\d*)/(\d*)/(\d*)u\.tif',
r'http://lcweb2\.loc\.gov/master/pnp/([a-z0-9]*)/([a-z0-9]*)/([a-z0-9]*)/([a-z0-9]*)u\.tif',
tiff_url
).groups()
id = parts[ 1 ]
fileid = parts[ 2 ]
agg = parts[ 1 ]
id = parts[ 2 ]
fileid = parts[ 3 ]
if id not in PAGE_COUNT:
PAGE_COUNT[ id ] = 0
@ -48,12 +49,12 @@ for tiff_url in tiff_list:
and not os.path.exists( dzi_files ):
print 'making directory: %s' % os.path.dirname( path )
ensure_dir( path )
#ensure_dir( path )
print 'downloading master tiff: %s' % tiff_url
tiff_file = open( path, 'wb' )
tiff_file.write( urllib.urlopen( tiff_url ).read() )
tiff_file.close()
#tiff_file = open( path, 'wb' )
#tiff_file.write( urllib.urlopen( tiff_url ).read() )
#tiff_file.close()
print 'creating dzi: %s' % path
# Create Deep Zoom image pyramid from source

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@
PROJECT: openseadragon
BUILD_MAJOR: 0
BUILD_MINOR: 9
BUILD_ID: 65
BUILD_ID: 66
BUILD: ${PROJECT}.${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_ID}
VERSION: ${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_ID}

View File

@ -1,5 +1,5 @@
/**
* @version OpenSeadragon 0.9.65
* @version OpenSeadragon 0.9.66
*
* @fileOverview
* <h2>
@ -5370,6 +5370,7 @@ $.TileSource.prototype = {
return new $.Rect( px * scale, py * scale, sx * scale, sy * scale );
},
/**
* Responsible for retrieving, and caching the
@ -5962,7 +5963,7 @@ $.LegacyTileSource = function( levels ) {
this.levels = options.levels;
};
$.LegacyTileSource.prototype = {
$.extend( $.LegacyTileSource.prototype, $.TileSource.prototype, {
/**
* Determine if the data and/or url imply the image service is supported by
* this tile source.
@ -6035,18 +6036,6 @@ $.LegacyTileSource.prototype = {
}
},
/**
* @function
* @param {Number} level
*/
getPixelRatio: function( level ) {
var imageSizeScaled = this.dimensions.times( this.getLevelScale( level ) ),
rx = 1.0 / imageSizeScaled.x,
ry = 1.0 / imageSizeScaled.y;
return new $.Point(rx, ry);
},
/**
* @function
* @param {Number} level
@ -6056,28 +6045,6 @@ $.LegacyTileSource.prototype = {
return new $.Point( 0, 0 );
},
/**
* @function
* @param {Number} level
* @param {Number} x
* @param {Number} y
*/
getTileBounds: function( level, x, y ) {
var dimensionsScaled = this.dimensions.times( this.getLevelScale( level ) ),
px = ( x === 0 ) ? 0 : this.levels[ level ].width,
py = ( y === 0 ) ? 0 : this.levels[ level ].height,
sx = this.levels[ level ].width,
sy = this.levels[ level ].height,
scale = 1.0 / ( this.width >= this.height ?
dimensionsScaled.y :
dimensionsScaled.x
);
sx = Math.min( sx, dimensionsScaled.x - px );
sy = Math.min( sy, dimensionsScaled.y - py );
return new $.Rect( px * scale, py * scale, sx * scale, sy * scale );
},
/**
* This method is not implemented by this class other than to throw an Error
@ -6096,24 +6063,8 @@ $.LegacyTileSource.prototype = {
url = this.levels[ level ].url;
}
return url;
},
/**
* @function
* @param {Number} level
* @param {Number} x
* @param {Number} y
*/
tileExists: function( level, x, y ) {
var numTiles = this.getNumTiles( level );
return level >= this.minLevel &&
level <= this.maxLevel &&
x >= 0 &&
y >= 0 &&
x < numTiles.x &&
y < numTiles.y;
}
};
});
/**
* This method removes any files from the Array which dont conform to our
@ -8708,14 +8659,14 @@ $.Viewport.prototype = {
this.contentSize = contentSize;
this.contentAspectX = this.contentSize.x / this.contentSize.y;
this.contentAspectY = this.contentSize.y / this.contentSize.x;
this.fitWidthBounds = new $.Rect( 0, 0, this.contentAspectX, 1 );
this.fitWidthBounds = new $.Rect( 0, 0, 1, this.contentAspectX );
this.fitHeightBounds = new $.Rect( 0, 0, 1, this.contentAspectY );
if( this.contentSize.x <= this.contentSize.y ){
//if( this.contentSize.x <= this.contentSize.y ){
this.homeBounds = this.fitHeightBounds;
} else {
this.homeBounds = this.fitWidthBounds;
}
//} else {
// this.homeBounds = this.fitWidthBounds;
//}
},
/**
@ -8723,10 +8674,8 @@ $.Viewport.prototype = {
*/
getHomeZoom: function() {
var aspectFactor = Math.min(
this.contentAspectX,
this.contentAspectY
) / this.getAspectRatio();
var aspectFactor =
this.contentAspectX / this.getAspectRatio();
return ( aspectFactor >= 1 ) ?
1 :

View File

@ -55,7 +55,7 @@ $.LegacyTileSource = function( levels ) {
this.levels = options.levels;
};
$.LegacyTileSource.prototype = {
$.extend( $.LegacyTileSource.prototype, $.TileSource.prototype, {
/**
* Determine if the data and/or url imply the image service is supported by
* this tile source.
@ -128,18 +128,6 @@ $.LegacyTileSource.prototype = {
}
},
/**
* @function
* @param {Number} level
*/
getPixelRatio: function( level ) {
var imageSizeScaled = this.dimensions.times( this.getLevelScale( level ) ),
rx = 1.0 / imageSizeScaled.x,
ry = 1.0 / imageSizeScaled.y;
return new $.Point(rx, ry);
},
/**
* @function
* @param {Number} level
@ -149,28 +137,6 @@ $.LegacyTileSource.prototype = {
return new $.Point( 0, 0 );
},
/**
* @function
* @param {Number} level
* @param {Number} x
* @param {Number} y
*/
getTileBounds: function( level, x, y ) {
var dimensionsScaled = this.dimensions.times( this.getLevelScale( level ) ),
px = ( x === 0 ) ? 0 : this.levels[ level ].width,
py = ( y === 0 ) ? 0 : this.levels[ level ].height,
sx = this.levels[ level ].width,
sy = this.levels[ level ].height,
scale = 1.0 / ( this.width >= this.height ?
dimensionsScaled.y :
dimensionsScaled.x
);
sx = Math.min( sx, dimensionsScaled.x - px );
sy = Math.min( sy, dimensionsScaled.y - py );
return new $.Rect( px * scale, py * scale, sx * scale, sy * scale );
},
/**
* This method is not implemented by this class other than to throw an Error
@ -189,24 +155,8 @@ $.LegacyTileSource.prototype = {
url = this.levels[ level ].url;
}
return url;
},
/**
* @function
* @param {Number} level
* @param {Number} x
* @param {Number} y
*/
tileExists: function( level, x, y ) {
var numTiles = this.getNumTiles( level );
return level >= this.minLevel &&
level <= this.maxLevel &&
x >= 0 &&
y >= 0 &&
x < numTiles.x &&
y < numTiles.y;
}
};
});
/**
* This method removes any files from the Array which dont conform to our

View File

@ -200,6 +200,7 @@ $.TileSource.prototype = {
return new $.Rect( px * scale, py * scale, sx * scale, sy * scale );
},
/**
* Responsible for retrieving, and caching the

View File

@ -74,14 +74,14 @@ $.Viewport.prototype = {
this.contentSize = contentSize;
this.contentAspectX = this.contentSize.x / this.contentSize.y;
this.contentAspectY = this.contentSize.y / this.contentSize.x;
this.fitWidthBounds = new $.Rect( 0, 0, this.contentAspectX, 1 );
this.fitWidthBounds = new $.Rect( 0, 0, 1, this.contentAspectX );
this.fitHeightBounds = new $.Rect( 0, 0, 1, this.contentAspectY );
if( this.contentSize.x <= this.contentSize.y ){
//if( this.contentSize.x <= this.contentSize.y ){
this.homeBounds = this.fitHeightBounds;
} else {
this.homeBounds = this.fitWidthBounds;
}
//} else {
// this.homeBounds = this.fitWidthBounds;
//}
},
/**
@ -89,10 +89,8 @@ $.Viewport.prototype = {
*/
getHomeZoom: function() {
var aspectFactor = Math.min(
this.contentAspectX,
this.contentAspectY
) / this.getAspectRatio();
var aspectFactor =
this.contentAspectX / this.getAspectRatio();
return ( aspectFactor >= 1 ) ?
1 :

View File

@ -205,3 +205,22 @@ OpenSeadragon({
}
});
</script>
<div class="description">
<h3>Additional Examples</h3>
</div>
<div class="demoarea">
<div class="demoheading">
A very wide image.
</div>
<div id="example-wide-dzi"
class="openseadragon">
<script type="text/javascript">
OpenSeadragon({
id: "example-wide-dzi",
prefixUrl: "/openseadragon",
tileSources: "/openseadragon/examples/images/pnp/pan/6a32000/6a32400/6a32487.dzi"
});
</script>
</div>
</div>