Skip to content

Commit

Permalink
Merge pull request #43 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
updating master
  • Loading branch information
Ivanluv authored Jul 26, 2019
2 parents 892df5f + 2444581 commit 15334fa
Show file tree
Hide file tree
Showing 18 changed files with 1,949 additions and 3,781 deletions.
41 changes: 35 additions & 6 deletions instat/dlgClimaticSummary.vb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Public Class dlgClimaticSummary
Private iReceiverMaxY As Integer
Private iReceiverLabelMaxY As Integer
Private bResetSubdialog As Boolean = False
Private clsDefaultFunction, clsSummariesList, clsDefaultFactors, clsDayFilterCalc, clsDayFilterCalcFromConvert, clsDayFilterCalcFromList As New RFunction
Private clsDefaultFunction, clsConcFunction, clsSummariesList, clsDefaultFactors, clsDayFilterCalc, clsDayFilterCalcFromConvert, clsDayFilterCalcFromList, clsAddDateFunction As New RFunction
Private clsFromAndToConditionOperator, clsFromConditionOperator, clsToConditionOperator As New ROperator

Private Sub dlgClimaticSummary_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Expand Down Expand Up @@ -87,7 +87,7 @@ Public Class dlgClimaticSummary
ucrReceiverWithinYear.SetIncludedDataTypes({"numeric", "factor"})

' others
ucrReceiverDate.SetParameter(New RParameter("date", 1))
ucrReceiverDate.SetParameter(New RParameter("columns_to_summarise", 1))
ucrReceiverDate.SetParameterIsString()
ucrReceiverDate.Selector = ucrSelectorVariable
ucrReceiverDate.AddIncludedMetadataProperty("Climatic_Type", {Chr(34) & "date" & Chr(34)})
Expand Down Expand Up @@ -132,11 +132,13 @@ Public Class dlgClimaticSummary
ucrChkOmitMissing.SetRDefault("FALSE")

ucrChkAddDateColumn.SetText("Add Date Column")
ucrChkAddDateColumn.AddParameterPresentCondition(True, "data_name", True)
ucrChkAddDateColumn.AddParameterPresentCondition(False, "data_name", False)

'linking controls
ucrPnlAnnualWithin.AddToLinkedControls({ucrReceiverYear}, {rdoAnnual, rdoAnnualWithinYear}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)
ucrPnlAnnualWithin.AddToLinkedControls({ucrReceiverWithinYear}, {rdoAnnualWithinYear, rdoWithinYear}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)
ucrPnlAnnualWithin.AddToLinkedControls({ucrChkAddDateColumn}, {rdoAnnualWithinYear}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)
ucrPnlAnnualWithin.AddToLinkedControls({ucrChkAddDateColumn}, {rdoAnnual, rdoAnnualWithinYear}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)
ucrReceiverYear.SetLinkedDisplayControl(lblYear)
ucrReceiverWithinYear.SetLinkedDisplayControl(lblWithinYear)

Expand All @@ -147,6 +149,8 @@ Public Class dlgClimaticSummary
clsDefaultFunction = New RFunction
clsSummariesList = New RFunction
clsDefaultFactors = New RFunction
clsConcFunction = New RFunction
clsAddDateFunction = New RFunction

clsFromAndToConditionOperator = New ROperator
clsDayFilterCalc = New RFunction
Expand All @@ -162,7 +166,7 @@ Public Class dlgClimaticSummary
bResetSubdialog = True
ucrSelectorVariable.Reset()
ucrReceiverElement.SetMeAsReceiver()
ucrChkAddDateColumn.Enabled = False

'TODO: this changes to from >= receiver and to <= receiver if annual-variable is checekd.
clsFromAndToConditionOperator.bToScriptAsRString = True
clsDayFilterCalc.SetRCommand("instat_calculation$new")
Expand Down Expand Up @@ -193,21 +197,32 @@ Public Class dlgClimaticSummary
clsDefaultFunction.AddParameter("silent", "TRUE")

clsDefaultFactors.SetRCommand("c")
clsConcFunction.SetRCommand("c")

clsAddDateFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$calculate_summary")
clsAddDateFunction.AddParameter("factors", clsRFunctionParameter:=clsDefaultFactors, iPosition:=3)
clsAddDateFunction.AddParameter("summaries", Chr(34) & "summary_min" & Chr(34), iPosition:=4)
clsAddDateFunction.AddParameter("silent", "TRUE", iPosition:=5)

ucrBase.clsRsyntax.ClearCodes()
ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultFunction)
bResetSubdialog = True
End Sub

Private Sub SetRCodeForControls(bReset As Boolean)
ucrReceiverDOY.AddAdditionalCodeParameterPair(clsFromConditionOperator, New RParameter("doy", 0), iAdditionalPairNo:=1)
'This is currently not working. Selector should be able to pass additional parameter pairs!
'ucrSelectorVariable.AddAdditionalCodeParameterPair(clsAddDateFunction, New RParameter("data_name", 0), iAdditionalPairNo:=1)

ucrReceiverDOY.SetRCode(clsToConditionOperator, bReset)
ucrChkAddDateColumn.SetRCode(clsAddDateFunction, bReset)

ucrSelectorVariable.SetRCode(clsDefaultFunction, bReset)
ucrReceiverElement.SetRCode(clsDefaultFunction, bReset)
ucrChkStoreResults.SetRCode(clsDefaultFunction, bReset)
ucrChkPrintOutput.SetRCode(clsDefaultFunction, bReset)
ucrChkOmitMissing.SetRCode(clsDefaultFunction, bReset)
ucrReceiverDate.SetRCode(clsAddDateFunction, bReset)

ucrPnlAnnualWithin.SetRCode(clsDefaultFactors, bReset)
ucrReceiverStation.SetRCode(clsDefaultFactors, bReset)
Expand Down Expand Up @@ -249,7 +264,7 @@ Public Class dlgClimaticSummary
End Sub

Private Sub cmdSummary_Click(sender As Object, e As EventArgs) Handles cmdSummary.Click
sdgSummaries.SetRFunction(clsSummariesList, clsDefaultFunction, ucrSelectorVariable, bResetSubdialog)
sdgSummaries.SetRFunction(clsSummariesList, clsDefaultFunction, clsConcFunction, ucrSelectorVariable, bResetSubdialog)
bResetSubdialog = False
sdgSummaries.ShowDialog()
TestOKEnabled()
Expand Down Expand Up @@ -279,12 +294,18 @@ Public Class dlgClimaticSummary
End If
End Sub

Private Sub ucrReceiverStation_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverDOY.ControlValueChanged, ucrSelectorVariable.ControlValueChanged
Private Sub ucrReceiverStation_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverDOY.ControlValueChanged, ucrSelectorVariable.ControlValueChanged, ucrChkAddDateColumn.ControlValueChanged, ucrReceiverDate.ControlValueChanged
If Not ucrReceiverDOY.IsEmpty Then
clsDayFilterCalcFromList.AddParameter(ucrSelectorVariable.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strParameterValue:=ucrReceiverDOY.GetVariableNames(), iPosition:=0)
Else
clsDayFilterCalcFromList.RemoveParameterByName(ucrSelectorVariable.ucrAvailableDataFrames.cboAvailableDataFrames.Text)
End If

If ucrChkAddDateColumn.Checked AndAlso Not ucrReceiverDate.IsEmpty Then
clsAddDateFunction.AddParameter("data_name", Chr(34) & ucrSelectorVariable.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0)
Else
clsAddDateFunction.RemoveParameterByName("data_name")
End If
UpdateDayFilterPreview()
End Sub

Expand Down Expand Up @@ -315,4 +336,12 @@ Public Class dlgClimaticSummary
ucrInputFilterPreview.SetName(clsFromAndToConditionOperator.ToScript())
End If
End Sub

