//public   Task<DataTable> GetEntireFeatureAsync(string whereClause)
        //{
        //    return Task.Run(() => { return GetEntireFeature(whereClause); });
        //}

        //public List<string> GetLabels()
        //{
        //    return GetAttributes(this._labelColumnName).Select(i => i.ToString()).ToList();
        //}

        //public IEnumerable<Tuple<SqlGeometry, string>> GetGeometryLabelPairs()
        //{
        //    throw new NotImplementedException();
        //}

        //public IEnumerable<Tuple<SqlGeometry, string>> GetGeometryLabelPairs(string whereClause)
        //{
        //    throw new NotImplementedException();
        //}

        public override List <NamedSqlGeometry> GetGeometryLabelPairs(BoundingBox boundingBox)
        {
            List <string> attributes = GetAttributes(this._labelColumnName).Select(i => i.ToString()).ToList();

            SqlGeometry boundary = boundingBox.AsSqlGeometry();

            return(GetGeometries().Zip(attributes, (a, b) => new NamedSqlGeometry(a, b)).Where(i => i.Geometry.STIntersects(boundary).Value).ToList());
        }
Beispiel #2
0
        //POTENTIALLY ERROR PRONOUN: Check SqlGeometry special cases: IsNull, ...
        public override List <SqlGeometry> GetGeometries(BoundingBox boundingBox)
        {
            var bound = boundingBox.AsSqlGeometry().MakeValid();

            return(this._table.Select()
                   .Select(i => i[_spatialColumnName])
                   .Cast <SqlGeometry>()
                   .Where(i => !i.IsNull && bound.STIntersects(i.MakeValid()).IsTrue)
                   .ToList());
        }
        public virtual SqlFeatureSet GetSqlFeatures(BoundingBox boundingBox)
        {
            SqlGeometry boundary = boundingBox.AsSqlGeometry(this.GetSrid()).MakeValid();

            var features = GetSqlFeatures().Features.Where(i => !i.TheSqlGeometry.IsNotValidOrEmpty() && i.TheSqlGeometry.STIntersects(boundary).IsTrue).ToList();

            return(new SqlFeatureSet(this.GetSrid())
            {
                Features = features
            });
        }
        public override List <SqlGeometry> GetGeometries(BoundingBox boundingBox)
        {
            //SqlGeometry boundary =
            //     SqlGeometry.Parse(
            //         string.Format("POLYGON(({0} {1}, {0} {2}, {3} {2}, {3} {1}, {0} {1}))", boundingBox.XMin, boundingBox.YMin, boundingBox.YMax, boundingBox.XMax));

            //return GetGeometries().Where(i => i.STWithin(boundary).Value).ToList();
            SqlGeometry boundary = boundingBox.AsSqlGeometry(this.Srid).MakeValid();

            return(GetGeometries().Where(i => i.STIntersects(boundary).IsTrue).ToList());
        }
        public override List <SqlGeometry> GetGeometries(BoundingBox boundingBox)
        {
            //SqlGeometry boundary =
            //  SqlGeometry.Parse(
            //      string.Format(System.Globalization.CultureInfo.InvariantCulture,
            //      "POLYGON(({0} {1}, {0} {2}, {3} {2}, {3} {1}, {0} {1}))", boundingBox.XMin, boundingBox.YMin, boundingBox.YMax, boundingBox.XMax));

            //return GetGeometries().Where(i => i.STIntersects(boundary).IsTrue).ToList();
            SqlGeometry boundary = boundingBox.AsSqlGeometry(GetSrid());

            return(GetGeometries(boundary));
        }
        //public List<string> GetLabels()
        //{
        //    //return this._attributes.Select(i => i.ToString()).ToList();
        //    return this.geometryAttributePairs.Select(i => i.Item2.ToString()).ToList();
        //}

        //public IEnumerable<Tuple<SqlGeometry, string>> GetGeometryLabelPairs()
        //{
        //    //return _geometries.Zip(_attributes, (a, b) => Tuple.Create(a, _labelFunc(b))).ToList();
        //    return this.geometryAttributePairs;
        //}

        //public IEnumerable<Tuple<SqlGeometry, string>> GetGeometryLabelPairs(string whereClause)
        //{
        //    throw new NotImplementedException();
        //}

        public override List <NamedSqlGeometry> GetGeometryLabelPairs(BoundingBox boundingBox)
        {
            //SqlGeometry boundary =
            //    SqlGeometry.Parse(
            //        string.Format("POLYGON(({0} {1}, {0} {2}, {3} {2}, {3} {1}, {0} {1}))", boundingBox.XMin, boundingBox.YMin, boundingBox.YMax, boundingBox.XMax));

            //return _geometries.Zip(_attributes, (a, b) => Tuple.Create(a, _labelFunc(b))).Where(i => i.Item1.STWithin(boundary).Value).ToList();
            SqlGeometry boundary = boundingBox.AsSqlGeometry();

            //93.01.18
            //return _geometries.Zip(_attributes, (a, b) => Tuple.Create(a, _labelFunc(b))).Where(i => i.Item1.STIntersects(boundary).Value).ToList();

            return(this.geometryAttributePairs.Where(i => i.Geometry.STIntersects(boundary).Value).ToList());
        }
        public static bool Intersects(this BoundingBox boundingBox, SqlGeometry geometry)
        {
            if (geometry.IsNullOrEmpty())
            {
                return(false);
            }

            var geometryBoundingBox = geometry.GetBoundingBox();

            if (boundingBox.Intersects(geometryBoundingBox))
            {
                SqlGeometry boundary = boundingBox.AsSqlGeometry(geometry.GetSrid());

                return(geometry.STIntersects(boundary).IsTrue);
            }

            return(false);
        }
