Skip to content

Commit

Permalink
Merge pull request IDEMSInternational#488 from IDEMSInternational/master
Browse files Browse the repository at this point in the history
updated my master
  • Loading branch information
Patowhiz authored Jul 11, 2024
2 parents 360e93e + 95939b9 commit d2c1d28
Show file tree
Hide file tree
Showing 135 changed files with 7,755 additions and 3,671 deletions.
4 changes: 3 additions & 1 deletion instat/Model/DataFrame/clsDataFramePage.vb
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,16 @@ Public Class clsDataFramePage
columnHeader.strTypeShortCode = "(L)"
' Structured columns e.g. "circular or bigz or bigq " are coded with "(S)"
ElseIf strHeaderType.Contains("circular") OrElse strHeaderType.Contains("bigz") OrElse
strHeaderType.Contains("bigq") Then
strHeaderType.Contains("bigq") OrElse strHeaderType.Contains("polynomial") Then
columnHeader.strTypeShortCode = "(S)"
ElseIf strHeaderType.Contains("list") Then
columnHeader.strTypeShortCode = "(LT)"
ElseIf strHeaderType.Contains("complex") Then
columnHeader.strTypeShortCode = "(CX)"
ElseIf strHeaderType.Contains("sfc_MULTIPOLYGON") OrElse strHeaderType.Contains("sfc") Then
columnHeader.strTypeShortCode = "(G)"
ElseIf strHeaderType.Contains("Timeseries") OrElse strHeaderType.Contains("ts") Then
columnHeader.strTypeShortCode = "(TS)"
' Types of data for specific Application areas e.g. survival are coded with "(A)"
' No examples implemented yet.
'ElseIf strType.Contains() Then
Expand Down
69 changes: 34 additions & 35 deletions instat/Model/Output/clsOutputLogger.vb
Original file line number Diff line number Diff line change
Expand Up @@ -71,52 +71,51 @@ Public Class clsOutputLogger
End Property

Public Sub AddOutput(strScript As String, strOutput As String, bAsFile As Boolean, bDisplayOutputInExternalViewer As Boolean)
'Note this always takes the last script added as corresponding script
' Note this always takes the last script added as corresponding script
If String.IsNullOrWhiteSpace(strScript) Then
Throw New Exception("Cannot find script to attach output to.")
Exit Sub
End If

'add the R script as an output element
' Add the R script as an output element
Dim rScriptElement As New clsOutputElement
rScriptElement.SetContent(strScript, OutputType.Script, "")
_outputElements.Add(rScriptElement)
'raise event for output pages
' Raise event for output pages
RaiseEvent NewOutputAdded(rScriptElement, False)


