Contents
Exercise outline
The goal of this exercise is to visualize multiple data sets on one single map; doing so, different data sets can be compared at the same geospatial position(s) for the same modeling time step(s).
As an example, after this exercise it should be possible to show both the input data and the output data of a volume model in one and the same map view.
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