Add multiple angles!
This commit is contained in:
parent
b656e36461
commit
84e149dff1
|
|
@ -18,6 +18,8 @@ Public Class GUI
|
||||||
|
|
||||||
Dim PointButtons As New List(Of Button)
|
Dim PointButtons As New List(Of Button)
|
||||||
|
|
||||||
|
Dim angleCounter As Integer
|
||||||
|
|
||||||
' --- Start method when GUI loads ---
|
' --- Start method when GUI loads ---
|
||||||
Sub GUI_load() Handles MyBase.Load
|
Sub GUI_load() Handles MyBase.Load
|
||||||
containerPanel = DrawingPanel
|
containerPanel = DrawingPanel
|
||||||
|
|
@ -189,8 +191,10 @@ Public Class GUI
|
||||||
|
|
||||||
containerPanel.Controls.Add(PointButtons(i))
|
containerPanel.Controls.Add(PointButtons(i))
|
||||||
|
|
||||||
AddHandler PointButtons(i).Click, AddressOf Me.PointButton_Click
|
AddHandler PointButtons(i).Click, AddressOf PointButton_Click
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
angleCounter = angleCounter + 1
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub PointButton_Click(sender As Button, e As EventArgs)
|
Private Sub PointButton_Click(sender As Button, e As EventArgs)
|
||||||
|
|
@ -209,34 +213,34 @@ Public Class GUI
|
||||||
If tempX < containerMidX Then
|
If tempX < containerMidX Then
|
||||||
If tempY > containerMidY Then
|
If tempY > containerMidY Then
|
||||||
'Kvadrant 4
|
'Kvadrant 4
|
||||||
points.Add("pA1", {tempX + d1, tempY, 0, 0})
|
points.Add("pA" & angleCounter * 2 - 1, {tempX + d1, tempY, 0, 0})
|
||||||
points.Add("pA2", {tempX, tempY - d2, 0, 0})
|
points.Add("pA" & angleCounter * 2, {tempX, tempY - d2, 0, 0})
|
||||||
Else
|
Else
|
||||||
'Kvadrant 1
|
'Kvadrant 1
|
||||||
points.Add("pA1", {tempX, tempY + d2, 0, 0})
|
points.Add("pA" & angleCounter * 2 - 1, {tempX, tempY + d2, 0, 0})
|
||||||
points.Add("pA2", {tempX + d1, tempY, 0, 0})
|
points.Add("pA" & angleCounter * 2, {tempX + d1, tempY, 0, 0})
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
If tempY > containerMidY Then
|
If tempY > containerMidY Then
|
||||||
'Kvadrant 3
|
'Kvadrant 3
|
||||||
points.Add("pA1", {tempX, tempY - d2, 0, 0})
|
points.Add("pA" & angleCounter * 2 - 1, {tempX, tempY - d2, 0, 0})
|
||||||
points.Add("pA2", {tempX - d1, tempY, 0, 0})
|
points.Add("pA" & angleCounter * 2, {tempX - d1, tempY, 0, 0})
|
||||||
Else
|
Else
|
||||||
'Kvadrant 2
|
'Kvadrant 2
|
||||||
points.Add("pA1", {tempX - d1, tempY, 0, 0})
|
points.Add("pA" & angleCounter * 2 - 1, {tempX - d1, tempY, 0, 0})
|
||||||
points.Add("pA2", {tempX, tempY + d2, 0, 0})
|
points.Add("pA" & angleCounter * 2, {tempX, tempY + d2, 0, 0})
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Insert two new points
|
'Insert two new points
|
||||||
pointsOrder.Insert(index + 1, "pA1")
|
pointsOrder.Insert(index + 1, "pA" & angleCounter * 2 - 1)
|
||||||
pointsOrder.Insert(index + 2, "pA2")
|
pointsOrder.Insert(index + 2, "pA" & angleCounter * 2)
|
||||||
pointsOrder.RemoveAt(index)
|
pointsOrder.RemoveAt(index)
|
||||||
|
|
||||||
'Remove points buttons
|
|
||||||
For i = 0 To PointButtons.Count - 1
|
For i = 0 To PointButtons.Count - 1
|
||||||
RemoveHandler PointButtons(i).Click, AddressOf Me.PointButton_Click
|
RemoveHandler PointButtons(0).Click, AddressOf PointButton_Click
|
||||||
containerPanel.Controls.RemoveByKey(PointButtons(i).Name)
|
containerPanel.Controls.RemoveByKey(PointButtons(0).Name)
|
||||||
|
PointButtons.RemoveAt(0)
|
||||||
Next
|
Next
|
||||||
|
|
||||||
'Redraw grating
|
'Redraw grating
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue