Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5

Public Class Wall
   Inherits Core.WallM

   Public Property sPOSY As String
      Get
         Return LenToString(m_dPOSY, 3)
      End Get
      Set(value As String)
         StringToLen(value, m_dPOSY)
      End Set
   End Property

   Public Property sROT As String
      Get
         Return LenToString(m_dROT, 3)
      End Get
      Set(value As String)
         StringToLen(value, m_dROT)
      End Set
   End Property

   Public Property sFLIP As String
      Get
         Return LenToString(m_dFLIP, 3)
      End Get
      Set(value As String)
         StringToLen(value, m_dFLIP)
      End Set
   End Property

#Region "CONSTRUCTOR"

   Sub New(nParentMachGroup As Core.MyMachGroupM, nPartId As Integer)
      MyBase.New(nParentMachGroup, nPartId)
      ' leggo info pezzo
      EgtGetInfo(nPartId, BTL_PRT_PROJ, m_nProjId)
      EgtGetInfo(nPartId, BTL_PRT_PDN, m_nPDN)
      EgtGetInfo(nPartId, BTL_PRT_NAM, m_sNAM)
      EgtGetInfo(nPartId, BTL_PRT_L, m_dL)
      EgtGetInfo(nPartId, BTL_PRT_W, m_dW)
      EgtGetInfo(nPartId, BTL_PRT_H, m_dH)
      EgtGetInfo(nPartId, BTL_PRT_CNT, m_nCNT)
      Dim nTemp As Integer = 0
      If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, nTemp) Then
         nTemp = 0
      End If
      SetRotated(nTemp)
      If Not EgtGetInfo(nPartId, BTL_PRT_INVERTED, nTemp) Then
         nTemp = 0
      End If
      SetInverted(nTemp)
      ' leggo PosX, PosY, Rot e Flip
      Dim sInfo As String = ""
      Dim Index = 1
      Dim sSplitInfo() As String
      Dim bFound As Boolean = False
      While EgtGetInfo(m_ParentMachGroup.Id, MGR_RPT_PART & Index, sInfo)
         If Not String.IsNullOrWhiteSpace(sInfo) Then
            sSplitInfo = sInfo.Split(","c)
            If sSplitInfo(0) = nPartId Then
               bFound = True
               Exit While
            End If
         End If
         Index += 1
      End While
      If bFound Then
         StringToDouble(sSplitInfo(1), m_dPOSX)
         StringToDouble(sSplitInfo(2), m_dPOSY)
         StringToDouble(sSplitInfo(3), m_dROT)
         StringToDouble(sSplitInfo(4), m_dFLIP)
      End If
      ' vado sul layer delle feature
      Dim nProcessingId As Integer = EgtGetFirstNameInGroup(nPartId, PROCESSINGS)
      Dim nFeatureId As Integer = EgtGetFirstInGroup(nProcessingId)
      While nFeatureId <> GDB_ID.NULL
         ' verifico che sia una feature
         Dim nGRP As Integer
         If EgtGetInfo(nFeatureId, BTL_FTR_GRP, nGRP) Then
            ' creo la feature
            '''FeatureList.Add(New BTLFeatureVM(Nothing, nFeatureId))
         End If
         nFeatureId = EgtGetNext(nFeatureId)
      End While
   End Sub

#End Region    ' CONSTRUCTOR

End Class
