Imports EgtBEAMWALL.Core.ConstBeam
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)
      ' condizioni che cambiano la vista del progetto
      'Select Case m_Type
      '   Case BWType.BEAM
      '      Select Case nView
      '         Case VT.TOP
      '            EgtSetView(VT.TOP, bRedraw)
      '         Case VT.FRONT
      '            EgtSetView(VT.FRONT, bRedraw)
      '         Case VT.BACK
      '            EgtSetView(VT.BACK, bRedraw)
      '         Case VT.RIGHT
      '            EgtSetView(VT.RIGHT, bRedraw)
      '         Case VT.LEFT
      '            EgtSetView(VT.LEFT, bRedraw)
      '         Case VT.ISO_SW
      '            EgtSetView(VT.ISO_SW, bRedraw)
      '         Case Else                                                ' VT.ISO_SW
      '            EgtSetView(VT.ISO_SW, bRedraw)
      '      End Select
      '   Case BWType.WALL
      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 "IsoViewSECommand"

   '   ''' <summary>
   '   ''' Returns a command that do IsoViewSE.
   '   ''' </summary>
   '   Public ReadOnly Property IsoViewSECommand As ICommand
   '      Get
   '         If m_cmdIsoViewSE Is Nothing Then
   '            m_cmdIsoViewSE = New Command(AddressOf IsoViewSE)
   '         End If
   '         Return m_cmdIsoViewSE
   '      End Get
   '   End Property

   '   ''' <summary>
   '   ''' Execute the IsoViewSE.  This method is invoked by the IsoViewSECommand.
   '   ''' </summary>
   '   Public Sub IsoViewSE(ByVal param As Object)
   '      LibMap.refSceneHostVM.MainScene.IsoViewSE()
   '   End Sub

   '#End Region ' IsoViewSECommand

#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

   '#Region "IsoViewNECommand"

   '   ''' <summary>
   '   ''' Returns a command that do IsoViewNE.
   '   ''' </summary>
   '   Public ReadOnly Property IsoViewNECommand As ICommand
   '      Get
   '         If m_cmdIsoViewNE Is Nothing Then
   '            m_cmdIsoViewNE = New Command(AddressOf IsoViewNE)
   '         End If
   '         Return m_cmdIsoViewNE
   '      End Get
   '   End Property

   '   ''' <summary>
   '   ''' Execute the IsoViewNE.  This method is invoked by the IsoViewNECommand.
   '   ''' </summary>
   '   Public Sub IsoViewNE(ByVal param As Object)
   '      LibMap.refSceneHostVM.MainScene.IsoViewNE()
   '   End Sub

   '#End Region ' IsoViewNECommand

   '#Region "IsoViewNWCommand"

   '   ''' <summary>
   '   ''' Returns a command that do IsoViewNW.
   '   ''' </summary>
   '   Public ReadOnly Property IsoViewNWCommand As ICommand
   '      Get
   '         If m_cmdIsoViewNW Is Nothing Then
   '            m_cmdIsoViewNW = New Command(AddressOf IsoViewNW)
   '         End If
   '         Return m_cmdIsoViewNW
   '      End Get
   '   End Property

   '   ''' <summary>
   '   ''' Execute the IsoViewNW.  This method is invoked by the IsoViewNWCommand.
   '   ''' </summary>
   '   Public Sub IsoViewNW(ByVal param As Object)
   '      LibMap.refSceneHostVM.MainScene.IsoViewNW()
   '   End Sub

   '#End Region ' IsoViewNWCommand

   '#Region "ViewToCPlaneCommand"

   '   ''' <summary>
   '   ''' Returns a command that do GetDist.
   '   ''' </summary>
   '   Public ReadOnly Property ViewToCPlaneCommand As ICommand
   '      Get
   '         If m_cmdViewToCPlane Is Nothing Then
   '            m_cmdViewToCPlane = New Command(AddressOf ViewToCPlane)
   '         End If
   '         Return m_cmdViewToCPlane
   '      End Get
   '   End Property

   '   ''' <summary>
   '   ''' Execute the GetDist.  This method is invoked by the GetDistCommand.
   '   ''' </summary>
   '   Public Sub ViewToCPlane(ByVal param As Object)
   '      LibMap.refSceneHostVM.MainScene.CPlaneView()
   '   End Sub

   '#End Region ' ViewToCPlaneCommand

#End Region    ' COMMANDS

End Class

