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(); }
// on interacting with button void OnCollisionEnter(Collision other) { if (other.gameObject.tag == "Controller") { if (d.getVisualNode().hiding() == true) { off = 1; gameObject.GetComponent <Image>().color = Color.black; print("on"); } if (d.getVisualNode().hiding() == false) { off = 0; gameObject.GetComponent <Image>().color = Color.white; print("off"); } // unhighlight previous node if (visualnode != null && d.getVisualNode() != visualnode) { visualnode.transform.parent.GetComponent <ClusterBehaviour>().ExitHighlight(); } // set UI to white // Get cluster nodes and cluster class ClusterBehaviour c = d.getVisualNode().transform.parent.GetComponent <ClusterBehaviour>(); ArrayList clusterNodes = c.returnClusterNodes(); // if filtering cluster nodes if (off == 0) { d.getVisualNode().setHiding(true); foreach (VisualNode v in clusterNodes) { if (v != d.getVisualNode()) { graph.addIgnoreNode(v); } } foreach (VisualNode v in clusterNodes) { if (v != d.getVisualNode()) { v.OnHideEdges(); } } } // if unfiltering cluster nodes if (off == 1) { d.getVisualNode().setHiding(false); foreach (VisualNode v in clusterNodes) { if (v != d.getVisualNode()) { graph.removeIgnoreNode(v); } } foreach (VisualNode v in clusterNodes) { if (v != d.getVisualNode()) { v.UnHideEdges(); } } } off++; // reset back to 0 if greater than 1 if (off > 1) { off = 0; } c.RecreateCluster(); visualnode = d.getVisualNode(); } }