Beispiel #8
0
        public override List <NamedSqlGeometry> GetGeometryLabelPairs(BoundingBox boundingBox)
        {
            var bound = boundingBox.AsSqlGeometry().MakeValid();

            if (string.IsNullOrEmpty(_labelColumnName) && _table.Columns.Contains(_labelColumnName))
            {
                return(new List <NamedSqlGeometry>());
            }

            if (this._labelColumnName == null)
            {
                return(this._table.Select()
                       .Select(i => new NamedSqlGeometry((SqlGeometry)i[_spatialColumnName], string.Empty))
                       .Where(i => !i.Geometry.IsNull && bound.STIntersects(i.Geometry.MakeValid()).IsTrue)
                       .ToList());
            }
            else
            {
                return(this._table.Select()
                       .Select(i => new NamedSqlGeometry((SqlGeometry)i[_spatialColumnName], i[_labelColumnName]?.ToString()))
                       .Where(i => !i.Geometry.IsNull && bound.STIntersects(i.Geometry.MakeValid()).IsTrue)
                       .ToList());
            }
        }
        public List <SqlGeometry> GetGeometries(double scale, BoundingBox boundingBox)
        {
            SqlGeometry boundary = boundingBox.AsSqlGeometry(GetSrid());

            return(GetGeometries(scale, boundary));
        }
Beispiel #10
0
        public List <SqlGeometry> GetGeometries(double scale, BoundingBox boundingBox)
        {
            SqlGeometry boundary = boundingBox.AsSqlGeometry();

            return(GetGeometries(scale).AsParallel().Where(i => i.STIntersects(boundary).IsTrue).ToList());
        }
Beispiel #11
0
        public static bool Intersects(this BoundingBox boundingBox, SqlGeometry geometry)
        {
            SqlGeometry boundary = boundingBox.AsSqlGeometry(geometry.GetSrid());

            return(geometry.STIntersects(boundary).IsTrue);
        }
        //public virtual List<NamedSqlGeometry> GetGeometryLabelPairs(string whereClause)
        //{
        //    throw new NotImplementedException();
        //}

        public virtual List <NamedSqlGeometry> GetGeometryLabelPairsForDisplay(BoundingBox boundary)
        {
            SqlGeometry geometry = boundary.AsSqlGeometry(GetSrid());

            return(GetGeometryLabelPairs(geometry));
        }
        public override DataTable GetEntireFeatures(BoundingBox geometry)
        {
            var boundary = geometry.AsSqlGeometry(GetSrid());

            return(GetEntireFeatures(boundary));
        }
        //public virtual DataTable GetEntireFeatures(string whereClause)
        //{
        //    throw new NotImplementedException();
        //}

        public virtual DataTable GetEntireFeatures(BoundingBox boundary)
        {
            SqlGeometry geometry = boundary.AsSqlGeometry(GetSrid());

            return(GetEntireFeatures(geometry));
        }
        public override List <NamedSqlGeometry> GetGeometryLabelPairsForDisplay(BoundingBox boundingBox)
        {
            SqlGeometry boundary = boundingBox.AsSqlGeometry(GetSrid());

            return(GetGeometryLabelPairs(boundary));
        }
        //public virtual List<SqlGeometry> GetGeometries(string whereClause)
        //{
        //    throw new NotImplementedException();
        //}

        public virtual List <SqlGeometry> GetGeometries(BoundingBox boundingBox)
        {
            SqlGeometry boundary = boundingBox.AsSqlGeometry(this.GetSrid()).MakeValid();

            return(GetGeometries().Where(i => i.STIntersects(boundary).IsTrue).ToList());
        }
        public override List <SqlGeometry> GetGeometries(BoundingBox boundingBox)
        {
            SqlGeometry boundary = boundingBox.AsSqlGeometry();

            return(GetGeometries().Where(i => i.STIntersects(boundary).IsTrue).ToList());
        }
        public override List <SqlGeometry> GetGeometries(BoundingBox boundingBox)
        {
            SqlGeometry boundary = boundingBox.AsSqlGeometry(GetSrid());

            return(GetGeometries(boundary));
        }