本文整理汇总了C#中SharpMap.GetFeatureCount方法的典型用法代码示例。如果您正苦于以下问题:C# SharpMap.GetFeatureCount方法的具体用法?C# SharpMap.GetFeatureCount怎么用?C# SharpMap.GetFeatureCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharpMap
的用法示例。
在下文中一共展示了SharpMap.GetFeatureCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildFromProvider
/// <summary>
/// Builds from the given provider.
/// </summary>
/// <param name="provider">
/// The base <see cref="SharpMap.Data.Providers.IProvider"/>
/// from witch initialize the <see cref="NtsProvider"/> instance.
/// </param>
private void BuildFromProvider(SharpMap.Data.Providers.IProvider provider)
{
// Features list initialization
features = new List<GisSharpBlog.NetTopologySuite.Features.Feature>(provider.GetFeatureCount());
try
{
// Load all features from the given provider
provider.Open();
Collection<uint> ids = provider.GetObjectIDsInView(provider.GetExtents());
foreach (uint id in ids)
{
SharpMap.Data.FeatureDataRow dataRow = provider.GetFeature(id);
GisSharpBlog.NetTopologySuite.Geometries.Geometry geometry = GeometryConverter.ToNTSGeometry(dataRow.Geometry, geometryFactory);
GisSharpBlog.NetTopologySuite.Features.AttributesTable attributes = new GisSharpBlog.NetTopologySuite.Features.AttributesTable();
foreach (DataColumn column in dataRow.Table.Columns)
{
if (dataRow[column] == null || dataRow[column].GetType() == typeof(System.DBNull))
throw new ApplicationException("Null values not supported");
attributes.AddAttribute(column.ColumnName, dataRow[column]);
}
features.Add(new GisSharpBlog.NetTopologySuite.Features.Feature(geometry, attributes));
}
}
finally
{
if (provider.IsOpen)
provider.Close();
}
}