public virtual Vertex this[int index] { get { return(index < Count?CreateVertex( MiApi.mitab_c_get_vertex_x(Part.Feature.Handle, Part.Index, index), MiApi.mitab_c_get_vertex_y(Part.Feature.Handle, Part.Index, index)) : null); } }
public virtual Topology.Geometries.Coordinate this[int index] { get { return(index < Count ? new Topology.Geometries.Coordinate(MiApi.mitab_c_get_vertex_x(Part.Feature.Handle, Part.Index, index), MiApi.mitab_c_get_vertex_y(Part.Feature.Handle, Part.Index, index)) : null); } }
public void Dispose(bool disposing) { if (disposing && !disposed) { MiApi.mitab_c_destroy_feature(this.Handle); disposed = true; } }
protected internal Feature(Layer layer, int featureId) { this.Id = featureId; this.Layer = layer; this.Handle = MiApi.mitab_c_read_feature(layer.Handle, featureId); this.Type = MiApi.mitab_c_get_type(Handle); this.Parts = CreateParts(this); }
protected internal Fields(Layer layer) : base(MiApi.mitab_c_get_field_count(layer.Handle)) { fields = new Field[Count]; for (int i = 0; i < Count; i++) { fields[i] = CreateField(layer, i); } }
protected internal Field(Layer layer, int i) { this.Layer = layer; this.Index = i; this.Name = MiApi.mitab_c_get_field_name(layer.Handle, i); this.Type = MiApi.mitab_c_get_field_type(layer.Handle, i); this.Precision = (short)MiApi.mitab_c_get_field_precision(layer.Handle, i); this.Width = MiApi.mitab_c_get_field_width(layer.Handle, i); }
protected internal Layer(string fileName) { this.Handle = MiApi.mitab_c_open(fileName); if (this.Handle == IntPtr.Zero) { throw new FileNotFoundException("File " + fileName + " not found", fileName); } this.Fields = CreateFields(); this.Features = CreateFeatures(); this.FileName = fileName; }
protected internal DataValues(Feature feature) : base(MiApi.mitab_c_get_field_count(feature.Layer.Handle)) { Values = new object[Count]; for (int i = 0; i < Count; i++) { switch (feature.Layer.Fields[i].Type) { case FieldType.TABFT_Char: Values[i] = MiApi.mitab_c_get_field_as_string(feature.Handle, i); break; case FieldType.TABFT_Date: double d = MiApi.mitab_c_get_field_as_double(feature.Handle, i); if (d == 0) { Values[i] = null; } else { int year = (int)(d / 10000); int month = (int)((d - year * 10000) / 100); int day = (int)(d - year * 10000 - month * 100); Values[i] = new DateTime(year, month, day); } break; case FieldType.TABFT_Decimal: Values[i] = MiApi.mitab_c_get_field_as_double(feature.Handle, i); break; case FieldType.TABFT_Float: Values[i] = (float)MiApi.mitab_c_get_field_as_double(feature.Handle, i); break; case FieldType.TABFT_Integer: Values[i] = (int)MiApi.mitab_c_get_field_as_double(feature.Handle, i); break; case FieldType.TABFT_Logical: Values[i] = MiApi.mitab_c_get_field_as_string(feature.Handle, i) == "T"? true : false; break; case FieldType.TABFT_SmallInt: Values[i] = (short)MiApi.mitab_c_get_field_as_double(feature.Handle, i); break; } } }
public Feature GetFirst() { return(this[MiApi.mitab_c_next_feature_id(Layer.Handle, -1)]); }
protected internal Features(Layer layer) : base(MiApi.mitab_c_get_feature_count(layer.Handle)) { this.Layer = layer; }
public override bool MoveNext() { return((eIdx = MiApi.mitab_c_next_feature_id(layer.Handle, eIdx)) != -1); }
/// <summary> /// Convenience method to return the next Feature in the file. /// </summary> /// <returns>A following feature in the file.</returns> public Feature GetNext() { return(new Feature(this.Layer, MiApi.mitab_c_next_feature_id(Layer.Handle, this.Id))); }
protected internal Parts(Feature feature) : base(MiApi.mitab_c_get_parts(feature.Handle)) { this.Feature = feature; }
protected internal Vertices(Part part) : base(MiApi.mitab_c_get_vertex_count(part.Feature.Handle, part.Index)) { this.Part = part; }
/// <summary> /// Returns a double representation of this fields value for the given feature. /// </summary> /// <param name="feature">The feature to find the fields value for.</param> /// <returns>A double representation of this fields value for the given feature</returns> public double GetValueAsDouble(Feature feature) { return(MiApi.mitab_c_get_field_as_double(feature.Handle, this.Index)); }
/// <summary> /// Returns a string representation of this fields value for the given feature. /// </summary> /// <param name="feature">The feature to find the fields value for.</param> /// <returns>A string representation of this fields value for the given feature</returns> public string GetValueAsString(Feature feature) { return(MiApi.mitab_c_get_field_as_string(feature.Handle, this.Index)); }