Skip to content

Commit

Permalink
Merge pull request #171 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
update
  • Loading branch information
MeSophie authored Jan 18, 2024
2 parents 68b2ea2 + 34efd2d commit bc26baa
Show file tree
Hide file tree
Showing 32 changed files with 4,923 additions and 1,592 deletions.
871 changes: 560 additions & 311 deletions instat/DlgDefineClimaticData.Designer.vb

Large diffs are not rendered by default.

173 changes: 151 additions & 22 deletions instat/DlgDefineClimaticData.vb

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions instat/UserControls/DataGrid/ReoGrid/ucrReoGrid.vb
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ Public MustInherit Class ucrReoGrid
Private Function GetRowIndex(currWorkSheet As Worksheet, strRowName As String) As Integer
If currWorkSheet IsNot Nothing Then
For i As Integer = 0 To currWorkSheet.Rows - 1
Dim strCol As String = currWorkSheet.RowHeaders(i).Text
If strCol = strRowName Then
Dim strCol As String = currWorkSheet.RowHeaders(i).Text - 1
If CInt(strCol) = CInt(strRowName) Then
Return i
End If
Next
Expand All @@ -234,7 +234,7 @@ Public MustInherit Class ucrReoGrid
If strColumnHeader.Contains("(") Then
strColumnHeader = strColumnHeader.Split("(")(0)
End If
Dim iRowIndex = GetRowIndex(grdData.CurrentWorksheet, iRow) + 1
Dim iRowIndex = GetRowIndex(grdData.CurrentWorksheet, iRow)
If strColumnHeader.Trim = strColumn _
AndAlso iRowIndex > -1 Then
Return grdData.CurrentWorksheet(iRowIndex, i).ToString()
Expand Down
513 changes: 317 additions & 196 deletions instat/dlgEvapotranspiration.Designer.vb

Large diffs are not rendered by default.

559 changes: 386 additions & 173 deletions instat/dlgEvapotranspiration.vb

Large diffs are not rendered by default.

271 changes: 170 additions & 101 deletions instat/dlgGeneralForGraphics.Designer.vb

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions instat/dlgGeneralForGraphics.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>55</value>
</metadata>
<metadata name="contextMenuStripOptions.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>415, 13</value>
</metadata>
Expand Down
264 changes: 250 additions & 14 deletions instat/dlgGeneralForGraphics.vb

Large diffs are not rendered by default.

35 changes: 30 additions & 5 deletions instat/dlgUnstack.vb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Public Class dlgUnstack
Private clsDummyCarryFunction As New RFunction
Private clsHierachyFunction As New RFunction
Private clsSelectDataFunction As New RFunction
Private clsAddKeyFunction, clsAddLinkFunction As New RFunction
Private clsUnstackedOperator, clsCommaOperator, clsformulaOperator, clspipeOperator As New ROperator
Private clsDcastFunction As New RFunction
Private clsBaseRCode As New RCodeStructure
Expand Down Expand Up @@ -124,6 +125,8 @@ Public Class dlgUnstack
clsformulaOperator = New ROperator
clsDummyFunction = New RFunction
clsDummyCarryFunction = New RFunction
clsAddKeyFunction = New RFunction
clsAddLinkFunction = New RFunction

clsDummyCarryFunction.AddParameter("checked", "FALSE", iPosition:=0)

Expand All @@ -133,6 +136,12 @@ Public Class dlgUnstack
ucrSelectorForUnstack.Reset()
ucrNewDFName.Reset()

clsAddKeyFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_key")
clsAddKeyFunction.AddParameter("key_name", Chr(34) & "key" & Chr(34), iPosition:=2)

clsAddLinkFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_link")
clsAddLinkFunction.AddParameter("type", Chr(34) & "keyed_link" & Chr(34), iPosition:=3)

' Operations
clsformulaOperator.SetOperation("~")
clsformulaOperator.bBrackets = False
Expand Down Expand Up @@ -216,7 +225,7 @@ Public Class dlgUnstack
clsSelectDataFunction.RemoveParameterByName("single")
For Each strMultiple In ucrMultipleColumnsReceiver.GetVariableNamesAsList()
clsCommaMultiple.AddParameter(strMultiple, strMultiple, iPosition:=position)
position = position + 1
position += 1
Next
clsSelectDataFunction.AddParameter("Multiple_Values", clsROperatorParameter:=clsCommaMultiple, iPosition:=4, bIncludeArgumentName:=False)
clsDcastFunction.AddParameter("values_from", ucrMultipleColumnsReceiver.GetVariableNames(False), iPosition:=2)
Expand Down Expand Up @@ -269,6 +278,7 @@ Public Class dlgUnstack
Private Sub ucrSelector_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorForUnstack.ControlValueChanged
NewDefaultName()
AddRemoveDataOrPipeOperator()
clsAddLinkFunction.AddParameter("from_data_frame", Chr(34) & ucrSelectorForUnstack.strCurrentDataFrame & Chr(34), iPosition:=0)
End Sub

