Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GsaGH-345 posthog diagrams #552

Merged
merged 5 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion GsaGH/Components/5_Results/FootfallResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected override void SolveInstance(IGH_DataAccess da) {

case GsaResultGoo goo: {
result = goo.Value;
if (result.Type == CaseType.Combination) {
if (result.Type == CaseType.CombinationCase) {
this.AddRuntimeError("Footfall Result only available for Analysis Cases");
return;
}
Expand Down
8 changes: 4 additions & 4 deletions GsaGH/Components/5_Results/GetResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected override void SolveInstance(IGH_DataAccess da) {
if (type.ToUpper().StartsWith("A")) {
resultType = CaseType.AnalysisCase;
} else if (type.ToUpper().StartsWith("C")) {
resultType = CaseType.Combination;
resultType = CaseType.CombinationCase;
} else {
this.AddRuntimeError("Error converting input " + Params.Input[1].NickName
+ " to 'Analysis' or 'Combination'");
Expand Down Expand Up @@ -145,7 +145,7 @@ protected override void SolveInstance(IGH_DataAccess da) {

break;

case CaseType.Combination:
case CaseType.CombinationCase:
if (_combinationCaseResults == null) {
_combinationCaseResults = model.Model.CombinationCaseResults();
if (_combinationCaseResults == null || _combinationCaseResults.Count == 0) {
Expand Down Expand Up @@ -177,8 +177,8 @@ IReadOnlyDictionary<int, ReadOnlyCollection<NodeResult>> tempNodeCombResult
}

if (!_result.ContainsKey(
new Tuple<CaseType, int>(CaseType.Combination, caseId))) {
_result.Add(new Tuple<CaseType, int>(CaseType.Combination, caseId),
new Tuple<CaseType, int>(CaseType.CombinationCase, caseId))) {
_result.Add(new Tuple<CaseType, int>(CaseType.CombinationCase, caseId),
new GsaResult(model, _combinationCaseResults[caseId], caseId, permutationIDs));
}

Expand Down
2 changes: 1 addition & 1 deletion GsaGH/Components/5_Results/GlobalPerformanceResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ protected override void SolveInternal(IGH_DataAccess da) {

case GsaResultGoo goo: {
result = goo.Value;
if (result.Type == CaseType.Combination) {
if (result.Type == CaseType.CombinationCase) {
this.AddRuntimeError("Global Result only available for Analysis Cases");
return;
}
Expand Down
20 changes: 10 additions & 10 deletions GsaGH/Components/5_Results/SelectResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ public override void SetSelected(int i, int j) {
}
case 0: {
if (_selectedItems[i] == _type[1]) {
if (_resultType == CaseType.Combination) {
if (_resultType == CaseType.CombinationCase) {
return;
}

_resultType = CaseType.Combination;
_resultType = CaseType.CombinationCase;
UpdateDropdowns();
}

Expand All @@ -74,7 +74,7 @@ public override void SetSelected(int i, int j) {
string.Join(string.Empty, _selectedItems[i].ToCharArray().Where(char.IsDigit)));
if (newId != _caseId) {
_caseId = newId;
if (_resultType == CaseType.Combination) {
if (_resultType == CaseType.CombinationCase) {
UpdatePermutations();
}
}
Expand Down Expand Up @@ -187,8 +187,8 @@ protected override void SolveInternal(IGH_DataAccess da) {
}
} else if (type.ToUpper().StartsWith("C")) {
_selectedItems[0] = _dropDownItems[0][1];
if (_resultType != CaseType.Combination) {
_resultType = CaseType.Combination;
if (_resultType != CaseType.CombinationCase) {
_resultType = CaseType.CombinationCase;
if (_dropDownItems.Count < 3) {
_dropDownItems.Add(new List<string>() {
"All",
Expand All @@ -213,7 +213,7 @@ protected override void SolveInternal(IGH_DataAccess da) {
var ghACase = new GH_Integer();
if (da.GetData(2, ref ghACase)) {
if (GH_Convert.ToInt32(ghACase, out int analCase, GH_Conversion.Both)) {
if (_resultType == CaseType.Combination && _caseId != analCase) {
if (_resultType == CaseType.CombinationCase && _caseId != analCase) {
UpdatePermutations();
}

Expand Down Expand Up @@ -267,7 +267,7 @@ protected override void SolveInternal(IGH_DataAccess da) {

break;

case CaseType.Combination:
case CaseType.CombinationCase:
if (_combinationCaseResults == null) {
_combinationCaseResults = _gsaModel.Model.CombinationCaseResults();
if (_combinationCaseResults == null || _combinationCaseResults.Count == 0) {
Expand Down Expand Up @@ -319,7 +319,7 @@ protected override void UpdateUIFromSelectedItems() {
if (_selectedItems[0] == _type[0]) {
_resultType = CaseType.AnalysisCase;
} else if (_selectedItems[0] == _type[1]) {
_resultType = CaseType.Combination;
_resultType = CaseType.CombinationCase;
}

if (_selectedItems[1].ToLower() == "all") {
Expand Down Expand Up @@ -363,7 +363,7 @@ private void UpdateDropdowns() {
_dropDownItems[1] = cases;
_selectedItems[1] = type[0] + _caseId.ToString();

if (_resultType == CaseType.Combination) {
if (_resultType == CaseType.CombinationCase) {
if (_dropDownItems.Count < 3) {
_dropDownItems.Add(new List<string>() {
"All",
Expand All @@ -390,7 +390,7 @@ private void UpdateDropdowns() {
}

private void UpdatePermutations() {
if (_resultType != CaseType.Combination) {
if (_resultType != CaseType.CombinationCase) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion GsaGH/Components/5_Results/TotalLoadsAndReactions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ protected override void SolveInternal(IGH_DataAccess da) {

case GsaResultGoo goo: {
result = goo.Value;
if (result.Type == CaseType.Combination) {
if (result.Type == CaseType.CombinationCase) {
this.AddRuntimeError("Global Result only available for Analysis Cases");
return;
}
Expand Down
4 changes: 2 additions & 2 deletions GsaGH/Components/6_Display/Contour1dResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ protected override void SolveInternal(IGH_DataAccess da) {
case GsaResultGoo goo: {
result = goo.Value;
switch (result.Type) {
case CaseType.Combination when result.SelectedPermutationIds.Count > 1:
case CaseType.CombinationCase when result.SelectedPermutationIds.Count > 1:
this.AddRuntimeWarning("Combination Case " + result.CaseId + " contains "
+ result.SelectedPermutationIds.Count
+ " permutations - only one permutation can be displayed at a time."
Expand All @@ -512,7 +512,7 @@ protected override void SolveInternal(IGH_DataAccess da) {
_case = "Case C" + result.CaseId + " P" + result.SelectedPermutationIds[0];
break;

case CaseType.Combination:
case CaseType.CombinationCase:
_case = "Case C" + result.CaseId + " P" + result.SelectedPermutationIds[0];
break;

Expand Down
4 changes: 2 additions & 2 deletions GsaGH/Components/6_Display/Contour2dResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ protected override void SolveInternal(IGH_DataAccess da) {

result = goo.Value;
switch (result.Type) {
case CaseType.Combination when result.SelectedPermutationIds.Count > 1:
case CaseType.CombinationCase when result.SelectedPermutationIds.Count > 1:
this.AddRuntimeWarning("Combination Case " + result.CaseId + " contains "
+ result.SelectedPermutationIds.Count
+ " permutations - only one permutation can be displayed at a time."
Expand All @@ -575,7 +575,7 @@ protected override void SolveInternal(IGH_DataAccess da) {
_case = "Case C" + result.CaseId + " P" + result.SelectedPermutationIds[0];
break;

case CaseType.Combination:
case CaseType.CombinationCase:
_case = "Case C" + result.CaseId + " P" + result.SelectedPermutationIds[0];
break;

Expand Down
4 changes: 2 additions & 2 deletions GsaGH/Components/6_Display/Contour3dResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ protected override void SolveInternal(IGH_DataAccess da) {
case GsaResultGoo goo: {
result = goo.Value;
switch (result.Type) {
case CaseType.Combination when result.SelectedPermutationIds.Count > 1:
case CaseType.CombinationCase when result.SelectedPermutationIds.Count > 1:
this.AddRuntimeWarning("Combination Case " + result.CaseId + " contains "
+ result.SelectedPermutationIds.Count
+ " permutations - only one permutation can be displayed at a time."
Expand All @@ -408,7 +408,7 @@ protected override void SolveInternal(IGH_DataAccess da) {
_case = "Case C" + result.CaseId + " P" + result.SelectedPermutationIds[0];
break;

case CaseType.Combination:
case CaseType.CombinationCase:
_case = "Case C" + result.CaseId + " P" + result.SelectedPermutationIds[0];
break;

Expand Down
4 changes: 2 additions & 2 deletions GsaGH/Components/6_Display/ContourNodeResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ protected override void SolveInternal(IGH_DataAccess da) {

case GsaResultGoo goo: {
result = goo.Value;
if (result.Type == CaseType.Combination
if (result.Type == CaseType.CombinationCase
&& result.SelectedPermutationIds.Count > 1) {
this.AddRuntimeWarning("Combination Case " + result.CaseId + " contains "
+ result.SelectedPermutationIds.Count
Expand All @@ -439,7 +439,7 @@ protected override void SolveInternal(IGH_DataAccess da) {
_case = "Case C" + result.CaseId + " P" + result.SelectedPermutationIds[0];
}

if (result.Type == CaseType.Combination) {
if (result.Type == CaseType.CombinationCase) {
_case = "Case C" + result.CaseId + " P" + result.SelectedPermutationIds[0];
}

Expand Down
3 changes: 1 addition & 2 deletions GsaGH/Components/6_Display/ReactionForceDiagrams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ GsaResultsValues forceValues
});

SetOutputs(da, reactionForceVectors, annotations);
PostHog.Result(result.Type, 0, GsaResultsValues.ResultType.Force,
_selectedDisplayValue.ToString());
PostHog.Diagram("Result", result.Type, "ReactionForce", _selectedDisplayValue.ToString(), Parameters.EntityType.Node);
}

private double ComputeAutoScale(GsaResultsValues forceValues, BoundingBox bbox) {
Expand Down
4 changes: 2 additions & 2 deletions GsaGH/Components/6_Display/ResultDiagrams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,14 @@
if (ghTyp?.Value is GsaResultGoo goo) {
result = goo.Value;
switch (result.Type) {
case CaseType.Combination when result.SelectedPermutationIds.Count > 1:
case CaseType.CombinationCase when result.SelectedPermutationIds.Count > 1:

Check warning on line 205 in GsaGH/Components/6_Display/ResultDiagrams.cs

View check run for this annotation

Codecov / codecov/patch

GsaGH/Components/6_Display/ResultDiagrams.cs#L205

Added line #L205 was not covered by tests
string warningText
= $"Combination Case {result.CaseId} contains {result.SelectedPermutationIds.Count} permutations - only one permutation can be displayed at a time.{Environment.NewLine}Displaying first permutation; please use the 'Select Results' to select other single permutations";
this.AddRuntimeWarning(warningText);
_case = $"C{result.CaseId}";
break;

case CaseType.Combination:
case CaseType.CombinationCase:
_case = $"C{result.CaseId}";
break;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,15 +356,15 @@ protected override void SolveInternal(IGH_DataAccess da) {
if (ghTyp.Value is GsaResultGoo goo) {
result = goo.Value;
switch (result.Type) {
case CaseType.Combination when result.SelectedPermutationIds.Count > 1:
case CaseType.CombinationCase when result.SelectedPermutationIds.Count > 1:
this.AddRuntimeWarning("Combination case contains "
+ result.SelectedPermutationIds.Count
+ " - only one permutation can be displayed at a time." + Environment.NewLine
+ "Displaying first permutation; please use the 'Select Results' to select other single permutations");
_case = "Case C" + result.CaseId + " P" + result.SelectedPermutationIds[0];
break;

case CaseType.Combination:
case CaseType.CombinationCase:
_case = "Case C" + result.CaseId + " P" + result.SelectedPermutationIds[0];
break;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,15 +431,15 @@ protected override void SolveInternal(IGH_DataAccess da) {
if (ghTyp.Value is GsaResultGoo goo) {
result = goo.Value;
switch (result.Type) {
case CaseType.Combination when result.SelectedPermutationIds.Count > 1:
case CaseType.CombinationCase when result.SelectedPermutationIds.Count > 1:
this.AddRuntimeWarning("Combination case contains "
+ result.SelectedPermutationIds.Count
+ " - only one permutation can be displayed at a time." + Environment.NewLine
+ "Displaying first permutation; please use the 'Select Results' to select other single permutations");
_case = "Case C" + result.CaseId + " P" + result.SelectedPermutationIds[0];
break;

case CaseType.Combination:
case CaseType.CombinationCase:
_case = "Case C" + result.CaseId + " P" + result.SelectedPermutationIds[0];
break;

Expand Down
4 changes: 2 additions & 2 deletions GsaGH/Components/GraveyardComp/NodeContourResults_OBSOLETE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,15 +309,15 @@ protected override void SolveInternal(IGH_DataAccess da) {
if (ghTyp.Value is GsaResultGoo goo) {
result = goo.Value;
switch (result.Type) {
case CaseType.Combination when result.SelectedPermutationIds.Count > 1:
case CaseType.CombinationCase when result.SelectedPermutationIds.Count > 1:
this.AddRuntimeWarning("Combination case contains "
+ result.SelectedPermutationIds.Count
+ " - only one permutation can be displayed at a time." + Environment.NewLine
+ "Displaying first permutation; please use the 'Select Results' to select other single permutations");
_case = "Case C" + result.CaseId + " P" + result.SelectedPermutationIds[0];
break;

case CaseType.Combination:
case CaseType.CombinationCase:
_case = "Case C" + result.CaseId + " P" + result.SelectedPermutationIds[0];
break;

Expand Down
4 changes: 2 additions & 2 deletions GsaGH/Helpers/PostHog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ internal static void Diagram(string diagramType, CaseType caseType, string type,

internal static void Diagram(
string diagramType, string caseId, string type, List<GsaAPI.DiagramType> subTypes, EntityType entityType) {
CaseType caseType = caseId.StartsWith("L") ? CaseType.Load
: caseId.StartsWith("A") ? CaseType.AnalysisCase : CaseType.Combination;
CaseType caseType = caseId.StartsWith("L") ? CaseType.LoadCase
: caseId.StartsWith("A") ? CaseType.AnalysisCase : CaseType.CombinationCase;
List<string> subType = subTypes.ConvertAll(x => x.ToString());
Diagram(diagramType, caseType, type, string.Join(";", subTypes), entityType);
}
Expand Down
4 changes: 2 additions & 2 deletions GsaGH/Parameters/5_Results/GsaResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ internal GsaResult(
GsaModel model, CombinationCaseResult result, int caseId, IEnumerable<int> permutations) {
Model = model;
CombinationCaseResult = result;
Type = CaseType.Combination;
Type = CaseType.CombinationCase;
CaseId = caseId;
SelectedPermutationIds = permutations.OrderBy(x => x).ToList();
}
Expand All @@ -360,7 +360,7 @@ public override string ToString() {
txt = "A" + CaseId;
break;

case CaseType.Combination: {
case CaseType.CombinationCase: {
txt = "C" + CaseId;
if (SelectedPermutationIds.Count > 0) {
txt = SelectedPermutationIds.Count > 1 ? txt + " P:" + SelectedPermutationIds.Count :
Expand Down
4 changes: 2 additions & 2 deletions GsaGH/Parameters/Enums/CaseType.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace GsaGH.Parameters {
public enum CaseType {
Load,
LoadCase,
AnalysisCase,
Combination
CombinationCase
}
}
4 changes: 2 additions & 2 deletions GsaGHTests/3_Components/5_Results/GetResultsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void TestCombinationNoPermutation() {
ComponentTestHelper.SetInput(comp, 1, 2);

var result = (GsaResultGoo)ComponentTestHelper.GetOutput(comp);
Assert.Equal(CaseType.Combination, result.Value.Type);
Assert.Equal(CaseType.CombinationCase, result.Value.Type);
Assert.Equal(1, result.Value.CaseId);
Assert.Equal(new List<int>() {
1,
Expand All @@ -84,7 +84,7 @@ public void TestCombinationWithPermutation() {
ComponentTestHelper.SetInput(comp, 1, 3);

var result = (GsaResultGoo)ComponentTestHelper.GetOutput(comp);
Assert.Equal(CaseType.Combination, result.Value.Type);
Assert.Equal(CaseType.CombinationCase, result.Value.Type);
Assert.Equal(1, result.Value.CaseId);
Assert.Equal(new List<int>() {
1,
Expand Down
Loading