Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version

Silverlight Database Deep Zoom

, 26 Mar 2009 CPOL
The article describes how to create a Deep Zoom image and store the tiles in a database, and how to read the image from the database and display it in the browser.
DatabaseDeepZoom.zip
DatabaseDeepZoom.root
DatabaseDeepZoom
DatabaseDeepZoom.csproj.user
Properties
Settings.settings
Search Image.ico
DbDzComposer
Properties
scopeDbDz.csproj.user
DeepZoomSilverlightProject
DeepZoomSilverlightProject.csproj.user
fullscreen_hover.png
fullscreen_pressed.png
fullscreen_rest.png
home_hover.png
home_pressed.png
home_rest.png
Properties
Service References
ImageListClient
configuration.svcinfo
configuration91.svcinfo
DeepZoomSilverlightProject.ImageListClient.ImageInfo.datasource
ImageListService.disco
ImageListService.wsdl
ImageListService1.wsdl
Reference.svcmap
ServiceReferences.ClientConfig
zoomin_hover.png
zoomin_pressed.png
zoomin_rest.png
zoomout_hover.png
zoomout_pressed.png
zoomout_rest.png
DeepZoomSilverlightWeb
App_Data
DeepZoom.mdb
bin
de
es
fr
it
ja
ko
zh-Hans
zh-Hant
ClientBin
DeepZoomSilverlightProject.xap
DeepZoomSilverlightWeb.csproj.user
ImageListService.svc
Properties
// 
// This source code is licensed for commercial and non-commercial use under the 
// Code Project Open License (CPOL) 1.02  http://www.codeproject.com/info/cpol10.aspx
// Developer: Joerg Lang (lang.joerg@gmail.com)
//  
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;

namespace DbDzComposer
{
    /// <summary>
    /// This abstract class defines the interfaces a concrete class must define to save to a database
    /// </summary>
    public abstract class IDzDbPersistance
    {
        /// <summary>
        /// Gets or sets the db connection.
        /// </summary>
        /// <value>The db connection.</value>
        public abstract IDbConnection DbConnection { get; set; }

        /// <summary>
        /// Saves some basic information about the image.
        /// </summary>
        /// <param name="imageName">Name of the image.</param>
        /// <param name="width">The widht.</param>
        /// <param name="height">The height.</param>
        /// <param name="tileSize">Size of the tile.</param>
        /// <param name="overlap">The overlap.</param>
        /// <param name="mimeType">The mime type of the tiles</param>
        /// <param name="thumbnail">A Thumbnail preview</param>
        /// <returns></returns>
        public abstract int SaveImageInfo(string imageName, int width, int height, int tileSize, int overlap,
                                          string mimeType, Bitmap thumbnail);

        /// <summary>
        /// Gets a list with the information about the images.
        /// </summary>
        /// <param name="fromUri">The Uri from which the call is made.</param>
        /// <returns></returns>
        public abstract List<ImageInfo> GetImageInfo(Uri fromUri);

        /// <summary>
        /// Saves one image tile to a image that was created before using the SaveImageInfo method.
        /// </summary>
        /// <param name="imageId">The image id.</param>
        /// <param name="level">The level.</param>
        /// <param name="x">The x.</param>
        /// <param name="y">The y.</param>
        /// <param name="bitmap">The bitmap.</param>
        public abstract void SaveImageTile(int imageId, int level, int x, int y, Bitmap bitmap);

        /// <summary>
        /// Gets the image tile requested by the level, and the x and y coordinates for a specific image.
        /// </summary>
        /// <param name="imageId">The image id.</param>
        /// <param name="level">The level.</param>
        /// <param name="x">The x.</param>
        /// <param name="y">The y.</param>
        /// <returns></returns>
        public abstract Bitmap GetImageTile(int imageId, int level, int x, int y);

        /// <summary>
        /// Gets the thumbnail for a specifig image
        /// </summary>
        /// <param name="imageId">The image id.</param>
        /// <returns></returns>
        public abstract Bitmap GetThumbnail(int imageId);
    }

    /// <summary>
    /// A simple class that allows us to return the information about an image 
    /// </summary>
    public class ImageInfo
    {
        public int ImageId { get; set; }
        public string ImageName { get; set; }
        public int Width { get; set; }
        public int Height { get; set; }
        public int TileSize { get; set; }
        public int Overlap { get; set; }
        public string MimeType { get; set; }
        public string ThumbnailUrl { get; set; }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Joerg Lang
CEO
Switzerland Switzerland
I have my own software company called Evelix (www.evelix.ch). The company is located in Liestal, Switzerland. I develop software for the web and the desktop. Every now and then I give computer classes in a learning institution.
 
I was born in 1966, am married and have one kid. Hobbies are Fasnacht (www.bmg.bs), skiing and of course computers.
 
Actually I studied mechanical engineering and have a bachelors degree in it, but computers interested me since I had a Commodore C128. In the meantime my mobile has a thousand times more memory than my computers back then. First I started programming in Basic. After that I did use Pascal for a while, but the real (commercial) programming started with VB3. Now I do programming in C# and sometimes still in VB6 when I have to support an older application.
 
Currently I'm working towards my Microsoft Certified Trainer status.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141220.1 | Last Updated 26 Mar 2009
Article Copyright 2009 by Joerg Lang
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid