Skip to content

Commit

Permalink
Merge pull request #63 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
fetching latest copy
  • Loading branch information
maxwellfundi authored Jun 16, 2016
2 parents db5287b + f3af921 commit 81fbe67
Show file tree
Hide file tree
Showing 33 changed files with 924 additions and 646 deletions.
16 changes: 15 additions & 1 deletion instat/UcrGeomListWithAes.designer.vb

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

43 changes: 39 additions & 4 deletions instat/UcrGeomListWithAes.vb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ Public Class UcrGeomListWithParameters
Public lstCurrArguments As New List(Of String)
Public bFirstLoad As Boolean = True
Public ucrLayersControl As ucrLayerParameters
Public bCheckEnabled As Boolean = True
Public Event DataFrameChanged()
Public clsAesFunction As RFunction

Private Sub UcrGeomListWithParameters_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If bFirstLoad Then
Expand All @@ -31,6 +33,7 @@ Public Class UcrGeomListWithParameters
bFirstLoad = False
End If
End Sub

Private Sub InitialiseControl()
ucrReceiverParam1.Selector = UcrSelector
ucrReceiverParam2.Selector = UcrSelector
Expand All @@ -49,8 +52,12 @@ Public Class UcrGeomListWithParameters
UcrSelector.Reset()
End Sub

Public Sub SetGeomFunction(clsAesGeomFunc As RFunction)
clsGeomFunction = clsAesGeomFunc
Public Sub SetGeomFunction(clsGeomFunc As RFunction)
clsGeomFunction = clsGeomFunc
End Sub

Public Sub SetAesFunction(clsAesFunc As RFunction)
clsAesFunction = clsAesFunc
End Sub

Public Sub SetParameters() 'this will set function or aes parameters
Expand Down Expand Up @@ -158,13 +165,14 @@ Public Class UcrGeomListWithParameters
End If
SetParameters()
End Sub

Private Sub ucrReceiverParam1_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverParam1.SelectionChanged
If Not ucrReceiverParam1.IsEmpty Then
clsRaesFunction.AddParameter(lstCurrArguments(0), ucrReceiverParam1.GetVariableNames(False))
Else
clsRaesFunction.RemoveParameterByName(lstCurrArguments(0))
End If
dlgGeneralForGraphics.TestOkEnabled()
TestForOkEnabled()
End Sub

Private Sub ucrReceiverParam2_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverParam2.SelectionChanged
Expand All @@ -173,13 +181,15 @@ Public Class UcrGeomListWithParameters
Else
clsRaesFunction.RemoveParameterByName(lstCurrArguments(1))
End If
TestForOkEnabled()
End Sub
Private Sub ucrReceiverParam3_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverParam3.SelectionChanged
If Not ucrReceiverParam3.IsEmpty Then
clsRaesFunction.AddParameter(lstCurrArguments(2), ucrReceiverParam3.GetVariableNames(False))
Else
clsRaesFunction.RemoveParameterByName(lstCurrArguments(2))
End If
TestForOkEnabled()

End Sub

Expand All @@ -189,14 +199,15 @@ Public Class UcrGeomListWithParameters
Else
clsRaesFunction.RemoveParameterByName(lstCurrArguments(3))
End If

TestForOkEnabled()
End Sub
Private Sub ucrReceiverParam5_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverParam5.SelectionChanged
If Not ucrReceiverParam5.IsEmpty Then
clsRaesFunction.AddParameter(lstCurrArguments(4), ucrReceiverParam5.GetVariableNames(False))
Else
clsRaesFunction.RemoveParameterByName(lstCurrArguments(4))
End If
TestForOkEnabled()
End Sub

Private Sub ucrReceiverParam6_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverParam6.SelectionChanged
Expand All @@ -205,6 +216,7 @@ Public Class UcrGeomListWithParameters
Else
clsRaesFunction.RemoveParameterByName(lstCurrArguments(5))
End If
TestForOkEnabled()
End Sub

Private Sub ucrReceiverParam7_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverParam7.SelectionChanged, ucrReceiverParam9.SelectionChanged, ucrReceiverParam8.SelectionChanged
Expand All @@ -213,13 +225,15 @@ Public Class UcrGeomListWithParameters
Else
clsRaesFunction.RemoveParameterByName(lstCurrArguments(6))
End If
TestForOkEnabled()
End Sub
Private Sub ucrReceiverParam8_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverParam8.SelectionChanged, ucrReceiverParam9.SelectionChanged, ucrReceiverParam8.SelectionChanged
If Not ucrReceiverParam8.IsEmpty Then
clsRaesFunction.AddParameter(lstCurrArguments(7), ucrReceiverParam8.GetVariableNames(False))
Else
clsRaesFunction.RemoveParameterByName(lstCurrArguments(7))
End If
TestForOkEnabled()
End Sub

