Jeff's Junk

The sillynonsense and .NET musings of Jeff Putz

News

My Sites

Deep Zoom... so close!

I've been trying to put together a couple of articles on rolling your own Deep Zoom viewer, fed by a database with images all cut up for you. The image cutting I've got, the data I've got... but the MultiScaleImage control is not working as expected.

There are a couple of articles out there already that describe how to feed custom data to the control about image locations. Here's my version:

    public class ViewerSource : MultiScaleTileSource {
        public ViewerSource(int imageWidth, int imageHeight, int tileSize, int overlap, int imageID) : base(imageWidth, imageHeight, tileSize, tileSize, overlap)
        {
            ImageID = imageID;
        }

        public int ImageID { get; private set; }

        protected override void GetTileLayers(int tileLevel, int tilePositionX, int tilePositionY, System.Collections.Generic.IList<object> tileImageLayerSources)
        {
            string source = String.Format("http://localhost:2974/TileHandler.ashx?id={0}&level={1}&x={2}&y={3}", ImageID, tileLevel, tilePositionX, tilePositionY);
            Uri uri = new Uri(source, UriKind.Absolute);
            tileImageLayerSources.Add(uri);
        }
    }

If I step through the code, I can see that it's getting the URL's for the images right (I can cut and paste and see they work), but the requests are never made for them. In the constructor for the XAML page, I use this:

ViewerSource source = new ViewerSource(4372, 2906, 256, 0, 6);
msi.Source = source;

... where msi is the MultiScaleImage. For some reason, no go. Interestingly enough, when I put a break point on the .Add(uri), the IList<object> is empty, which doesn't seem right.

This is frustrating the heck out of me, because I feel like I'm pretty close. Does anyone else have experience with this? If I can't make it work, it might be an interesting exercise to try and do it in Javascript since I have the tile part all figured out.

Comments

Shaun said:

Try passing 1 for the overlap instead of 0

# October 15, 2008 9:29 AM

Shaun said:

Sorry, disregard my previous comment...It appears that you are passing 0 for the tile height.

# October 15, 2008 9:32 AM

Jeff said:

But the images do not overlap. That wasn't the issue. The issues is still not clear, actually. It just started working the next day.

# October 15, 2008 9:35 AM

Jeff said:

No, it wasn't that either. The constructor was my own, and correct.

# October 15, 2008 9:40 AM

Community Blogs said:

In this issue: Rich Griffin, Martin Mihaylov, Tim Heuer, Jafar Husain, Jeff Prosise, Mike Snow, Jeff

# November 4, 2008 6:28 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)