public Geometry GetResultGeometry(SpatialFunction opCode)
        {
            Geometry result    = null;
            bool     isSuccess = false;
            ExceptionDispatchInfo savedException = null;

            try
            {
                // try basic operation with input geometries
                result = OverlayOp.Overlay(_geom[0], _geom[1], opCode);
                bool isValid = true;
                // not needed if noding validation is used
                //      boolean isValid = OverlayResultValidator.isValid(geom[0], geom[1], OverlayOp.INTERSECTION, result);
                // if (isValid)
                isSuccess = true;
            }
            catch (Exception ex)
            {
                savedException = ExceptionDispatchInfo.Capture(ex);
                // Ignore this exception, since the operation will be rerun
            }
            if (!isSuccess)
            {
                // this may still throw an exception
                // if so, throw the original exception since it has the input coordinates
                try
                {
                    result = SnapOverlayOp.Overlay(_geom[0], _geom[1], opCode);
                }
                catch (Exception)
                {
                    savedException.Throw();
                }
            }
            return(result);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="g0"></param>
        /// <param name="g1"></param>
        /// <param name="opCode"></param>
        /// <returns></returns>
        public static Geometry Overlay(Geometry g0, Geometry g1, SpatialFunction opCode)
        {
            var op = new SnapOverlayOp(g0, g1);

            return(op.GetResultGeometry(opCode));
        }