Example #1
0
        private void CreateChildren(RelationshipInfo relationshipInfo)
        {
            var verticesWithPositions = relationshipInfo.Layout;

            if (verticesWithPositions.Any() == false)
            {
                return;
            }

            if (verticesWithPositions == null)
            {
                return;
            }

            var minX = verticesWithPositions.Values.Min(p => p.X) - 10;
            var minY = verticesWithPositions.Values.Min(p => p.Y) - 10;

            offsetVector = new Point(-minX, -minY);

            Children.Clear();
            verticesWithPositions.
            ToList()
            .Select(CreateVertex)
            .ToList()
            .ForEach(c => Children.Add(c));

            RelationshipInfo.Graph.Edges
            .Select(CreateEdge)
            .ToList()
            .ForEach(e => Children.Add(e));
        }
Example #2
0
 public void UpdateRelationshipInfo(IDictionary <VertexModel, Point> layout = null)
 {
     if (layout != null && layout.Keys.OrderBy(_ => _.VertexId).SequenceEqual(graph.Vertices.OrderBy(_ => _.VertexId)))
     {
         RelationshipInfo = new RelationshipInfo(graph, layout);
     }
     else
     {
         RelationshipInfo = new RelationshipInfo(graph, layoutFactory.ComputeLayout(graph, new Dictionary <VertexModel, Point>(0)));
     }
 }