示例#1
0
        // Used for IsSimple.
        internal static bool NeedsCracking(bool allowCoincident, com.epl.geometry.EditShape shape, double tolerance, com.epl.geometry.NonSimpleResult result, com.epl.geometry.ProgressTracker progress_tracker)
        {
            if (!CanBeCracked(shape))
            {
                return(false);
            }
            com.epl.geometry.Cracker cracker = new com.epl.geometry.Cracker(progress_tracker);
            cracker.m_shape            = shape;
            cracker.m_tolerance        = tolerance;
            cracker.m_bAllowCoincident = allowCoincident;
            if (cracker.NeedsCrackingImpl_())
            {
                if (result != null)
                {
                    result.Assign(cracker.m_non_simple_result);
                }
                return(true);
            }
            // Now swap the coordinates to catch horizontal cases.
            com.epl.geometry.Transformation2D transform = new com.epl.geometry.Transformation2D();
            transform.SetSwapCoordinates();
            shape.ApplyTransformation(transform);
            cracker                    = new com.epl.geometry.Cracker(progress_tracker);
            cracker.m_shape            = shape;
            cracker.m_tolerance        = tolerance;
            cracker.m_bAllowCoincident = allowCoincident;
            bool b_res = cracker.NeedsCrackingImpl_();

            transform.SetSwapCoordinates();
            shape.ApplyTransformation(transform);
            // restore shape
            if (b_res)
            {
                if (result != null)
                {
                    result.Assign(cracker.m_non_simple_result);
                }
                return(true);
            }
            return(false);
        }