From 7e122de2e3163ae3b0094184e7ff94374c975274 Mon Sep 17 00:00:00 2001 From: Sophie Date: Wed, 3 May 2023 10:04:17 +0100 Subject: [PATCH 1/7] minor modifications --- instat/dlgClimaticStationMaps.vb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/instat/dlgClimaticStationMaps.vb b/instat/dlgClimaticStationMaps.vb index 9b18502a69f..d1bdfff1416 100644 --- a/instat/dlgClimaticStationMaps.vb +++ b/instat/dlgClimaticStationMaps.vb @@ -331,6 +331,8 @@ Public Class dlgClimaticStationMaps bReset:=bResetSFLayerSubdialog) sdgLayerOptions.ShowDialog() bResetSFLayerSubdialog = False + clsGgplotFunction.RemoveParameterByName("mapping") + clsLabelRepelFunction.AddParameter("mapping", clsRFunctionParameter:=clsLabelRepelAesFunction, iPosition:=1) End Sub Private Sub toolStripMenuItemPointOptions_Click(sender As Object, e As EventArgs) Handles toolStripMenuItemPointOptions.Click From b8b0f933a540935a2bfbd46e777fd67cd41b4700 Mon Sep 17 00:00:00 2001 From: Sophie Date: Wed, 10 May 2023 09:03:51 +0100 Subject: [PATCH 2/7] minor Changes --- instat/dlgClimaticStationMaps.Designer.vb | 34 ++++++++++++++--------- instat/dlgClimaticStationMaps.vb | 29 ++++++++++++++++++- instat/ucrGeom.vb | 4 +-- 3 files changed, 51 insertions(+), 16 deletions(-) diff --git a/instat/dlgClimaticStationMaps.Designer.vb b/instat/dlgClimaticStationMaps.Designer.vb index c70ebe2d9aa..fc860b1a803 100644 --- a/instat/dlgClimaticStationMaps.Designer.vb +++ b/instat/dlgClimaticStationMaps.Designer.vb @@ -50,9 +50,10 @@ Partial Class dlgClimaticStationMaps Me.PlotOptionsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemSFOptions = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemMapping = New System.Windows.Forms.ToolStripMenuItem() - Me.cmdOptions = New instat.ucrSplitButton() Me.toolStripMenuItemPointOptions = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemLabelRepelOptions = New System.Windows.Forms.ToolStripMenuItem() + Me.cmdOptions = New instat.ucrSplitButton() + Me.toolStripMenuItemTextRepelOptions = New System.Windows.Forms.ToolStripMenuItem() Me.grpPoints.SuspendLayout() Me.grpMapOutline.SuspendLayout() Me.contextMenuStripOptions.SuspendLayout() @@ -330,9 +331,9 @@ Partial Class dlgClimaticStationMaps ' 'contextMenuStripOptions ' - Me.contextMenuStripOptions.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.PlotOptionsToolStripMenuItem, Me.toolStripMenuItemSFOptions, Me.toolStripMenuItemMapping, Me.toolStripMenuItemPointOptions, Me.toolStripMenuItemLabelRepelOptions}) + Me.contextMenuStripOptions.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.PlotOptionsToolStripMenuItem, Me.toolStripMenuItemSFOptions, Me.toolStripMenuItemMapping, Me.toolStripMenuItemPointOptions, Me.toolStripMenuItemLabelRepelOptions, Me.toolStripMenuItemTextRepelOptions}) Me.contextMenuStripOptions.Name = "contextMenuStripOk" - Me.contextMenuStripOptions.Size = New System.Drawing.Size(181, 136) + Me.contextMenuStripOptions.Size = New System.Drawing.Size(181, 158) ' 'PlotOptionsToolStripMenuItem ' @@ -352,6 +353,18 @@ Partial Class dlgClimaticStationMaps Me.toolStripMenuItemMapping.Size = New System.Drawing.Size(180, 22) Me.toolStripMenuItemMapping.Text = "Map Options" ' + 'toolStripMenuItemPointOptions + ' + Me.toolStripMenuItemPointOptions.Name = "toolStripMenuItemPointOptions" + Me.toolStripMenuItemPointOptions.Size = New System.Drawing.Size(180, 22) + Me.toolStripMenuItemPointOptions.Text = "Point Options" + ' + 'toolStripMenuItemLabelRepelOptions + ' + Me.toolStripMenuItemLabelRepelOptions.Name = "toolStripMenuItemLabelRepelOptions" + Me.toolStripMenuItemLabelRepelOptions.Size = New System.Drawing.Size(180, 22) + Me.toolStripMenuItemLabelRepelOptions.Text = "Label Repel Options" + ' 'cmdOptions ' Me.cmdOptions.AutoSize = True @@ -365,17 +378,11 @@ Partial Class dlgClimaticStationMaps Me.cmdOptions.Text = "Plot Options" Me.cmdOptions.UseVisualStyleBackColor = True ' - 'toolStripMenuItemPointOptions - ' - Me.toolStripMenuItemPointOptions.Name = "toolStripMenuItemPointOptions" - Me.toolStripMenuItemPointOptions.Size = New System.Drawing.Size(180, 22) - Me.toolStripMenuItemPointOptions.Text = "Point Options" - ' - 'toolStripMenuItemLabelRepelOptions + 'toolStripMenuItemTextRepelOptions ' - Me.toolStripMenuItemLabelRepelOptions.Name = "toolStripMenuItemLabelRepelOptions" - Me.toolStripMenuItemLabelRepelOptions.Size = New System.Drawing.Size(180, 22) - Me.toolStripMenuItemLabelRepelOptions.Text = "Label Repel Options" + Me.toolStripMenuItemTextRepelOptions.Name = "toolStripMenuItemTextRepelOptions" + Me.toolStripMenuItemTextRepelOptions.Size = New System.Drawing.Size(180, 22) + Me.toolStripMenuItemTextRepelOptions.Text = "Text Repel Options" ' 'dlgClimaticStationMaps ' @@ -432,4 +439,5 @@ Partial Class dlgClimaticStationMaps Friend WithEvents PlotOptionsToolStripMenuItem As ToolStripMenuItem Friend WithEvents toolStripMenuItemPointOptions As ToolStripMenuItem Friend WithEvents toolStripMenuItemLabelRepelOptions As ToolStripMenuItem + Friend WithEvents toolStripMenuItemTextRepelOptions As ToolStripMenuItem End Class diff --git a/instat/dlgClimaticStationMaps.vb b/instat/dlgClimaticStationMaps.vb index d1bdfff1416..84e4c564cf1 100644 --- a/instat/dlgClimaticStationMaps.vb +++ b/instat/dlgClimaticStationMaps.vb @@ -20,7 +20,7 @@ Imports RDotNet Public Class dlgClimaticStationMaps Private bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsGgplotFunction, clsGeomSfFunction, clsGeomPointFunction, clsSfAesFunction, clsGeomPointAesFunction, clsScaleShapeFunction, clsLabelRepelFunction As New RFunction + Private clsGgplotFunction, clsGeomSfFunction, clsGeomPointFunction, clsSfAesFunction, clsGeomPointAesFunction, clsScaleShapeFunction, clsLabelRepelFunction, clsTextRepelFunction As New RFunction Private clsGGplotOperator, clsFacetOp As New ROperator Private clsLabsFunction As New RFunction @@ -36,6 +36,7 @@ Public Class dlgClimaticStationMaps Private bResetSubdialog As Boolean = True Private bResetSFLayerSubdialog As Boolean = True Private clsLabelRepelAesFunction As New RFunction + Private clsTextRepelAesFunction As New RFunction Private clsCoordPolarFunction As New RFunction Private clsCoordPolarStartOperator As New ROperator Private clsXScaleDateFunction As New RFunction @@ -139,7 +140,9 @@ Public Class dlgClimaticStationMaps clsGeomPointAesFunction = New RFunction clsScaleShapeFunction = New RFunction clsLabelRepelFunction = New RFunction + clsTextRepelFunction = New RFunction clsLabelRepelAesFunction = New RFunction + clsTextRepelAesFunction = New RFunction clsGGplotOperator = New ROperator clsXlimFunction = New RFunction @@ -194,9 +197,16 @@ Public Class dlgClimaticStationMaps clsLabelRepelFunction.SetRCommand("geom_label_repel") clsLabelRepelFunction.AddParameter("mapping", clsRFunctionParameter:=clsLabelRepelAesFunction, iPosition:=1) + clsTextRepelFunction.SetPackageName("ggrepel") + clsTextRepelFunction.SetRCommand("geom_text_repel") + clsTextRepelFunction.AddParameter("mapping", clsRFunctionParameter:=clsTextRepelAesFunction, iPosition:=1) + + clsLabelRepelAesFunction.SetPackageName("ggplot2") clsLabelRepelAesFunction.SetRCommand("aes") + clsTextRepelAesFunction.SetPackageName("ggplot2") + clsTextRepelAesFunction.SetRCommand("aes") clsGGplotOperator.SetOperation("+") clsGGplotOperator.AddParameter("ggplot", clsRFunctionParameter:=clsGgplotFunction, bIncludeArgumentName:=False, iPosition:=0) @@ -235,6 +245,10 @@ Public Class dlgClimaticStationMaps ucrReceiverLongitude.AddAdditionalCodeParameterPair(clsLabelRepelAesFunction, ucrReceiverLongitude.GetParameter(), iAdditionalPairNo:=1) ucrReceiverLatitude.AddAdditionalCodeParameterPair(clsLabelRepelAesFunction, ucrReceiverLatitude.GetParameter(), iAdditionalPairNo:=1) + ucrReceiverLongitude.AddAdditionalCodeParameterPair(clsTextRepelAesFunction, ucrReceiverLongitude.GetParameter(), iAdditionalPairNo:=2) + ucrReceiverLatitude.AddAdditionalCodeParameterPair(clsTextRepelAesFunction, ucrReceiverLatitude.GetParameter(), iAdditionalPairNo:=2) + ucrReceiverStation.AddAdditionalCodeParameterPair(clsTextRepelAesFunction, ucrReceiverStation.GetParameter(), iAdditionalPairNo:=1) + ucrSelectorOutline.SetRCode(clsGeomSfFunction, bReset) ucrReceiverFill.SetRCode(clsSfAesFunction, bReset) ucrSaveMap.SetRCode(clsGGplotOperator, bReset) @@ -335,6 +349,18 @@ Public Class dlgClimaticStationMaps clsLabelRepelFunction.AddParameter("mapping", clsRFunctionParameter:=clsLabelRepelAesFunction, iPosition:=1) End Sub + + Private Sub toolStripMenuItemTextRepelOptions_Click(sender As Object, e As EventArgs) Handles toolStripMenuItemTextRepelOptions.Click + sdgLayerOptions.SetupLayer(clsNewGgPlot:=clsGgplotFunction, clsNewGeomFunc:=clsTextRepelFunction, clsNewGlobalAesFunc:=clsTextRepelAesFunction, + clsNewLocalAes:=clsLocalRaesFunction, bFixGeom:=False, ucrNewBaseSelector:=ucrSelectorStation, bApplyAesGlobally:=True, + bReset:=bResetSFLayerSubdialog) + sdgLayerOptions.ShowDialog() + bResetSFLayerSubdialog = False + clsGgplotFunction.RemoveParameterByName("mapping") + clsTextRepelFunction.AddParameter("mapping", clsRFunctionParameter:=clsTextRepelAesFunction, iPosition:=1) + + End Sub + Private Sub toolStripMenuItemPointOptions_Click(sender As Object, e As EventArgs) Handles toolStripMenuItemPointOptions.Click sdgLayerOptions.SetupLayer(clsNewGgPlot:=clsGgplotFunction, clsNewGeomFunc:=clsGeomPointFunction, clsNewGlobalAesFunc:=clsGeomPointAesFunction, clsNewLocalAes:=clsLocalRaesFunction, bFixGeom:=False, ucrNewBaseSelector:=ucrSelectorStation, bApplyAesGlobally:=True, @@ -351,6 +377,7 @@ Public Class dlgClimaticStationMaps If ucrChkAddPoints.Checked Then If Not ucrReceiverStation.IsEmpty Then clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) + clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=3) End If If Not ucrReceiverFacet.IsEmpty Then clsGGplotOperator.AddParameter("facets", clsRFunctionParameter:=clsRFacetFunction, bIncludeArgumentName:=False, iPosition:=2) diff --git a/instat/ucrGeom.vb b/instat/ucrGeom.vb index b5c6dae1fd1..4fd7edebd3b 100644 --- a/instat/ucrGeom.vb +++ b/instat/ucrGeom.vb @@ -1353,8 +1353,8 @@ Public Class ucrGeom clsgeom_label_repel.AddLayerParameter("label.r", "numeric", "0.15", lstParameterStrings:={2, 0}) clsgeom_label_repel.AddLayerParameter("min.segment.length", "numeric", "0.5", lstParameterStrings:={1, 0}) clsgeom_label_repel.AddLayerParameter("arrow", "editablelist", "arrow()", lstParameterStrings:={"arrow()"}) - clsgeom_label_repel.AddLayerParameter("max.time", "numeric", "0.5") - clsgeom_label_repel.AddLayerParameter("max.iter", "numeric", "1000", lstParameterStrings:={0, 1}) + clsgeom_label_repel.AddLayerParameter("size", "numeric", "1", lstParameterStrings:={1, 1}) + clsgeom_label_repel.AddLayerParameter("colour", "colour", Chr(34) & "black" & Chr(34)) clsgeom_label_repel.AddLayerParameter("max.overlaps", "numeric", "10", lstParameterStrings:={0, 1}) clsgeom_label_repel.AddLayerParameter("nudge_x", "numeric", "0", lstParameterStrings:={2}) clsgeom_label_repel.AddLayerParameter("nudge_y", "numeric", "0", lstParameterStrings:={2}) From 9d9389b1c6a3075a4e1df35ceddb9fb1e67ad44f Mon Sep 17 00:00:00 2001 From: Sophie Date: Fri, 12 May 2023 17:08:37 +0100 Subject: [PATCH 3/7] Added Label Options croup box --- instat/dlgClimaticStationMaps.Designer.vb | 103 ++++++++++++++++++---- instat/dlgClimaticStationMaps.vb | 60 +++++++++++-- instat/ucrGeom.vb | 4 +- 3 files changed, 139 insertions(+), 28 deletions(-) diff --git a/instat/dlgClimaticStationMaps.Designer.vb b/instat/dlgClimaticStationMaps.Designer.vb index fc860b1a803..15c715d666e 100644 --- a/instat/dlgClimaticStationMaps.Designer.vb +++ b/instat/dlgClimaticStationMaps.Designer.vb @@ -26,6 +26,11 @@ Partial Class dlgClimaticStationMaps Me.ucrSaveMap = New instat.ucrSave() Me.ucrBase = New instat.ucrButtons() Me.grpPoints = New System.Windows.Forms.GroupBox() + Me.grpBoxLabelOptions = New System.Windows.Forms.GroupBox() + Me.lblSize = New System.Windows.Forms.Label() + Me.ucrNudSize = New instat.ucrNud() + Me.ucrChkLabelAll = New instat.ucrCheck() + Me.ucrChkLabelledRectangle = New instat.ucrCheck() Me.lblLabels = New System.Windows.Forms.Label() Me.ucrReceiverStation = New instat.ucrReceiverSingle() Me.lblFacet = New System.Windows.Forms.Label() @@ -52,9 +57,10 @@ Partial Class dlgClimaticStationMaps Me.toolStripMenuItemMapping = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemPointOptions = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemLabelRepelOptions = New System.Windows.Forms.ToolStripMenuItem() - Me.cmdOptions = New instat.ucrSplitButton() Me.toolStripMenuItemTextRepelOptions = New System.Windows.Forms.ToolStripMenuItem() + Me.cmdOptions = New instat.ucrSplitButton() Me.grpPoints.SuspendLayout() + Me.grpBoxLabelOptions.SuspendLayout() Me.grpMapOutline.SuspendLayout() Me.contextMenuStripOptions.SuspendLayout() Me.SuspendLayout() @@ -62,7 +68,7 @@ Partial Class dlgClimaticStationMaps 'ucrSaveMap ' Me.ucrSaveMap.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSaveMap.Location = New System.Drawing.Point(10, 261) + Me.ucrSaveMap.Location = New System.Drawing.Point(10, 319) Me.ucrSaveMap.Margin = New System.Windows.Forms.Padding(6, 8, 6, 8) Me.ucrSaveMap.Name = "ucrSaveMap" Me.ucrSaveMap.Size = New System.Drawing.Size(320, 22) @@ -72,7 +78,7 @@ Partial Class dlgClimaticStationMaps ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 286) + Me.ucrBase.Location = New System.Drawing.Point(10, 350) Me.ucrBase.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(408, 52) @@ -80,6 +86,7 @@ Partial Class dlgClimaticStationMaps ' 'grpPoints ' + Me.grpPoints.Controls.Add(Me.grpBoxLabelOptions) Me.grpPoints.Controls.Add(Me.lblLabels) Me.grpPoints.Controls.Add(Me.ucrReceiverStation) Me.grpPoints.Controls.Add(Me.lblFacet) @@ -95,11 +102,65 @@ Partial Class dlgClimaticStationMaps Me.grpPoints.Controls.Add(Me.ucrReceiverLongitude) Me.grpPoints.Location = New System.Drawing.Point(373, 8) Me.grpPoints.Name = "grpPoints" - Me.grpPoints.Size = New System.Drawing.Size(371, 261) + Me.grpPoints.Size = New System.Drawing.Size(371, 334) Me.grpPoints.TabIndex = 1 Me.grpPoints.TabStop = False Me.grpPoints.Text = "Points" ' + 'grpBoxLabelOptions + ' + Me.grpBoxLabelOptions.Controls.Add(Me.lblSize) + Me.grpBoxLabelOptions.Controls.Add(Me.ucrNudSize) + Me.grpBoxLabelOptions.Controls.Add(Me.ucrChkLabelAll) + Me.grpBoxLabelOptions.Controls.Add(Me.ucrChkLabelledRectangle) + Me.grpBoxLabelOptions.Location = New System.Drawing.Point(21, 228) + Me.grpBoxLabelOptions.Name = "grpBoxLabelOptions" + Me.grpBoxLabelOptions.Size = New System.Drawing.Size(200, 100) + Me.grpBoxLabelOptions.TabIndex = 13 + Me.grpBoxLabelOptions.TabStop = False + Me.grpBoxLabelOptions.Text = "Label Options:" + ' + 'lblSize + ' + Me.lblSize.AutoSize = True + Me.lblSize.Location = New System.Drawing.Point(5, 46) + Me.lblSize.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0) + Me.lblSize.Name = "lblSize" + Me.lblSize.Size = New System.Drawing.Size(30, 13) + Me.lblSize.TabIndex = 12 + Me.lblSize.Text = "Size:" + ' + 'ucrNudSize + ' + Me.ucrNudSize.AutoSize = True + Me.ucrNudSize.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSize.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudSize.Location = New System.Drawing.Point(45, 43) + Me.ucrNudSize.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudSize.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSize.Name = "ucrNudSize" + Me.ucrNudSize.Size = New System.Drawing.Size(50, 20) + Me.ucrNudSize.TabIndex = 8 + Me.ucrNudSize.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrChkLabelAll + ' + Me.ucrChkLabelAll.AutoSize = True + Me.ucrChkLabelAll.Checked = False + Me.ucrChkLabelAll.Location = New System.Drawing.Point(6, 72) + Me.ucrChkLabelAll.Name = "ucrChkLabelAll" + Me.ucrChkLabelAll.Size = New System.Drawing.Size(120, 23) + Me.ucrChkLabelAll.TabIndex = 7 + ' + 'ucrChkLabelledRectangle + ' + Me.ucrChkLabelledRectangle.AutoSize = True + Me.ucrChkLabelledRectangle.Checked = False + Me.ucrChkLabelledRectangle.Location = New System.Drawing.Point(6, 17) + Me.ucrChkLabelledRectangle.Name = "ucrChkLabelledRectangle" + Me.ucrChkLabelledRectangle.Size = New System.Drawing.Size(120, 23) + Me.ucrChkLabelledRectangle.TabIndex = 6 + ' 'lblLabels ' Me.lblLabels.AutoSize = True @@ -333,38 +394,44 @@ Partial Class dlgClimaticStationMaps ' Me.contextMenuStripOptions.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.PlotOptionsToolStripMenuItem, Me.toolStripMenuItemSFOptions, Me.toolStripMenuItemMapping, Me.toolStripMenuItemPointOptions, Me.toolStripMenuItemLabelRepelOptions, Me.toolStripMenuItemTextRepelOptions}) Me.contextMenuStripOptions.Name = "contextMenuStripOk" - Me.contextMenuStripOptions.Size = New System.Drawing.Size(181, 158) + Me.contextMenuStripOptions.Size = New System.Drawing.Size(180, 136) ' 'PlotOptionsToolStripMenuItem ' Me.PlotOptionsToolStripMenuItem.Name = "PlotOptionsToolStripMenuItem" - Me.PlotOptionsToolStripMenuItem.Size = New System.Drawing.Size(180, 22) + Me.PlotOptionsToolStripMenuItem.Size = New System.Drawing.Size(179, 22) Me.PlotOptionsToolStripMenuItem.Text = "Plot Options" ' 'toolStripMenuItemSFOptions ' Me.toolStripMenuItemSFOptions.Name = "toolStripMenuItemSFOptions" - Me.toolStripMenuItemSFOptions.Size = New System.Drawing.Size(180, 22) + Me.toolStripMenuItemSFOptions.Size = New System.Drawing.Size(179, 22) Me.toolStripMenuItemSFOptions.Text = "SF Options" ' 'toolStripMenuItemMapping ' Me.toolStripMenuItemMapping.Name = "toolStripMenuItemMapping" - Me.toolStripMenuItemMapping.Size = New System.Drawing.Size(180, 22) + Me.toolStripMenuItemMapping.Size = New System.Drawing.Size(179, 22) Me.toolStripMenuItemMapping.Text = "Map Options" ' 'toolStripMenuItemPointOptions ' Me.toolStripMenuItemPointOptions.Name = "toolStripMenuItemPointOptions" - Me.toolStripMenuItemPointOptions.Size = New System.Drawing.Size(180, 22) + Me.toolStripMenuItemPointOptions.Size = New System.Drawing.Size(179, 22) Me.toolStripMenuItemPointOptions.Text = "Point Options" ' 'toolStripMenuItemLabelRepelOptions ' Me.toolStripMenuItemLabelRepelOptions.Name = "toolStripMenuItemLabelRepelOptions" - Me.toolStripMenuItemLabelRepelOptions.Size = New System.Drawing.Size(180, 22) + Me.toolStripMenuItemLabelRepelOptions.Size = New System.Drawing.Size(179, 22) Me.toolStripMenuItemLabelRepelOptions.Text = "Label Repel Options" ' + 'toolStripMenuItemTextRepelOptions + ' + Me.toolStripMenuItemTextRepelOptions.Name = "toolStripMenuItemTextRepelOptions" + Me.toolStripMenuItemTextRepelOptions.Size = New System.Drawing.Size(179, 22) + Me.toolStripMenuItemTextRepelOptions.Text = "Text Repel Options" + ' 'cmdOptions ' Me.cmdOptions.AutoSize = True @@ -378,17 +445,12 @@ Partial Class dlgClimaticStationMaps Me.cmdOptions.Text = "Plot Options" Me.cmdOptions.UseVisualStyleBackColor = True ' - 'toolStripMenuItemTextRepelOptions - ' - Me.toolStripMenuItemTextRepelOptions.Name = "toolStripMenuItemTextRepelOptions" - Me.toolStripMenuItemTextRepelOptions.Size = New System.Drawing.Size(180, 22) - Me.toolStripMenuItemTextRepelOptions.Text = "Text Repel Options" - ' 'dlgClimaticStationMaps ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi - Me.ClientSize = New System.Drawing.Size(756, 345) + Me.AutoSize = True + Me.ClientSize = New System.Drawing.Size(756, 406) Me.Controls.Add(Me.cmdOptions) Me.Controls.Add(Me.grpMapOutline) Me.Controls.Add(Me.grpPoints) @@ -402,6 +464,8 @@ Partial Class dlgClimaticStationMaps Me.Text = "Climatic Maps" Me.grpPoints.ResumeLayout(False) Me.grpPoints.PerformLayout() + Me.grpBoxLabelOptions.ResumeLayout(False) + Me.grpBoxLabelOptions.PerformLayout() Me.grpMapOutline.ResumeLayout(False) Me.grpMapOutline.PerformLayout() Me.contextMenuStripOptions.ResumeLayout(False) @@ -440,4 +504,9 @@ Partial Class dlgClimaticStationMaps Friend WithEvents toolStripMenuItemPointOptions As ToolStripMenuItem Friend WithEvents toolStripMenuItemLabelRepelOptions As ToolStripMenuItem Friend WithEvents toolStripMenuItemTextRepelOptions As ToolStripMenuItem + Friend WithEvents grpBoxLabelOptions As GroupBox + Friend WithEvents lblSize As Label + Friend WithEvents ucrNudSize As ucrNud + Friend WithEvents ucrChkLabelAll As ucrCheck + Friend WithEvents ucrChkLabelledRectangle As ucrCheck End Class diff --git a/instat/dlgClimaticStationMaps.vb b/instat/dlgClimaticStationMaps.vb index 84e4c564cf1..75b149dbc44 100644 --- a/instat/dlgClimaticStationMaps.vb +++ b/instat/dlgClimaticStationMaps.vb @@ -46,6 +46,7 @@ Public Class dlgClimaticStationMaps Private clsAnnotateFunction As New RFunction Private clsGetDataFrame As New RFunction Private clsRemoveFunc As New RFunction + Private clsDummyFunction As New RFunction Private Sub dlgClimaticMaps_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -73,7 +74,6 @@ Public Class dlgClimaticStationMaps ucrSelectorStation.SetParameter(New RParameter("data", 0)) ucrSelectorStation.SetParameterIsrfunction() - ucrReceiverGeometry.Selector = ucrSelectorOutline ucrReceiverFill.SetParameter(New RParameter("fill", 0)) @@ -81,8 +81,6 @@ Public Class dlgClimaticStationMaps ucrReceiverFill.SetParameterIsString() ucrReceiverFill.bWithQuotes = False - - ucrReceiverLongitude.SetParameter(New RParameter("x", 0)) ucrReceiverLongitude.Selector = ucrSelectorStation ucrReceiverLongitude.SetIncludedDataTypes({"numeric"}) @@ -124,6 +122,21 @@ Public Class dlgClimaticStationMaps ucrSaveMap.SetAssignToIfUncheckedValue("last_map") ucrSaveMap.SetDataFrameSelector(ucrSelectorOutline.ucrAvailableDataFrames) + ucrChkLabelledRectangle.SetText("Labelled Rectangle") + ucrChkLabelledRectangle.AddParameterValuesCondition(True, "colour", "True") + ucrChkLabelledRectangle.AddParameterValuesCondition(False, "colour", "False") + + ucrChkLabelAll.SetText("Label All") + ucrChkLabelAll.AddParameterValuesCondition(True, "check", "True") + ucrChkLabelAll.AddParameterValuesCondition(False, "check", "False") + ucrChkLabelAll.SetRDefault("FALSE") + + ucrNudSize.SetParameter(New RParameter("size", 2)) + ucrNudSize.Minimum = 1 + ucrNudSize.DecimalPlaces = 2 + ucrNudSize.Increment = 0.1 + ucrNudSize.SetLinkedDisplayControl(lblSize) + ucrChkAddPoints.SetText("Add Points") ucrChkAddPoints.AddParameterPresentCondition(True, "geom_point") ucrChkAddPoints.AddParameterPresentCondition(False, "geom_point", False) @@ -143,6 +156,7 @@ Public Class dlgClimaticStationMaps clsTextRepelFunction = New RFunction clsLabelRepelAesFunction = New RFunction clsTextRepelAesFunction = New RFunction + clsDummyFunction = New RFunction clsGGplotOperator = New ROperator clsXlimFunction = New RFunction @@ -168,6 +182,8 @@ Public Class dlgClimaticStationMaps clsRemoveFunc.SetRCommand("rm") + clsDummyFunction.AddParameter("colour", "True", iPosition:=1) + clsGgplotFunction.SetPackageName("ggplot2") clsGgplotFunction.SetRCommand("ggplot") @@ -196,11 +212,14 @@ Public Class dlgClimaticStationMaps clsLabelRepelFunction.SetPackageName("ggrepel") clsLabelRepelFunction.SetRCommand("geom_label_repel") clsLabelRepelFunction.AddParameter("mapping", clsRFunctionParameter:=clsLabelRepelAesFunction, iPosition:=1) + clsLabelRepelFunction.AddParameter("colour", Chr(34) & "red" & Chr(34), iPosition:=2) + clsLabelRepelFunction.AddParameter("size", "1", iPosition:=3) clsTextRepelFunction.SetPackageName("ggrepel") clsTextRepelFunction.SetRCommand("geom_text_repel") clsTextRepelFunction.AddParameter("mapping", clsRFunctionParameter:=clsTextRepelAesFunction, iPosition:=1) - + clsTextRepelFunction.AddParameter("colour", Chr(34) & "black" & Chr(34), iPosition:=2) + clsTextRepelFunction.AddParameter("size", "1", iPosition:=3) clsLabelRepelAesFunction.SetPackageName("ggplot2") clsLabelRepelAesFunction.SetRCommand("aes") @@ -244,10 +263,9 @@ Public Class dlgClimaticStationMaps Private Sub SetRCodeForControls(bReset As Boolean) ucrReceiverLongitude.AddAdditionalCodeParameterPair(clsLabelRepelAesFunction, ucrReceiverLongitude.GetParameter(), iAdditionalPairNo:=1) ucrReceiverLatitude.AddAdditionalCodeParameterPair(clsLabelRepelAesFunction, ucrReceiverLatitude.GetParameter(), iAdditionalPairNo:=1) - + ucrReceiverStation.AddAdditionalCodeParameterPair(clsTextRepelAesFunction, ucrReceiverStation.GetParameter(), iAdditionalPairNo:=1) ucrReceiverLongitude.AddAdditionalCodeParameterPair(clsTextRepelAesFunction, ucrReceiverLongitude.GetParameter(), iAdditionalPairNo:=2) ucrReceiverLatitude.AddAdditionalCodeParameterPair(clsTextRepelAesFunction, ucrReceiverLatitude.GetParameter(), iAdditionalPairNo:=2) - ucrReceiverStation.AddAdditionalCodeParameterPair(clsTextRepelAesFunction, ucrReceiverStation.GetParameter(), iAdditionalPairNo:=1) ucrSelectorOutline.SetRCode(clsGeomSfFunction, bReset) ucrReceiverFill.SetRCode(clsSfAesFunction, bReset) @@ -258,7 +276,8 @@ Public Class dlgClimaticStationMaps ucrReceiverShape.SetRCode(clsGeomPointAesFunction, bReset) ucrReceiverColor.SetRCode(clsGeomPointAesFunction, bReset) ucrReceiverFacet.SetRCode(clsFacetOp, bReset) - + ucrChkLabelledRectangle.SetRCode(clsDummyFunction, bReset) + ucrChkLabelAll.SetRCode(clsGGplotOperator, bReset) ucrReceiverStation.SetRCode(clsLabelRepelAesFunction, bReset) ucrChkAddPoints.SetRCode(clsGGplotOperator, bReset) End Sub @@ -349,7 +368,6 @@ Public Class dlgClimaticStationMaps clsLabelRepelFunction.AddParameter("mapping", clsRFunctionParameter:=clsLabelRepelAesFunction, iPosition:=1) End Sub - Private Sub toolStripMenuItemTextRepelOptions_Click(sender As Object, e As EventArgs) Handles toolStripMenuItemTextRepelOptions.Click sdgLayerOptions.SetupLayer(clsNewGgPlot:=clsGgplotFunction, clsNewGeomFunc:=clsTextRepelFunction, clsNewGlobalAesFunc:=clsTextRepelAesFunction, clsNewLocalAes:=clsLocalRaesFunction, bFixGeom:=False, ucrNewBaseSelector:=ucrSelectorStation, bApplyAesGlobally:=True, @@ -375,8 +393,9 @@ Public Class dlgClimaticStationMaps clsGGplotOperator.RemoveParameterByName("facets") clsGGplotOperator.RemoveParameterByName("scale_shape_manual") If ucrChkAddPoints.Checked Then - If Not ucrReceiverStation.IsEmpty Then + If Not ucrReceiverStation.IsEmpty AndAlso ucrChkLabelledRectangle.Checked Then clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) + ElseIf Not ucrReceiverStation.IsEmpty AndAlso Not ucrChkLabelledRectangle.Checked Then clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=3) End If If Not ucrReceiverFacet.IsEmpty Then @@ -444,4 +463,27 @@ Public Class dlgClimaticStationMaps ucrReceiverStation.ControlContentsChanged TestOkEnabled() End Sub + + Private Sub ucrChkLabelledRectangle_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkLabelledRectangle.ControlValueChanged + If ucrChkLabelledRectangle.Checked Then + clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) + clsGGplotOperator.RemoveParameterByName("geom_text") + clsLabelRepelAesFunction.RemoveParameterByName("size") + Else + clsGGplotOperator.AddParameter("geom_Text", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) + clsGGplotOperator.RemoveParameterByName("geom_label") + clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=3) + clsTextRepelAesFunction.RemoveParameterByName("size") + End If + End Sub + + Private Sub ucrChkLabelAll_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkLabelAll.ControlValueChanged + If ucrChkLabelAll.Checked AndAlso ucrChkLabelAll.Checked Then + clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) + clsLabelRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) + ElseIf ucrChkLabelAll.Checked AndAlso Not ucrChkLabelAll.Checked Then + clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=3) + clsTextRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) + End If + End Sub End Class diff --git a/instat/ucrGeom.vb b/instat/ucrGeom.vb index 4fd7edebd3b..2b4b9f50af3 100644 --- a/instat/ucrGeom.vb +++ b/instat/ucrGeom.vb @@ -2080,8 +2080,8 @@ Public Class ucrGeom clsgeom_text_repel.AddLayerParameter("point.padding", "numeric", "0", lstParameterStrings:={2, 0}) clsgeom_text_repel.AddLayerParameter("min.segment.length", "numeric", "0.5", lstParameterStrings:={1, 0}) clsgeom_text_repel.AddLayerParameter("arrow", "editablelist", "arrow()", lstParameterStrings:={"arrow()"}) - clsgeom_text_repel.AddLayerParameter("max.time", "numeric", "0.5") - clsgeom_text_repel.AddLayerParameter("max.iter", "numeric", "1000", lstParameterStrings:={0, 1}) + clsgeom_text_repel.AddLayerParameter("size", "numeric", "1", lstParameterStrings:={1, 0}) + clsgeom_text_repel.AddLayerParameter("colour", "colour", Chr(34) & "black" & Chr(34)) clsgeom_text_repel.AddLayerParameter("max.overlaps", "numeric", "10", lstParameterStrings:={0, 1}) clsgeom_text_repel.AddLayerParameter("nudge_x", "numeric", "0", lstParameterStrings:={2}) clsgeom_text_repel.AddLayerParameter("nudge_y", "numeric", "0", lstParameterStrings:={2}) From 95a2de8df2633c204ed9a34e5c9912949c612589 Mon Sep 17 00:00:00 2001 From: Sophie Date: Fri, 12 May 2023 17:31:12 +0100 Subject: [PATCH 4/7] Minor change --- instat/dlgClimaticStationMaps.Designer.vb | 1 - instat/dlgClimaticStationMaps.vb | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/instat/dlgClimaticStationMaps.Designer.vb b/instat/dlgClimaticStationMaps.Designer.vb index 15c715d666e..dcba4734ee1 100644 --- a/instat/dlgClimaticStationMaps.Designer.vb +++ b/instat/dlgClimaticStationMaps.Designer.vb @@ -449,7 +449,6 @@ Partial Class dlgClimaticStationMaps ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi - Me.AutoSize = True Me.ClientSize = New System.Drawing.Size(756, 406) Me.Controls.Add(Me.cmdOptions) Me.Controls.Add(Me.grpMapOutline) diff --git a/instat/dlgClimaticStationMaps.vb b/instat/dlgClimaticStationMaps.vb index 75b149dbc44..098dd48d133 100644 --- a/instat/dlgClimaticStationMaps.vb +++ b/instat/dlgClimaticStationMaps.vb @@ -351,10 +351,14 @@ Public Class dlgClimaticStationMaps Private Sub ChangeSize() If ucrChkAddPoints.Checked Then grpPoints.Visible = True - Me.Size = New Size(772, 384) + Me.Size = New Size(772, 442) + Me.ucrSaveMap.Location = New Point(10, 319) + Me.ucrBase.Location = New Point(10, 350) Else grpPoints.Visible = False - Me.Size = New Size(439, 384) + Me.Size = New Size(772, 384) + Me.ucrSaveMap.Location = New Point(10, 261) + Me.ucrBase.Location = New Point(10, 286) End If End Sub From ba6a852aa56ca35eaa5b397f83c7fab88663cfd5 Mon Sep 17 00:00:00 2001 From: Sophie Date: Tue, 16 May 2023 14:28:05 +0100 Subject: [PATCH 5/7] Added Colour Check box --- instat/dlgClimaticStationMaps.Designer.vb | 83 ++++++---- instat/dlgClimaticStationMaps.vb | 189 ++++++++++++++++++---- instat/ucrGeom.vb | 4 +- 3 files changed, 214 insertions(+), 62 deletions(-) diff --git a/instat/dlgClimaticStationMaps.Designer.vb b/instat/dlgClimaticStationMaps.Designer.vb index dcba4734ee1..6923a57d683 100644 --- a/instat/dlgClimaticStationMaps.Designer.vb +++ b/instat/dlgClimaticStationMaps.Designer.vb @@ -27,8 +27,8 @@ Partial Class dlgClimaticStationMaps Me.ucrBase = New instat.ucrButtons() Me.grpPoints = New System.Windows.Forms.GroupBox() Me.grpBoxLabelOptions = New System.Windows.Forms.GroupBox() - Me.lblSize = New System.Windows.Forms.Label() - Me.ucrNudSize = New instat.ucrNud() + Me.ucrChkColour = New instat.ucrCheck() + Me.ucrChkSize = New instat.ucrCheck() Me.ucrChkLabelAll = New instat.ucrCheck() Me.ucrChkLabelledRectangle = New instat.ucrCheck() Me.lblLabels = New System.Windows.Forms.Label() @@ -59,6 +59,8 @@ Partial Class dlgClimaticStationMaps Me.toolStripMenuItemLabelRepelOptions = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemTextRepelOptions = New System.Windows.Forms.ToolStripMenuItem() Me.cmdOptions = New instat.ucrSplitButton() + Me.ucrNudSize = New instat.ucrNud() + Me.ucrInputColour = New instat.ucrInputComboBox() Me.grpPoints.SuspendLayout() Me.grpBoxLabelOptions.SuspendLayout() Me.grpMapOutline.SuspendLayout() @@ -109,47 +111,44 @@ Partial Class dlgClimaticStationMaps ' 'grpBoxLabelOptions ' - Me.grpBoxLabelOptions.Controls.Add(Me.lblSize) + Me.grpBoxLabelOptions.Controls.Add(Me.ucrInputColour) Me.grpBoxLabelOptions.Controls.Add(Me.ucrNudSize) + Me.grpBoxLabelOptions.Controls.Add(Me.ucrChkColour) + Me.grpBoxLabelOptions.Controls.Add(Me.ucrChkSize) Me.grpBoxLabelOptions.Controls.Add(Me.ucrChkLabelAll) Me.grpBoxLabelOptions.Controls.Add(Me.ucrChkLabelledRectangle) - Me.grpBoxLabelOptions.Location = New System.Drawing.Point(21, 228) + Me.grpBoxLabelOptions.Location = New System.Drawing.Point(21, 205) Me.grpBoxLabelOptions.Name = "grpBoxLabelOptions" - Me.grpBoxLabelOptions.Size = New System.Drawing.Size(200, 100) + Me.grpBoxLabelOptions.Size = New System.Drawing.Size(214, 128) Me.grpBoxLabelOptions.TabIndex = 13 Me.grpBoxLabelOptions.TabStop = False Me.grpBoxLabelOptions.Text = "Label Options:" ' - 'lblSize + 'ucrChkColour ' - Me.lblSize.AutoSize = True - Me.lblSize.Location = New System.Drawing.Point(5, 46) - Me.lblSize.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0) - Me.lblSize.Name = "lblSize" - Me.lblSize.Size = New System.Drawing.Size(30, 13) - Me.lblSize.TabIndex = 12 - Me.lblSize.Text = "Size:" + Me.ucrChkColour.AutoSize = True + Me.ucrChkColour.Checked = False + Me.ucrChkColour.Location = New System.Drawing.Point(6, 95) + Me.ucrChkColour.Name = "ucrChkColour" + Me.ucrChkColour.Size = New System.Drawing.Size(87, 23) + Me.ucrChkColour.TabIndex = 9 ' - 'ucrNudSize + 'ucrChkSize ' - Me.ucrNudSize.AutoSize = True - Me.ucrNudSize.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudSize.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudSize.Location = New System.Drawing.Point(45, 43) - Me.ucrNudSize.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudSize.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudSize.Name = "ucrNudSize" - Me.ucrNudSize.Size = New System.Drawing.Size(50, 20) - Me.ucrNudSize.TabIndex = 8 - Me.ucrNudSize.Value = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrChkSize.AutoSize = True + Me.ucrChkSize.Checked = False + Me.ucrChkSize.Location = New System.Drawing.Point(6, 41) + Me.ucrChkSize.Name = "ucrChkSize" + Me.ucrChkSize.Size = New System.Drawing.Size(87, 23) + Me.ucrChkSize.TabIndex = 8 ' 'ucrChkLabelAll ' Me.ucrChkLabelAll.AutoSize = True Me.ucrChkLabelAll.Checked = False - Me.ucrChkLabelAll.Location = New System.Drawing.Point(6, 72) + Me.ucrChkLabelAll.Location = New System.Drawing.Point(6, 69) Me.ucrChkLabelAll.Name = "ucrChkLabelAll" - Me.ucrChkLabelAll.Size = New System.Drawing.Size(120, 23) + Me.ucrChkLabelAll.Size = New System.Drawing.Size(87, 23) Me.ucrChkLabelAll.TabIndex = 7 ' 'ucrChkLabelledRectangle @@ -158,7 +157,7 @@ Partial Class dlgClimaticStationMaps Me.ucrChkLabelledRectangle.Checked = False Me.ucrChkLabelledRectangle.Location = New System.Drawing.Point(6, 17) Me.ucrChkLabelledRectangle.Name = "ucrChkLabelledRectangle" - Me.ucrChkLabelledRectangle.Size = New System.Drawing.Size(120, 23) + Me.ucrChkLabelledRectangle.Size = New System.Drawing.Size(87, 23) Me.ucrChkLabelledRectangle.TabIndex = 6 ' 'lblLabels @@ -445,6 +444,30 @@ Partial Class dlgClimaticStationMaps Me.cmdOptions.Text = "Plot Options" Me.cmdOptions.UseVisualStyleBackColor = True ' + 'ucrNudSize + ' + Me.ucrNudSize.AutoSize = True + Me.ucrNudSize.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSize.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudSize.Location = New System.Drawing.Point(108, 41) + Me.ucrNudSize.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudSize.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSize.Name = "ucrNudSize" + Me.ucrNudSize.Size = New System.Drawing.Size(50, 20) + Me.ucrNudSize.TabIndex = 10 + Me.ucrNudSize.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrInputColour + ' + Me.ucrInputColour.AddQuotesIfUnrecognised = True + Me.ucrInputColour.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputColour.GetSetSelectedIndex = -1 + Me.ucrInputColour.IsReadOnly = False + Me.ucrInputColour.Location = New System.Drawing.Point(86, 94) + Me.ucrInputColour.Name = "ucrInputColour" + Me.ucrInputColour.Size = New System.Drawing.Size(122, 21) + Me.ucrInputColour.TabIndex = 11 + ' 'dlgClimaticStationMaps ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) @@ -504,8 +527,10 @@ Partial Class dlgClimaticStationMaps Friend WithEvents toolStripMenuItemLabelRepelOptions As ToolStripMenuItem Friend WithEvents toolStripMenuItemTextRepelOptions As ToolStripMenuItem Friend WithEvents grpBoxLabelOptions As GroupBox - Friend WithEvents lblSize As Label - Friend WithEvents ucrNudSize As ucrNud Friend WithEvents ucrChkLabelAll As ucrCheck Friend WithEvents ucrChkLabelledRectangle As ucrCheck + Friend WithEvents ucrChkSize As ucrCheck + Friend WithEvents ucrChkColour As ucrCheck + Friend WithEvents ucrInputColour As ucrInputComboBox + Friend WithEvents ucrNudSize As ucrNud End Class diff --git a/instat/dlgClimaticStationMaps.vb b/instat/dlgClimaticStationMaps.vb index 098dd48d133..90e9efc364d 100644 --- a/instat/dlgClimaticStationMaps.vb +++ b/instat/dlgClimaticStationMaps.vb @@ -68,6 +68,8 @@ Public Class dlgClimaticStationMaps ucrBase.clsRsyntax.iCallType = 3 ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False + Dim dctGRugColour As New Dictionary(Of String, String) + ucrSelectorOutline.SetParameter(New RParameter("data", 0)) ucrSelectorOutline.SetParameterIsrfunction() @@ -122,26 +124,51 @@ Public Class dlgClimaticStationMaps ucrSaveMap.SetAssignToIfUncheckedValue("last_map") ucrSaveMap.SetDataFrameSelector(ucrSelectorOutline.ucrAvailableDataFrames) - ucrChkLabelledRectangle.SetText("Labelled Rectangle") - ucrChkLabelledRectangle.AddParameterValuesCondition(True, "colour", "True") - ucrChkLabelledRectangle.AddParameterValuesCondition(False, "colour", "False") + ucrChkLabelledRectangle.SetText("Text") + ucrChkLabelledRectangle.AddParameterValuesCondition(True, "text", "True") + ucrChkLabelledRectangle.AddParameterValuesCondition(False, "text", "False") + ucrChkLabelledRectangle.SetRDefault("FALSE") ucrChkLabelAll.SetText("Label All") - ucrChkLabelAll.AddParameterValuesCondition(True, "check", "True") - ucrChkLabelAll.AddParameterValuesCondition(False, "check", "False") + ucrChkLabelAll.SetParameter(New RParameter("max.overlaps", 6)) + ucrChkLabelAll.AddParameterValuesCondition(True, "max.overlaps", "True") + ucrChkLabelAll.AddParameterValuesCondition(False, "max.overlaps", "False") ucrChkLabelAll.SetRDefault("FALSE") - ucrNudSize.SetParameter(New RParameter("size", 2)) - ucrNudSize.Minimum = 1 - ucrNudSize.DecimalPlaces = 2 + ucrChkSize.SetText("Size") + ucrChkSize.AddParameterValuesCondition(True, "check", "True") + ucrChkSize.AddParameterValuesCondition(False, "check", "False") + ucrChkSize.AddToLinkedControls(ucrNudSize, {True}, bNewLinkedHideIfParameterMissing:=True) + + ucrNudSize.SetParameter(New RParameter("size", 4)) + ucrNudSize.Minimum = 0 + ucrNudSize.DecimalPlaces = 1 ucrNudSize.Increment = 0.1 - ucrNudSize.SetLinkedDisplayControl(lblSize) + ucrNudSize.SetRDefault("5") + + ucrChkColour.SetText("Colour") + ucrChkColour.AddParameterValuesCondition(True, "checked", "True") + ucrChkColour.AddParameterValuesCondition(False, "checked", "False") + ucrChkColour.AddToLinkedControls(ucrInputColour, {True}, bNewLinkedHideIfParameterMissing:=True) + + + ucrInputColour.SetParameter(New RParameter("colour", 5)) + dctGRugColour.Add("Black", Chr(34) & "black" & Chr(34)) + dctGRugColour.Add("Red", Chr(34) & "red" & Chr(34)) + dctGRugColour.Add("Blue", Chr(34) & "blue" & Chr(34)) + dctGRugColour.Add("Yellow", Chr(34) & "yellow" & Chr(34)) + dctGRugColour.Add("Green", Chr(34) & "green" & Chr(34)) + dctGRugColour.Add("Violet", Chr(34) & "violet" & Chr(34)) + dctGRugColour.Add("White", Chr(34) & "white" & Chr(34)) + dctGRugColour.Add("None", Chr(34) & "none" & Chr(34)) + ucrInputColour.SetItems(dctGRugColour) + ucrInputColour.bAllowNonConditionValues = True + ucrInputColour.SetRDefault(Chr(34) & "black" & Chr(34)) ucrChkAddPoints.SetText("Add Points") ucrChkAddPoints.AddParameterPresentCondition(True, "geom_point") ucrChkAddPoints.AddParameterPresentCondition(False, "geom_point", False) ChangeSize() - End Sub Private Sub SetDefaults() @@ -182,7 +209,8 @@ Public Class dlgClimaticStationMaps clsRemoveFunc.SetRCommand("rm") - clsDummyFunction.AddParameter("colour", "True", iPosition:=1) + clsDummyFunction.AddParameter("checked", "False", iPosition:=0) + clsDummyFunction.AddParameter("check", "False", iPosition:=1) clsGgplotFunction.SetPackageName("ggplot2") clsGgplotFunction.SetRCommand("ggplot") @@ -212,14 +240,10 @@ Public Class dlgClimaticStationMaps clsLabelRepelFunction.SetPackageName("ggrepel") clsLabelRepelFunction.SetRCommand("geom_label_repel") clsLabelRepelFunction.AddParameter("mapping", clsRFunctionParameter:=clsLabelRepelAesFunction, iPosition:=1) - clsLabelRepelFunction.AddParameter("colour", Chr(34) & "red" & Chr(34), iPosition:=2) - clsLabelRepelFunction.AddParameter("size", "1", iPosition:=3) clsTextRepelFunction.SetPackageName("ggrepel") clsTextRepelFunction.SetRCommand("geom_text_repel") clsTextRepelFunction.AddParameter("mapping", clsRFunctionParameter:=clsTextRepelAesFunction, iPosition:=1) - clsTextRepelFunction.AddParameter("colour", Chr(34) & "black" & Chr(34), iPosition:=2) - clsTextRepelFunction.AddParameter("size", "1", iPosition:=3) clsLabelRepelAesFunction.SetPackageName("ggplot2") clsLabelRepelAesFunction.SetRCommand("aes") @@ -261,6 +285,9 @@ Public Class dlgClimaticStationMaps End Sub Private Sub SetRCodeForControls(bReset As Boolean) + ucrChkLabelAll.AddAdditionalCodeParameterPair(clsTextRepelFunction, New RParameter("max.overlaps", 6), iAdditionalPairNo:=1) + ucrNudSize.AddAdditionalCodeParameterPair(clsTextRepelFunction, New RParameter("size", 4), iAdditionalPairNo:=1) + ucrInputColour.AddAdditionalCodeParameterPair(clsTextRepelFunction, New RParameter("colour", 5), iAdditionalPairNo:=1) ucrReceiverLongitude.AddAdditionalCodeParameterPair(clsLabelRepelAesFunction, ucrReceiverLongitude.GetParameter(), iAdditionalPairNo:=1) ucrReceiverLatitude.AddAdditionalCodeParameterPair(clsLabelRepelAesFunction, ucrReceiverLatitude.GetParameter(), iAdditionalPairNo:=1) ucrReceiverStation.AddAdditionalCodeParameterPair(clsTextRepelAesFunction, ucrReceiverStation.GetParameter(), iAdditionalPairNo:=1) @@ -276,10 +303,17 @@ Public Class dlgClimaticStationMaps ucrReceiverShape.SetRCode(clsGeomPointAesFunction, bReset) ucrReceiverColor.SetRCode(clsGeomPointAesFunction, bReset) ucrReceiverFacet.SetRCode(clsFacetOp, bReset) - ucrChkLabelledRectangle.SetRCode(clsDummyFunction, bReset) - ucrChkLabelAll.SetRCode(clsGGplotOperator, bReset) ucrReceiverStation.SetRCode(clsLabelRepelAesFunction, bReset) + + ucrNudSize.SetRCode(clsLabelRepelFunction, bReset) + ucrInputColour.SetRCode(clsLabelRepelFunction, bReset) ucrChkAddPoints.SetRCode(clsGGplotOperator, bReset) + If bReset Then + ucrChkLabelledRectangle.SetRCode(clsGGplotOperator, bReset) + ucrChkLabelAll.SetRCode(clsLabelRepelFunction, bReset) + ucrChkSize.SetRCode(clsDummyFunction, bReset) + ucrChkColour.SetRCode(clsDummyFunction, bReset) + End If End Sub Private Sub TestOkEnabled() @@ -400,7 +434,7 @@ Public Class dlgClimaticStationMaps If Not ucrReceiverStation.IsEmpty AndAlso ucrChkLabelledRectangle.Checked Then clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) ElseIf Not ucrReceiverStation.IsEmpty AndAlso Not ucrChkLabelledRectangle.Checked Then - clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=3) + clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=2) End If If Not ucrReceiverFacet.IsEmpty Then clsGGplotOperator.AddParameter("facets", clsRFunctionParameter:=clsRFacetFunction, bIncludeArgumentName:=False, iPosition:=2) @@ -468,26 +502,119 @@ Public Class dlgClimaticStationMaps TestOkEnabled() End Sub - Private Sub ucrChkLabelledRectangle_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkLabelledRectangle.ControlValueChanged - If ucrChkLabelledRectangle.Checked Then + Private Sub AddGeomParameter() + If ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then + clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) + clsLabelRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) + clsLabelRepelFunction.AddParameter("size", "5", iPosition:=3) + clsLabelRepelFunction.AddParameter("colour", Chr(34) & "black" & Chr(34), iPosition:=2) + clsGGplotOperator.RemoveParameterByName("geom_text") + ElseIf Not ucrChkLabelledRectangle.Checked AndAlso Not ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso Not ucrChkColour.Checked Then + clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=2) + clsGGplotOperator.RemoveParameterByName("geom_label") + clsTextRepelFunction.RemoveParameterByName("size") + clsTextRepelFunction.RemoveParameterByName("colour") + clsTextRepelFunction.RemoveParameterByName("max.overlaps") + ElseIf Not ucrChkLabelledRectangle.Checked AndAlso Not ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then + clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=2) + clsTextRepelFunction.AddParameter("colour", Chr(34) & "black" & Chr(34), iPosition:=2) + clsGGplotOperator.RemoveParameterByName("geom_label") + clsTextRepelFunction.RemoveParameterByName("size") + clsTextRepelFunction.RemoveParameterByName("max.overlaps") + ElseIf ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso ucrChkLabelAll.Checked AndAlso Not ucrChkColour.Checked Then + clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) + clsLabelRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) + clsLabelRepelFunction.AddParameter("size", "5", iPosition:=3) + clsGGplotOperator.RemoveParameterByName("geom_text") + clsLabelRepelFunction.RemoveParameterByName("colour") + ElseIf ucrChkLabelledRectangle.Checked AndAlso Not ucrChkSize.Checked AndAlso ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then + clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) + clsLabelRepelFunction.AddParameter("colour", Chr(34) & "black" & Chr(34), iPosition:=2) + clsLabelRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) + clsGGplotOperator.RemoveParameterByName("geom_text") + clsLabelRepelFunction.RemoveParameterByName("size") + ElseIf ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then + clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) + clsLabelRepelFunction.AddParameter("size", "5", iPosition:=3) + clsLabelRepelFunction.AddParameter("colour", Chr(34) & "black" & Chr(34), iPosition:=2) + clsGGplotOperator.RemoveParameterByName("geom_text") + clsLabelRepelFunction.RemoveParameterByName("max.overlaps") + ElseIf Not ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then + clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=2) + clsTextRepelFunction.AddParameter("size", "5", iPosition:=3) + clsTextRepelFunction.AddParameter("colour", Chr(34) & "black" & Chr(34), iPosition:=2) + clsTextRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) + clsGGplotOperator.RemoveParameterByName("geom_label") + ElseIf Not ucrChkLabelledRectangle.Checked AndAlso Not ucrChkSize.Checked AndAlso ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then + clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=2) + clsTextRepelFunction.AddParameter("colour", Chr(34) & "black" & Chr(34), iPosition:=2) + clsTextRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) + clsGGplotOperator.RemoveParameterByName("geom_label") + clsTextRepelFunction.RemoveParameterByName("size") + ElseIf ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso Not ucrChkColour.Checked Then + clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) + clsLabelRepelFunction.AddParameter("size", "5", iPosition:=3) + clsGGplotOperator.RemoveParameterByName("geom_text") + clsLabelRepelFunction.RemoveParameterByName("colour") + clsLabelRepelFunction.RemoveParameterByName("max.overlaps") + ElseIf ucrChkLabelledRectangle.Checked AndAlso Not ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then + clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) + clsLabelRepelFunction.AddParameter("colour", Chr(34) & "black" & Chr(34), iPosition:=2) + clsGGplotOperator.RemoveParameterByName("geom_text") + clsLabelRepelFunction.RemoveParameterByName("size") + clsLabelRepelFunction.RemoveParameterByName("max.overlaps") + ElseIf Not ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then + clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=2) + clsTextRepelFunction.AddParameter("colour", Chr(34) & "black" & Chr(34), iPosition:=2) + clsTextRepelFunction.AddParameter("size", "5", iPosition:=3) + clsGGplotOperator.RemoveParameterByName("geom_label") + clsTextRepelFunction.RemoveParameterByName("max.overlaps") + ElseIf ucrChkLabelledRectangle.Checked AndAlso Not ucrChkSize.Checked AndAlso ucrChkLabelAll.Checked AndAlso Not ucrChkColour.Checked Then + clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) + clsLabelRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) + clsLabelRepelFunction.RemoveParameterByName("size") + clsLabelRepelFunction.RemoveParameterByName("colour") + clsGGplotOperator.RemoveParameterByName("geom_text") + ElseIf Not ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso ucrChkLabelAll.Checked AndAlso Not ucrChkColour.Checked Then + clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=2) + clsTextRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=2) + clsTextRepelFunction.AddParameter("size", "5", iPosition:=3) + clsGGplotOperator.RemoveParameterByName("geom_label") + clsTextRepelFunction.RemoveParameterByName("colour") + ElseIf Not ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso Not ucrChkColour.Checked Then + clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=2) + clsTextRepelFunction.AddParameter("size", "5", iPosition:=3) + clsGGplotOperator.RemoveParameterByName("geom_label") + clsTextRepelFunction.RemoveParameterByName("colour") + clsTextRepelFunction.RemoveParameterByName("max.overlaps") + ElseIf ucrChkLabelledRectangle.Checked AndAlso Not ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso Not ucrChkColour.Checked Then clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) clsGGplotOperator.RemoveParameterByName("geom_text") - clsLabelRepelAesFunction.RemoveParameterByName("size") + clsLabelRepelFunction.RemoveParameterByName("colour") + clsLabelRepelFunction.RemoveParameterByName("max.overlaps") + clsLabelRepelFunction.RemoveParameterByName("size") Else - clsGGplotOperator.AddParameter("geom_Text", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) + clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=2) clsGGplotOperator.RemoveParameterByName("geom_label") - clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=3) - clsTextRepelAesFunction.RemoveParameterByName("size") + clsTextRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) + clsTextRepelFunction.RemoveParameterByName("colour") + clsTextRepelFunction.RemoveParameterByName("size") End If End Sub + Private Sub ucrChkLabelledRectangle_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkLabelledRectangle.ControlValueChanged + AddGeomParameter() + End Sub + Private Sub ucrChkLabelAll_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkLabelAll.ControlValueChanged - If ucrChkLabelAll.Checked AndAlso ucrChkLabelAll.Checked Then - clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) - clsLabelRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) - ElseIf ucrChkLabelAll.Checked AndAlso Not ucrChkLabelAll.Checked Then - clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=3) - clsTextRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) - End If + AddGeomParameter() + End Sub + + Private Sub ucrChkSize_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkSize.ControlValueChanged + AddGeomParameter() + End Sub + + Private Sub ucrChkColour_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkColour.ControlValueChanged + AddGeomParameter() End Sub End Class diff --git a/instat/ucrGeom.vb b/instat/ucrGeom.vb index 2b4b9f50af3..a3ec37be430 100644 --- a/instat/ucrGeom.vb +++ b/instat/ucrGeom.vb @@ -1353,7 +1353,7 @@ Public Class ucrGeom clsgeom_label_repel.AddLayerParameter("label.r", "numeric", "0.15", lstParameterStrings:={2, 0}) clsgeom_label_repel.AddLayerParameter("min.segment.length", "numeric", "0.5", lstParameterStrings:={1, 0}) clsgeom_label_repel.AddLayerParameter("arrow", "editablelist", "arrow()", lstParameterStrings:={"arrow()"}) - clsgeom_label_repel.AddLayerParameter("size", "numeric", "1", lstParameterStrings:={1, 1}) + clsgeom_label_repel.AddLayerParameter("size", "numeric", "5", lstParameterStrings:={1, 1}) clsgeom_label_repel.AddLayerParameter("colour", "colour", Chr(34) & "black" & Chr(34)) clsgeom_label_repel.AddLayerParameter("max.overlaps", "numeric", "10", lstParameterStrings:={0, 1}) clsgeom_label_repel.AddLayerParameter("nudge_x", "numeric", "0", lstParameterStrings:={2}) @@ -2080,7 +2080,7 @@ Public Class ucrGeom clsgeom_text_repel.AddLayerParameter("point.padding", "numeric", "0", lstParameterStrings:={2, 0}) clsgeom_text_repel.AddLayerParameter("min.segment.length", "numeric", "0.5", lstParameterStrings:={1, 0}) clsgeom_text_repel.AddLayerParameter("arrow", "editablelist", "arrow()", lstParameterStrings:={"arrow()"}) - clsgeom_text_repel.AddLayerParameter("size", "numeric", "1", lstParameterStrings:={1, 0}) + clsgeom_text_repel.AddLayerParameter("size", "numeric", "5", lstParameterStrings:={1, 0}) clsgeom_text_repel.AddLayerParameter("colour", "colour", Chr(34) & "black" & Chr(34)) clsgeom_text_repel.AddLayerParameter("max.overlaps", "numeric", "10", lstParameterStrings:={0, 1}) clsgeom_text_repel.AddLayerParameter("nudge_x", "numeric", "0", lstParameterStrings:={2}) From b180c11d5492695724354906153c64be6a3b67e1 Mon Sep 17 00:00:00 2001 From: Sophie Date: Wed, 17 May 2023 10:54:32 +0100 Subject: [PATCH 6/7] Minor Changes --- instat/dlgClimaticStationMaps.vb | 124 +++++++++++++++---------------- 1 file changed, 61 insertions(+), 63 deletions(-) diff --git a/instat/dlgClimaticStationMaps.vb b/instat/dlgClimaticStationMaps.vb index 90e9efc364d..84cfa3b4980 100644 --- a/instat/dlgClimaticStationMaps.vb +++ b/instat/dlgClimaticStationMaps.vb @@ -151,7 +151,6 @@ Public Class dlgClimaticStationMaps ucrChkColour.AddParameterValuesCondition(False, "checked", "False") ucrChkColour.AddToLinkedControls(ucrInputColour, {True}, bNewLinkedHideIfParameterMissing:=True) - ucrInputColour.SetParameter(New RParameter("colour", 5)) dctGRugColour.Add("Black", Chr(34) & "black" & Chr(34)) dctGRugColour.Add("Red", Chr(34) & "red" & Chr(34)) @@ -304,9 +303,8 @@ Public Class dlgClimaticStationMaps ucrReceiverColor.SetRCode(clsGeomPointAesFunction, bReset) ucrReceiverFacet.SetRCode(clsFacetOp, bReset) ucrReceiverStation.SetRCode(clsLabelRepelAesFunction, bReset) - - ucrNudSize.SetRCode(clsLabelRepelFunction, bReset) ucrInputColour.SetRCode(clsLabelRepelFunction, bReset) + ucrNudSize.SetRCode(clsLabelRepelFunction, bReset) ucrChkAddPoints.SetRCode(clsGGplotOperator, bReset) If bReset Then ucrChkLabelledRectangle.SetRCode(clsGGplotOperator, bReset) @@ -432,9 +430,9 @@ Public Class dlgClimaticStationMaps clsGGplotOperator.RemoveParameterByName("scale_shape_manual") If ucrChkAddPoints.Checked Then If Not ucrReceiverStation.IsEmpty AndAlso ucrChkLabelledRectangle.Checked Then - clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) - ElseIf Not ucrReceiverStation.IsEmpty AndAlso Not ucrChkLabelledRectangle.Checked Then clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=2) + ElseIf Not ucrReceiverStation.IsEmpty AndAlso Not ucrChkLabelledRectangle.Checked Then + clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) End If If Not ucrReceiverFacet.IsEmpty Then clsGGplotOperator.AddParameter("facets", clsRFunctionParameter:=clsRFacetFunction, bIncludeArgumentName:=False, iPosition:=2) @@ -504,101 +502,101 @@ Public Class dlgClimaticStationMaps Private Sub AddGeomParameter() If ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then - clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) - clsLabelRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) - clsLabelRepelFunction.AddParameter("size", "5", iPosition:=3) - clsLabelRepelFunction.AddParameter("colour", Chr(34) & "black" & Chr(34), iPosition:=2) - clsGGplotOperator.RemoveParameterByName("geom_text") - ElseIf Not ucrChkLabelledRectangle.Checked AndAlso Not ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso Not ucrChkColour.Checked Then clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=2) + clsTextRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) + clsTextRepelFunction.AddParameter("size", ucrNudSize.GetText(), iPosition:=3) + clsTextRepelFunction.AddParameter("colour", Chr(34) & ucrInputColour.GetText() & Chr(34), iPosition:=2) clsGGplotOperator.RemoveParameterByName("geom_label") - clsTextRepelFunction.RemoveParameterByName("size") - clsTextRepelFunction.RemoveParameterByName("colour") - clsTextRepelFunction.RemoveParameterByName("max.overlaps") - ElseIf Not ucrChkLabelledRectangle.Checked AndAlso Not ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then - clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=2) - clsTextRepelFunction.AddParameter("colour", Chr(34) & "black" & Chr(34), iPosition:=2) - clsGGplotOperator.RemoveParameterByName("geom_label") - clsTextRepelFunction.RemoveParameterByName("size") - clsTextRepelFunction.RemoveParameterByName("max.overlaps") - ElseIf ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso ucrChkLabelAll.Checked AndAlso Not ucrChkColour.Checked Then + ElseIf Not ucrChkLabelledRectangle.Checked AndAlso Not ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso Not ucrChkColour.Checked Then clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) - clsLabelRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) - clsLabelRepelFunction.AddParameter("size", "5", iPosition:=3) clsGGplotOperator.RemoveParameterByName("geom_text") + clsLabelRepelFunction.RemoveParameterByName("size") clsLabelRepelFunction.RemoveParameterByName("colour") - ElseIf ucrChkLabelledRectangle.Checked AndAlso Not ucrChkSize.Checked AndAlso ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then + clsLabelRepelFunction.RemoveParameterByName("max.overlaps") + ElseIf Not ucrChkLabelledRectangle.Checked AndAlso Not ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) - clsLabelRepelFunction.AddParameter("colour", Chr(34) & "black" & Chr(34), iPosition:=2) - clsLabelRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) + clsLabelRepelFunction.AddParameter("colour", Chr(34) & ucrInputColour.GetText() & Chr(34), iPosition:=2) clsGGplotOperator.RemoveParameterByName("geom_text") clsLabelRepelFunction.RemoveParameterByName("size") - ElseIf ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then - clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) - clsLabelRepelFunction.AddParameter("size", "5", iPosition:=3) - clsLabelRepelFunction.AddParameter("colour", Chr(34) & "black" & Chr(34), iPosition:=2) - clsGGplotOperator.RemoveParameterByName("geom_text") clsLabelRepelFunction.RemoveParameterByName("max.overlaps") - ElseIf Not ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then + ElseIf ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso ucrChkLabelAll.Checked AndAlso Not ucrChkColour.Checked Then clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=2) - clsTextRepelFunction.AddParameter("size", "5", iPosition:=3) - clsTextRepelFunction.AddParameter("colour", Chr(34) & "black" & Chr(34), iPosition:=2) clsTextRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) + clsTextRepelFunction.AddParameter("size", ucrNudSize.GetText(), iPosition:=3) clsGGplotOperator.RemoveParameterByName("geom_label") - ElseIf Not ucrChkLabelledRectangle.Checked AndAlso Not ucrChkSize.Checked AndAlso ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then + clsTextRepelFunction.RemoveParameterByName("colour") + ElseIf ucrChkLabelledRectangle.Checked AndAlso Not ucrChkSize.Checked AndAlso ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=2) - clsTextRepelFunction.AddParameter("colour", Chr(34) & "black" & Chr(34), iPosition:=2) + clsTextRepelFunction.AddParameter("colour", Chr(34) & ucrInputColour.GetText() & Chr(34), iPosition:=2) clsTextRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) clsGGplotOperator.RemoveParameterByName("geom_label") clsTextRepelFunction.RemoveParameterByName("size") - ElseIf ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso Not ucrChkColour.Checked Then + ElseIf ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then + clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=2) + clsTextRepelFunction.AddParameter("size", ucrNudSize.GetText(), iPosition:=3) + clsTextRepelFunction.AddParameter("colour", Chr(34) & ucrInputColour.GetText() & Chr(34), iPosition:=2) + clsGGplotOperator.RemoveParameterByName("geom_label") + clsTextRepelFunction.RemoveParameterByName("max.overlaps") + ElseIf Not ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) - clsLabelRepelFunction.AddParameter("size", "5", iPosition:=3) + clsLabelRepelFunction.AddParameter("size", ucrNudSize.GetText(), iPosition:=3) + clsLabelRepelFunction.AddParameter("colour", Chr(34) & ucrInputColour.GetText() & Chr(34), iPosition:=2) + clsLabelRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) clsGGplotOperator.RemoveParameterByName("geom_text") - clsLabelRepelFunction.RemoveParameterByName("colour") - clsLabelRepelFunction.RemoveParameterByName("max.overlaps") - ElseIf ucrChkLabelledRectangle.Checked AndAlso Not ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then + ElseIf Not ucrChkLabelledRectangle.Checked AndAlso Not ucrChkSize.Checked AndAlso ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) - clsLabelRepelFunction.AddParameter("colour", Chr(34) & "black" & Chr(34), iPosition:=2) + clsLabelRepelFunction.AddParameter("colour", Chr(34) & ucrInputColour.GetText() & Chr(34), iPosition:=2) + clsLabelRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) clsGGplotOperator.RemoveParameterByName("geom_text") clsLabelRepelFunction.RemoveParameterByName("size") - clsLabelRepelFunction.RemoveParameterByName("max.overlaps") - ElseIf Not ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then + ElseIf ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso Not ucrChkColour.Checked Then clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=2) - clsTextRepelFunction.AddParameter("colour", Chr(34) & "black" & Chr(34), iPosition:=2) - clsTextRepelFunction.AddParameter("size", "5", iPosition:=3) + clsTextRepelFunction.AddParameter("size", ucrNudSize.GetText(), iPosition:=3) clsGGplotOperator.RemoveParameterByName("geom_label") + clsTextRepelFunction.RemoveParameterByName("colour") clsTextRepelFunction.RemoveParameterByName("max.overlaps") - ElseIf ucrChkLabelledRectangle.Checked AndAlso Not ucrChkSize.Checked AndAlso ucrChkLabelAll.Checked AndAlso Not ucrChkColour.Checked Then + ElseIf ucrChkLabelledRectangle.Checked AndAlso Not ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then + clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=2) + clsTextRepelFunction.AddParameter("colour", Chr(34) & ucrInputColour.GetText() & Chr(34), iPosition:=2) + clsGGplotOperator.RemoveParameterByName("geom_label") + clsTextRepelFunction.RemoveParameterByName("size") + clsTextRepelFunction.RemoveParameterByName("max.overlaps") + ElseIf Not ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso ucrChkColour.Checked Then clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) - clsLabelRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) - clsLabelRepelFunction.RemoveParameterByName("size") - clsLabelRepelFunction.RemoveParameterByName("colour") + clsLabelRepelFunction.AddParameter("colour", Chr(34) & ucrInputColour.GetText() & Chr(34), iPosition:=2) + clsLabelRepelFunction.AddParameter("size", ucrNudSize.GetText(), iPosition:=3) clsGGplotOperator.RemoveParameterByName("geom_text") - ElseIf Not ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso ucrChkLabelAll.Checked AndAlso Not ucrChkColour.Checked Then + clsLabelRepelFunction.RemoveParameterByName("max.overlaps") + ElseIf ucrChkLabelledRectangle.Checked AndAlso Not ucrChkSize.Checked AndAlso ucrChkLabelAll.Checked AndAlso Not ucrChkColour.Checked Then clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=2) - clsTextRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=2) - clsTextRepelFunction.AddParameter("size", "5", iPosition:=3) - clsGGplotOperator.RemoveParameterByName("geom_label") + clsTextRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) + clsTextRepelFunction.RemoveParameterByName("size") clsTextRepelFunction.RemoveParameterByName("colour") - ElseIf Not ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso Not ucrChkColour.Checked Then - clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=2) - clsTextRepelFunction.AddParameter("size", "5", iPosition:=3) clsGGplotOperator.RemoveParameterByName("geom_label") - clsTextRepelFunction.RemoveParameterByName("colour") - clsTextRepelFunction.RemoveParameterByName("max.overlaps") - ElseIf ucrChkLabelledRectangle.Checked AndAlso Not ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso Not ucrChkColour.Checked Then + ElseIf Not ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso ucrChkLabelAll.Checked AndAlso Not ucrChkColour.Checked Then + clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) + clsLabelRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=2) + clsLabelRepelFunction.AddParameter("size", ucrNudSize.GetText(), iPosition:=3) + clsGGplotOperator.RemoveParameterByName("geom_text") + clsLabelRepelFunction.RemoveParameterByName("colour") + ElseIf Not ucrChkLabelledRectangle.Checked AndAlso ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso Not ucrChkColour.Checked Then clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) + clsLabelRepelFunction.AddParameter("size", ucrNudSize.GetText(), iPosition:=3) clsGGplotOperator.RemoveParameterByName("geom_text") clsLabelRepelFunction.RemoveParameterByName("colour") clsLabelRepelFunction.RemoveParameterByName("max.overlaps") - clsLabelRepelFunction.RemoveParameterByName("size") - Else + ElseIf ucrChkLabelledRectangle.Checked AndAlso Not ucrChkSize.Checked AndAlso Not ucrChkLabelAll.Checked AndAlso Not ucrChkColour.Checked Then clsGGplotOperator.AddParameter("geom_text", clsRFunctionParameter:=clsTextRepelFunction, iPosition:=2) clsGGplotOperator.RemoveParameterByName("geom_label") - clsTextRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) clsTextRepelFunction.RemoveParameterByName("colour") + clsTextRepelFunction.RemoveParameterByName("max.overlaps") clsTextRepelFunction.RemoveParameterByName("size") + Else + clsGGplotOperator.AddParameter("geom_label", clsRFunctionParameter:=clsLabelRepelFunction, iPosition:=2) + clsGGplotOperator.RemoveParameterByName("geom_text") + clsLabelRepelFunction.AddParameter("max.overlaps", "Inf", iPosition:=4) + clsLabelRepelFunction.RemoveParameterByName("colour") + clsLabelRepelFunction.RemoveParameterByName("size") End If End Sub From 2c8a8b64d5865b49c317a30e4df78e9a43c921ad Mon Sep 17 00:00:00 2001 From: Sophie Date: Wed, 17 May 2023 11:01:31 +0100 Subject: [PATCH 7/7] Minor change --- instat/dlgClimaticStationMaps.vb | 1 - 1 file changed, 1 deletion(-) diff --git a/instat/dlgClimaticStationMaps.vb b/instat/dlgClimaticStationMaps.vb index 84cfa3b4980..feb295067e3 100644 --- a/instat/dlgClimaticStationMaps.vb +++ b/instat/dlgClimaticStationMaps.vb @@ -412,7 +412,6 @@ Public Class dlgClimaticStationMaps bResetSFLayerSubdialog = False clsGgplotFunction.RemoveParameterByName("mapping") clsTextRepelFunction.AddParameter("mapping", clsRFunctionParameter:=clsTextRepelAesFunction, iPosition:=1) - End Sub Private Sub toolStripMenuItemPointOptions_Click(sender As Object, e As EventArgs) Handles toolStripMenuItemPointOptions.Click