Exemplo n.º 1
0
        public void MeasureBufferConstructionConstructBuffersPerformance()
        {
            const int iterations            = 100;
            IEnumerable <IGeometry> sources = GetBufferInput(iterations);

            IBufferConstruction bufferConstruction = GetBufferConstruction();

            IGeometryBag outputBag = new GeometryBagClass();

            var watch = new Stopwatch();

            watch.Start();

            bufferConstruction.ConstructBuffers(
                new GeometryEnumerator <IGeometry>(sources),
                10, (IGeometryCollection)outputBag);

            watch.Stop();

            Assert.AreEqual(iterations, ((IGeometryCollection)outputBag).GeometryCount);

            Console.Out.WriteLine(
                "IBufferConstruction.ConstructBuffers: {0:N2} ms per geometry",
                (double)watch.ElapsedMilliseconds / iterations);
        }
Exemplo n.º 2
0
        private IList <IPolygon> BufferCore([NotNull] IEnumGeometry enumInput,
                                            double distance)
        {
            // does no longer work as of 9.3.1 (implementing IGeometryCollection is NOT sufficient)
            // BufferOutput output = new BufferOutput();

            if (_properties.EndOption == esriBufferConstructionEndEnum.esriBufferFlat)
            {
                ResetCorruptFlatEndEnvironment();
            }

            IGeometryCollection outputCollection = PrepareTemplateBag();

            try
            {
                try
                {
                    _construction.ConstructBuffers(enumInput, distance,
                                                   outputCollection);
                }
                catch (Exception)
                {
                    _msg.DebugFormat(
                        "Error buffering {0} geometries with distance {1}",
                        enumInput.Count, distance);
                    throw;
                }

                return(GetOutput(outputCollection));
            }
            finally
            {
                ResetTemplateBag();
            }
        }
Exemplo n.º 3
0
        public void LearningTestBufferConstructionHandlingEmptyInput()
        {
            var inputBag = new GeometryBagClass();

            IBufferConstruction bufferConstruction = GetBufferConstruction();

            IGeometryBag outputBag = new GeometryBagClass();

            bufferConstruction.ConstructBuffers(inputBag, 10,
                                                (IGeometryCollection)outputBag);

            Assert.AreEqual(0, ((IGeometryCollection)outputBag).GeometryCount);
        }