If Not String.IsNullOrEmpty(strOutput) Then
Dim outputElement As New clsOutputElement
Dim outputType As OutputType
If bAsFile Then
Dim strFileExtension As String = Path.GetExtension(strOutput).ToLower
Select Case strFileExtension
Case ".png"
outputType = OutputType.ImageOutput
Case ".html"
outputType = OutputType.HtmlOutput
Case ".txt"
outputType = OutputType.TextOutput
Case Else
MessageBox.Show("The file type to be added is currently not suported",
"Developer Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error)
Exit Sub
End Select
Else
outputType = OutputType.TextOutput
' Split the strOutput into an array of lines, removing empty entries
Dim arrFilesPaths() As String = strOutput.Split({Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)

For Each output In arrFilesPaths
If Not String.IsNullOrEmpty(output) Then
Dim outputElement As New clsOutputElement
Dim outputType As OutputType

If bAsFile Then
Dim strFileExtension As String = Path.GetExtension(output).ToLower
Select Case strFileExtension
Case ".png"
outputType = OutputType.ImageOutput
Case ".html"
outputType = OutputType.HtmlOutput
Case ".txt"
outputType = OutputType.TextOutput
Case Else
MessageBox.Show("The file type to be added is currently not supported", "Developer Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End Select
Else
outputType = OutputType.TextOutput
End If

' Add the output with its R script as another output element
outputElement.SetContent("", outputType, output)
_outputElements.Add(outputElement)
' Raise event for output pages
RaiseEvent NewOutputAdded(outputElement, bDisplayOutputInExternalViewer)
End If

'add the output with it's R script as another output element
outputElement.SetContent("", outputType, strOutput)
_outputElements.Add(outputElement)
'raise event for output pages
RaiseEvent NewOutputAdded(outputElement, bDisplayOutputInExternalViewer)

End If


Next

End Sub

Expand Down
37 changes: 6 additions & 31 deletions instat/clsRLink.vb
Original file line number Diff line number Diff line change
Expand Up @@ -749,22 +749,9 @@ Public Class RLink
bShowWaitDialogOverride:=Nothing)
End If

' Split the strOutput into an array of lines, removing empty entries
Dim arrFilesPaths() As String = strOutput.Split({Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)

' Check if arrFilesPaths has at least one element before iterating
If arrFilesPaths.Length > 0 Then
' Iterate through each file path
For Each _path In arrFilesPaths
' Add output to logger
clsOutputLogger.AddOutput(clsRStatement.Text, _path, bAsFile:=True,
' Add output to logger
clsOutputLogger.AddOutput(clsRStatement.Text, strOutput, bAsFile:=True,
bDisplayOutputInExternalViewer:=clsRStatement.TextNoFormatting.StartsWith("view_object_data"))
Next
Else
' Add output to logger
clsOutputLogger.AddOutput(clsRStatement.Text, strOutput, bAsFile:=True,
bDisplayOutputInExternalViewer:=clsRStatement.TextNoFormatting.StartsWith("view_object_data"))
End If

' Log the script
LogScript(clsRStatement.Text.TrimEnd(vbCr, vbLf))
Expand Down Expand Up @@ -1012,22 +999,8 @@ Public Class RLink
End If
End If

If bAsFile Then
' Split the strOutput into an array of lines, removing empty entries
Dim arrFilesPaths() As String = strOutput.Split({Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)
' Iterate through each HTML files
For Each _path In arrFilesPaths
' Add each HTML file as an output to clsOutputLogger
' strScriptWithComment: the script with associated comments
' _path: the path to the HTML file
' bAsFile: a boolean indicating whether the output should be treated as a file
' bDisplayOutputInExternalViewer: a boolean indicating whether to display the output in an external viewer
clsOutputLogger.AddOutput(strScriptWithComment, _path, bAsFile, bDisplayOutputInExternalViewer)
Next
Else
' If strOutput is empty or does not contain valid HTML files, add strOutput itself as an output
clsOutputLogger.AddOutput(strScriptWithComment, strOutput, bAsFile, bDisplayOutputInExternalViewer)
End If
' If strOutput is empty or does not contain valid HTML files, add strOutput itself as an output
clsOutputLogger.AddOutput(strScriptWithComment, strOutput, bAsFile, bDisplayOutputInExternalViewer)


Catch e As Exception
Expand Down Expand Up @@ -1447,6 +1420,8 @@ Public Class RLink
clsGetItems.SetRCommand(strInstatDataObject & "$get_link_names")
Case "key"
clsGetItems.SetRCommand(strInstatDataObject & "$get_key_names")
Case "scalar"
clsGetItems.SetRCommand(strInstatDataObject & "$get_scalar_names")
Case "database_variables"
clsGetItems.SetRCommand(strInstatDataObject & "$get_database_variable_names")
clsGetItems.AddParameter("query", Chr(34) & strDatabaseQuery & Chr(34))
Expand Down
4 changes: 2 additions & 2 deletions instat/clsRSyntax.vb
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ Public Class RSyntax
'Sometimes the output of the R-command we deal with should not be part of the script...
'That's only the case when this output has already been assigned.
If (bUseBaseFunction AndAlso clsBaseFunction.IsAssigned()) OrElse
(bUseBaseOperator AndAlso clsBaseFunction.IsAssigned()) OrElse
(bUseCommandString AndAlso clsBaseFunction.IsAssigned()) Then
(bUseBaseOperator AndAlso clsBaseOperator.IsAssigned()) OrElse
(bUseCommandString AndAlso clsBaseCommandString.IsAssigned()) Then
Return strScript
End If
End If
Expand Down
4 changes: 2 additions & 2 deletions instat/dlgAddKey.vb
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ Public Class dlgAddKey
Private Sub SetHelpOptions()
Select Case enumAddkeyMode
Case AddkeyMode.Prepare
ucrBase.iHelpTopicID = 416
ucrBase.iHelpTopicID = 504
Case AddkeyMode.Climatic
ucrBase.iHelpTopicID = 424
ucrBase.iHelpTopicID = 611
End Select
End Sub

Expand Down
2 changes: 1 addition & 1 deletion instat/dlgBarAndPieChart.vb
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ Public Class dlgBarAndPieChart
ucrReceiverWordcloudAngle.Selector = ucrBarChartSelector

ucrSaveBar.SetIsComboBox()
ucrSaveBar.SetCheckBoxText("Save Graph")
ucrSaveBar.SetCheckBoxText("Store Graph")
ucrSaveBar.SetDataFrameSelector(ucrBarChartSelector.ucrAvailableDataFrames)
ucrSaveBar.SetSaveTypeAsGraph()
ucrSaveBar.SetPrefix("bar_plot")
Expand Down
29 changes: 22 additions & 7 deletions instat/dlgBoxPlot.vb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Public Class dlgBoxplot
ucrPnlPlots.AddFunctionNamesCondition(rdoBoxplotTufte, {"geom_boxplot", "geom_tufteboxplot"})
ucrPnlPlots.AddFunctionNamesCondition(rdoJitter, "geom_jitter")
ucrPnlPlots.AddFunctionNamesCondition(rdoViolin, "geom_violin")
ucrPnlPlots.AddToLinkedControls({ucrChkAddPoints, ucrChkWidth}, {rdoBoxplotTufte, rdoViolin}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)
ucrPnlPlots.AddToLinkedControls({ucrChkAddPoints}, {rdoBoxplotTufte, rdoViolin}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)
ucrPnlPlots.AddToLinkedControls({ucrChkTufte}, {rdoBoxplotTufte}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)
ucrChkTufte.AddToLinkedControls(ucrChkVarWidth, {"FALSE"}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)
ucrPnlPlots.AddToLinkedControls(ucrChkBoxPlot, {rdoJitter, rdoViolin}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)
Expand Down Expand Up @@ -198,7 +198,7 @@ Public Class dlgBoxplot

ucrSaveBoxplot.SetPrefix("box_plot")
ucrSaveBoxplot.SetIsComboBox()
ucrSaveBoxplot.SetCheckBoxText("Save Graph")
ucrSaveBoxplot.SetCheckBoxText("Store Graph")
ucrSaveBoxplot.SetSaveTypeAsGraph()
ucrSaveBoxplot.SetDataFrameSelector(ucrSelectorBoxPlot.ucrAvailableDataFrames)
ucrSaveBoxplot.SetAssignToIfUncheckedValue("last_graph")
Expand Down Expand Up @@ -235,7 +235,7 @@ Public Class dlgBoxplot
ucrInputStation.SetItems({strFacetWrap, strFacetRow, strFacetCol, strNone})
ucrInputStation.SetDropDownStyleAsNonEditable()

ucrChkWidth.SetText("Width")
ucrChkWidth.SetText("Cut Width")
ucrChkWidth.AddToLinkedControls({ucrInputWidth}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=0.25)
ucrChkWidth.AddParameterValuesCondition(True, "cut_width", "True")
ucrChkWidth.AddParameterValuesCondition(False, "cut_width", "False")
Expand All @@ -260,6 +260,7 @@ Public Class dlgBoxplot
ucrChkGrouptoConnect.AddParameterPresentCondition(False, strStatSummaryParameterName, False)
'this control exists but diabled for now
DialogueSize()
HideShowWidth()
End Sub

Private Sub SetDefaults()
Expand Down Expand Up @@ -438,6 +439,7 @@ Public Class dlgBoxplot
ucrChkBoxPlot.SetRCode(clsDummyFunction, bReset)
ucrChkWidth.SetRCode(clsDummyFunction, bReset)
End If
HideShowWidth()
End Sub

Private Sub TestOkEnabled()
Expand Down Expand Up @@ -488,6 +490,8 @@ Public Class dlgBoxplot
SetGeomPrefixFillColourAes()
DialogueSize()
EnableDisableBoxplotOptions()
HideShowWidth()

If rdoBoxplotTufte.Checked Then
If ucrChkAddPoints.Checked Then
clsBoxplotFunction.AddParameter("outlier.shape", "NA", iPosition:=2)
Expand Down Expand Up @@ -732,6 +736,7 @@ Public Class dlgBoxplot
AddRemoveGroupBy()
EnableDisableWidth()
AddRemoveAesParm()
HideShowWidth()
End Sub

Private Sub GetParameterValue(clsOperator As ROperator)
Expand Down Expand Up @@ -805,22 +810,22 @@ Public Class dlgBoxplot
clsCutWitdhFunction.RemoveParameterByName("var")
End If
EnableDisableWidth()
HideShowWidth()
'ucrInputWidth.Visible = ucrChkWidth.Checked
End Sub

Private Sub ucrChkWidth_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkWidth.ControlValueChanged
EnableDisableWidth()
HideShowWidth()
'ucrInputWidth.Visible = ucrChkWidth.Checked
End Sub

Private Sub EnableDisableWidth()
If ucrByFactorsReceiver.strCurrDataType = "Date" OrElse ucrByFactorsReceiver.strCurrDataType = "factor" OrElse ucrByFactorsReceiver.strCurrDataType = "orderded, factor" Then
ucrChkWidth.Enabled = False
ucrInputWidth.Enabled = False
clsBoxplotFunction.RemoveParameterByName("aes")
clsWidthRaesFunction.RemoveParameterByName("group")
clsViolinplotFunction.RemoveParameterByName("aes")
Else
ucrChkWidth.Enabled = True
ucrInputWidth.Enabled = True
If ucrChkWidth.Checked AndAlso Not ucrByFactorsReceiver.IsEmpty Then
clsWidthRaesFunction.AddParameter("group", clsRFunctionParameter:=clsCutWitdhFunction, iPosition:=1)
clsBoxplotFunction.AddParameter("aes", clsRFunctionParameter:=clsWidthRaesFunction, bIncludeArgumentName:=False, iPosition:=1)
Expand All @@ -833,6 +838,16 @@ Public Class dlgBoxplot
End If
End Sub

Private Sub HideShowWidth()
ucrChkWidth.Visible = False
ucrInputWidth.Visible = False

If (rdoBoxplotTufte.Checked OrElse rdoViolin.Checked) AndAlso ucrByFactorsReceiver.strCurrDataType = "numeric" Then
ucrChkWidth.Visible = True
ucrInputWidth.Visible = ucrChkWidth.Checked
End If
End Sub

Private Sub ucrChkBoxPlot_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkBoxPlot.ControlValueChanged, ucrNudBoxPlot.ControlValueChanged
If ucrChkBoxPlot.Checked Then
clsGeomBoxPlotFunction.AddParameter("width", ucrNudBoxPlot.GetText(), iPosition:=3)
Expand Down
Loading

0 comments on commit d2c1d28

Please sign in to comment.