Esempio n. 1
0
    private IEnumerator CheckForParentThenChildren()
    {
        if (parentSet == false)
        {
            if (axisType == "node")
            {
                Tag parent = new Tag();

                yield return(StartCoroutine(ViRMA_APIController.GetHierarchyParent(axisId, (response) => {
                    if (response != null)
                    {
                        parent = response;
                        parentAxisId = parent.Id;
                        parentAxisLabel = parent.Label;
                        //Debug.Log("Parent: " + parent.Label);
                    }
                    else
                    {
                        //Debug.Log("No parent!");
                    }
                })));

                StartCoroutine(ViRMA_APIController.GetHierarchyChildren(parent.Id, (response) => {
                    parent.Children     = response;
                    parentChildrenCount = parent.Children.Count;
                    parentSet           = true;
                }));
            }
        }
    }
Esempio n. 2
0
 private void CheckForChildren()
 {
     if (childrenSet == false)
     {
         if (axisType == "node")
         {
             StartCoroutine(ViRMA_APIController.GetHierarchyChildren(axisPointId, (response) => {
                 List <Tag> children    = response;
                 axisPointChildrenCount = children.Count;
                 childrenSet            = true;
             }));
         }
     }
 }
Esempio n. 3
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!");
                 }
             }));
         }
     }
 }
