Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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"]);
            }
        }
Exemplo n.º 3
0
        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);
            }
        }