当前位置: 首页>>代码示例>>C#>>正文


C# FeatureDataTable.ImportRow方法代码示例

本文整理汇总了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"]);
            }
        }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:42,代码来源:DataTablePointTests.cs

示例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);
            }
        }
开发者ID:pobingwanghai,项目名称:SharpMapV2,代码行数:23,代码来源:FeatureDataReader.cs

示例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);
        }
开发者ID:goranpavlovic,项目名称:Gis,代码行数:37,代码来源:DataTablePoint.cs

示例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);
        }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:35,代码来源:DataTablePoint.cs

示例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);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:37,代码来源:DataTablePoint.cs

示例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;
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:27,代码来源:DataTablePoint.cs


注:本文中的FeatureDataTable.ImportRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。