-
Notifications
You must be signed in to change notification settings - Fork 110
Refactored faceting logic in dlgPICSARainfall class #10044
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
Changes from 2 commits
e23f29d
c49f5f3
267d950
24b39b2
882d877
0535877
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,8 +41,6 @@ Public Class dlgPICSARainfall | |
| Private clsCLimitsYDate As New RFunction | ||
| Private clsFacetFunction As New RFunction | ||
| Private clsFacetOperator As New ROperator | ||
| Private clsFacetRowOp As New ROperator | ||
| Private clsFacetColOp As New ROperator | ||
| Private clsThemeFunction As New RFunction | ||
| Private dctThemeFunctions As New Dictionary(Of String, RFunction) | ||
| Private bResetSubdialog As Boolean = True | ||
|
|
@@ -119,6 +117,7 @@ Public Class dlgPICSARainfall | |
| Private clsAesGeomTextLabelUpperTercileLine As New RFunction | ||
| Private clsPasteUpperTercileY As New RFunction | ||
| Private clsFormatUpperTercileY As New RFunction | ||
| Private clsVarsFunction As New RFunction | ||
|
|
||
| Private clsAsDate As New RFunction | ||
| Private clsAsNumeric As New RFunction | ||
|
|
@@ -199,8 +198,6 @@ Public Class dlgPICSARainfall | |
| ucrInputStation.SetItems({strFacetWrap, strFacetRow, strFacetColAll, strFacetRowAll, strFacetCol, strNone}) | ||
| ucrInputStation.SetDropDownStyleAsNonEditable() | ||
|
|
||
|
|
||
|
|
||
| ucrSave.SetPrefix("picsa_rainfall_graph") | ||
| ucrSave.SetIsComboBox() | ||
| ucrSave.SetSaveTypeAsGraph() | ||
|
|
@@ -233,16 +230,12 @@ Public Class dlgPICSARainfall | |
| clsPipeOperator = New ROperator | ||
| clsFactorLevels = New RFunction | ||
|
|
||
| clsVarsFunction = New RFunction | ||
| clsCLimitsYContinuous = New RFunction | ||
| clsCLimitsYDate = New RFunction | ||
|
|
||
| clsFacetFunction = New RFunction | ||
| clsFacetOperator = New ROperator | ||
| clsFacetRowOp = New ROperator | ||
| clsFacetColOp = New ROperator | ||
|
|
||
| clsAsDateYLimit = New RFunction | ||
|
|
||
| clsGeomHlineMean = New RFunction | ||
| clsGeomHlineAesMean = New RFunction | ||
| clsMeanFunction = New RFunction | ||
|
|
@@ -320,7 +313,6 @@ Public Class dlgPICSARainfall | |
| 'TODO Not yet implemented so do not add | ||
| 'clsYScaleDateFunction.AddParameter("limits", clsRFunctionParameter:=clsCLimitsYDate, iPosition:=8) | ||
|
|
||
|
|
||
| clsThemeFunction = GgplotDefaults.clsDefaultThemeFunction | ||
| clsLocalRaesFunction = GgplotDefaults.clsAesFunction.Clone() | ||
| dctThemeFunctions = New Dictionary(Of String, RFunction)(GgplotDefaults.dctThemeFunctions) | ||
|
|
@@ -373,14 +365,14 @@ Public Class dlgPICSARainfall | |
| clsPointsFunc.AddParameter("colour", Chr(34) & "red" & Chr(34)) | ||
|
|
||
| clsFacetFunction.SetPackageName("ggplot2") | ||
| clsFacetRowOp.SetOperation("+") | ||
| clsFacetRowOp.bBrackets = False | ||
| clsFacetColOp.SetOperation("+") | ||
| clsFacetColOp.bBrackets = False | ||
| 'clsFacetRowOp.SetOperation("+") | ||
| 'clsFacetRowOp.bBrackets = False | ||
| 'clsFacetColOp.SetOperation("+") | ||
| 'clsFacetColOp.bBrackets = False | ||
| clsFacetOperator.SetOperation("~") | ||
| clsFacetOperator.bForceIncludeOperation = True | ||
| clsFacetOperator.bBrackets = False | ||
| clsFacetFunction.AddParameter("facets", clsROperatorParameter:=clsFacetOperator, iPosition:=0) | ||
| 'clsFacetFunction.AddParameter("facets", clsROperatorParameter:=clsFacetOperator, iPosition:=0) | ||
|
||
|
|
||
|
|
||
| 'Mean Line | ||
|
|
@@ -645,6 +637,9 @@ Public Class dlgPICSARainfall | |
|
|
||
| clsAsNumeric.SetRCommand("as.numeric") | ||
|
|
||
| clsVarsFunction.SetPackageName("ggplot2") | ||
| clsVarsFunction.SetRCommand("Vars") | ||
|
|
||
| clsRaesFunction.AddParameter("y", clsRFunctionParameter:=clsAsNumeric, iPosition:=1) | ||
| clsRaesFunction.AddParameter("x", ucrReceiverX.GetVariableNames, iPosition:=2) | ||
| clsCoordPolarStartOperator = GgplotDefaults.clsCoordPolarStartOperator.Clone() | ||
|
|
@@ -738,8 +733,8 @@ Public Class dlgPICSARainfall | |
|
|
||
| Private Sub UpdateParameters() | ||
| clsFacetOperator.RemoveParameterByName("var1") | ||
| clsFacetColOp.RemoveParameterByName("col" & ucrInputStation.Name) | ||
| clsFacetRowOp.RemoveParameterByName("row" & ucrInputStation.Name) | ||
| 'clsFacetColOp.RemoveParameterByName("col" & ucrInputStation.Name) | ||
| 'clsFacetRowOp.RemoveParameterByName("row" & ucrInputStation.Name) | ||
|
||
| clsBaseOperator.RemoveParameterByName("facets") | ||
| bUpdatingParameters = True | ||
| ucrReceiverFacetBy.SetRCode(Nothing) | ||
|
|
@@ -749,10 +744,13 @@ Public Class dlgPICSARainfall | |
| ucrReceiverFacetBy.SetRCode(clsFacetOperator) | ||
| Case strFacetCol, strFacetColAll | ||
| ucrReceiverFacetBy.ChangeParameterName("col" & ucrInputStation.Name) | ||
| ucrReceiverFacetBy.SetRCode(clsFacetColOp) | ||
| 'ucrReceiverFacetBy.SetRCode(clsFacetColOp) | ||
|
||
| clsVarsFunction.AddParameter("var", ucrReceiverFacetBy.GetVariableNames(False), iPosition:=0, bIncludeArgumentName:=False) | ||
|
|
||
| Case strFacetRow, strFacetRowAll | ||
| ucrReceiverFacetBy.ChangeParameterName("row" & ucrInputStation.Name) | ||
| ucrReceiverFacetBy.SetRCode(clsFacetRowOp) | ||
| 'ucrReceiverFacetBy.SetRCode(clsFacetRowOp) | ||
|
||
| clsVarsFunction.AddParameter("var", ucrReceiverFacetBy.GetVariableNames(False), iPosition:=0, bIncludeArgumentName:=False) | ||
| End Select | ||
| If Not clsRaesFunction.ContainsParameter("x") Then | ||
| clsRaesFunction.AddParameter("x", Chr(34) & Chr(34)) | ||
|
|
@@ -771,6 +769,10 @@ Public Class dlgPICSARainfall | |
| Exit Sub | ||
| End If | ||
| clsBaseOperator.RemoveParameterByName("facets") | ||
| clsFacetFunction.RemoveParameterByName("facets") | ||
| clsFacetFunction.RemoveParameterByName("rows") | ||
| clsFacetFunction.RemoveParameterByName("ggplot2::rows") | ||
| clsFacetFunction.RemoveParameterByName("cols") | ||
| If Not ucrReceiverFacetBy.IsEmpty Then | ||
| Select Case ucrInputStation.GetText() | ||
| Case strFacetWrap | ||
|
|
@@ -786,9 +788,17 @@ Public Class dlgPICSARainfall | |
| bRowAll = True | ||
| End Select | ||
| End If | ||
| If bWrap OrElse bRow OrElse bCol OrElse bColAll OrElse bRowAll Then | ||
| clsBaseOperator.AddParameter("facets", clsRFunctionParameter:=clsFacetFunction) | ||
|
|
||
| If bWrap Then | ||
| clsFacetFunction.AddParameter("facets", clsROperatorParameter:=clsFacetOperator, iPosition:=0) | ||
| ElseIf bRow Then | ||
| clsFacetFunction.AddParameter("rows", clsRFunctionParameter:=clsVarsFunction) | ||
| ElseIf bRowAll Then | ||
| clsFacetFunction.AddParameter("ggplot2::rows", clsRFunctionParameter:=clsVarsFunction) | ||
| ElseIf bCol OrElse bColAll Then | ||
| clsFacetFunction.AddParameter("cols", clsRFunctionParameter:=clsVarsFunction) | ||
| End If | ||
| clsBaseOperator.AddParameter("facets", clsRFunctionParameter:=clsFacetFunction) | ||
|
|
||
| If bWrap Then | ||
| clsFacetFunction.SetRCommand("facet_wrap") | ||
|
|
@@ -803,22 +813,21 @@ Public Class dlgPICSARainfall | |
| Else | ||
| clsFacetFunction.RemoveParameterByName("margin") | ||
| End If | ||
|
|
||
| If bRow OrElse bRowAll Then | ||
| clsFacetOperator.AddParameter("left", clsROperatorParameter:=clsFacetRowOp, iPosition:=0) | ||
| ElseIf (bCol OrElse bColAll) AndAlso bWrap = False Then | ||
| clsFacetOperator.AddParameter("left", ".", iPosition:=0) | ||
| Else | ||
| clsFacetOperator.RemoveParameterByName("left") | ||
| End If | ||
|
|
||
| If bCol OrElse bColAll Then | ||
| clsFacetOperator.AddParameter("right", clsROperatorParameter:=clsFacetColOp, iPosition:=1) | ||
| ElseIf (bRow OrElse bRowAll) AndAlso bWrap = False Then | ||
| clsFacetOperator.AddParameter("right", ".", iPosition:=1) | ||
| Else | ||
| clsFacetOperator.RemoveParameterByName("right") | ||
| End If | ||
| 'If bRow OrElse bRowAll Then | ||
| ' 'clsFacetOperator.AddParameter("left", clsROperatorParameter:=clsFacetRowOp, iPosition:=0) | ||
| 'ElseIf (bCol OrElse bColAll) AndAlso bWrap = False Then | ||
| ' clsFacetOperator.AddParameter("left", ".", iPosition:=0) | ||
| 'Else | ||
| ' clsFacetOperator.RemoveParameterByName("left") | ||
| 'End If | ||
|
|
||
| 'If bCol OrElse bColAll Then | ||
| ' clsFacetOperator.AddParameter("right", clsROperatorParameter:=clsFacetColOp, iPosition:=1) | ||
| 'ElseIf (bRow OrElse bRowAll) AndAlso bWrap = False Then | ||
| ' clsFacetOperator.AddParameter("right", ".", iPosition:=1) | ||
| 'Else | ||
| ' clsFacetOperator.RemoveParameterByName("right") | ||
| 'End If | ||
|
||
| End Sub | ||
|
|
||
| Private Sub ucrVariablesAsFactorForPicsa_ControlValueChanged() Handles ucrVariablesAsFactorForPicsa.ControlValueChanged | ||
|
|
@@ -967,10 +976,10 @@ Public Class dlgPICSARainfall | |
| Select Case ucrInputStation.GetText() | ||
| Case strFacetWrap | ||
| GetParameterValue(clsFacetOperator) | ||
| Case strFacetCol, strFacetColAll | ||
| GetParameterValue(clsFacetColOp) | ||
| Case strFacetRow, strFacetRowAll | ||
| GetParameterValue(clsFacetRowOp) | ||
| 'Case strFacetCol, strFacetColAll | ||
| ' GetParameterValue(clsVarsFunction) | ||
| 'Case strFacetRow, strFacetRowAll | ||
| ' GetParameterValue(clsFacetRowOp) | ||
| End Select | ||
|
Comment on lines
954
to
957
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The grouping logic for |
||
| End If | ||
| If clsRaesFunction.ContainsParameter("colour") Then | ||
|
|
@@ -1086,3 +1095,4 @@ Public Class dlgPICSARainfall | |
| openSdgLayerOptions(clsPointsFunc) | ||
| End Sub | ||
| End Class | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block of code is commented out. It's preferable to remove unused code rather than commenting it out to keep the codebase clean.