Imports EgtUILib

Public Class ViewPanelVM
   Inherits EgtWPFLib5.ViewPanelVM

   ' Tipo di progetto aperto
   Private Shared m_Type As BWType
   Public Shared ReadOnly Property Type As BWType
      Get
         Return m_Type
      End Get
   End Property

   ' Posizione vista
   Private Shared m_nViewDir As VT = VT.ISO_SW

   Public Shared Sub BWSetView(nView As VT, Optional bRedraw As Boolean = True)
      Select Case nView
         Case VT.TOP
            Select Case m_nViewDir
               Case VT.ISO_SW, VT.ISO_SE
                  EgtSetGenericView(0, -90, bRedraw)              ' equivalente a vista TOP
               Case VT.ISO_NW, VT.ISO_NE
                  EgtSetGenericView(0, 90, bRedraw)               ' equivalente a vista TOP ruotata di 180 su Z
            End Select
         Case VT.FRONT
            Select Case m_nViewDir
               Case VT.ISO_SW, VT.ISO_SE
                  EgtSetGenericView(90, -90, bRedraw)              ' equivalente a vista FRONT
               Case VT.ISO_NW, VT.ISO_NE
                  EgtSetGenericView(90, 90, bRedraw)               ' equivalente a vista FRONT ruotata di 180 su Z
            End Select
         Case VT.BACK
            Select Case m_nViewDir
               Case VT.ISO_SW, VT.ISO_SE
                  EgtSetGenericView(-90, -90, bRedraw)              ' equivalente a vista BACK
               Case VT.ISO_NW, VT.ISO_NE
                  EgtSetGenericView(-90, 90, bRedraw)               ' equivalente a vista BACK ruotata di 180 su Z
            End Select
         Case VT.RIGHT
            Select Case m_nViewDir
               Case VT.ISO_SW, VT.ISO_SE
                  EgtSetGenericView(90, 0, bRedraw)                ' equivalente a vista RIGHT
               Case VT.ISO_NW, VT.ISO_NE
                  EgtSetGenericView(-90, 0, bRedraw)               ' equivalente a vista RIGHT ruotata di 180 su Z
            End Select
         Case VT.LEFT
            Select Case m_nViewDir
               Case VT.ISO_SW, VT.ISO_SE
                  EgtSetGenericView(-90, 0, bRedraw)              ' equivalente a vista LEFT
               Case VT.ISO_NW, VT.ISO_NE
                  EgtSetGenericView(90, 0, bRedraw)               ' equivalente a vista LEFT ruotata di 180 su Z
            End Select
         Case VT.ISO_SW
            Select Case m_nViewDir
               Case VT.ISO_SW, VT.ISO_SE
                  EgtSetGenericView(60, 225, bRedraw)              ' equivalente a vista ISO_SW
               Case VT.ISO_NW, VT.ISO_NE
                  EgtSetGenericView(60, 45, bRedraw)               ' equivalente a vista ISO_SW ruotata di 180 su Z
            End Select
         Case Else                                                 ' VT.ISO_SW
            Select Case m_nViewDir
               Case VT.ISO_SW, VT.ISO_SE
                  EgtSetGenericView(60, 225, bRedraw)              ' equivalente a vista ISO_SW
               Case VT.ISO_NW, VT.ISO_NE
                  EgtSetGenericView(60, 45, bRedraw)               ' equivalente a vista ISO_SW ruotata di 180 su Z
            End Select
      End Select
      'End Select
   End Sub

   Public Shared Sub UpdateMachParam(ViewDir As VT)
      m_nViewDir = ViewDir
   End Sub

   Public Shared Sub UpdateBWType(Type As BWType)
      m_Type = Type
   End Sub

#Region "COMMANDS"

#Region "TopViewCommand"

   ''' <summary>
   ''' Execute the TopView.  This method is invoked by the TopViewCommand.
   ''' </summary>
   Public Overrides Sub TopView(ByVal param As Object)
      ViewPanelVM.BWSetView(VT.TOP, True)
   End Sub

#End Region ' TopViewCommand

#Region "FrontViewCommand"

   ''' <summary>
   ''' Execute the FrontView.  This method is invoked by the FrontViewCommand.
   ''' </summary>
   Public Overrides Sub FrontView(ByVal param As Object)
      ViewPanelVM.BWSetView(VT.FRONT, True)
   End Sub

#End Region ' FrontViewCommand

#Region "LeftViewCommand"

   ''' <summary>
   ''' Execute the LeftView.  This method is invoked by the LeftViewCommand.
   ''' </summary>
   Public Overrides Sub LeftView(ByVal param As Object)
      ViewPanelVM.BWSetView(VT.LEFT, True)
   End Sub

#End Region ' LeftViewCommand

#Region "BackViewCommand"

   ''' <summary>
   ''' Execute the BackView.  This method is invoked by the BackViewCommand.
   ''' </summary>
   Public Overrides Sub BackView(ByVal param As Object)
      ViewPanelVM.BWSetView(VT.BACK, True)
   End Sub

#End Region ' BackViewCommand

#Region "RightViewCommand"

   ''' <summary>
   ''' Execute the RightView.  This method is invoked by the RightViewCommand.
   ''' </summary>
   Public Overrides Sub RightView(ByVal param As Object)
      ViewPanelVM.BWSetView(VT.RIGHT, True)
   End Sub

#End Region ' RightViewCommand

#Region "IsoViewSWCommand"

   ''' <summary>
   ''' Execute the IsoViewSW.  This method is invoked by the IsoViewSWCommand.
   ''' </summary>
   Public Overrides Sub IsoViewSW(ByVal param As Object)
      ViewPanelVM.BWSetView(VT.ISO_SW, True)
   End Sub

#End Region ' IsoViewSWCommand

#End Region    ' COMMANDS

End Class

