/// <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"); // } }