Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 2
0
 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);
     }
 }
Exemplo n.º 3
0
 public void Dispose(bool disposing)
 {
     if (disposing && !disposed)
     {
         MiApi.mitab_c_destroy_feature(this.Handle);
         disposed = true;
     }
 }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
 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);
     }
 }
Exemplo n.º 6
0
 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);
 }
Exemplo n.º 7
0
 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;
 }
Exemplo n.º 8
0
        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;
                }
            }
        }
Exemplo n.º 9
0
 public Feature GetFirst()
 {
     return(this[MiApi.mitab_c_next_feature_id(Layer.Handle, -1)]);
 }
Exemplo n.º 10
0
 protected internal Features(Layer layer) :
     base(MiApi.mitab_c_get_feature_count(layer.Handle))
 {
     this.Layer = layer;
 }
Exemplo n.º 11
0
 public override bool MoveNext()
 {
     return((eIdx = MiApi.mitab_c_next_feature_id(layer.Handle, eIdx)) != -1);
 }
Exemplo n.º 12
0
 /// <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)));
 }
Exemplo n.º 13
0
 protected internal Parts(Feature feature) : base(MiApi.mitab_c_get_parts(feature.Handle))
 {
     this.Feature = feature;
 }
Exemplo n.º 14
0
 protected internal Vertices(Part part) :
     base(MiApi.mitab_c_get_vertex_count(part.Feature.Handle, part.Index))
 {
     this.Part = part;
 }
Exemplo n.º 15
0
 /// <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));
 }
Exemplo n.º 16
0
 /// <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));
 }