From 98cb03103995a42ae1327a8a690208896a55551c Mon Sep 17 00:00:00 2001 From: Anton Date: Thu, 28 Jan 2021 15:21:12 +0100 Subject: [PATCH] All points exported to SW correctly --- Wardrobe/GUI.Designer.vb | 54 ++++++++++++++++++++++++++++++++++++++-- Wardrobe/GUI.vb | 37 ++++++++++++++------------- 2 files changed, 72 insertions(+), 19 deletions(-) diff --git a/Wardrobe/GUI.Designer.vb b/Wardrobe/GUI.Designer.vb index 4862409..81f4830 100644 --- a/Wardrobe/GUI.Designer.vb +++ b/Wardrobe/GUI.Designer.vb @@ -33,6 +33,10 @@ Partial Class GUI Me.Label2 = New System.Windows.Forms.Label() Me.ExportSWButton = New System.Windows.Forms.Button() Me.AngleButton = New System.Windows.Forms.Button() + Me.AngleD1 = New System.Windows.Forms.TextBox() + Me.AngleD2 = New System.Windows.Forms.TextBox() + Me.LabelAngleX = New System.Windows.Forms.Label() + Me.LabelAngleY = New System.Windows.Forms.Label() Me.SuspendLayout() ' 'DrawingPanel @@ -114,18 +118,60 @@ Partial Class GUI ' 'AngleButton ' - Me.AngleButton.Location = New System.Drawing.Point(54, 153) + Me.AngleButton.Location = New System.Drawing.Point(38, 162) Me.AngleButton.Name = "AngleButton" - Me.AngleButton.Size = New System.Drawing.Size(122, 75) + Me.AngleButton.Size = New System.Drawing.Size(122, 34) Me.AngleButton.TabIndex = 7 Me.AngleButton.Text = "Add Angle" Me.AngleButton.UseVisualStyleBackColor = True ' + 'AngleD1 + ' + Me.AngleD1.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.AngleD1.Location = New System.Drawing.Point(52, 224) + Me.AngleD1.Name = "AngleD1" + Me.AngleD1.Size = New System.Drawing.Size(82, 26) + Me.AngleD1.TabIndex = 8 + Me.AngleD1.Text = "50" + ' + 'AngleD2 + ' + Me.AngleD2.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.AngleD2.Location = New System.Drawing.Point(196, 224) + Me.AngleD2.Name = "AngleD2" + Me.AngleD2.Size = New System.Drawing.Size(90, 26) + Me.AngleD2.TabIndex = 9 + Me.AngleD2.Text = "50" + ' + 'LabelAngleX + ' + Me.LabelAngleX.AutoSize = True + Me.LabelAngleX.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.LabelAngleX.Location = New System.Drawing.Point(26, 227) + Me.LabelAngleX.Name = "LabelAngleX" + Me.LabelAngleX.Size = New System.Drawing.Size(20, 20) + Me.LabelAngleX.TabIndex = 10 + Me.LabelAngleX.Text = "X" + ' + 'LabelAngleY + ' + Me.LabelAngleY.AutoSize = True + Me.LabelAngleY.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.LabelAngleY.Location = New System.Drawing.Point(171, 227) + Me.LabelAngleY.Name = "LabelAngleY" + Me.LabelAngleY.Size = New System.Drawing.Size(19, 20) + Me.LabelAngleY.TabIndex = 11 + Me.LabelAngleY.Text = "Y" + ' 'GUI ' Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(1199, 614) + Me.Controls.Add(Me.LabelAngleY) + Me.Controls.Add(Me.LabelAngleX) + Me.Controls.Add(Me.AngleD2) + Me.Controls.Add(Me.AngleD1) Me.Controls.Add(Me.AngleButton) Me.Controls.Add(Me.ExportSWButton) Me.Controls.Add(Me.Label2) @@ -152,4 +198,8 @@ Partial Class GUI Friend WithEvents Label2 As Label Friend WithEvents ExportSWButton As Button Friend WithEvents AngleButton As Button + Friend WithEvents AngleD1 As TextBox + Friend WithEvents AngleD2 As TextBox + Friend WithEvents LabelAngleX As Label + Friend WithEvents LabelAngleY As Label End Class diff --git a/Wardrobe/GUI.vb b/Wardrobe/GUI.vb index b1893eb..b0435a1 100644 --- a/Wardrobe/GUI.vb +++ b/Wardrobe/GUI.vb @@ -203,32 +203,35 @@ Public Class GUI Dim index As Integer = pointsOrder.IndexOf(pointPressed) 'Retrive that points coords - Dim tempX, tempY As Integer - tempX = points(pointPressed)(0) - tempY = points(pointPressed)(1) + Dim pXP As Decimal = points(pointPressed)(0) + Dim pYP As Decimal = points(pointPressed)(1) + Dim pXSW As Decimal = points(pointPressed)(2) + Dim pYSW As Decimal = points(pointPressed)(3) - Dim d1, d2 As Integer 'Kommer anges som double i SW coord men vi vill ha pixel coord här - d1 = 80 - d2 = 50 - If tempX < containerMidX Then - If tempY > containerMidY Then + Dim d1P As Decimal = AngleD1.Text / scaleDiff + Dim d2P As Decimal = AngleD2.Text / scaleDiff + Dim d1SW As Decimal = AngleD1.Text / 1000 + Dim d2SW As Decimal = AngleD2.Text / 1000 + + If pXP < containerMidX Then + If pYP > containerMidY Then 'Kvadrant 4 - points.Add("pA" & angleCounter * 2 - 1, {tempX + d1, tempY, 0, 0}) - points.Add("pA" & angleCounter * 2, {tempX, tempY - d2, 0, 0}) + points.Add("pA" & angleCounter * 2 - 1, {pXP + d1P, pYP, pXSW + d1SW, pYSW}) + points.Add("pA" & angleCounter * 2, {pXP, pYP - d2P, pXSW, pYSW + d2SW}) Else 'Kvadrant 1 - points.Add("pA" & angleCounter * 2 - 1, {tempX, tempY + d2, 0, 0}) - points.Add("pA" & angleCounter * 2, {tempX + d1, tempY, 0, 0}) + points.Add("pA" & angleCounter * 2 - 1, {pXP, pYP + d2P, pXSW, pYSW - d2SW}) + points.Add("pA" & angleCounter * 2, {pXP + d1P, pYP, pXSW + d1SW, pYSW}) End If Else - If tempY > containerMidY Then + If pYP > containerMidY Then 'Kvadrant 3 - points.Add("pA" & angleCounter * 2 - 1, {tempX, tempY - d2, 0, 0}) - points.Add("pA" & angleCounter * 2, {tempX - d1, tempY, 0, 0}) + points.Add("pA" & angleCounter * 2 - 1, {pXP, pYP - d2P, pXSW, pYSW + d2SW}) + points.Add("pA" & angleCounter * 2, {pXP - d1P, pYP, pXSW - d1SW, pYSW}) Else 'Kvadrant 2 - points.Add("pA" & angleCounter * 2 - 1, {tempX - d1, tempY, 0, 0}) - points.Add("pA" & angleCounter * 2, {tempX, tempY + d2, 0, 0}) + points.Add("pA" & angleCounter * 2 - 1, {pXP - d1P, pYP, pXSW - d1SW, pYSW}) + points.Add("pA" & angleCounter * 2, {pXP, pYP + d2P, pXSW, pYSW - d2SW}) End If End If