Beispiel #1
0
        Topic GetSibling(Topic from, bool forward, int level, Vector4 vector)
        {
            if (this.Level == level && this.Vector == vector)
            {
                return(this);
            }

            if (forward)
            {
                if (HasChildren)
                {
                    if (Children.Contains(from) && from != LastChild)
                    {
                        return(from.NextSibling.GetSibling(this, forward, level, vector));
                    }
                    else if (from == ParentTopic)
                    {
                        return(FirstChild.GetSibling(this, forward, level, vector));
                    }
                }
            }
            else
            {
                if (HasChildren)
                {
                    if (Children.Contains(from) && from != FirstChild)
                    {
                        return(from.PreviousSibling.GetSibling(this, forward, level, vector));
                    }
                    else if (from == ParentTopic)
                    {
                        return(LastChild.GetSibling(this, forward, level, vector));
                    }
                }
            }

            if (ParentTopic == null)
            {
                return(null);
            }
            else
            {
                return(ParentTopic.GetSibling(this, forward, level, vector));
            }
        }
Beispiel #2
0
        public Topic GetSibling(bool forward, bool nested, bool wrap)
        {
            if (ParentTopic == null)
            {
                return(null);
            }

            if (nested)
            {
                return(GetNestedSibling(forward, wrap));
            }
            else
            {
                Topic next = GetNestedSibling(forward, false);
                if (next != null)
                {
                    return(next);
                }

                next = ParentTopic.GetSibling(this, forward, Level, Vector);
                if (next != null)
                {
                    return(next);
                }

                if (wrap && MindMap != null && MindMap.Root != null)
                {
                    next = MindMap.Root.GetFirstTopic(forward, Level, Vector);
                }

                if (next == this)
                {
                    return(null);
                }
                else
                {
                    return(next);
                }
            }
        }