Esempio n. 1
0
        /// <summary>
        /// Throws an NotSupportedException. Attribute data is not supported by this datasource
        /// </summary>
        /// <param name="geom"></param>
        /// <param name="ds">FeatureDataSet to fill data into</param>
        public void ExecuteIntersectionQuery(IGeometry geom, FeatureDataSet ds)
        {
            FeatureDataTable fdt;

            lock (_featuresLock)
                fdt = _features.Clone();

            fdt.BeginLoadData();
            var pg = new NetTopologySuite.Geometries.Prepared.PreparedGeometryFactory().Create(geom);

            foreach (var idFeature in EnumerateFeatures(geom.EnvelopeInternal))
            {
                var fdr = idFeature.Value;
                if (pg.Intersects(fdr.Geometry))
                {
                    fdt.LoadDataRow(fdr.ItemArray, true);
                    var tmpGeom = fdr.Geometry;
                    if (tmpGeom != null)
                    {
                        ((FeatureDataRow)fdt.Rows[fdt.Rows.Count - 1]).Geometry = (IGeometry)tmpGeom.Clone();
                    }
                }
            }
            fdt.EndLoadData();

            ds.Tables.Add(fdt);
        }
Esempio n. 2
0
        /// <summary>
        /// Throws an NotSupportedException. Attribute data is not supported by this datasource
        /// </summary>
        /// <param name="geom"></param>
        /// <param name="ds">FeatureDataSet to fill data into</param>
        public virtual void ExecuteIntersectionQuery(IGeometry geom, FeatureDataSet ds)
        {
            FeatureDataTable dt = AttributesTable.Clone();

            foreach (FeatureDataRow row in AttributesTable)
            {
                dt.Rows.Add(row.ItemArray);
                ((FeatureDataRow)dt.Rows[dt.Count - 1]).Geometry = row.Geometry;
            }
            ds.Tables.Add(dt);
        }
Esempio 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);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Throws an NotSupportedException. Attribute data is not supported by this datasource
        /// </summary>
        /// <param name="geom"></param>
        /// <param name="ds">FeatureDataSet to fill data into</param>
        public void ExecuteIntersectionQuery(Geometry geom, FeatureDataSet ds)
        {
            FeatureDataTable fdt = new FeatureDataTable();

            fdt = _features.Clone();

            foreach (FeatureDataRow fdr in _features)
            {
                if (fdr.Geometry.GetBoundingBox().Intersects(geom))
                {
                    fdt.LoadDataRow(fdr.ItemArray, false);
                    (fdt.Rows[fdt.Rows.Count - 1] as FeatureDataRow).Geometry = fdr.Geometry;
                }
            }

            ds.Tables.Add(fdt);
        }
        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);
            }
        }