From e969fef6f023ff2807de68b74bee7eb1fb4fb19b Mon Sep 17 00:00:00 2001 From: Anton Date: Wed, 3 Feb 2021 09:31:38 +0100 Subject: [PATCH] Added grating direction symbol --- Wardrobe/GUI.Designer.vb | 63 +++++++++++++++++++++++----------------- Wardrobe/GUI.resx | 3 ++ Wardrobe/GUI.vb | 47 +++++++++++++++++++++++------- 3 files changed, 76 insertions(+), 37 deletions(-) diff --git a/Wardrobe/GUI.Designer.vb b/Wardrobe/GUI.Designer.vb index 086c680..de36355 100644 --- a/Wardrobe/GUI.Designer.vb +++ b/Wardrobe/GUI.Designer.vb @@ -44,15 +44,16 @@ Partial Class GUI Me.ComboBox_Width = New System.Windows.Forms.ComboBox() Me.ComboBox_Length = New System.Windows.Forms.ComboBox() Me.Button_Square = New System.Windows.Forms.Button() + Me.Label9 = New System.Windows.Forms.Label() Me.SuspendLayout() ' 'DrawingPanel ' Me.DrawingPanel.BackColor = System.Drawing.SystemColors.Window - Me.DrawingPanel.Location = New System.Drawing.Point(239, 95) + Me.DrawingPanel.Location = New System.Drawing.Point(239, 145) Me.DrawingPanel.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) Me.DrawingPanel.Name = "DrawingPanel" - Me.DrawingPanel.Size = New System.Drawing.Size(905, 540) + Me.DrawingPanel.Size = New System.Drawing.Size(1134, 559) Me.DrawingPanel.TabIndex = 0 ' 'ContextMenuStrip1 @@ -65,7 +66,7 @@ Partial Class GUI ' Me.Label1.AutoSize = True Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label1.Location = New System.Drawing.Point(303, 25) + Me.Label1.Location = New System.Drawing.Point(284, 49) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(44, 17) Me.Label1.TabIndex = 4 @@ -75,7 +76,7 @@ Partial Class GUI ' Me.Label2.AutoSize = True Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label2.Location = New System.Drawing.Point(292, 58) + Me.Label2.Location = New System.Drawing.Point(273, 82) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(52, 17) Me.Label2.TabIndex = 5 @@ -84,7 +85,7 @@ Partial Class GUI 'ExportSWButton ' Me.ExportSWButton.BackColor = System.Drawing.SystemColors.ActiveCaption - Me.ExportSWButton.Location = New System.Drawing.Point(1052, 643) + Me.ExportSWButton.Location = New System.Drawing.Point(1281, 717) Me.ExportSWButton.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) Me.ExportSWButton.Name = "ExportSWButton" Me.ExportSWButton.Size = New System.Drawing.Size(92, 33) @@ -94,7 +95,7 @@ Partial Class GUI ' 'AngleButton ' - Me.AngleButton.Location = New System.Drawing.Point(11, 158) + Me.AngleButton.Location = New System.Drawing.Point(11, 201) Me.AngleButton.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) Me.AngleButton.Name = "AngleButton" Me.AngleButton.Size = New System.Drawing.Size(92, 28) @@ -104,7 +105,7 @@ Partial Class GUI ' 'SettingsButton ' - Me.SettingsButton.Location = New System.Drawing.Point(11, 635) + Me.SettingsButton.Location = New System.Drawing.Point(11, 709) Me.SettingsButton.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) Me.SettingsButton.Name = "SettingsButton" Me.SettingsButton.Size = New System.Drawing.Size(60, 41) @@ -117,7 +118,7 @@ Partial Class GUI Me.ComboBox_TypeChooser.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList Me.ComboBox_TypeChooser.FormattingEnabled = True Me.ComboBox_TypeChooser.Items.AddRange(New Object() {"Pressure Welded", "Type A"}) - Me.ComboBox_TypeChooser.Location = New System.Drawing.Point(107, 25) + Me.ComboBox_TypeChooser.Location = New System.Drawing.Point(91, 46) Me.ComboBox_TypeChooser.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) Me.ComboBox_TypeChooser.Name = "ComboBox_TypeChooser" Me.ComboBox_TypeChooser.Size = New System.Drawing.Size(141, 21) @@ -130,7 +131,7 @@ Partial Class GUI Me.ComboBox_MeshSize.Enabled = False Me.ComboBox_MeshSize.FormattingEnabled = True Me.ComboBox_MeshSize.Items.AddRange(New Object() {"12x100 (B9)", "25x50 (F4)", "34x37 (H3)"}) - Me.ComboBox_MeshSize.Location = New System.Drawing.Point(107, 58) + Me.ComboBox_MeshSize.Location = New System.Drawing.Point(91, 81) Me.ComboBox_MeshSize.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) Me.ComboBox_MeshSize.Name = "ComboBox_MeshSize" Me.ComboBox_MeshSize.Size = New System.Drawing.Size(141, 21) @@ -142,7 +143,7 @@ Partial Class GUI Me.ComboBox_Thickness.Enabled = False Me.ComboBox_Thickness.FormattingEnabled = True Me.ComboBox_Thickness.Items.AddRange(New Object() {"2", "3", "4"}) - Me.ComboBox_Thickness.Location = New System.Drawing.Point(596, 21) + Me.ComboBox_Thickness.Location = New System.Drawing.Point(577, 45) Me.ComboBox_Thickness.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) Me.ComboBox_Thickness.Name = "ComboBox_Thickness" Me.ComboBox_Thickness.Size = New System.Drawing.Size(141, 21) @@ -154,7 +155,7 @@ Partial Class GUI Me.ComboBox_Height.Enabled = False Me.ComboBox_Height.FormattingEnabled = True Me.ComboBox_Height.Items.AddRange(New Object() {"20", "25", "30"}) - Me.ComboBox_Height.Location = New System.Drawing.Point(596, 55) + Me.ComboBox_Height.Location = New System.Drawing.Point(577, 79) Me.ComboBox_Height.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) Me.ComboBox_Height.Name = "ComboBox_Height" Me.ComboBox_Height.Size = New System.Drawing.Size(141, 21) @@ -164,7 +165,7 @@ Partial Class GUI ' Me.Label3.AutoSize = True Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label3.Location = New System.Drawing.Point(62, 24) + Me.Label3.Location = New System.Drawing.Point(46, 45) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(40, 17) Me.Label3.TabIndex = 17 @@ -174,7 +175,7 @@ Partial Class GUI ' Me.Label4.AutoSize = True Me.Label4.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label4.Location = New System.Drawing.Point(29, 59) + Me.Label4.Location = New System.Drawing.Point(13, 82) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(73, 17) Me.Label4.TabIndex = 18 @@ -184,7 +185,7 @@ Partial Class GUI ' Me.Label5.AutoSize = True Me.Label5.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label5.Location = New System.Drawing.Point(519, 22) + Me.Label5.Location = New System.Drawing.Point(500, 46) Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(72, 17) Me.Label5.TabIndex = 19 @@ -194,7 +195,7 @@ Partial Class GUI ' Me.Label6.AutoSize = True Me.Label6.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label6.Location = New System.Drawing.Point(542, 55) + Me.Label6.Location = New System.Drawing.Point(523, 79) Me.Label6.Name = "Label6" Me.Label6.Size = New System.Drawing.Size(49, 17) Me.Label6.TabIndex = 20 @@ -204,31 +205,29 @@ Partial Class GUI ' Me.Label7.AutoSize = True Me.Label7.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label7.Location = New System.Drawing.Point(8, 107) + Me.Label7.Location = New System.Drawing.Point(8, 151) Me.Label7.Name = "Label7" Me.Label7.Size = New System.Drawing.Size(78, 17) Me.Label7.TabIndex = 21 - Me.Label7.Text = "Recesses" + Me.Label7.Text = "Functions" ' 'Label8 ' Me.Label8.AutoSize = True Me.Label8.BackColor = System.Drawing.Color.Black Me.Label8.Font = New System.Drawing.Font("Microsoft Sans Serif", 1.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label8.Location = New System.Drawing.Point(10, 134) + Me.Label8.Location = New System.Drawing.Point(10, 178) Me.Label8.Name = "Label8" - Me.Label8.Size = New System.Drawing.Size(173, 2) + Me.Label8.Size = New System.Drawing.Size(220, 2) Me.Label8.TabIndex = 22 - Me.Label8.Text = " " & - " " & - " " + Me.Label8.Text = resources.GetString("Label8.Text") ' 'ComboBox_Width ' Me.ComboBox_Width.Enabled = False Me.ComboBox_Width.FormattingEnabled = True Me.ComboBox_Width.Items.AddRange(New Object() {"500", "700", "722", "1000"}) - Me.ComboBox_Width.Location = New System.Drawing.Point(352, 25) + Me.ComboBox_Width.Location = New System.Drawing.Point(333, 49) Me.ComboBox_Width.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) Me.ComboBox_Width.Name = "ComboBox_Width" Me.ComboBox_Width.Size = New System.Drawing.Size(141, 21) @@ -240,7 +239,7 @@ Partial Class GUI Me.ComboBox_Length.Enabled = False Me.ComboBox_Length.FormattingEnabled = True Me.ComboBox_Length.Items.AddRange(New Object() {"300", "600", "900", "1000"}) - Me.ComboBox_Length.Location = New System.Drawing.Point(352, 58) + Me.ComboBox_Length.Location = New System.Drawing.Point(333, 82) Me.ComboBox_Length.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) Me.ComboBox_Length.Name = "ComboBox_Length" Me.ComboBox_Length.Size = New System.Drawing.Size(141, 21) @@ -249,18 +248,29 @@ Partial Class GUI ' 'Button_Square ' - Me.Button_Square.Location = New System.Drawing.Point(11, 237) + Me.Button_Square.Location = New System.Drawing.Point(11, 281) Me.Button_Square.Name = "Button_Square" Me.Button_Square.Size = New System.Drawing.Size(92, 28) Me.Button_Square.TabIndex = 25 Me.Button_Square.Text = "Add Square Corner" Me.Button_Square.UseVisualStyleBackColor = True ' + 'Label9 + ' + Me.Label9.AutoSize = True + Me.Label9.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label9.Location = New System.Drawing.Point(13, 12) + Me.Label9.Name = "Label9" + Me.Label9.Size = New System.Drawing.Size(146, 17) + Me.Label9.TabIndex = 26 + Me.Label9.Text = "Floor gratings data" + ' 'GUI ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(1155, 687) + Me.ClientSize = New System.Drawing.Size(1384, 761) + Me.Controls.Add(Me.Label9) Me.Controls.Add(Me.Button_Square) Me.Controls.Add(Me.ComboBox_Length) Me.Controls.Add(Me.ComboBox_Width) @@ -310,4 +320,5 @@ Partial Class GUI Friend WithEvents ComboBox_Width As ComboBox Friend WithEvents ComboBox_Length As ComboBox Friend WithEvents Button_Square As Button + Friend WithEvents Label9 As Label End Class diff --git a/Wardrobe/GUI.resx b/Wardrobe/GUI.resx index c8aa1a5..8845183 100644 --- a/Wardrobe/GUI.resx +++ b/Wardrobe/GUI.resx @@ -120,6 +120,9 @@ 17, 17 + + + diff --git a/Wardrobe/GUI.vb b/Wardrobe/GUI.vb index 8692ab7..5467bd1 100644 --- a/Wardrobe/GUI.vb +++ b/Wardrobe/GUI.vb @@ -19,6 +19,8 @@ Public Class GUI Public pCon3(3) As Decimal Public pCon4(3) As Decimal + Dim symbolPoints As New Dictionary(Of String, Decimal()) + Dim points As New Dictionary(Of String, Decimal()) Dim pointsFunc As New Dictionary(Of String, Boolean) Dim pointsOrder As New List(Of String) @@ -39,6 +41,8 @@ Public Class GUI Set_ContainerPointsX() Set_ContainerPointsY() + Create_SymbolPoints() + Update_GratingDimensions() Create_StartPoints() @@ -76,6 +80,19 @@ Public Class GUI pCon4(1) = containerMidY + drawH / 2 End Sub + ' --- Create points for grating direction symbol --- + Private Sub Create_SymbolPoints() + symbolPoints.Add("p1", {-30 + containerMidX, -2 + containerMidY}) + symbolPoints.Add("p2", {20 + containerMidX, -2 + containerMidY}) + symbolPoints.Add("p3", {12 + containerMidX, -10 + containerMidY}) + symbolPoints.Add("p4", {15 + containerMidX, -13 + containerMidY}) + symbolPoints.Add("p5", {30 + containerMidX, 2 + containerMidY}) + symbolPoints.Add("p6", {-20 + containerMidX, 2 + containerMidY}) + symbolPoints.Add("p7", {-12 + containerMidX, 10 + containerMidY}) + symbolPoints.Add("p8", {-15 + containerMidX, 13 + containerMidY}) + symbolPoints.Add("p9", {-30 + containerMidX, -2 + containerMidY}) + End Sub + ' --- Updates the outer dimensions of the grating --- Private Sub Update_GratingDimensions() gratingAspect = gratingMaxW / gratingMaxL @@ -128,6 +145,12 @@ Public Class GUI e.Graphics.DrawLine(penCon, CInt(pCon3(0)), CInt(pCon3(1)), CInt(pCon4(0)), CInt(pCon4(1))) e.Graphics.DrawLine(penCon, CInt(pCon4(0)), CInt(pCon4(1)), CInt(pCon1(0)), CInt(pCon1(1))) + ' Draw grating direction symbol + Dim symPen As Pen = New Pen(Color.Black, 1) + For i = 1 To symbolPoints.Count - 1 + e.Graphics.DrawLine(symPen, symbolPoints("p" & i)(0), symbolPoints("p" & i)(1), symbolPoints("p" & i + 1)(0), symbolPoints("p" & i + 1)(1)) + Next + ' Draw actual grating (black) Dim pen As Pen = New Pen(Color.Black, 1) For i = 0 To pointsOrder.Count - 1 @@ -259,13 +282,13 @@ Public Class GUI ComboBox_MeshSize.Items.Add("25x50 (F4)") 'Tillfällig ComboBox_MeshSize.Items.Add("34x37 (H3)") 'Tillfällig - For i = 1 To 5 - ComboBox_MeshSize.Items.Add("hej " & i) 'Hämta från databas - Next + 'For i = 1 To 5 + ' ComboBox_MeshSize.Items.Add("hej " & i) 'Hämta från databas + 'Next Else - For i = 1 To 5 - ComboBox_MeshSize.Items.Add("Test " & i) 'Hämta från databas - Next + 'For i = 1 To 5 + ' ComboBox_MeshSize.Items.Add("Test " & i) 'Hämta från databas + 'Next End If End Sub @@ -318,11 +341,11 @@ Public Class GUI Create_TextBox("X_TextBox", "", buttonX + 20, buttonY + 40, 60) AddHandler Me.Controls("X_TextBox").TextChanged, AddressOf FunctionText_Changed - Create_Label("X_Label", "X", buttonX, buttonY + 43) + Create_Label("X_Label", "1", buttonX, buttonY + 43) Create_TextBox("Y_TextBox", "", buttonX + 130, buttonY + 40, 60) AddHandler Me.Controls("Y_TextBox").TextChanged, AddressOf FunctionText_Changed - Create_Label("Y_Label", "Y", buttonX + 110, buttonY + 43) + Create_Label("Y_Label", "2", buttonX + 110, buttonY + 43) angleFunctionActive = True End Sub @@ -337,11 +360,11 @@ Public Class GUI Create_TextBox("X_TextBox", "", buttonX + 20, buttonY + 40, 60) AddHandler Me.Controls("X_TextBox").TextChanged, AddressOf FunctionText_Changed - Create_Label("X_Label", "X", buttonX, buttonY + 43) + Create_Label("X_Label", "1", buttonX, buttonY + 43) Create_TextBox("Y_TextBox", "", buttonX + 130, buttonY + 40, 60) AddHandler Me.Controls("Y_TextBox").TextChanged, AddressOf FunctionText_Changed - Create_Label("Y_Label", "Y", buttonX + 110, buttonY + 43) + Create_Label("Y_Label", "2", buttonX + 110, buttonY + 43) ' Add option for corner or side @@ -522,4 +545,6 @@ Public Class GUI End Sub -End Class \ No newline at end of file +End Class + +' LENGTH OCH WIDTH BÖR RITAS TVÄRTOM \ No newline at end of file