mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-02-21 09:13:14 +03:00
refs #54 - added missing support for tilesource configuration as xml string or json string via Viewer.open
This commit is contained in:
parent
86f101f02c
commit
9aecfddcbf
@ -216,6 +216,7 @@ function configureFromXML( tileSource, xmlDoc ){
|
|||||||
configuration = {
|
configuration = {
|
||||||
Image: {
|
Image: {
|
||||||
xmlns: "http://schemas.microsoft.com/deepzoom/2008",
|
xmlns: "http://schemas.microsoft.com/deepzoom/2008",
|
||||||
|
Url: root.getAttribute( "Url" ),
|
||||||
Format: root.getAttribute( "Format" ),
|
Format: root.getAttribute( "Format" ),
|
||||||
DisplayRect: null,
|
DisplayRect: null,
|
||||||
Overlap: parseInt( root.getAttribute( "Overlap" ), 10 ),
|
Overlap: parseInt( root.getAttribute( "Overlap" ), 10 ),
|
||||||
@ -315,8 +316,6 @@ function configureFromObject( tileSource, configuration ){
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
delete configuration.Image;
|
|
||||||
|
|
||||||
return $.extend(true, {
|
return $.extend(true, {
|
||||||
width: width, /* width *required */
|
width: width, /* width *required */
|
||||||
height: height, /* height *required */
|
height: height, /* height *required */
|
||||||
|
@ -413,7 +413,7 @@ function processResponse( xhr ){
|
|||||||
* @eprivate
|
* @eprivate
|
||||||
* @inner
|
* @inner
|
||||||
* @function
|
* @function
|
||||||
* @param {Object|Array} data - the tile source configuration object
|
* @param {Object|Array|Document} data - the tile source configuration object
|
||||||
* @param {String} url - the url where the tile source configuration object was
|
* @param {String} url - the url where the tile source configuration object was
|
||||||
* loaded from, if any.
|
* loaded from, if any.
|
||||||
*/
|
*/
|
||||||
|
@ -309,18 +309,24 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
$TileSource,
|
$TileSource,
|
||||||
options;
|
options;
|
||||||
|
|
||||||
|
//allow plain xml strings or json strings to be parsed here
|
||||||
|
if( $.type( tileSource ) == 'string' ){
|
||||||
|
if( tileSource.match(/\s*<.*/) ){
|
||||||
|
tileSource = $.parseXml( tileSource );
|
||||||
|
}else if( tileSource.match(/\s*[\{\[].*/) ){
|
||||||
|
/*jshint evil:true*/
|
||||||
|
tileSource = eval( '('+tileSource+')' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
if ( $.type( tileSource ) == 'string') {
|
if ( $.type( tileSource ) == 'string') {
|
||||||
//TODO: We cant assume a string implies a dzi since all
|
//If its still a string it means it must be a url at this point
|
||||||
//complete TileSource implementations should have a getInfo
|
|
||||||
//which allows them to be configured via AJAX. Im not sure
|
|
||||||
//if its better to use file extension or url pattern, or to
|
|
||||||
//inspect the resulting info object.
|
|
||||||
tileSource = new $.TileSource( tileSource, function( readySource ){
|
tileSource = new $.TileSource( tileSource, function( readySource ){
|
||||||
openTileSource( _this, readySource );
|
openTileSource( _this, readySource );
|
||||||
});
|
});
|
||||||
|
|
||||||
} else if ( $.isPlainObject( tileSource ) ){
|
} else if ( $.isPlainObject( tileSource ) || tileSource.nodeType ){
|
||||||
if( $.isFunction( tileSource.getTileUrl ) ){
|
if( $.isFunction( tileSource.getTileUrl ) ){
|
||||||
//Custom tile source
|
//Custom tile source
|
||||||
customTileSource = new $.TileSource(tileSource);
|
customTileSource = new $.TileSource(tileSource);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user