Private Sub ucrChkAddDateColumn_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkAddDateColumn.ControlValueChanged
If ucrChkAddDateColumn.Checked Then
ucrBase.clsRsyntax.AddToAfterCodes(clsAddDateFunction, iPosition:=0)
Else
ucrBase.clsRsyntax.RemoveFromAfterCodes(clsAddDateFunction)
End If
End Sub
End Class
7 changes: 5 additions & 2 deletions instat/dlgColumnStats.vb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Public Class dlgColumnStats
Private bReset As Boolean = True
Private clsSummariesList As New RFunction
Private bResetSubdialog As Boolean = False
Private clsDefaultFunction As New RFunction
Private clsDefaultFunction, clsConcFunction As New RFunction
Public strDefaultDataFrame As String = ""
Public strDefaultVariables() As String
Public strDefaultFactors() As String
Expand Down Expand Up @@ -92,11 +92,14 @@ Public Class dlgColumnStats
Private Sub SetDefaults()
clsDefaultFunction = New RFunction
clsSummariesList = New RFunction
clsConcFunction = New RFunction

ucrSelectorForColumnStatistics.Reset()
sdgProportionsPercentages.ucrSelectorProportionsPercentiles.Reset()
ucrReceiverSelectedVariables.SetMeAsReceiver()

clsConcFunction.SetRCommand("c")

clsSummariesList.SetRCommand("c")
clsSummariesList.AddParameter("summary_count_non_missing", Chr(34) & "summary_count_non_missing" & Chr(34), bIncludeArgumentName:=False)
clsSummariesList.AddParameter("summary_count", Chr(34) & "summary_count" & Chr(34), bIncludeArgumentName:=False)
Expand Down Expand Up @@ -150,7 +153,7 @@ Public Class dlgColumnStats
End Sub

Private Sub cmdSummaries_Click(sender As Object, e As EventArgs) Handles cmdSummaries.Click
sdgSummaries.SetRFunction(clsSummariesList, clsDefaultFunction, ucrSelectorForColumnStatistics, bResetSubdialog)
sdgSummaries.SetRFunction(clsSummariesList, clsDefaultFunction, clsConcFunction, ucrSelectorForColumnStatistics, bResetSubdialog)
sdgSummaries.ShowDialog()
bResetSubdialog = False
TestOKEnabled()
Expand Down
7 changes: 5 additions & 2 deletions instat/dlgDescribeTwoVariable.vb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Public Class dlgDescribeTwoVariable
Private bReset As Boolean = True
Private bResetSubdialog As Boolean = False
Public strVarType, strSecondVarType As String
Public clsGetDataType, clsGetSecondDataType, clsRCorrelation, clsRCustomSummary, clsRAnova, clsRFreqTables As New RFunction
Public clsGetDataType, clsGetSecondDataType, clsRCorrelation, clsRCustomSummary, clsConcFunction, clsRAnova, clsRFreqTables As New RFunction
Private clsSummariesList As New RFunction
Private Sub dlgDescribeTwoVariable_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If bFirstLoad Then
Expand Down Expand Up @@ -74,10 +74,13 @@ Public Class dlgDescribeTwoVariable
clsRCorrelation = New RFunction
clsSummariesList = New RFunction
clsRCustomSummary = New RFunction
clsConcFunction = New RFunction

ucrSelectorDescribeTwoVar.Reset()
ucrReceiverFirstVar.SetMeAsReceiver()

clsConcFunction.SetRCommand("c")

clsRFreqTables.AddParameter("addmargins", "FALSE", iPosition:=2)
clsRFreqTables.AddParameter("proportions", "FALSE", iPosition:=3)
clsRFreqTables.AddParameter("percentages", "FALSE", iPosition:=4)
Expand Down Expand Up @@ -152,7 +155,7 @@ Public Class dlgDescribeTwoVariable
End Sub

Private Sub cmdSummaries_Click(sender As Object, e As EventArgs) Handles cmdSummaries.Click
sdgSummaries.SetRFunction(clsSummariesList, clsRCustomSummary, ucrSelectorDescribeTwoVar, bResetSubdialog)
sdgSummaries.SetRFunction(clsSummariesList, clsRCustomSummary, clsConcFunction, ucrSelectorDescribeTwoVar, bResetSubdialog)
bResetSubdialog = False
sdgSummaries.ShowDialog()
TestOKEnabled()
Expand Down
40 changes: 16 additions & 24 deletions instat/dlgLinePlot.designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 15334fa

Please sign in to comment.