You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

The root page TOOLS:Tutorial could not be found in space Delta Shell.


1. Create a new class named "DemoAppMapLayerProvider"

2. Add the following contents to this class:

using System.Collections.Generic;
using System.Linq;
using DelftTools.Shell.Gui;
using DeltaShell.Plugin.DemoApp.Models;
using SharpMap.Api.Layers;
using SharpMap.Layers;

namespace DeltaShell.Plugin.DemoApp
{
    public class DemoAppMapLayerProvider : IMapLayerProvider
    {
        public ILayer CreateLayer(object data, object parentData)
        {
            var myModel = data as VolumeModel;
            if (myModel != null)
            {
                return new GroupLayer(myModel.Name);
            }

            return null;
        }

        public bool CanCreateLayerFor(object data, object parentData)
        {
            return data is VolumeModel;
        }

        public IEnumerable<object> ChildLayerObjects(object data)
        {
            var myModel = data as VolumeModel;
            if (myModel != null)
            {
                return myModel.DataItems.Select(d => d.Value);
            }

            return Enumerable.Empty<object>();
        }
    }
}

3. Register the map layer provider in the gui plugin class by adding the following code to DemoAppGuiPlugin:

        public override IMapLayerProvider MapLayerProvider
        {
            get { return new DemoAppMapLayerProvider(); }
        }

4. Run the application and create a volume model: a dialog to select a view for the volume model will automatically be opened Image Select Central map


  • No labels