/// <summary>Reduces precision pointwise, then snap-rounds.
 /// <para/>
 /// Note that output set may not contain non-unique linework
 /// (and thus cannot be used as input to Polygonizer directly).
 /// <c>UnaryUnion</c> is one way to make the linework unique.
 /// </summary>
 /// <param name="geom">A Geometry containing linework to node</param>
 /// <param name="scaleFactor">The precision model scale factor to use</param>
 /// <returns>The noded, snap-rounded linework</returns>
 public static IGeometry SnapRoundLines(
     IGeometry geom, double scaleFactor)
 {
     var pm = new PrecisionModel(scaleFactor);
     var gsr = new GeometrySnapRounder(pm);
     gsr.LineworkOnly =true;
     var snapped = gsr.Execute(geom);
     return snapped;
 }
Esempio n. 2
0
        /// <summary>Reduces precision pointwise, then snap-rounds.
        /// <para/>
        /// Note that output set may not contain non-unique linework
        /// (and thus cannot be used as input to Polygonizer directly).
        /// <c>UnaryUnion</c> is one way to make the linework unique.
        /// </summary>
        /// <param name="geom">A Geometry containing linework to node</param>
        /// <param name="scaleFactor">The precision model scale factor to use</param>
        /// <returns>The noded, snap-rounded linework</returns>
        public static Geometry SnapRoundLines(
            Geometry geom, double scaleFactor)
        {
            var pm  = new PrecisionModel(scaleFactor);
            var gsr = new GeometrySnapRounder(pm);

            gsr.LineworkOnly = true;
            var snapped = gsr.Execute(geom);

            return(snapped);
        }
Esempio n. 3
0
        /// <summary>Reduces precision pointwise, then snap-rounds.
        /// <para/>
        /// Note that output set may not contain non-unique linework
        /// (and thus cannot be used as input to Polygonizer directly).
        /// <c>UnaryUnion</c> is one way to make the linework unique.
        /// </summary>
        /// <param name="geom">A Geometry containing linework to node</param>
        /// <param name="scaleFactor">The precision model scale factor to use</param>
        /// <returns>The noded, snap-rounded linework</returns>
        public static IGeometry SnapRoundLines(
            IGeometry geom, double scaleFactor)
        {
            IPrecisionModel pm = new PrecisionModel(scaleFactor);

            var roundedGeom = GeometryPrecisionReducer.ReducePointwise(geom, pm);

            var geomList = new List <IGeometry>();

            geomList.Add(roundedGeom);

            var noder = new GeometrySnapRounder(pm);
            var lines = noder.Node(geomList);

            return(FunctionsUtil.GetFactoryOrDefault(geom).BuildGeometry(lines));
        }
        public static IGeometry SnapRound(
            IGeometry geomA, IGeometry geomB,
            double scaleFactor)
        {
            var pm = new PrecisionModel(scaleFactor);

            var geom = geomA;

            if (geomB != null)
            {
                geom = geomA.Factory.CreateGeometryCollection(new IGeometry[] { geomA, geomB });
            }

            GeometrySnapRounder gsr = new GeometrySnapRounder(pm);
            var snapped = gsr.Execute(geom);
            return snapped;
        }
Esempio n. 5
0
        public static Geometry SnapRound(
            Geometry geomA, Geometry geomB,
            double scaleFactor)
        {
            var pm = new PrecisionModel(scaleFactor);

            var geom = geomA;

            if (geomB != null)
            {
                geom = geomA.Factory.CreateGeometryCollection(new Geometry[] { geomA, geomB });
            }

            var gsr     = new GeometrySnapRounder(pm);
            var snapped = gsr.Execute(geom);

            return(snapped);
        }
Esempio n. 6
0
        public static IGeometry SnapRound(
            IGeometry geomA, IGeometry geomB,
            double scaleFactor)
        {
            var pm = new PrecisionModel(scaleFactor);

            var roundedGeomA = GeometryPrecisionReducer.ReducePointwise(geomA, pm);
            var geomRound    = roundedGeomA;

            if (geomB != null)
            {
                var roundedGeomB = GeometryPrecisionReducer.ReducePointwise(geomB, pm);
                geomRound = geomA.Factory.CreateGeometryCollection(new [] { roundedGeomA, roundedGeomB });
            }

            var       noder   = new GeometrySnapRounder(pm);
            IGeometry snapped = noder.Node(geomRound);

            return(snapped);
        }