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); }
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(); } }
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); }