Skip to content

Commit

Permalink
refactor: fixed typos, renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikaLos committed Dec 18, 2024
1 parent 1f6a6e6 commit 1770740
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 68 deletions.
20 changes: 10 additions & 10 deletions GsaGH/Components/6_Display/AssemblyResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ private enum FoldMode {
"Drift Index",
"Force",
});
private static readonly ContourLegendManager _contourLegendManager = ContourLegendManager.GetDefault();
private string _case = string.Empty;
private double _defScale = 250;
private DisplayValue _disp = DisplayValue.ResXyz;
Expand All @@ -121,7 +122,6 @@ private enum FoldMode {
private string _resType;
private bool _slider = true;
private EnvelopeMethod _envelopeType = EnvelopeMethod.Absolute;
private static readonly ContourLegendManager _contourLegendMenager = ContourLegendManager.GetDefault();
private List<(int startY, int endY, Color gradientColor)> _gradients
= new List<(int startY, int endY, Color gradientColor)>();

Expand All @@ -139,7 +139,7 @@ public override void CreateAttributes() {

public override void DrawViewportWires(IGH_PreviewArgs args) {
base.DrawViewportWires(args);
_contourLegendMenager.Legend.DrawLegendRectangle(args, _resType, _case, _gradients);
_contourLegendManager.Legend.DrawLegendRectangle(args, _resType, _case, _gradients);
}

public override bool Read(GH_IReader reader) {
Expand All @@ -158,7 +158,7 @@ public override bool Read(GH_IReader reader) {
_forceUnit = (ForceUnit)UnitsHelper.Parse(typeof(ForceUnit), reader.GetString("force"));
_momentUnit = (MomentUnit)UnitsHelper.Parse(typeof(MomentUnit), reader.GetString("moment"));

_contourLegendMenager.DeserialiseLegendState(reader);
_contourLegendManager.DeserialiseLegendState(reader);

return base.Read(reader);
}
Expand Down Expand Up @@ -299,7 +299,7 @@ public override bool Write(GH_IWriter writer) {
writer.SetString("moment", Moment.GetAbbreviation(_momentUnit));
writer.SetString("envelope", _envelopeType.ToString());

_contourLegendMenager.SerialiseLegendState(writer);
_contourLegendManager.SerialiseLegendState(writer);

return base.Write(writer);
}
Expand All @@ -314,7 +314,7 @@ protected override void AppendAdditionalComponentMenuItems(ToolStripDropDown men
ToolStripMenuItem envelopeMenu = GenerateToolStripMenuItem.GetEnvelopeSubMenuItem(_envelopeType, UpdateEnvelope);
menu.Items.Add(envelopeMenu);

Menu_AppendItem(menu, "Show Legend", ShowLegend, true, _contourLegendMenager.Configuration.IsVisible);
Menu_AppendItem(menu, "Show Legend", ShowLegend, true, _contourLegendManager.Configuration.IsVisible);

var gradient = new GH_GradientControl();
gradient.CreateAttributes();
Expand Down Expand Up @@ -342,7 +342,7 @@ protected override void AppendAdditionalComponentMenuItems(ToolStripDropDown men

menu.Items.Add(unitsMenu);

ToolStripMenuItem legendScaleMenu = _contourLegendMenager.CreateMenu(this, () => base.UpdateUI());
ToolStripMenuItem legendScaleMenu = _contourLegendManager.CreateMenu(this, () => base.UpdateUI());

menu.Items.Add(legendScaleMenu);

Expand Down Expand Up @@ -776,7 +776,7 @@ Parameters.Results.AssemblyForcesAndMoments forces
}
});

int gripheight = _contourLegendMenager.Configuration.ActualHeight / ghGradient.GripCount;
int gripheight = _contourLegendManager.Configuration.ActualHeight / ghGradient.GripCount;
var legendValues = new List<string>();
var legendValuePositionsY = new List<int>();

Expand Down Expand Up @@ -843,10 +843,10 @@ Parameters.Results.AssemblyForcesAndMoments forces
legendValues[i] = legendValues[i].Replace(",", string.Empty);
}

legendValuePositionsY.Add(_contourLegendMenager.Configuration.ActualHeight - starty + (gripheight / 2) - 2);
legendValuePositionsY.Add(_contourLegendManager.Configuration.ActualHeight - starty + (gripheight / 2) - 2);
}