Esempio n. 4
0
    private IEnumerator GenerateAxesFromLabels(Query submittedQuery)
    {
        activeAxesLabels = new AxesLabels();

        // get X label data from server
        if (submittedQuery.X != null)
        {
            string parentLabel = "";
            yield return(StartCoroutine(ViRMA_APIController.GetHierarchyTag(submittedQuery.X.Id, (Tag parentTag) => {
                parentLabel = parentTag.Label;
            })));

            yield return(StartCoroutine(ViRMA_APIController.GetHierarchyChildren(submittedQuery.X.Id, (List <Tag> childTags) => {
                activeAxesLabels.SetAxisLabsls("X", submittedQuery.X.Id, submittedQuery.X.Type, parentLabel, childTags);
            })));
        }

        // get Y label data from server
        if (submittedQuery.Y != null)
        {
            string parentLabel = "";
            yield return(StartCoroutine(ViRMA_APIController.GetHierarchyTag(submittedQuery.Y.Id, (Tag parentTag) => {
                parentLabel = parentTag.Label;
            })));

            yield return(StartCoroutine(ViRMA_APIController.GetHierarchyChildren(submittedQuery.Y.Id, (List <Tag> childTags) => {
                activeAxesLabels.SetAxisLabsls("Y", submittedQuery.Y.Id, submittedQuery.Y.Type, parentLabel, childTags);
            })));
        }

        // get Z label data from server
        if (submittedQuery.Z != null)
        {
            string parentLabel = "";
            yield return(StartCoroutine(ViRMA_APIController.GetHierarchyTag(submittedQuery.Z.Id, (Tag parentTag) => {
                parentLabel = parentTag.Label;
            })));

            yield return(StartCoroutine(ViRMA_APIController.GetHierarchyChildren(submittedQuery.Z.Id, (List <Tag> childTags) => {
                activeAxesLabels.SetAxisLabsls("Z", submittedQuery.Z.Id, submittedQuery.Z.Type, parentLabel, childTags);
            })));
        }

        // // global style for propety blocks
        Material transparentMaterial             = Resources.Load("Materials/BasicTransparent") as Material;
        MaterialPropertyBlock materialProperties = new MaterialPropertyBlock();
        float axisLineWidth = 0.005f;

        // origin point
        GameObject AxisOriginPoint = GameObject.CreatePrimitive(PrimitiveType.Cube);

        AxisOriginPoint.GetComponent <Renderer>().material = transparentMaterial;
        materialProperties.SetColor("_Color", new Color32(0, 0, 0, 255));
        AxisOriginPoint.GetComponent <Renderer>().SetPropertyBlock(materialProperties);
        AxisOriginPoint.name = "AxisOriginPoint";
        AxisOriginPoint.transform.position   = Vector3.zero;
        AxisOriginPoint.transform.localScale = Vector3.one * 0.5f;
        AxisOriginPoint.transform.parent     = cellsandAxesWrapper.transform;

        // add origin block to all axis object lists
        axisXPointObjs.Add(AxisOriginPoint);
        axisYPointObjs.Add(AxisOriginPoint);
        axisZPointObjs.Add(AxisOriginPoint);

        // x axis points
        if (activeAxesLabels.X != null)
        {
            materialProperties.SetColor("_Color", ViRMA_Colors.axisFadeRed);
            for (int i = 0; i < activeAxesLabels.X.Labels.Count; i++)
            {
                // create gameobject to represent axis point
                GameObject axisXPoint = GameObject.CreatePrimitive(PrimitiveType.Cube);
                axisXPoint.GetComponent <Renderer>().material = transparentMaterial;
                axisXPoint.GetComponent <Renderer>().SetPropertyBlock(materialProperties);
                axisXPoint.name = "AxisXPoint_" + i;
                axisXPoint.transform.position   = new Vector3(i + 1, 0, 0) * (defaultCellSpacingRatio + 1);
                axisXPoint.transform.localScale = Vector3.one * 0.5f;
                axisXPoint.transform.parent     = cellsandAxesWrapper.transform;
                axisXPoint.AddComponent <ViRMA_AxisPoint>().x = true;

                // apply metadata to axis point
                ViRMA_AxisPoint axisPoint = axisXPoint.GetComponent <ViRMA_AxisPoint>();
                axisPoint.axisId         = activeAxesLabels.X.Id;
                axisPoint.axisLabel      = activeAxesLabels.X.Label;
                axisPoint.axisType       = activeAxesLabels.X.Type;
                axisPoint.axisPointLabel = activeAxesLabels.X.Labels[i].Label;
                axisPoint.axisPointId    = activeAxesLabels.X.Labels[i].Id;

                // add gameobject to list
                axisXPointObjs.Add(axisXPoint);

                // x axis roll up axis point
                if (i == activeAxesLabels.X.Labels.Count - 1)
                {
                    GameObject axisXPointRollUp = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                    axisXPointRollUp.GetComponent <Renderer>().material = transparentMaterial;
                    axisXPointRollUp.GetComponent <Renderer>().SetPropertyBlock(materialProperties);
                    axisXPointRollUp.name = "AxisXPoint_RollUp";
                    axisXPointRollUp.transform.position = new Vector3(i + 2, 0, 0) * (defaultCellSpacingRatio + 1);
                    axisXPointRollUp.transform.parent   = cellsandAxesWrapper.transform;
                    axisXPointRollUp.AddComponent <ViRMA_RollUpPoint>().x         = true;
                    axisXPointRollUp.GetComponent <ViRMA_RollUpPoint>().axisId    = activeAxesLabels.X.Id;
                    axisXPointRollUp.GetComponent <ViRMA_RollUpPoint>().axisLabel = activeAxesLabels.X.Label;
                    axisXPointRollUp.GetComponent <ViRMA_RollUpPoint>().axisType  = activeAxesLabels.X.Type;
                }
            }

            // x axis line
            if (axisXPointObjs.Count > 2)
            {
                GameObject AxisXLineObj = new GameObject("AxisXLine");
                axisXLine = AxisXLineObj.AddComponent <LineRenderer>();
                axisXLine.GetComponent <Renderer>().material = transparentMaterial;
                axisXLine.GetComponent <Renderer>().SetPropertyBlock(materialProperties);
                axisXLine.positionCount = 2;
                axisXLine.startWidth    = axisLineWidth;
                axisXLine.endWidth      = axisLineWidth;
            }
        }

        // y axis points
        if (activeAxesLabels.Y != null)
        {
            materialProperties.SetColor("_Color", ViRMA_Colors.axisFadeGreen);
            for (int i = 0; i < activeAxesLabels.Y.Labels.Count; i++)
            {
                // create gameobject to represent axis point
                GameObject axisYPoint = GameObject.CreatePrimitive(PrimitiveType.Cube);
                axisYPoint.GetComponent <Renderer>().material = transparentMaterial;
                axisYPoint.GetComponent <Renderer>().SetPropertyBlock(materialProperties);
                axisYPoint.name = "AxisYPoint_" + i;
                axisYPoint.transform.position   = new Vector3(0, i + 1, 0) * (defaultCellSpacingRatio + 1);
                axisYPoint.transform.localScale = Vector3.one * 0.5f;
                axisYPoint.transform.parent     = cellsandAxesWrapper.transform;
                axisYPoint.AddComponent <ViRMA_AxisPoint>().y = true;

                // apply metadata to axis point
                ViRMA_AxisPoint axisPoint = axisYPoint.GetComponent <ViRMA_AxisPoint>();
                axisPoint.axisId         = activeAxesLabels.Y.Id;
                axisPoint.axisLabel      = activeAxesLabels.Y.Label;
                axisPoint.axisType       = activeAxesLabels.Y.Type;
                axisPoint.axisPointLabel = activeAxesLabels.Y.Labels[i].Label;
                axisPoint.axisPointId    = activeAxesLabels.Y.Labels[i].Id;

                // add gameobject to list
                axisYPointObjs.Add(axisYPoint);

                // y axis roll up axis point
                if (i == activeAxesLabels.Y.Labels.Count - 1)
                {
                    GameObject axisYPointRollUp = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                    axisYPointRollUp.GetComponent <Renderer>().material = transparentMaterial;
                    axisYPointRollUp.GetComponent <Renderer>().SetPropertyBlock(materialProperties);
                    axisYPointRollUp.name = "AxisYPoint_RollUp";
                    axisYPointRollUp.transform.position = new Vector3(0, i + 2, 0) * (defaultCellSpacingRatio + 1);
                    axisYPointRollUp.transform.parent   = cellsandAxesWrapper.transform;
                    axisYPointRollUp.AddComponent <ViRMA_RollUpPoint>().y         = true;
                    axisYPointRollUp.GetComponent <ViRMA_RollUpPoint>().axisId    = activeAxesLabels.Y.Id;
                    axisYPointRollUp.GetComponent <ViRMA_RollUpPoint>().axisLabel = activeAxesLabels.Y.Label;
                    axisYPointRollUp.GetComponent <ViRMA_RollUpPoint>().axisType  = activeAxesLabels.Y.Type;
                }
            }

            // y axis line
            if (axisYPointObjs.Count > 2)
            {
                GameObject AxisYLineObj = new GameObject("AxisYLine");
                axisYLine = AxisYLineObj.AddComponent <LineRenderer>();
                axisYLine.GetComponent <Renderer>().material = transparentMaterial;
                axisYLine.GetComponent <Renderer>().SetPropertyBlock(materialProperties);
                axisYLine.positionCount = 2;
                axisYLine.startWidth    = axisLineWidth;
                axisYLine.endWidth      = axisLineWidth;
            }
        }

        // z axis points
        if (activeAxesLabels.Z != null)
        {
            materialProperties.SetColor("_Color", ViRMA_Colors.axisFadeBlue);
            for (int i = 0; i < activeAxesLabels.Z.Labels.Count; i++)
            {
                // create gameobject to represent axis point
                GameObject axisZPoint = GameObject.CreatePrimitive(PrimitiveType.Cube);
                axisZPoint.GetComponent <Renderer>().material = transparentMaterial;
                axisZPoint.GetComponent <Renderer>().SetPropertyBlock(materialProperties);
                axisZPoint.name = "AxisZPoint_" + i;
                axisZPoint.transform.position   = new Vector3(0, 0, i + 1) * (defaultCellSpacingRatio + 1);
                axisZPoint.transform.localScale = Vector3.one * 0.5f;
                axisZPoint.transform.parent     = cellsandAxesWrapper.transform;
                axisZPoint.AddComponent <ViRMA_AxisPoint>().z = true;

                // apply metadata to axis point
                ViRMA_AxisPoint axisPoint = axisZPoint.GetComponent <ViRMA_AxisPoint>();
                axisPoint.axisId         = activeAxesLabels.Z.Id;
                axisPoint.axisLabel      = activeAxesLabels.Z.Label;
                axisPoint.axisType       = activeAxesLabels.Z.Type;
                axisPoint.axisPointLabel = activeAxesLabels.Z.Labels[i].Label;
                axisPoint.axisPointId    = activeAxesLabels.Z.Labels[i].Id;

                // add gameobject to list
                axisZPointObjs.Add(axisZPoint);

                // z axis roll up axis point
                if (i == activeAxesLabels.Z.Labels.Count - 1)
                {
                    GameObject axisZPointRollUp = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                    axisZPointRollUp.GetComponent <Renderer>().material = transparentMaterial;
                    axisZPointRollUp.GetComponent <Renderer>().SetPropertyBlock(materialProperties);
                    axisZPointRollUp.name = "AxisYPoint_RollUp";
                    axisZPointRollUp.transform.position = new Vector3(0, 0, i + 2) * (defaultCellSpacingRatio + 1);
                    axisZPointRollUp.transform.parent   = cellsandAxesWrapper.transform;
                    axisZPointRollUp.AddComponent <ViRMA_RollUpPoint>().z         = true;
                    axisZPointRollUp.GetComponent <ViRMA_RollUpPoint>().axisId    = activeAxesLabels.Z.Id;
                    axisZPointRollUp.GetComponent <ViRMA_RollUpPoint>().axisLabel = activeAxesLabels.Z.Label;
                    axisZPointRollUp.GetComponent <ViRMA_RollUpPoint>().axisType  = activeAxesLabels.Z.Type;
                }
            }

            // z axis line
            if (axisZPointObjs.Count > 2)
            {
                GameObject AxisZLineObj = new GameObject("AxisZLine");
                axisZLine = AxisZLineObj.AddComponent <LineRenderer>();
                axisZLine.GetComponent <Renderer>().material = transparentMaterial;
                axisZLine.GetComponent <Renderer>().SetPropertyBlock(materialProperties);
                axisZLine.positionCount = 2;
                axisZLine.startWidth    = axisLineWidth;
                axisZLine.endWidth      = axisLineWidth;
            }
        }
    }
Esempio n. 5
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;
    }