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

Compare with Current View Page History

« Previous Version 23 Next »

Contents

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

Exercise outline

The goal of this exercise is to visualize multiple data sets on one map; in the end it should be possible to inspect both the input data and the output data of a volume model in one and the same map view. In this way different data sets can be compared at the same place and for the same modeling time step.

Fixme

Fixme

Fixme

Fixme

Exercise results

[TODO] Description of the exercise results




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