Exemplo n.º 1
0
 // node interaction (drill dowm, roll up, timeline for cell)
 public void DrillDownRollUp(SteamVR_Action_Boolean action, SteamVR_Input_Sources source)
 {
     if (focusedAxisPoint != null)
     {
         if (focusedAxisPoint.GetComponent <ViRMA_AxisPoint>())
         {
             ViRMA_AxisPoint axisPoint = focusedAxisPoint.GetComponent <ViRMA_AxisPoint>();
             if (axisPoint.axisType == "node")
             {
                 StartCoroutine(ViRMA_APIController.GetHierarchyChildren(axisPoint.axisPointId, (response) => {
                     List <Tag> children = response;
                     if (children.Count > 0)
                     {
                         string axisQueryType = "";
                         if (axisPoint.x)
                         {
                             axisQueryType = "X";
                         }
                         else if (axisPoint.y)
                         {
                             axisQueryType = "Y";
                         }
                         else if (axisPoint.z)
                         {
                             axisQueryType = "Z";
                         }
                         globals.queryController.buildingQuery.SetAxis(axisQueryType, axisPoint.axisPointId, "node");
                         // Debug.Log(children.Count + " children in " + axisPoint.axisPointLabel);
                     }
                     else
                     {
                         //Debug.Log("0 children in " + axisPoint.axisPointLabel);
                     }
                 }));
             }
         }
         else if (focusedAxisPoint.GetComponent <ViRMA_RollUpPoint>())
         {
             ViRMA_RollUpPoint axisPoint = focusedAxisPoint.GetComponent <ViRMA_RollUpPoint>();
             StartCoroutine(ViRMA_APIController.GetHierarchyParent(focusedAxisPoint.GetComponent <ViRMA_RollUpPoint>().axisId, (response) => {
                 Tag parent = response;
                 if (parent != null)
                 {
                     string axisQueryType = "";
                     if (axisPoint.x)
                     {
                         axisQueryType = "X";
                     }
                     else if (axisPoint.y)
                     {
                         axisQueryType = "Y";
                     }
                     else if (axisPoint.z)
                     {
                         axisQueryType = "Z";
                     }
                     globals.queryController.buildingQuery.SetAxis(axisQueryType, parent.Id, "node");
                     // Debug.Log("Parent: " + parent.Name);
                 }
                 else
                 {
                     //Debug.Log("No parent!");
                 }
             }));
         }
     }
 }
Exemplo n.º 2
0
    private IEnumerator GetTraversedHierarchyNodes(Tag submittedTagData)
    {
        dimensionExpLorerLoaded = false;

        // assign parent groupings
        GameObject             parentGroupObj = hoveredTagBtn.transform.parent.GetComponent <ViRMA_DimExplorerGroup>().parentDimExGrp;
        ViRMA_DimExplorerGroup parentGroup    = parentGroupObj.GetComponent <ViRMA_DimExplorerGroup>();
        Tag parentTagData = new Tag();


        // assign children groupings
        GameObject             childrenGroupObj = hoveredTagBtn.transform.parent.GetComponent <ViRMA_DimExplorerGroup>().childrenDimExGrp;
        ViRMA_DimExplorerGroup childrenGroup    = childrenGroupObj.GetComponent <ViRMA_DimExplorerGroup>();
        List <Tag>             childrenTagData  = new List <Tag>();


        // assign siblings groupings
        GameObject             siblingsGroupObj = hoveredTagBtn.transform.parent.GetComponent <ViRMA_DimExplorerGroup>().siblingsDimExGrp;
        ViRMA_DimExplorerGroup siblingsGroup    = siblingsGroupObj.GetComponent <ViRMA_DimExplorerGroup>();
        List <Tag>             siblingsTagData  = new List <Tag>();


        // fetch and wait for parent data
        yield return(StartCoroutine(ViRMA_APIController.GetHierarchyParent(submittedTagData.Id, (response) => {
            parentTagData = response;
        })));

        // fetch and wait for children data
        yield return(StartCoroutine(ViRMA_APIController.GetHierarchyChildren(submittedTagData.Id, (response) => {
            childrenTagData = response;
        })));

        // fetch and wait for sibling data
        if (parentTagData.Id == 0)
        {
            // if the parent id is zero, it means we're at the top of hierarchy so replace normal siblings with previous parent instead
            yield return(StartCoroutine(ViRMA_APIController.GetHierarchyParent(childrenTagData[0].Id, (response) => {
                siblingsTagData = new List <Tag>()
                {
                    response
                };
            })));
        }
        else
        {
            // if parent isn't zero, then just get the normal siblings like always
            yield return(StartCoroutine(ViRMA_APIController.GetHierarchyChildren(parentTagData.Id, (response) => {
                siblingsTagData = response;
            })));
        }

        // reload parent dim ex group
        if (parentTagData.Label == null)
        {
            parentGroup.ClearDimExplorerGroup();
        }
        else
        {
            parentGroup.tagsInGroup = new List <Tag>()
            {
                parentTagData
            };
            StartCoroutine(parentGroup.LoadDimExplorerGroup());
        }

        // reload childen dim ex grouo
        if (childrenTagData.Count < 1)
        {
            childrenGroup.ClearDimExplorerGroup();
        }
        else
        {
            childrenGroup.tagsInGroup = childrenTagData;
            StartCoroutine(childrenGroup.LoadDimExplorerGroup());
        }

        // reload sibling dim ex grouo
        if (siblingsTagData.Count < 1)
        {
            siblingsGroup.ClearDimExplorerGroup();
        }
        else
        {
            siblingsGroup.searchedForTagData = submittedTagData;
            siblingsGroup.tagsInGroup        = siblingsTagData;
            StartCoroutine(siblingsGroup.LoadDimExplorerGroup());
        }

        dimensionExpLorerLoaded = true;
    }