Ejemplo n.º 1
0
        /// <summary>Конструктор</summary>
        /// <param name="layer">Слой</param>
        /// <param name="nid">Ключ</param>
        /// <param name="type">Тип</param>
        /// <param name="nParts">Список частей</param>
        /// <param name="nFieldValues">Список значений полей</param>
        /// <param name="nStyle">Стили</param>
        internal Feature(MiLayer layer, int nid, FeatureType type, List <List <Vertex> > nParts,
                         IReadOnlyList <string> nFieldValues, IReadOnlyDictionary <string, string> nStyle)
        {
            Id     = nid;
            Handle = MiApi.mitab_c_create_feature(layer.Handle, (int)type);
            Layer  = layer;
            Type   = type;
            Parts  = new Parts(this, nParts);
            if (nStyle != null)
            {
                SetStyle(nStyle);
            }
            if (nFieldValues != null)
            {
                for (var i = 0; i < nFieldValues.Count; i++)
                {
                    MiApi.mitab_c_set_field(Handle, i, nFieldValues[i]);
                }
            }
            var res = MiApi.mitab_c_write_feature(layer.Handle, Handle);

            if (res.ToInt32() == 1)
            {
                MiApi.mitab_c_destroy_feature(Handle);
            }
            else
            {
                throw new Exception("Ошибка создания Feature"); //
            }
        }
Ejemplo n.º 2
0
 /// <inheritdoc />
 public void Dispose(bool disposing)
 {
     if (disposing && !disposed)
     {
         MiApi.mitab_c_destroy_feature(this.Handle);
         disposed = true;
     }
 }
Ejemplo n.º 3
0
 /// <summary>Освобождаем ресурсы</summary>
 /// <param name="disposing"></param>
 public void Dispose(bool disposing)
 {
     if (!disposing || _disposed)
     {
         return;
     }
     MiApi.mitab_c_destroy_feature(Handle);
     _disposed = true;
 }