Private Sub ucrReceiverParam9_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverParam9.SelectionChanged, ucrReceiverParam9.SelectionChanged, ucrReceiverParam8.SelectionChanged
Expand All @@ -228,10 +242,31 @@ Public Class UcrGeomListWithParameters
Else
clsRaesFunction.RemoveParameterByName(lstCurrArguments(8))
End If
TestForOkEnabled()
End Sub

Public Sub SetDataframe(strDataframe As String, Optional bEnableDataframe As Boolean = True)
UcrSelector.SetDataframe(strDataframe, bEnableDataframe)
End Sub

Private Sub UcrSelector_DataFrameChanged() Handles UcrSelector.DataFrameChanged
clsGeomFunction.AddParameter("data", clsRFunctionParameter:=UcrSelector.ucrAvailableDataFrames.clsCurrDataFrame)
' RaiseEvent DataFrameChanged() do we need this?
End Sub

Public Function TestForOkEnabled() As Boolean
Dim i As Integer = 0

For i = 0 To (clsCurrGeom.clsAesParameters.Count - 1)
If (clsCurrGeom.clsAesParameters(i).bIsMandatory = True) AndAlso (lstAesParameterUcr(i).IsEmpty()) Then
'this should have okay disabled
Return False
End If
Next
Return True
End Function

Private Sub chkChangeAes_CheckedChanged(sender As Object, e As EventArgs) Handles chkChangeAes.CheckedChanged

End Sub
End Class
24 changes: 23 additions & 1 deletion instat/clsRFunction.vb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Public Class RFunction
Public strAssignToGraph As String
Public bToBeAssigned As Boolean = False
Public bIsAssigned As Boolean = False
Private bAssignToIsPrefix As Boolean = False
Public bAssignToIsPrefix As Boolean = False

Public Sub SetRCommand(strTemp As String)
strRCommand = strTemp
Expand Down Expand Up @@ -218,4 +218,26 @@ Public Class RFunction
bIsAssigned = False
End Sub

Public Function Clone() As RFunction

Dim clsRFunction As New RFunction
Dim clsRParam As New RParameter
clsRFunction.strRCommand = strRCommand
clsRFunction.strAssignTo = strAssignTo
clsRFunction.strAssignToDataFrame = strAssignToDataFrame
clsRFunction.strAssignToColumn = strAssignToColumn
clsRFunction.strAssignToModel = strAssignToModel
clsRFunction.strAssignToGraph = strAssignToGraph
clsRFunction.bToBeAssigned = bToBeAssigned
clsRFunction.bIsAssigned = bIsAssigned
clsRFunction.bAssignToIsPrefix = bAssignToIsPrefix

For Each clsRParam In clsParameters
clsRFunction.AddParameter(clsRParam.Clone)
Next

Return clsRFunction

End Function

End Class
33 changes: 32 additions & 1 deletion instat/clsROperator.vb
Original file line number Diff line number Diff line change
Expand Up @@ -296,5 +296,36 @@ Public Class ROperator
RemoveParameter(True)
'RemoveParameter(False)
RemoveAllAdditionalParameters()
End Sub
End Sub

Public Function Clone() As ROperator
Dim clsTempROperator As New ROperator
Dim clsLeftFunction As New RFunction
Dim clsLeftOperator As New ROperator
Dim clsLeftParameter As New RParameter
Dim clsAdditionalParams As New RParameter

clsTempROperator.strOperation = strOperation
clsTempROperator.bBrackets = bBrackets
clsTempROperator.strAssignTo = strAssignTo
clsTempROperator.strAssignToDataFrame = strAssignToDataFrame
clsTempROperator.strAssignToColumn = strAssignToColumn
clsTempROperator.strAssignToModel = strAssignToModel
clsTempROperator.strAssignToGraph = strAssignToGraph
clsTempROperator.bToBeAssigned = bToBeAssigned
clsTempROperator.bIsAssigned = bIsAssigned
clsTempROperator.bForceIncludeOperation = bForceIncludeOperation
clsTempROperator.bAssignToIsPrefix = bAssignToIsPrefix

clsTempROperator.clsLeftFunction = clsLeftFunction.Clone
clsTempROperator.clsLeftOperator = clsLeftOperator.Clone
clsTempROperator.clsLeftParameter = clsLeftParameter.Clone

