GeoCache.Common.Repository.SdeRepository.GetByEnvelope C# (CSharp) Method

GetByEnvelope() public method

Get all geometries inside the envelope from a featureClass
public GetByEnvelope ( string featureClassName, IEnvelope envelope ) : IEnumerable
featureClassName string FeatureClass name
envelope IEnvelope Envelope
return IEnumerable
        public IEnumerable<IGeometry> GetByEnvelope(string featureClassName, IEnvelope envelope)
        {
            var feature = this.OpenFeatureClass(featureClassName);
            var filter = new SpatialFilterClass
                {
                    Geometry = new ESRI.ArcGIS.Geometry.EnvelopeClass
                        {
                            XMax = envelope.MaxX, XMin = envelope.MinX, YMax = envelope.MaxY, YMin = envelope.MinY
                        },
                    SpatialRel = esriSpatialRelEnum.esriSpatialRelContains
                    
                };
            return new FeatureCursor(feature.Search(filter, false), feature.FeatureCount(filter));
        }

Usage Example

Ejemplo n.º 1
0
        public void TestMethod1()
        {
            int percent = 0;

            var repository = new SdeRepository("srvprodist", "5151", "bdgd", "bdgd", "sde.DEFAULT");
            var cache = new InMemoryCache(repository, repository.GetFullExtent("admgid.Switch_PT"), "admgid.Switch_PT");

            cache.OnProgress += delegate(int i)
                {
                    percent = i;
                };

            cache.BuildAllCache();

            IList<IGeometry> list = new List<IGeometry>();

            var envelop = new Envelope(325017, 320003, 7392018, 7391712);
            IEnvelope affected = null;

            var inicio = DateTime.Now;
            var result = cache.RetriveData(envelop, ref list, ref affected);
            var tempo1 = (DateTime.Now - inicio).TotalMilliseconds;

            inicio = DateTime.Now;
            var fromSde = repository.GetByEnvelope("admgid.Switch_PT", envelop);
            var tempo2 = (DateTime.Now - inicio).TotalMilliseconds;

            Assert.AreEqual(list.Count, fromSde.Count());
            Assert.IsTrue(tempo1 < tempo2);
            Assert.AreEqual(percent, 100);
        }
All Usage Examples Of GeoCache.Common.Repository.SdeRepository::GetByEnvelope