Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note

In order to successfully build the code below, references need to be added to:

  • GeoAPI
  • GeoAPI.Extensions
  • NetTopologySuite.Extensions
  • SharpMap
  • SharpMap.API

These Dlls can all be found in the packages folder of the solution (D:\VolumeModel\packages\DeltaShell.Framework.1.1.1.34867\lib\net40\DeltaShell). After adding the references be sure to set the copylocal property of the references to false to prevent duplication of dlls in the bin folder.

Code Block
using System.Collections.Generic;
using System.ComponentModel;
using DelftTools.Utils.Collections;
using DelftTools.Utils.Collections.Generic;
using GeoAPI.CoordinateSystems;
using GeoAPI.Extensions.Feature;
namespace DeltaShell.Plugins.VolumeModel.Models
{
    public class DrainageBasin : INotifyPropertyChanged, INotifyCollectionChanged
    {
        private ICoordinateSystem coordinateSystem;
        private readonly IEventedList<IFeature> catchments;
        public DrainageBasin()
        {
            catchments = new EventedList<IFeature>();
            catchments.CollectionChanged += (s, e) =>
                {
                    if (CollectionChanged != null)
                    {
                        CollectionChanged(s, e);
                    }
                };
        }
        public ICoordinateSystem CoordinateSystem
        {
            get { return coordinateSystem; }
            set
            {
                coordinateSystem = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("CoordinateSystem"));
                }
            }
        }
        public IList<IFeature> Catchments
        {
            get { return catchments; }
        }
        public event PropertyChangedEventHandler PropertyChanged;
        public event NotifyCollectionChangedEventHandler CollectionChanged;
    }
}

 

 

Now also add VolumeModel.cs to the Models folder and add the following code:

...