예제 #1
0
        public void Link(Linkable end1, Linkable end2, int linkShapeId)
        {
            if (end1 == end2)
            {
                throw new NotSupportedException("no self loops");
            }

            if (end1.HasAdjacent(end2))
            {
                throw new NotSupportedException("no multiedges");
            }

            var fwd = new Edge(end1, end2, linkShapeId, true);

            _forwardEdges.Add(linkShapeId, fwd);
            end1.AddEdge(fwd);
            end2.AddEdge(new Edge(end2, end1, linkShapeId, false));
        }
예제 #2
0
        public void Unlink(Linkable end1, Linkable end2, int usrId)
        {
            if (end1 == end2)
            {
                throw new NotSupportedException("no self loops");
            }

            if (!end1.HasAdjacent(end2))
            {
                throw new NotSupportedException("no link");
            }

            var edge1 = end1.RemoveEdge(end2);

            if (edge1.forward)
            {
                _forwardEdges.Remove(edge1.linkShapeId);
            }

            var edge2 = end2.RemoveEdge(end1);

            if (edge2.forward)
            {
                _forwardEdges.Remove(edge2.linkShapeId);
            }

            if (edge1.linkShapeId != edge2.linkShapeId)
            {
                throw new NotSupportedException("?");
            }

            if (onLinkRemove != null)
            {
                onLinkRemove(end1, end2, edge1.linkShapeId, usrId);
            }
        }
예제 #3
0
        public void Unlink(Linkable end1, Linkable end2, int usrId)
        {
            if (end1 == end2)
                throw new NotSupportedException("no self loops");

            if (!end1.HasAdjacent(end2))
                throw new NotSupportedException("no link");

            var edge1 = end1.RemoveEdge(end2);
            if (edge1.forward)
                _forwardEdges.Remove(edge1.linkShapeId);

            var edge2 = end2.RemoveEdge(end1);
            if (edge2.forward)
                _forwardEdges.Remove(edge2.linkShapeId);

            if (edge1.linkShapeId != edge2.linkShapeId)
                throw new NotSupportedException("?");

            if (onLinkRemove != null)
                onLinkRemove(end1, end2, edge1.linkShapeId, usrId);
        }
예제 #4
0
        public void Link(Linkable end1, Linkable end2, int linkShapeId)
        {
            if (end1 == end2)
                throw new NotSupportedException("no self loops");

            if (end1.HasAdjacent(end2))
                throw new NotSupportedException("no multiedges");

            var fwd = new Edge(end1, end2, linkShapeId, true);
            _forwardEdges.Add(linkShapeId, fwd);
            end1.AddEdge(fwd);
            end2.AddEdge(new Edge(end2, end1, linkShapeId, false));
        }