Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private IGeometry[] Snap()
        {
            IGeometry[] remGeom = RemoveCommonBits(geom);

            // MD - testing only
            // IGeometry[] remGeom = geom;

            IGeometry[] snapGeom = GeometrySnapper.Snap(remGeom[0], remGeom[1], tolerance);
            // MD - may want to do this at some point, but it adds cycles
            // CheckValid(snapGeom[0]);
            // CheckValid(snapGeom[1]);
            return(snapGeom);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Snaps two geometries together with a given tolerance.
        /// </summary>
        /// <param name="g0"></param>
        /// <param name="g1"></param>
        /// <param name="snapTolerance"></param>
        /// <returns></returns>
        public static IGeometry[] Snap(IGeometry g0, IGeometry g1, double snapTolerance)
        {
            IGeometry[] snapGeom = new IGeometry[2];
            GeometrySnapper snapper0 = new GeometrySnapper(g0);
            snapGeom[0] = snapper0.SnapTo(g1, snapTolerance);

            GeometrySnapper snapper1 = new GeometrySnapper(g1);
            /**
             * Snap the second geometry to the snapped first geometry
             * (this strategy minimizes the number of possible different points in the result)
             */
            snapGeom[1] = snapper1.SnapTo(snapGeom[0], snapTolerance);
            return snapGeom;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Snaps two geometries together with a given tolerance.
        /// </summary>
        /// <param name="g0"></param>
        /// <param name="g1"></param>
        /// <param name="snapTolerance"></param>
        /// <returns></returns>
        public static IGeometry[] Snap(IGeometry g0, IGeometry g1, double snapTolerance)
        {
            IGeometry[]     snapGeom = new IGeometry[2];
            GeometrySnapper snapper0 = new GeometrySnapper(g0);

            snapGeom[0] = snapper0.SnapTo(g1, snapTolerance);

            GeometrySnapper snapper1 = new GeometrySnapper(g1);

            /**
             * Snap the second geometry to the snapped first geometry
             * (this strategy minimizes the number of possible different points in the result)
             */
            snapGeom[1] = snapper1.SnapTo(snapGeom[0], snapTolerance);
            return(snapGeom);
        }
Ejemplo n.º 4
0
 /// <summary>
 ///
 /// </summary>
 private void ComputeSnapTolerance()
 {
     tolerance = GeometrySnapper.ComputeOverlaySnapTolerance(geom[0], geom[1]);
 }