예제 #1
0
        public void ResetHighlight(IMNodeInternal hop)
        {
            if (Equals(_globalHighlightTarget) ||
                !Highlighting ||
                (_highlightedLink != null && _highlightedLink.OtherEnd(this).Equals(hop)))
            {
                return;
            }

            lock (HighlightLock) {
                _highlightState = HighlghtState.NotHighlighting;

                if (_highlightedLink != null)
                {
                    _highlightedLink.Reset();
                    _highlightedLink.OtherEnd(this).ResetHighlight(this);
                    _highlightedLink = null;
                }
            }
        }
예제 #2
0
        private void RouteChangeListener(string alg, IMNodeInternal target, IMLink oldRoute, IMLink newRoute, float oldDist, float dist)
        {
            Logger.Debug(Name + " changing route to " + target.Name + ". " + (oldRoute == null ? "No old route" : "Old route: " + oldRoute.Name) + ". " + (newRoute == null ? "No new route" : "New route: " + newRoute.Name));
            if (OnForwardingTableChange != null && (oldRoute == null || newRoute == null || !oldRoute.Equals(newRoute) || oldDist != dist))
            {
                OnForwardingTableChange(ID, ForwardingTableList);
            }

            //If not highlighting or not highlighting the route that was changed quit
            if ((oldRoute != null && newRoute != null && oldRoute.Equals(newRoute)) ||
                !GlobalHighlighting ||
                !target.Equals(_globalHighlightTarget) ||
                (GlobalHighlightingSingle && !HighlightingSingle && !Equals(_globalHighlightRoot)))
            {
                return;
            }

            if (oldRoute != null)
            {
                oldRoute.Reset();
                if (HighlightingSingle)
                {
                    oldRoute.OtherEnd(this).ResetHighlight(this);
                }
            }

            if (newRoute != null)
            {
                newRoute.Colour = _globalHighlightColour;
                if (GlobalHighlightingSingle)
                {
                    _highlightState = HighlghtState.HighlightingSingle;
                    newRoute.OtherEnd(this).Highlight(this);
                }
            }
            else
            {
                _highlightState = HighlghtState.NotHighlighting;
            }

            _highlightedLink = newRoute;
        }
예제 #3
0
        private void RouteChangeListener(string alg, IMNodeInternal target, IMLink oldRoute, IMLink newRoute, float oldDist, float dist)
        {
            Logger.Debug(Name + " changing route to " + target.Name + ". " + (oldRoute == null ? "No old route" : "Old route: " + oldRoute.Name) + ". " + (newRoute == null ? "No new route" : "New route: " + newRoute.Name));
            if (OnForwardingTableChange != null && (oldRoute == null || newRoute == null || !oldRoute.Equals(newRoute) || oldDist != dist))
                OnForwardingTableChange(ID, ForwardingTableList);

            //If not highlighting or not highlighting the route that was changed quit
            if ((oldRoute != null && newRoute != null && oldRoute.Equals(newRoute)) ||
                !GlobalHighlighting ||
                !target.Equals(_globalHighlightTarget) ||
                (GlobalHighlightingSingle && !HighlightingSingle && !Equals(_globalHighlightRoot)))
                return;

            if (oldRoute != null) {
                oldRoute.Reset();
                if (HighlightingSingle)
                    oldRoute.OtherEnd(this).ResetHighlight(this);
            }

            if (newRoute != null) {
                newRoute.Colour = _globalHighlightColour;
                if (GlobalHighlightingSingle) {
                    _highlightState = HighlghtState.HighlightingSingle;
                    newRoute.OtherEnd(this).Highlight(this);
                }
            } else
                _highlightState = HighlghtState.NotHighlighting;

            _highlightedLink = newRoute;
        }