本文整理汇总了C#中FeatureDataTable.ImportRow方法的典型用法代码示例。如果您正苦于以下问题:C# FeatureDataTable.ImportRow方法的具体用法?C# FeatureDataTable.ImportRow怎么用?C# FeatureDataTable.ImportRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FeatureDataTable
的用法示例。
在下文中一共展示了FeatureDataTable.ImportRow方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteIntersectionQueryReturnsExpectedFeatures
public void ExecuteIntersectionQueryReturnsExpectedFeatures()
{
DataTable source = CreateDataTableSource();
DataTablePoint provider = new DataTablePoint(source, "oid", "x", "y");
var query = new Envelope(400, 600, 400, 600);
FeatureDataTable expected = new FeatureDataTable();
expected.TableName = "PointSource";
foreach (DataColumn column in source.Columns)
{
expected.Columns.Add(column.ColumnName, column.DataType);
}
foreach (DataRowView rowView in source.DefaultView)
{
if (query.Contains(new Coordinate((double) rowView["x"], (double) rowView["y"])))
{
expected.ImportRow(rowView.Row);
}
}
FeatureDataSet dataSet = new FeatureDataSet();
provider.ExecuteIntersectionQuery(query, dataSet);
Assert.IsNotNull(dataSet);
Assert.IsNotNull(dataSet.Tables);
Assert.AreEqual(1, dataSet.Tables.Count);
FeatureDataTable actual = dataSet.Tables[0];
Assert.AreEqual(expected.Rows.Count, actual.Rows.Count);
foreach (DataRowView expectedRowView in expected.DefaultView)
{
DataRow[] actualRows = actual.Select("oid = " + expectedRowView["oid"]);
Assert.AreEqual(1, actualRows.Length);
Assert.AreEqual(expectedRowView["oid"], actualRows[0]["oid"]);
Assert.AreEqual(expectedRowView["x"], actualRows[0]["x"]);
Assert.AreEqual(expectedRowView["y"], actualRows[0]["y"]);
}
}
示例2: FeatureDataReader
internal FeatureDataReader(IGeometryFactory factory,
FeatureDataTable source,
FeatureQueryExpression query,
FeatureQueryExecutionOptions options)
{
if (source == null) throw new ArgumentNullException("source");
if (options != FeatureQueryExecutionOptions.FullFeature)
{
throw new ArgumentException("Only QueryExecutionOptions.All is supported.",
"options");
}
_factory = factory;
_options = options;
_query = query;
_table = source.Clone();
foreach (FeatureDataRow row in source.Select(query.SpatialPredicate))
{
_table.ImportRow(row);
}
}
示例3: ExecuteIntersectionQuery
/// <summary>
/// Retrieves all features within the given BoundingBox.
/// </summary>
/// <param name="bbox">Bounds of the region to search.</param>
/// <param name="ds">FeatureDataSet to fill data into</param>
public void ExecuteIntersectionQuery(BoundingBox bbox, FeatureDataSet ds)
{
DataRow[] rows;
if (Table.Rows.Count == 0)
{
return;
}
string statement = XColumn + " > " + bbox.Left.ToString(Map.NumberFormatEnUs) + " AND " +
XColumn + " < " + bbox.Right.ToString(Map.NumberFormatEnUs) + " AND " +
YColumn + " > " + bbox.Bottom.ToString(Map.NumberFormatEnUs) + " AND " +
YColumn + " < " + bbox.Top.ToString(Map.NumberFormatEnUs);
rows = Table.Select(statement);
FeatureDataTable fdt = new FeatureDataTable(Table);
foreach (DataColumn col in Table.Columns)
{
fdt.Columns.Add(col.ColumnName, col.DataType, col.Expression);
}
foreach (DataRow dr in rows)
{
fdt.ImportRow(dr);
FeatureDataRow fdr = fdt.Rows[fdt.Rows.Count - 1] as FeatureDataRow;
fdr.Geometry = new Point((double) dr[XColumn], (double) dr[YColumn]);
}
ds.Tables.Add(fdt);
}
示例4: ExecuteIntersectionQuery
/// <summary>
/// Retrieves all features within the given BoundingBox.
/// </summary>
/// <param name="bounds">Bounds of the region to search.</param>
/// <param name="fcs">FeatureDataSet to fill data into</param>
public override void ExecuteIntersectionQuery(Envelope bounds, IFeatureCollectionSet fcs, CancellationToken? cancellationToken = null)
{
if (Table.Rows.Count == 0)
{
return;
}
string statement = XColumn + " > " + bounds.MinX.ToString(Map.NumberFormatEnUs) + " AND " +
XColumn + " < " + bounds.MaxX.ToString(Map.NumberFormatEnUs) + " AND " +
YColumn + " > " + bounds.MinY.ToString(Map.NumberFormatEnUs) + " AND " +
YColumn + " < " + bounds.MaxY.ToString(Map.NumberFormatEnUs);
var rows = Table.Select(statement);
var fdt = new FeatureDataTable(Table);
foreach (DataColumn col in Table.Columns)
{
fdt.Columns.Add(col.ColumnName, col.DataType, col.Expression);
}
foreach (var dr in rows)
{
fdt.ImportRow(dr);
var fdr = (FeatureDataRow)fdt.Rows[fdt.Rows.Count - 1];
fdr.Geometry = Factory.CreatePoint(new Coordinate((double) dr[XColumn], (double) dr[YColumn]));
}
fcs.Add(fdt);
}
示例5: ExecuteIntersectionQuery
/// <summary>
/// Retrieves all features within the given BoundingBox.
/// </summary>
/// <param name="bbox">Bounds of the region to search.</param>
/// <param name="ds">FeatureDataSet to fill data into</param>
public void ExecuteIntersectionQuery(IEnvelope bbox, FeatureDataSet ds)
{
DataRow[] rows;
if (Table.Rows.Count == 0)
{
return;
}
string statement = XColumn + " > " + bbox.MinX.ToString(Map.numberFormat_EnUS) + " AND " +
XColumn + " < " + bbox.MaxX.ToString(Map.numberFormat_EnUS) + " AND " +
YColumn + " > " + bbox.MinY.ToString(Map.numberFormat_EnUS) + " AND " +
YColumn + " < " + bbox.MaxY.ToString(Map.numberFormat_EnUS);
rows = Table.Select(statement);
FeatureDataTable fdt = new FeatureDataTable(Table);
foreach (DataColumn col in Table.Columns)
{
fdt.Columns.Add(col.ColumnName, col.DataType, col.Expression);
}
foreach (DataRow dr in rows)
{
fdt.ImportRow(dr);
FeatureDataRow fdr = fdt.Rows[fdt.Rows.Count - 1] as FeatureDataRow;
fdr.Geometry = SharpMap.Converters.Geometries.GeometryFactory.CreatePoint((double)dr[XColumn], (double)dr[YColumn]);
}
ds.Tables.Add(fdt);
}
示例6: GetFeature
/// <summary>
/// Returns a datarow based on a RowID
/// </summary>
/// <param name="index"></param>
/// <returns>datarow</returns>
public IFeature GetFeature(int index)
{
//hack assume index is rowindex
var rows = Table.Rows[index];
var featureDataTable = new FeatureDataTable(Table);
foreach (DataColumn col in Table.Columns)
{
featureDataTable.Columns.Add(col.ColumnName, col.DataType, col.Expression);
}
featureDataTable.ImportRow(rows);
var featureDataRow = featureDataTable.Rows[0] as FeatureDataRow;
featureDataRow.Geometry = SharpMap.Converters.Geometries.GeometryFactory.CreatePoint((double) rows[XColumn],
(double) rows[YColumn]);
return featureDataRow;
}