Ejemplo n.º 1
0
        public void Add(IGISFeature feature)
        {
            if (feature == null)
            {
                throw new ArgumentNullException("feature", "A valid feature is required to be added.");
            }

            if (_features == null)
            {
                throw new NullReferenceException("Cannot add feature to the InMemoryLayer. The internal list reference is NULL.");
            }

            if (FindByKeyValue(_features, feature.Attributes.GetValue(KeyFieldName)) != null)
            {
                throw new ArgumentException("Cannot add feature. A feature with the same key already exists.");
            }

            InMemoryGISFeature newFeature = CreateFeature();

            _features.Add(newFeature);

            newFeature.Shape = feature.Shape;

            foreach (string key in feature.Attributes.GetKeys())
            {
                newFeature.Attributes.SetValue(key, feature.Attributes.GetValue(key));
            }
        }
Ejemplo n.º 2
0
 public bool MoveNext()
 {
     if (++_index >= _features.Count)
     {
         return(false);
     }
     else
     {
         _current = _features[_index];
         return(true);
     }
 }
Ejemplo n.º 3
0
        public void Delete(IGISFeature feature)
        {
            if (feature == null)
            {
                throw new ArgumentNullException("feature", "A valid feature is required to be added.");
            }

            if (_features == null)
            {
                throw new NullReferenceException("Cannot delete feature from the InMemoryLayer. The internal list reference is NULL.");
            }

            InMemoryGISFeature mc = FindByKeyValue(_features, feature.Attributes.GetValue(KeyFieldName));

            if (mc != null)
            {
                _features.Remove(mc);
            }
        }
Ejemplo n.º 4
0
 public bool MoveNext()
 {
     if (++_index >= _features.Count)
     {
         return false;
     }
     else
     {
         _current = _features[_index];
         return true;
     }
 }