2533192b24
-pulito codice
139 lines
4.0 KiB
VB.net
139 lines
4.0 KiB
VB.net
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class RotateVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
#Region "Messages"
|
|
|
|
Public ReadOnly Property Conferma_Msg As String
|
|
Get
|
|
Return EgtMsg(110003)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Annulla_Msg As String
|
|
Get
|
|
Return EgtMsg(110004)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property TopBar_Msg As String
|
|
Get
|
|
Return EgtMsg(110005)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Testo_Msg As String
|
|
Get
|
|
Return EgtMsg(110006)
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Messages
|
|
|
|
Private m_bAxisSelected As Boolean = False
|
|
Public Property bAxisSelected As Boolean
|
|
Get
|
|
Return m_bAxisSelected
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_bAxisSelected = value
|
|
If m_bAxisSelected Then
|
|
'Map.refSceneButtonV.m_RotateUC.TopBar.Text = "Inserisci l'angolo di rotazione"
|
|
End If
|
|
NotifyPropertyChanged(NameOf(bAxisSelected))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_ConfermaCmd As ICommand
|
|
Public ReadOnly Property ConfermaCmd As ICommand
|
|
Get
|
|
If m_ConfermaCmd Is Nothing Then
|
|
m_ConfermaCmd = New Command(AddressOf Conferma)
|
|
End If
|
|
Return m_ConfermaCmd
|
|
End Get
|
|
End Property
|
|
|
|
Private m_AnnullaCmd As ICommand
|
|
Public ReadOnly Property AnnullaCmd As ICommand
|
|
Get
|
|
If m_AnnullaCmd Is Nothing Then
|
|
m_AnnullaCmd = New Command(AddressOf Annulla)
|
|
End If
|
|
Return m_AnnullaCmd
|
|
End Get
|
|
End Property
|
|
|
|
|
|
#End Region ' Fields & Properties
|
|
|
|
#Region "METHODS"
|
|
|
|
Public Sub Conferma()
|
|
Close()
|
|
End Sub
|
|
|
|
Public Sub Annulla()
|
|
' faccio il reset del rotate
|
|
If Map.refSceneHostV.m_bRotated Then
|
|
SolidManagerM.ResetRotation(True, True)
|
|
End If
|
|
Close()
|
|
End Sub
|
|
|
|
Private Sub Close()
|
|
SolidManagerM.ResetOperationMarks(Map.refSceneHostV.m_nIdPart)
|
|
EgtDraw()
|
|
Dim Btn As SceneBtn = Map.refSceneButtonVM.GetButton(EGT_ROTATE)
|
|
If TypeOf (Btn) Is _ToggleButton Then
|
|
DirectCast(Btn, _ToggleButton).IsChecked = False
|
|
Else
|
|
EgtOutLog("CONFIG ERR: Il pulsante di Rotate è stato definito come Button anziché ToggleButton")
|
|
End If
|
|
' setto le variabili di salvataggio per le operazioni temporanee
|
|
Dim bSave As Boolean = True
|
|
If EgtLuaSetGlobBoolVar("ASS.bSaveHist", bSave) Then AssLog("ASS.bSaveHist = " & bSave.ToString)
|
|
Dim bSaveTemp As Boolean = False
|
|
If EgtLuaSetGlobBoolVar("ASS.bSaveTemp", bSaveTemp) Then AssLog("ASS.bSaveTemp = " & bSaveTemp.ToString)
|
|
Map.refSceneButtonV.RemoveRotateUC()
|
|
End Sub
|
|
|
|
Public Sub AngText_Changed()
|
|
Dim Btn As SceneBtn = Map.refSceneButtonVM.GetButton(EGT_ROTATE)
|
|
If TypeOf (Btn) Is _ToggleButton Then
|
|
If Not DirectCast(Btn, _ToggleButton).IsChecked Then Return
|
|
Else
|
|
EgtOutLog("CONFIG ERR: Il pulsante di Rotate è stato definito come Button anziché ToggleButton")
|
|
Return
|
|
End If
|
|
|
|
Dim nId As Integer = Map.refSceneHostV.m_nIdPart
|
|
If nId = GDB_ID.NULL Then Return
|
|
Dim sAng As String = Map.refSceneButtonV.m_RotateUC.RotInputData.Text
|
|
If String.IsNullOrEmpty(sAng) Then Return
|
|
If Not IsNumeric(sAng) Then Return
|
|
Dim dAng As Double = CDbl(sAng)
|
|
If dAng <> 0 Then
|
|
If Map.refSceneHostV.m_dAngRot <> 0 Then
|
|
ResetRotation(False, False)
|
|
End If
|
|
Dim PartSolidIdSel = SolidManagerM.GetPartSolid(nId)
|
|
Dim vtDir As Vector3d
|
|
Dim ptStart As Point3d
|
|
If PartSolidIdSel.nIdLineAxisRotate = GDB_ID.NULL Then Return
|
|
EgtStartPoint(PartSolidIdSel.nIdLineAxisRotate, GDB_ID.ROOT, ptStart)
|
|
EgtStartVector(PartSolidIdSel.nIdLineAxisRotate, GDB_ID.ROOT, vtDir)
|
|
SolidManagerM.Rotate(nId, ptStart, vtDir, dAng, False, True)
|
|
Map.refSceneHostV.m_bRotated = True
|
|
Map.refSceneHostV.m_dAngRot = dAng
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' Methods
|
|
|
|
End Class
|