Exemplo n.º 1
0
 /// <summary>
 /// Creates a new row in the given <see cref="SharpMap.Data.FeatureDataTable"/> <paramref name="dataTable"/>
 /// using data in <see cref="GisSharpBlog.NetTopologySuite.Features.Feature"/> <paramref name="feature"/>.
 /// </summary>
 /// <param name="dataTable">The <see cref="SharpMap.Data.FeatureDataTable"/> to fill.</param>
 /// <param name="feature">Data to insert in the <see cref="SharpMap.Data.FeatureDataTable"/>.</param>
 private void CreateNewRow(SharpMap.Data.FeatureDataTable dataTable, GisSharpBlog.NetTopologySuite.Features.Feature feature)
 {
     SharpMap.Data.FeatureDataRow dataRow = dataTable.NewRow();
     dataRow.Geometry = GeometryConverter.ToSharpMapGeometry(feature.Geometry as GisSharpBlog.NetTopologySuite.Geometries.Geometry);
     foreach (string columnName in feature.Attributes.GetNames())
     {
         dataRow[columnName] = feature.Attributes[columnName];
     }
     dataTable.AddRow(dataRow);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the feature identified from the given <paramref name="rowID" />.
        /// </summary>
        /// <param name="rowID">The row ID.</param>
        /// <returns></returns>
        public SharpMap.Data.FeatureDataRow GetFeature(uint rowID)
        {
            GisSharpBlog.NetTopologySuite.Features.Feature feature = features[Convert.ToInt32(rowID)];
            SharpMap.Data.FeatureDataTable dataTable = new SharpMap.Data.FeatureDataTable();
            foreach (string columnName in feature.Attributes.GetNames())
            {
                dataTable.Columns.Add(new DataColumn(columnName, feature.Attributes.GetType(columnName)));
            }

            SharpMap.Data.FeatureDataRow dataRow = dataTable.NewRow();
            dataRow.Geometry = GeometryConverter.ToSharpMapGeometry(feature.Geometry as GisSharpBlog.NetTopologySuite.Geometries.Geometry);
            foreach (string columnName in feature.Attributes.GetNames())
            {
                dataRow[columnName] = feature.Attributes[columnName];
            }
            return(dataRow);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Gets the geometry by ID.
 /// </summary>
 /// <param name="oid">The oid.</param>
 /// <returns></returns>
 public SharpMap.Geometries.Geometry GetGeometryByID(uint oid)
 {
     GisSharpBlog.NetTopologySuite.Features.Feature feature = features[Convert.ToInt32(oid)];
     return(GeometryConverter.ToSharpMapGeometry(feature.Geometry as GisSharpBlog.NetTopologySuite.Geometries.Geometry));
 }