_contourLegendMenager.Configuration.SetTextValues(legendValues).SetValuePositionsY(legendValuePositionsY);
_contourLegendManager.Configuration.SetTextValues(legendValues).SetValuePositionsY(legendValuePositionsY);

da.SetDataTree(0, resultLines);
da.SetDataList(1, cs);
Expand Down Expand Up @@ -926,7 +926,7 @@ private void ReDrawComponent() {
}

internal void ShowLegend(object sender, EventArgs e) {
_contourLegendMenager.Configuration.ToggleLegendVisibility();
_contourLegendManager.Configuration.ToggleLegendVisibility();
ExpirePreview(true);
}

Expand Down
20 changes: 10 additions & 10 deletions GsaGH/Components/6_Display/Contour1dResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ private enum FoldMode {
"Footfall",
"Steel Design",
});
private readonly ContourLegendManager _contourLegendManager = ContourLegendManager.GetDefault();
private string _case = string.Empty;
private double _defScale = 250;
private DisplayValue _disp = DisplayValue.ResXyz;
Expand All @@ -149,7 +150,6 @@ private enum FoldMode {
private bool _slider = true;
private PressureUnit _stressUnit = DefaultUnits.StressUnitResult;
private EnvelopeMethod _envelopeType = EnvelopeMethod.Absolute;
private readonly ContourLegendManager _contourLegendMenager = ContourLegendManager.GetDefault();
private List<(int startY, int endY, Color gradientColor)> _gradients
= new List<(int startY, int endY, Color gradientColor)>();

Expand All @@ -167,7 +167,7 @@ public override void CreateAttributes() {

public override void DrawViewportWires(IGH_PreviewArgs args) {
base.DrawViewportWires(args);
_contourLegendMenager.Legend.DrawLegendRectangle(args, _resType, _case, _gradients);
_contourLegendManager.Legend.DrawLegendRectangle(args, _resType, _case, _gradients);
}

public override bool Read(GH_IReader reader) {
Expand Down Expand Up @@ -195,7 +195,7 @@ public override bool Read(GH_IReader reader) {
_momentUnit = (MomentUnit)UnitsHelper.Parse(typeof(MomentUnit), reader.GetString("moment"));
_energyResultUnit = (EnergyUnit)UnitsHelper.Parse(typeof(EnergyUnit), reader.GetString("energy"));

_contourLegendMenager.DeserialiseLegendState(reader);
_contourLegendManager.DeserialiseLegendState(reader);

return base.Read(reader);
}
Expand Down Expand Up @@ -405,7 +405,7 @@ public override bool Write(GH_IWriter writer) {
writer.SetString("energy", Energy.GetAbbreviation(_energyResultUnit));
writer.SetString("envelope", _envelopeType.ToString());

_contourLegendMenager.SerialiseLegendState(writer);
_contourLegendManager.SerialiseLegendState(writer);

return base.Write(writer);
}
Expand All @@ -420,7 +420,7 @@ protected override void AppendAdditionalComponentMenuItems(ToolStripDropDown men
ToolStripMenuItem envelopeMenu = GenerateToolStripMenuItem.GetEnvelopeSubMenuItem(_envelopeType, UpdateEnvelope);
menu.Items.Add(envelopeMenu);

Menu_AppendItem(menu, "Show Legend", ShowLegend, true, _contourLegendMenager.Configuration.IsVisible);
Menu_AppendItem(menu, "Show Legend", ShowLegend, true, _contourLegendManager.Configuration.IsVisible);

var gradient = new GH_GradientControl();
gradient.CreateAttributes();
Expand Down Expand Up @@ -456,7 +456,7 @@ protected override void AppendAdditionalComponentMenuItems(ToolStripDropDown men

menu.Items.Add(unitsMenu);

ToolStripMenuItem legendScaleMenu = _contourLegendMenager.CreateMenu(this, () => base.UpdateUI());
ToolStripMenuItem legendScaleMenu = _contourLegendManager.CreateMenu(this, () => base.UpdateUI());
menu.Items.Add(legendScaleMenu);

Menu_AppendSeparator(menu);
Expand Down Expand Up @@ -1027,7 +1027,7 @@ IEntity0dResultCache<ISteelUtilisation, SteelUtilisationExtremaKeys> utilisation
}
}
});
int gripheight = _contourLegendMenager.Configuration.ActualHeight / ghGradient.GripCount;
int gripheight = _contourLegendManager.Configuration.ActualHeight / ghGradient.GripCount;
var legendValues = new List<string>();
var legendValuePositionsY = new List<int>();

Expand Down Expand Up @@ -1107,10 +1107,10 @@ IEntity0dResultCache<ISteelUtilisation, SteelUtilisationExtremaKeys> utilisation
legendValues[i] = legendValues[i].Replace(",", string.Empty);
}

