예제 #1
0
        /// <summary>
        ///     Validate the edge information
        /// </summary>
        /// <returns></returns>
        internal bool Validate()
        {
            // RQS- All variables should be set
            if (VtxEnd == null)
            {
                return(Failure());
            }

            if (VtxStart == null)
            {
                return(Failure());
            }

            if (EdgeCCWPredecessor == null)
            {
                return(Failure());
            }

            if (EdgeCCWSuccessor == null)
            {
                return(Failure());
            }

            if (EdgeCWPredecessor == null)
            {
                return(Failure());
            }

            if (EdgeCWSuccessor == null)
            {
                return(Failure());
            }

            if (PolyLeft == null)
            {
                return(Failure());
            }

            if (PolyRight == null)
            {
                return(Failure());
            }
            // -RQS

            // RQS- Check adjacencies
            //
            // Make sure that we and all our CW/CCW successor/predecessor edges
            // are marked as adjacent in our start/end vertices
            if (!VtxEnd.FValidateEdgeIsAdjacent(this))
            {
                return(Failure());
            }

            if (!VtxStart.FValidateEdgeIsAdjacent(EdgeCCWPredecessor))
            {
                return(Failure());
            }

            if (!VtxEnd.FValidateEdgeIsAdjacent(EdgeCCWSuccessor))
            {
                return(Failure());
            }

            if (!VtxStart.FValidateEdgeIsAdjacent(EdgeCWPredecessor))
            {
                return(Failure());
            }

            if (!VtxEnd.FValidateEdgeIsAdjacent(EdgeCWSuccessor))
            {
                return(Failure());
            }

            if (!VtxStart.FValidateEdgeIsAdjacent(this))
            {
                return(Failure());
            }
            // -RQS

            // RQS- Check adjacency of all listed edges to the proper polygons
            if (!PolyLeft.FValidateEdgeIsAdjacent(this))
            {
                return(Failure());
            }

            if (!PolyRight.FValidateEdgeIsAdjacent(this))
            {
                return(Failure());
            }

            if (!PolyLeft.FValidateEdgeIsAdjacent(EdgeCWSuccessor))
            {
                return(Failure());
            }

            if (!PolyLeft.FValidateEdgeIsAdjacent(EdgeCCWPredecessor))
            {
                return(Failure());
            }

            if (!PolyRight.FValidateEdgeIsAdjacent(EdgeCCWSuccessor))
            {
                return(Failure());
            }

            if (!PolyRight.FValidateEdgeIsAdjacent(EdgeCWPredecessor))
            {
                return(Failure());
            }
            // -RQS

            return(true);
        }