Exemplo n.º 1
0
 public bool SharesNode(DiagramNodeConnection otherConnection)
 {
     return(FirstNode == otherConnection.FirstNode ||
            SecondNode == otherConnection.FirstNode ||
            FirstNode == otherConnection.SecondNode ||
            SecondNode == otherConnection.SecondNode);
 }
Exemplo n.º 2
0
    private void loadCorrelations()
    {
        DataTable data;
        Dictionary <int, DiagramNode> nodes;
        List <DiagramNodeConnection>  connections;
        int?selectedSiteId;

        nodes       = new Dictionary <int, DiagramNode>();
        connections = new List <DiagramNodeConnection>();

        selectedSiteId = siteList.GetSelectedSiteId();
        if (selectedSiteId == null)
        {
            return;
        }

        data = _db.Report_DatasourceCorrelations(selectedSiteId.Value);
        //data = _db.Report_DatasourceCorrelations(8);

        for (int i = 0; i < data.Rows.Count; i++)
        {
            DiagramNode node;
            int         nodeId, otherNodeId;
            string      name, otherName;

            nodeId = (int)data.Rows[i]["ConfiguredDatasourceId"];
            name   = (string)data.Rows[i]["Name"];
            if (nodes.ContainsKey(nodeId))
            {
                node = nodes[nodeId];
            }
            else
            {
                nodes.Add(nodeId, new DiagramNode(DiagramGenerator.WrapText(name, 15), nodeId, null));
            }

            otherNodeId = (int)data.Rows[i]["OtherDatasourceId"];
            otherName   = (string)data.Rows[i]["OtherName"];
            if (nodes.ContainsKey(otherNodeId))
            {
                node = nodes[otherNodeId];
            }
            else
            {
                nodes.Add(otherNodeId, new DiagramNode(DiagramGenerator.WrapText(otherName, 15), otherNodeId, null));
            }

            string strength;

            strength = (string)data.Rows[i]["StrengthLabel"];

            if (strength != "None")
            {
                DiagramNodeConnection connection;
                connection = new DiagramNodeConnection();
                if (strength == "Large")
                {
                    connection.ConnectorWidth = 3;
                }
                else if (strength == "Medium")
                {
                    connection.ConnectorWidth = 2;
                }
                else
                {
                    connection.ConnectorWidth = 1;
                }

                connection.FirstNode  = nodes[nodeId];
                connection.SecondNode = nodes[otherNodeId];
                connections.Add(connection);
            }
        }

        processNodesAndConnections(connections);
    }