legendValuePositionsY.Add(_contourLegendMenager.Configuration.ActualHeight - starty + (gripheight / 2) - 2);
legendValuePositionsY.Add(_contourLegendManager.Configuration.ActualHeight - starty + (gripheight / 2) - 2);
}

_contourLegendMenager.Configuration.SetTextValues(legendValues).SetValuePositionsY(legendValuePositionsY);
_contourLegendManager.Configuration.SetTextValues(legendValues).SetValuePositionsY(legendValuePositionsY);

da.SetDataTree(0, resultLines);
da.SetDataList(1, cs);
Expand Down Expand Up @@ -1214,7 +1214,7 @@ private void ReDrawComponent() {
}

internal void ShowLegend(object sender, EventArgs e) {
_contourLegendMenager.Configuration.ToggleLegendVisibility();
_contourLegendManager.Configuration.ToggleLegendVisibility();
ExpirePreview(true);
}

Expand Down
20 changes: 10 additions & 10 deletions GsaGH/Components/6_Display/Contour2dResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ private enum FoldMode {
"Stress",
"Footfall",
});
private readonly ContourLegendManager _contourLegendManager = ContourLegendManager.GetDefault();
private string _case = string.Empty;
private double _defScale = 250;
private DisplayValue _disp = DisplayValue.ResXyz;
Expand All @@ -129,7 +130,6 @@ private enum FoldMode {
private bool _slider = true;
private PressureUnit _stressUnitResult = DefaultUnits.StressUnitResult;
private EnvelopeMethod _envelopeType = EnvelopeMethod.Absolute;
private readonly ContourLegendManager _contourLegendMenager = ContourLegendManager.GetDefault();
private List<(int startY, int endY, Color gradientColor)> _gradients
= new List<(int startY, int endY, Color gradientColor)>();

Expand All @@ -148,7 +148,7 @@ public override void CreateAttributes() {
public override void DrawViewportWires(IGH_PreviewArgs args) {
base.DrawViewportWires(args);

_contourLegendMenager.Legend.DrawLegendRectangle(args, _resType, _case, _gradients);
_contourLegendManager.Legend.DrawLegendRectangle(args, _resType, _case, _gradients);
}

public override bool Read(GH_IReader reader) {
Expand All @@ -172,7 +172,7 @@ public override bool Read(GH_IReader reader) {
_forceUnit = (ForceUnit)UnitsHelper.Parse(typeof(ForceUnit), reader.GetString("moment"));
_stressUnitResult = (PressureUnit)UnitsHelper.Parse(typeof(PressureUnit), reader.GetString("stress"));

_contourLegendMenager.DeserialiseLegendState(reader);
_contourLegendManager.DeserialiseLegendState(reader);

return base.Read(reader);
}
Expand Down Expand Up @@ -392,7 +392,7 @@ public override bool Write(GH_IWriter writer) {
writer.SetString("stress", Pressure.GetAbbreviation(_stressUnitResult));
writer.SetString("envelope", _envelopeType.ToString());

_contourLegendMenager.SerialiseLegendState(writer);
_contourLegendManager.SerialiseLegendState(writer);

return base.Write(writer);
}
Expand All @@ -407,7 +407,7 @@ protected override void AppendAdditionalComponentMenuItems(ToolStripDropDown men
ToolStripMenuItem envelopeMenu = GenerateToolStripMenuItem.GetEnvelopeSubMenuItem(_envelopeType, UpdateEnvelope);
menu.Items.Add(envelopeMenu);

Menu_AppendItem(menu, "Show Legend", ShowLegend, true, _contourLegendMenager.Configuration.IsVisible);
Menu_AppendItem(menu, "Show Legend", ShowLegend, true, _contourLegendManager.Configuration.IsVisible);

var gradient = new GH_GradientControl();
gradient.CreateAttributes();
Expand Down Expand Up @@ -438,7 +438,7 @@ protected override void AppendAdditionalComponentMenuItems(ToolStripDropDown men

menu.Items.Add(unitsMenu);

ToolStripMenuItem legendScaleMenu = _contourLegendMenager.CreateMenu(this, () => base.UpdateUI());
ToolStripMenuItem legendScaleMenu = _contourLegendManager.CreateMenu(this, () => base.UpdateUI());
menu.Items.Add(legendScaleMenu);

Menu_AppendSeparator(menu);
Expand Down Expand Up @@ -861,7 +861,7 @@ IEntity0dResultSubset<IFootfall, ResultFootfall<Entity0dExtremaKey>> nodeFootfal
resultMeshes.AddRange(meshes.Values.ToList(), values.Values.ToList(), verticies.Values.ToList(),
meshes.Keys.ToList());

int gripheight = _contourLegendMenager.Configuration.ActualHeight / ghGradient.GripCount;
int gripheight = _contourLegendManager.Configuration.ActualHeight / ghGradient.GripCount;
var legendValues = new List<string>();
var legendValuePositionsY = new List<int>();

Expand Down Expand Up @@ -932,10 +932,10 @@ IEntity0dResultSubset<IFootfall, ResultFootfall<Entity0dExtremaKey>> nodeFootfal
legendValues[i] = legendValues[i].Replace(",", string.Empty);
}

legendValuePositionsY.Add(_contourLegendMenager.Configuration.ActualHeight - starty + (gripheight / 2) - 2);
legendValuePositionsY.Add(_contourLegendManager.Configuration.ActualHeight - starty + (gripheight / 2) - 2);
}

_contourLegendMenager.Configuration.SetTextValues(legendValues).SetValuePositionsY(legendValuePositionsY);
_contourLegendManager.Configuration.SetTextValues(legendValues).SetValuePositionsY(legendValuePositionsY);

da.SetData(0, resultMeshes);
da.SetDataList(1, cs);
Expand Down Expand Up @@ -1027,7 +1027,7 @@ private void ReDrawComponent() {
}

internal void ShowLegend(object sender, EventArgs e) {
_contourLegendMenager.Configuration.ToggleLegendVisibility();
_contourLegendManager.Configuration.ToggleLegendVisibility();
ExpirePreview(true);
}

Expand Down
20 changes: 10 additions & 10 deletions GsaGH/Components/6_Display/Contour3dResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ private enum FoldMode {
"Displacement",
"Stress",
});
private readonly ContourLegendManager _contourLegendManager = ContourLegendManager.GetDefault();
private string _case = string.Empty;
private double _defScale = 250;
private DisplayValue _disp = DisplayValue.ResXyz;
Expand All @@ -97,7 +98,6 @@ private enum FoldMode {
private bool _slider = true;
private PressureUnit _stressUnitResult = DefaultUnits.StressUnitResult;
private EnvelopeMethod _envelopeType = EnvelopeMethod.Absolute;
private readonly ContourLegendManager _contourLegendMenager = ContourLegendManager.GetDefault();
private List<(int startY, int endY, Color gradientColor)> _gradients
= new List<(int startY, int endY, Color gradientColor)>();

Expand All @@ -115,7 +115,7 @@ public override void CreateAttributes() {

public override void DrawViewportWires(IGH_PreviewArgs args) {
base.DrawViewportWires(args);
_contourLegendMenager.Legend.DrawLegendRectangle(args, _resType, _case, _gradients);
_contourLegendManager.Legend.DrawLegendRectangle(args, _resType, _case, _gradients);
}

public override bool Read(GH_IReader reader) {
Expand All @@ -134,7 +134,7 @@ public override bool Read(GH_IReader reader) {
_lengthResultUnit = (LengthUnit)UnitsHelper.Parse(typeof(LengthUnit), reader.GetString("length"));
_stressUnitResult = (PressureUnit)UnitsHelper.Parse(typeof(PressureUnit), reader.GetString("stress"));

_contourLegendMenager.DeserialiseLegendState(reader);
_contourLegendManager.DeserialiseLegendState(reader);

return base.Read(reader);
}
Expand Down Expand Up @@ -244,7 +244,7 @@ public override bool Write(GH_IWriter writer) {
writer.SetString("stress", Pressure.GetAbbreviation(_stressUnitResult));
writer.SetString("envelope", _envelopeType.ToString());

_contourLegendMenager.SerialiseLegendState(writer);
_contourLegendManager.SerialiseLegendState(writer);

return base.Write(writer);
}
Expand All @@ -259,7 +259,7 @@ protected override void AppendAdditionalComponentMenuItems(ToolStripDropDown men
ToolStripMenuItem envelopeMenu = GenerateToolStripMenuItem.GetEnvelopeSubMenuItem(_envelopeType, UpdateEnvelope);
menu.Items.Add(envelopeMenu);

Menu_AppendItem(menu, "Show Legend", ShowLegend, true, _contourLegendMenager.Configuration.IsVisible);
Menu_AppendItem(menu, "Show Legend", ShowLegend, true, _contourLegendManager.Configuration.IsVisible);

var gradient = new GH_GradientControl();
gradient.CreateAttributes();
Expand All @@ -279,7 +279,7 @@ protected override void AppendAdditionalComponentMenuItems(ToolStripDropDown men
});
unitsMenu.ImageScaling = ToolStripItemImageScaling.SizeToFit;
menu.Items.Add(unitsMenu);
ToolStripMenuItem legendScaleMenu = _contourLegendMenager.CreateMenu(this, () => base.UpdateUI());
ToolStripMenuItem legendScaleMenu = _contourLegendManager.CreateMenu(this, () => base.UpdateUI());
menu.Items.Add(legendScaleMenu);

Menu_AppendSeparator(menu);
Expand Down Expand Up @@ -574,7 +574,7 @@ IMeshResultSubset<IMeshQuantity<IStress>, IStress, ResultTensor3<Entity2dExtrema
resultMeshes.AddRange(meshes.Values.ToList(), values.Values.ToList(), verticies.Values.ToList(),
meshes.Keys.ToList());

int gripheight = _contourLegendMenager.Configuration.ActualHeight / ghGradient.GripCount;
int gripheight = _contourLegendManager.Configuration.ActualHeight / ghGradient.GripCount;
var legendValues = new List<string>();
var legendValuePositionsY = new List<int>();

Expand Down Expand Up @@ -623,10 +623,10 @@ IMeshResultSubset<IMeshQuantity<IStress>, IStress, ResultTensor3<Entity2dExtrema
legendValues[i] = legendValues[i].Replace(",", string.Empty); // remove thousand separator
}

legendValuePositionsY.Add(_contourLegendMenager.Configuration.ActualHeight - starty + (gripheight / 2) - 2);
legendValuePositionsY.Add(_contourLegendManager.Configuration.ActualHeight - starty + (gripheight / 2) - 2);
}

_contourLegendMenager.Configuration.SetTextValues(legendValues).SetValuePositionsY(legendValuePositionsY);
_contourLegendManager.Configuration.SetTextValues(legendValues).SetValuePositionsY(legendValuePositionsY);

da.SetData(0, resultMeshes);
da.SetDataList(1, cs);
Expand Down Expand Up @@ -682,7 +682,7 @@ private void ReDrawComponent() {
}

internal void ShowLegend(object sender, EventArgs e) {
_contourLegendMenager.Configuration.ToggleLegendVisibility();
_contourLegendManager.Configuration.ToggleLegendVisibility();
ExpirePreview(true);
}

Expand Down
Loading

0 comments on commit 1770740

Please sign in to comment.