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); }
public void Dispose() { ComUtils.ReleaseComObject(_construction); _properties = null; _construction = null; }
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); }
/// <summary> /// Initializes a new instance of the <see cref="BufferFactory"/> class. /// </summary> /// <param name="explodeBuffers">if set to <c>true</c> multipart buffers will be exploded.</param> /// <param name="densify">if set to <c>true</c> straight line segments are used to represent the buffer output (i.e. <see cref="GenerateCurves"/> is set to <c>false</c>). Otherwise, curve segments are used in the output.</param> /// <param name="densifyDeviation"> The maximum distance between a line connecting two buffer curve points and the true curve /// (defaults to -1, indicating 1000 * xy tolerance of spatial reference of input geometries ).</param> public BufferFactory(bool explodeBuffers = false, bool densify = false, double densifyDeviation = -1) { _construction = new BufferConstructionClass(); _properties = (IBufferConstructionProperties)_construction; _properties.ExplodeBuffers = explodeBuffers; if (densify) { _properties.GenerateCurves = false; _properties.DensifyDeviation = densifyDeviation; } }