Пример #1
0
        public void Test_T97Buffer()
        {
            ILineString ls = _geometryFactory.WktReader.Read("LINESTRING(0 0, 100 100)") as ILineString;
            Assert.IsNotNull(ls);

            BufferBuilder<BufferedCoordinate> bb =
                new BufferBuilder<BufferedCoordinate>(_geometryFactory);
            IGeometry<BufferedCoordinate> res = bb.Buffer((IGeometry<BufferedCoordinate>)ls, 10);
            Assert.IsNotNull(res);
        }
Пример #2
0
        private void BufferFixedPrecision(IPrecisionModel fixedPrecModel)
        {
            INoder noder = new ScaledNoder(new MCIndexSnapRounder(new PrecisionModel(1.0)),
                                           fixedPrecModel.Scale);

            var bufBuilder = new BufferBuilder(_bufParams);

            bufBuilder.WorkingPrecisionModel = fixedPrecModel;
            bufBuilder.Noder = noder;
            // this may throw an exception, if robustness errors are encountered
            _resultGeometry = bufBuilder.Buffer(_argGeom, _distance);
        }
Пример #3
0
        private void BufferOriginalPrecision()
        {
            try
            {
                // use fast noding by default
                var bufBuilder = new BufferBuilder(_bufParams);
                _resultGeometry = bufBuilder.Buffer(_argGeom, _distance);
            }
            catch (Exception ex)
            {
                _saveException = ex;
                // don't propagate the exception - it will be detected by fact that resultGeometry is null

                // testing ONLY - propagate exception
                //throw ex;
            }
        }
Пример #4
0
        private void BufferFixedPrecision(IPrecisionModel fixedPrecModel)
        {
            INoder noder = new ScaledNoder(new MCIndexSnapRounder(new PrecisionModel(1.0)),
                                          fixedPrecModel.Scale);

            var bufBuilder = new BufferBuilder(_bufParams);
            bufBuilder.WorkingPrecisionModel = fixedPrecModel;
            bufBuilder.Noder = noder;
            // this may throw an exception, if robustness errors are encountered
            _resultGeometry = bufBuilder.Buffer(_argGeom, _distance);
        }
Пример #5
0
        private void BufferOriginalPrecision()
        {
            try
            {
                // use fast noding by default
                var bufBuilder = new BufferBuilder(_bufParams);
                _resultGeometry = bufBuilder.Buffer(_argGeom, _distance);
            }
            catch (Exception ex)
            {
                _saveException = ex;
                // don't propagate the exception - it will be detected by fact that resultGeometry is null

                // testing ONLY - propagate exception
                //throw ex;
            }
        }
Пример #6
0
        public void Test_T666Buffer()
        {
            IPoint test = _geometryFactory.WktReader.Read("POINT(0 0)") as IPoint;
            Assert.IsNotNull(test);

            BufferBuilder<BufferedCoordinate> bb =
                new BufferBuilder<BufferedCoordinate>(_geometryFactory);
            bb.EndCapStyle = BufferStyle.Square;
            bb.QuadrantSegments = 2;
            IGeometry actual = bb.Buffer((IGeometry<BufferedCoordinate>)test, 10);
            IGeometry expected = _geometryFactory.WktReader.Read("POLYGON((10 10, -10 10, -10 -10, 10 -10, 10 10))");
            Assert.AreEqual(actual, expected);
        }