private void DrawConnectionForNodes(VisualizationNodeBase node, VisualizationConnection childConnection, RelationType relationType, bool isRecursion, int connectionCount)
        {
            VisualizationNodeBase childNode = childConnection.VNode;
            VisualizationNodeBase current   = relationType == RelationType.DEPENDENCY ? node : childNode;
            VisualizationNodeBase target    = relationType == RelationType.DEPENDENCY ? childNode : node;

            Vector2 currentPos = current.GetPosition(_viewAreaData);
            Vector2 targetPos  = target.GetPosition(_viewAreaData);

            float distanceBlend = 1;

            if (connectionCount > 20)
            {
                distanceBlend = Mathf.Pow(1 - Mathf.Clamp01(Mathf.Abs(currentPos.y - targetPos.y) / 20000.0f), 3);
            }

            float alphaAmount = (isRecursion ? 0.15f : 1.0f) * distanceBlend;

            DrawRecursionButton(isRecursion, node, childNode, relationType);

            if (childConnection.IsIndicator)
            {
                return;
            }

            if (alphaAmount > 0.01)
            {
                DrawConnection(currentPos.x + current.Bounds.Width, currentPos.y, targetPos.x, targetPos.y, GetConnectionColorForType(childConnection.Datas[0].Type), alphaAmount);
            }
        }
        private void AddBidirConnection(RelationType relationType, VisualizationNodeBase node, VisualizationNodeBase target,
                                        List <VisualizationConnection.Data> datas, bool isRecursion)
        {
            if (_nodeDisplayOptions.ShowPropertyPathes)
            {
                PathVisualizationNode pathVisualizationNode = new PathVisualizationNode();

                if (!VisualizationConnection.HasPathSegments(datas))
                {
                    datas = new List <VisualizationConnection.Data>();
                    datas.Add(new VisualizationConnection.Data("UnknownPath", new [] { new PathSegment("Unknown Path", PathSegmentType.Unknown) }));
                }

                node.AddRelation(relationType, new VisualizationConnection(datas, pathVisualizationNode, false));
                pathVisualizationNode.AddRelation(InvertRelationType(relationType), new VisualizationConnection(datas, node, false));

                node = pathVisualizationNode;
            }

            node.AddRelation(relationType, new VisualizationConnection(datas, target, isRecursion));
            target.AddRelation(InvertRelationType(relationType), new VisualizationConnection(datas, node, isRecursion));
        }
Exemple #3
0
 public void AddRelation(RelationType relationType, VisualizationConnection connection)
 {
     GetRelationArray(relationType).Add(connection);
 }