// deprecated public static IEnumerator GetAxesLabels(Query query, Action <AxesLabels> onSuccess) { AxesLabels axisLabels = new AxesLabels(); (string name, List <KeyValuePair <string, int> > labels) processLabelData(JSONNode response) { string name; List <KeyValuePair <string, int> > labels = new List <KeyValuePair <string, int> >(); if (response["tags"] == null) { // hierarchy name = "testing"; foreach (JSONObject child in response) { int labelId = child["id"]; string labelName = child["name"]; int bracketIndex = labelName.IndexOf("("); if (bracketIndex > -1) { labelName = labelName.Substring(0, bracketIndex); } KeyValuePair <string, int> labelIdPair = new KeyValuePair <string, int>(labelName, labelId); labels.Add(labelIdPair); } } else { // tagset name = response["name"]; foreach (JSONObject child in response["tags"]) { int labelId = child["id"]; string labelName = child["name"]; int bracketIndex = labelName.IndexOf("("); if (bracketIndex > -1) { labelName = labelName.Substring(0, bracketIndex); } KeyValuePair <string, int> labelIdPair = new KeyValuePair <string, int>(labelName, labelId); labels.Add(labelIdPair); } } labels = labels.OrderBy(kvp => kvp.Key).ToList(); return(name, labels); } if (query.X != null) { string type = query.X.Type; yield return(GetRequest(type + "/" + query.X.Id + "/children", (response) => { (string name, List <KeyValuePair <string, int> > labels) = processLabelData(response); //axisLabels.SetAxisLabsls("X", query.X.Id, type, name, labels); }));
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; } } }
// projected filters public void FetchProjectedFilterMetadata() { xParentChain = new List <Tag>(); yParentChain = new List <Tag>(); zParentChain = new List <Tag>(); xParentChainFetched = false; yParentChainFetched = false; zParentChainFetched = false; AxesLabels axesLabels = globals.vizController.activeAxesLabels; if (axesLabels.X != null) { if (axesLabels.X.Type == "node") { Tag firstNodeParent = new Tag(); firstNodeParent.Id = axesLabels.X.Id; firstNodeParent.Label = axesLabels.X.Label; xParentChain = new List <Tag>() { firstNodeParent }; StartCoroutine(GetHierarchyParentChain(axesLabels.X.Id, "X")); } else if (axesLabels.X.Type == "tagset") { Tag tagsetParent = new Tag(); tagsetParent.Id = axesLabels.X.Id; tagsetParent.Label = axesLabels.X.Label; xParentChain = new List <Tag>() { tagsetParent }; xParentChainFetched = true; } } else { xParentChainFetched = true; } if (axesLabels.Y != null) { if (axesLabels.Y.Type == "node") { Tag firstNodeParent = new Tag(); firstNodeParent.Id = axesLabels.Y.Id; firstNodeParent.Label = axesLabels.Y.Label; yParentChain = new List <Tag>() { firstNodeParent }; StartCoroutine(GetHierarchyParentChain(axesLabels.Y.Id, "Y")); } else if (axesLabels.Y.Type == "tagset") { Tag tagsetParent = new Tag(); tagsetParent.Id = axesLabels.Y.Id; tagsetParent.Label = axesLabels.Y.Label; yParentChain = new List <Tag>() { tagsetParent }; yParentChainFetched = true; } } else { yParentChainFetched = true; } if (axesLabels.Z != null) { if (axesLabels.Z.Type == "node") { Tag firstNodeParent = new Tag(); firstNodeParent.Id = axesLabels.Z.Id; firstNodeParent.Label = axesLabels.Z.Label; zParentChain = new List <Tag>() { firstNodeParent }; StartCoroutine(GetHierarchyParentChain(axesLabels.Z.Id, "Z")); } else if (axesLabels.Z.Type == "tagset") { Tag tagsetParent = new Tag(); tagsetParent.Id = axesLabels.Z.Id; tagsetParent.Label = axesLabels.Z.Label; zParentChain = new List <Tag>() { tagsetParent }; zParentChainFetched = true; } } else { zParentChainFetched = true; } }
// deprecated public void LoadTimelineData(GameObject submittedCell) { isContextTimeline = false; if (submittedCell.GetComponent <ViRMA_Cell>()) { // deep clone query filters for timeline API call List <Query.Filter> cellFiltersForTimeline = ObjectExtensions.Copy(globals.queryController.activeFilters); // get cell data and currently active viz axes labels timelineCellData = submittedCell.GetComponent <ViRMA_Cell>().thisCellData; activeVizLabels = globals.vizController.activeAxesLabels; // if X axis exits, find location of submitted call on it and grab data if (activeVizLabels.X != null) { int cellXPosition = (int)timelineCellData.Coordinates.x - 1; int cellXAxisId = activeVizLabels.X.Labels[cellXPosition].Id; string cellXAxisType = activeVizLabels.X.Type; Query.Filter projFilterX = new Query.Filter(cellXAxisType, new List <int>() { cellXAxisId }); cellFiltersForTimeline.Add(projFilterX); } // if Y axis exits, find location of submitted call on it and grab data if (activeVizLabels.Y != null) { int cellYPosition = (int)timelineCellData.Coordinates.y - 1; int cellYAxisId = activeVizLabels.Y.Labels[cellYPosition].Id; string cellYAxisType = activeVizLabels.Y.Type; Query.Filter projFilterY = new Query.Filter(cellYAxisType, new List <int>() { cellYAxisId }); cellFiltersForTimeline.Add(projFilterY); } // if Z axis exits, find location of submitted call on it and grab data if (activeVizLabels.Z != null) { int cellZPosition = (int)timelineCellData.Coordinates.z - 1; int cellZAxisId = activeVizLabels.Z.Labels[cellZPosition].Id; string cellZAxisType = activeVizLabels.Z.Type; Query.Filter projFilterZ = new Query.Filter(cellZAxisType, new List <int>() { cellZAxisId }); cellFiltersForTimeline.Add(projFilterZ); } // get timeline image data from server and load it StartCoroutine(ViRMA_APIController.GetTimeline(cellFiltersForTimeline, (results) => { cellContentResults = results; if (cellContentResults.Count > 0) { if (cellContentResults.Count >= resultsRenderSize) { if (cellContentResults.Count % resultsRenderSize == 0) { totalTimeLineSections = (cellContentResults.Count / resultsRenderSize); } else { totalTimeLineSections = (cellContentResults.Count / resultsRenderSize) + 1; } } else { totalTimeLineSections = 1; } LoadTimelineSection(0, totalTimeLineSections); } })); } }
public void LoadCellContentTimelineData(GameObject submittedCell) { isContextTimeline = false; if (submittedCell.GetComponent <ViRMA_Cell>()) { Query cellContentQuery = new Query(); cellContentQuery.Filters = ObjectExtensions.Copy(globals.queryController.activeFilters); // get cell data and currently active viz axes labels timelineCellData = submittedCell.GetComponent <ViRMA_Cell>().thisCellData; activeVizLabels = globals.vizController.activeAxesLabels; // if X axis exits, find location of submitted call on it and grab data if (activeVizLabels.X != null) { int cellXPosition = (int)timelineCellData.Coordinates.x - 1; int cellXAxisId = activeVizLabels.X.Labels[cellXPosition].Id; string cellXAxisType = activeVizLabels.X.Type; cellContentQuery.SetAxis("X", cellXAxisId, cellXAxisType); } // if Y axis exits, find location of submitted call on it and grab data if (activeVizLabels.Y != null) { int cellYPosition = (int)timelineCellData.Coordinates.y - 1; int cellYAxisId = activeVizLabels.Y.Labels[cellYPosition].Id; string cellYAxisType = activeVizLabels.Y.Type; cellContentQuery.SetAxis("Y", cellYAxisId, cellYAxisType); } // if Z axis exits, find location of submitted call on it and grab data if (activeVizLabels.Z != null) { int cellZPosition = (int)timelineCellData.Coordinates.z - 1; int cellZAxisId = activeVizLabels.Z.Labels[cellZPosition].Id; string cellZAxisType = activeVizLabels.Z.Type; cellContentQuery.SetAxis("Z", cellZAxisId, cellZAxisType); } // get cell content image data from server and load it StartCoroutine(ViRMA_APIController.GetCellContents(cellContentQuery, (results) => { cellContentResults = results; if (cellContentResults.Count > 0) { if (cellContentResults.Count >= resultsRenderSize) { if (cellContentResults.Count % resultsRenderSize == 0) { totalTimeLineSections = (cellContentResults.Count / resultsRenderSize); } else { totalTimeLineSections = (cellContentResults.Count / resultsRenderSize) + 1; } } else { totalTimeLineSections = 1; } LoadTimelineSection(0, totalTimeLineSections); } })); } }