Private Sub SetFormula()
Expand All @@ -280,7 +290,7 @@ Public Class dlgUnstack
clsCarryColumnsOperator.AddParameter("factor", ucrReceiverFactorToUnstackby.GetVariableNames(False), iPosition:=0, bIncludeArgumentName:=False)
For Each strIndicatorVar As String In ucrReceiverCarryColumns.GetVariableNamesAsList
clsCarryColumnsOperator.AddParameter(i, strIndicatorVar, iPosition:=i)
i = i + 1
i += 1
Next
If ucrReceiverCarryColumns.GetVariableNamesAsList.Contains(strcoll) Then
clsCarryColumnsOperator.RemoveParameterByName("factor")
Expand Down Expand Up @@ -312,7 +322,7 @@ Public Class dlgUnstack
For Each strcolumn In ucrReceiverCarryColumns.GetVariableNamesAsList
If Not ucrMultipleColumnsReceiver.GetVariableNamesAsList.Contains(strcolumn) Then
clsTempCommaOperator.AddParameter(strcolumn, strcolumn, iPosition:=iposition)
iposition = iposition + 1
iposition += 1
End If
Next
clsSelectDataFunction.AddParameter("comma", clsROperatorParameter:=clsTempCommaOperator, iPosition:=3, bIncludeArgumentName:=False)
Expand All @@ -332,22 +342,37 @@ Public Class dlgUnstack
CarryColumnsParameter()
End Sub

Private Sub ucrPnlUnstackCol_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlUnstackCol.ControlValueChanged
Private Sub ucrPnlUnstackCol_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlUnstackCol.ControlValueChanged, ucrReceiverFactorToUnstackby.ControlValueChanged
ucrNewDFName.SetRCode(clsBaseRCode)

If rdoSingle.Checked OrElse rdoMultiple.Checked Then
clsBaseRCode = clsDcastFunction
ucrBase.clsRsyntax.SetBaseRFunction(clsDcastFunction)
ucrBase.clsRsyntax.RemoveFromAfterCodes(clsAddKeyFunction)
ucrBase.clsRsyntax.RemoveFromAfterCodes(clsAddLinkFunction)
If rdoSingle.Checked Then
clsDummyFunction.AddParameter("checked", "single", iPosition:=0)
ElseIf rdoMultiple.Checked Then
clsDummyFunction.AddParameter("checked", "multiple", iPosition:=0)
End If
ElseIf rdoRestoreHierarchy.Checked Then
ucrReceiverFactorToUnstackby.bWithQuotes = True
clsBaseRCode = clsUnstackedOperator
clsDummyFunction.AddParameter("checked", "hierarchy", iPosition:=0)
ucrBase.clsRsyntax.SetBaseROperator(clsUnstackedOperator)
Dim strDataFrame = ucrNewDFName.GetText
If Not String.IsNullOrEmpty(strDataFrame) Then
clsAddKeyFunction.AddParameter("data_name", Chr(34) & strDataFrame & Chr(34), iPosition:=0)
clsAddKeyFunction.AddParameter("col_names", ucrReceiverFactorToUnstackby.GetVariableNames(), iPosition:=1)
clsAddLinkFunction.AddParameter("to_data_frame", Chr(34) & strDataFrame & Chr(34), iPosition:=1)
Dim strLinkPair As String = "c(" & ucrReceiverFactorToUnstackby.GetVariableNames(False) & "=" &
ucrReceiverFactorToUnstackby.GetVariableNames() & ")"
clsAddLinkFunction.AddParameter("link_pairs", strLinkPair, iPosition:=2)
ucrBase.clsRsyntax.AddToAfterCodes(clsAddKeyFunction, 0)
ucrBase.clsRsyntax.AddToAfterCodes(clsAddLinkFunction, 1)
End If
clsDcastFunction.RemoveAssignTo()
End If
ucrNewDFName.SetRCode(clsBaseRCode)
CarryColumnsLabelReceiverLocation()
SetFormula()
ValuesfillParameter()
Expand Down
Loading

0 comments on commit bc26baa

Please sign in to comment.