For Each clsAdditionalParams In clsAdditionalParameters
clsTempROperator.AddAdditionalParameter(clsAdditionalParams.Clone)
Next

Return clsTempROperator

End Function
End Class
15 changes: 15 additions & 0 deletions instat/clsRParameter.vb
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,19 @@ Public Class RParameter
End If
Return strRet
End Function

Public Function Clone() As RParameter
Dim clsTempRParam As New RParameter
Dim clsArgumentOperator As New ROperator

clsTempRParam.strArgumentName = strArgumentName
clsTempRParam.strArgumentValue = strArgumentValue
clsTempRParam.bIsFunction = bIsFunction
clsTempRParam.bIsOperator = bIsOperator
clsTempRParam.clsArgumentFunction = clsArgumentFunction.Clone
clsTempRParam.clsArgumentOperator = clsArgumentOperator.Clone


Return clsTempRParam
End Function
End Class
2 changes: 1 addition & 1 deletion instat/dlgBoxPlot.designer.vb

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

23 changes: 16 additions & 7 deletions instat/dlgBoxPlot.vb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ Public Class dlgBoxplot
Else
ReopenDialog()
End If

End Sub

Public Sub SetOperator()
Dim clsTempRFunc As New RFunction
If chkHorizontalBoxplot.Checked Then
Expand Down Expand Up @@ -70,14 +68,17 @@ Public Class dlgBoxplot
ucrSecondFactorReceiver.Selector = ucrSelectorBoxPlot
ucrSecondFactorReceiver.SetIncludedDataTypes({"factor"})


sdgPlots.SetRSyntax(ucrBase.clsRsyntax)
sdgBoxPlot.SetBoxPlotFunction(clsRgeom_boxplotFunction)
sdgLayerOptions.SetRSyntax(ucrBase.clsRsyntax)
'sdgLayerOptions.SetGeomFunction(clsRgeom_boxplotFunction)
'sdgLayerOptions.SetAesFunction(clsRaesFunction
sdgLayerOptions.SetupLayer(clsRgeom_boxplotFunction, clsRaesFunction, True, True, strDataframe:=ucrSelectorBoxPlot.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem)

ucrVariablesAsFactorForBoxplot.SetFactorReceiver(ucrByFactorsReceiver)
ucrVariablesAsFactorForBoxplot.SetSelector(ucrSelectorBoxPlot)
ucrVariablesAsFactorForBoxplot.SetIncludedDataType({"numeric"})

ucrSaveBoxplot.strPrefix = "graph"

End Sub

Private Sub TestOkEnabled()
Expand All @@ -87,14 +88,15 @@ Public Class dlgBoxplot
ucrBase.OKEnabled(False)
End If
End Sub

Private Sub cmdOptions_Click(sender As Object, e As EventArgs) Handles cmdOptions.Click
sdgPlots.ShowDialog()
End Sub

Private Sub ucrSelectorBoxPlot_DataFrameChanged() Handles ucrSelectorBoxPlot.DataFrameChanged
clsRggplotFunction.AddParameter("data", clsRFunctionParameter:=ucrSelectorBoxPlot.ucrAvailableDataFrames.clsCurrDataFrame)
End Sub


Private Sub ucrByFactorsReceiver_SelectionChanged(sender As Object, e As EventArgs) Handles ucrByFactorsReceiver.SelectionChanged
If Not ucrByFactorsReceiver.IsEmpty Then
clsRaesFunction.AddParameter("x", ucrByFactorsReceiver.GetVariableNames(False))
Expand All @@ -111,11 +113,12 @@ Public Class dlgBoxplot
clsRaesFunction.RemoveParameterByName("fill")
End If
End Sub

Private Sub ReopenDialog()
End Sub

Private Sub cmdBoxPlotOptions_Click(sender As Object, e As EventArgs) Handles cmdBoxPlotOptions.Click
sdgBoxPlot.ShowDialog()
sdgLayerOptions.ShowDialog()
End Sub

Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset
Expand All @@ -134,4 +137,10 @@ Public Class dlgBoxplot
End If
TestOkEnabled()
End Sub

Private Sub ucrSaveBoxplot_GraphNameChanged() Handles ucrSaveBoxplot.GraphNameChanged
ucrBase.clsRsyntax.SetAssignTo(ucrSaveBoxplot.strGraphName, strTempDataframe:=ucrSelectorBoxPlot.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:=ucrSaveBoxplot.strGraphName)
ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = True
End Sub

End Class
Loading

0 comments on commit 81fbe67

Please sign in to comment.