Imports EgtUILib

Public Module ManageView

   ' Tipo di progetto aperto
   Private m_Type As BWType

   ' Per macchine pareti:
   ' Posizione vista
   Private m_nViewDir As VT

   Public Function BWSetView(nView As VT, Optional bRedraw As Boolean = True)
      ' condizioni che cambiano la vista del progetto
      Select Case m_Type
         Case BWType.BEAM
            EgtSetView(VT.ISO_SW, bRedraw)
         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 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.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 Function

   Public Sub UpdateMachParam(ViewDir As Integer)
      m_nViewDir = ViewDir
   End Sub

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

End Module
