Public Class Data
    Public Shared objectNum As Integer

    Public Shared grossAreaPoints As New DataTable
    Public Shared gratingPoints As New DataTable
    Public Shared gratingMiddlePoints As New DataTable
    Public Shared angleRecessPoints As New DataTable

    Public Shared guiPanelMidX, guiPanelMidY As Integer
    Public Shared guiMaxDrawL As Integer = 1
    Public Shared guiMaxDrawW As Integer = 1

    Public Shared gratingW As Integer = 1000
    Public Shared gratingL As Integer = 1000

    Public Shared drawAR, gratingAR As Decimal
    Public Shared scaleDiff As Decimal = 1

    Public Shared recessData As New DataTable

    Public Shared pointsMeasurements As New Dictionary(Of String, Integer())

    ' --- Initialize Datatables, measurments and more ---
    Public Shared Sub Init_Data()
        ' Gross area points
        grossAreaPoints.Columns.Add("NAME", GetType(String))
        grossAreaPoints.Columns.Add("QUADRANT", GetType(String))
        grossAreaPoints.Columns.Add("X", GetType(Decimal))
        grossAreaPoints.Columns.Add("Y", GetType(Decimal))
        grossAreaPoints.Columns.Add("GUI X", GetType(Integer))
        grossAreaPoints.Columns.Add("GUI Y", GetType(Integer))

        ' Grating points
        gratingPoints.Columns.Add("NAME", GetType(String))
        gratingPoints.Columns.Add("QUADRANT", GetType(String))
        gratingPoints.Columns.Add("X", GetType(Decimal))
        gratingPoints.Columns.Add("Y", GetType(Decimal))
        gratingPoints.Columns.Add("GUI X", GetType(Integer))
        gratingPoints.Columns.Add("GUI Y", GetType(Integer))
        gratingPoints.Columns.Add("RECESS OK", GetType(Boolean))

        ' Grating Middle points
        gratingMiddlePoints.Columns.Add("NAME", GetType(String))
        gratingMiddlePoints.Columns.Add("X", GetType(Decimal))
        gratingMiddlePoints.Columns.Add("Y", GetType(Decimal))
        gratingMiddlePoints.Columns.Add("GUI X", GetType(Integer))
        gratingMiddlePoints.Columns.Add("GUI Y", GetType(Integer))

        ' Angle recess points
        angleRecessPoints.Columns.Add("NAME", GetType(String))
        angleRecessPoints.Columns.Add("QUADRANT", GetType(String))
        angleRecessPoints.Columns.Add("GUI X", GetType(Integer))
        angleRecessPoints.Columns.Add("GUI Y", GetType(Integer))


        pointsMeasurements.Add("Lmes", {1, 2, 1})
        pointsMeasurements.Add("Wmes", {2, 3, 2})

        recessData.Columns.Add("RECESS TYPE", GetType(String))
        recessData.Columns.Add("NAME", GetType(String))
        recessData.Columns.Add("CORNER", GetType(Integer))
        recessData.Columns.Add("SIDE", GetType(Integer))
        recessData.Columns.Add("WIDTH", GetType(Integer))
        recessData.Columns.Add("LENGTH", GetType(Integer))
        recessData.Columns.Add("OFFSET", GetType(Integer))
        recessData.Columns.Add("OFFSET X", GetType(Integer))
        recessData.Columns.Add("OFFSET Y", GetType(Integer))
        recessData.Columns.Add("GRATINGS", GetType(List(Of Integer)))
    End Sub

    Public Shared Sub Init_GrossAreaPoints()
        Dim pointRow As DataRow = grossAreaPoints.NewRow
        pointRow("NAME") = "P1"
        pointRow("QUADRANT") = 1
        pointRow("X") = (-gratingL / 2) / 1000
        pointRow("Y") = (gratingW / 2) / 1000
        pointRow("GUI X") = guiPanelMidX - guiMaxDrawL / 2
        pointRow("GUI Y") = guiPanelMidY - guiMaxDrawW / 2
        grossAreaPoints.Rows.Add(pointRow)

        pointRow = grossAreaPoints.NewRow
        pointRow("NAME") = "P2"
        pointRow("QUADRANT") = 2
        pointRow("X") = (gratingL / 2) / 1000
        pointRow("Y") = (gratingW / 2) / 1000
        pointRow("GUI X") = guiPanelMidX + guiMaxDrawL / 2
        pointRow("GUI Y") = guiPanelMidY - guiMaxDrawW / 2
        grossAreaPoints.Rows.Add(pointRow)

        pointRow = grossAreaPoints.NewRow
        pointRow("NAME") = "P3"
        pointRow("QUADRANT") = 3
        pointRow("X") = (gratingL / 2) / 1000
        pointRow("Y") = (-gratingW / 2) / 1000
        pointRow("GUI X") = guiPanelMidX + guiMaxDrawL / 2
        pointRow("GUI Y") = guiPanelMidY + guiMaxDrawW / 2
        grossAreaPoints.Rows.Add(pointRow)

        pointRow = grossAreaPoints.NewRow
        pointRow("NAME") = "P4"
        pointRow("QUADRANT") = 4
        pointRow("X") = (-gratingL / 2) / 1000
        pointRow("Y") = (-gratingW / 2) / 1000
        pointRow("GUI X") = guiPanelMidX - guiMaxDrawL / 2
        pointRow("GUI Y") = guiPanelMidY + guiMaxDrawW / 2
        grossAreaPoints.Rows.Add(pointRow)
    End Sub

    Public Shared Sub Init_GratingPoints()
        Dim pointRow As DataRow = gratingPoints.NewRow
        pointRow("NAME") = "P1"
        pointRow("QUADRANT") = 1
        pointRow("X") = (-gratingL / 2) / 1000
        pointRow("Y") = (gratingW / 2) / 1000
        pointRow("GUI X") = guiPanelMidX - guiMaxDrawL / 2
        pointRow("GUI Y") = guiPanelMidY - guiMaxDrawW / 2
        pointRow("RECESS OK") = True
        gratingPoints.Rows.Add(pointRow)

        pointRow = gratingPoints.NewRow
        pointRow("NAME") = "P2"
        pointRow("QUADRANT") = 2
        pointRow("X") = (gratingL / 2) / 1000
        pointRow("Y") = (gratingW / 2) / 1000
        pointRow("GUI X") = guiPanelMidX + guiMaxDrawL / 2
        pointRow("GUI Y") = guiPanelMidY - guiMaxDrawW / 2
        pointRow("RECESS OK") = True
        gratingPoints.Rows.Add(pointRow)

        pointRow = gratingPoints.NewRow
        pointRow("NAME") = "P3"
        pointRow("QUADRANT") = 3
        pointRow("X") = (gratingL / 2) / 1000
        pointRow("Y") = (-gratingW / 2) / 1000
        pointRow("GUI X") = guiPanelMidX + guiMaxDrawL / 2
        pointRow("GUI Y") = guiPanelMidY + guiMaxDrawW / 2
        pointRow("RECESS OK") = True
        gratingPoints.Rows.Add(pointRow)

        pointRow = gratingPoints.NewRow
        pointRow("NAME") = "P4"
        pointRow("QUADRANT") = 4
        pointRow("X") = (-gratingL / 2) / 1000
        pointRow("Y") = (-gratingW / 2) / 1000
        pointRow("GUI X") = guiPanelMidX - guiMaxDrawL / 2
        pointRow("GUI Y") = guiPanelMidY + guiMaxDrawW / 2
        pointRow("RECESS OK") = True
        gratingPoints.Rows.Add(pointRow)
    End Sub

End Class
