コード例 #1
0
        private HiddenCollection GetHiddenCollection([NotNull] string tag)
        {
            if (!_hiddenCollections.TryGetValue(tag, out HiddenCollection collection))
            {
                collection = new HiddenCollection();
                _hiddenCollections[tag] = collection;
            }

            return(collection);
        }
コード例 #2
0
        protected HiddenCollection GetHiddenCollection(string tag)
        {
            HiddenCollection h;

            if (!hiddenCollections.TryGetValue(tag, out h))
            {
                h = new HiddenCollection();
                hiddenCollections[tag] = h;
            }
            return(h);
        }
コード例 #3
0
        /// <inheritdoc />
        public bool HideEdge(TEdge edge, string tag)
        {
            HiddenCollection collection = GetHiddenCollection(tag);
            var hideEdgeHandler         = new EdgeAction <TVertex, TEdge>(e => collection.HiddenEdges.Add(e));

            EdgeHidden += hideEdgeHandler;
            bool hidden = HideEdge(edge);

            EdgeHidden -= hideEdgeHandler;
            return(hidden);
        }
コード例 #4
0
ファイル: GraphHideHelper.cs プロジェクト: heder/GraphSharp
        public bool HideVertex(TVertex v, string tag)
        {
            HiddenCollection h = GetHiddenCollection(tag);
            var eeh            = new EdgeAction <TVertex, TEdge>(e => h.hiddenEdges.Add(e));
            var veh            = new VertexAction <TVertex>(vertex => h.hiddenVertices.Add(vertex));

            EdgeHidden   += eeh;
            VertexHidden += veh;
            bool ret = HideVertex(v);

            EdgeHidden   -= eeh;
            VertexHidden -= veh;
            return(ret);
        }
コード例 #5
0
        public bool Unhide(string tag)
        {
            HiddenCollection h = GetHiddenCollection(tag);

            foreach (TVertex v in h.hiddenVertices)
            {
                UnhideVertex(v);
            }
            foreach (TEdge e in h.hiddenEdges)
            {
                UnhideEdge(e);
            }
            return(hiddenCollections.Remove(tag));
        }
コード例 #6
0
        /// <inheritdoc />
        public bool Unhide(string tag)
        {
            HiddenCollection collection = GetHiddenCollection(tag);

            foreach (TVertex vertex in collection.HiddenVertices)
            {
                UnhideVertex(vertex);
            }

            foreach (TEdge edge in collection.HiddenEdges)
            {
                UnhideEdge(edge);
            }

            return(_hiddenCollections.Remove(tag));
        }
コード例 #7
0
        /// <inheritdoc />
        public bool HideVertex(TVertex vertex, string tag)
        {
            HiddenCollection collection = GetHiddenCollection(tag);
            var hideEdgeHandler         = new EdgeAction <TVertex, TEdge>(e => collection.HiddenEdges.Add(e));
            var hideVertexHandler       = new VertexAction <TVertex>(v => collection.HiddenVertices.Add(v));

            EdgeHidden   += hideEdgeHandler;
            VertexHidden += hideVertexHandler;

            bool hidden = HideVertex(vertex);

            EdgeHidden   -= hideEdgeHandler;
            VertexHidden -= hideVertexHandler;

            return(hidden);
        }