Ejemplo n.º 1
0
    public void SendQuery()
    {
        ArrayList graphNodes = graph.returnGraphNodes();

        if (filterNodes.Count > 0)
        {
            foreach (VisualNode v in filterNodes)
            {
                graph.removeIgnoreNode(v);
                //v.ColorDef();
                v.gameObject.SetActive(false);
                v.GetComponent <MeshFilter>().mesh = def_mesh;
            }
        }
        filterNodes = new ArrayList();
        foreach (GameObject g in graphNodes)
        {
            VisualNode v          = g.GetComponent <VisualNode>();
            int        queryCount = 0;
            if (ageStrings.Count == 0)
            {
                foreach (string s in queryStrings)
                {
                    if (s.Equals(string.Empty) == false)
                    {
                        print(v.getAttributeInfo().ToLower().Contains(s.ToLower()));
                        if (v.getAttributeInfo().ToLower().Contains(s.ToLower()))
                        {
                            queryCount++;
                        }
                    }
                }
                if (queryCount == queryStrings.Count && Query.Equals(string.Empty) == false)
                {
                    print("Found Node");
                    filterNodes.Add(v);
                    graph.addIgnoreNode(v);
                }
            }
            else
            {
                bool foundAge = false;
                foreach (string s in ageStrings)
                {
                    if (s.Equals(string.Empty) == false)
                    {
                        if (v.getAttributeInfo().ToLower().Contains(s.ToLower()))
                        {
                            foundAge = true;
                            Query   += "found age";
                        }
                    }
                }
                foreach (string s in queryStrings)
                {
                    if (s.Equals(string.Empty) == false)
                    {
                        print(v.getAttributeInfo().ToLower().Contains(s.ToLower()));
                        if (v.getAttributeInfo().ToLower().Contains(s.ToLower()))
                        {
                            queryCount++;
                        }
                    }
                }
                if (queryCount == queryStrings.Count && Query.Equals(string.Empty) == false && foundAge == true)
                {
                    print("Found Node");
                    filterNodes.Add(v);
                    graph.addIgnoreNode(v);
                }
                if (queryStrings.Count == 0 && foundAge)
                {
                    print("Found Node");
                    filterNodes.Add(v);
                    graph.addIgnoreNode(v);
                }
            }
        }

        ArrayList clusters = graph.returnClusterNodes();

        foreach (ClusterBehaviour c in clusters)
        {
            if (Query.Equals(string.Empty))
            {
                c.Brighten();
            }
            else
            {
                c.Dim();
            }
            c.ExitHighlight();
            c.RecreateCluster();
        }
        CreateFilterCluster();
    }