diff --git a/Constants/ConstEgtStone3D.vb b/Constants/ConstEgtStone3D.vb index e7c7dd7..6cad8c2 100644 --- a/Constants/ConstEgtStone3D.vb +++ b/Constants/ConstEgtStone3D.vb @@ -47,4 +47,22 @@ Public Const KEY_ISOFILE_PATH = "IsoFilePath" Public Const FILE_PATH = "FilePath" + + 'enum per le trasformazioni + Public Enum PairStage As Integer + FirstLine = 0 + SecondLine = 1 + FacePair = 2 + End Enum + + Public Enum RotateStage As Integer + SelectPart = 0 + SelectAxis = 1 + InsertAngle = 2 + End Enum + + Public Enum MoveStage As Integer + SelectPart = 0 + InsertMovement = 1 + End Enum End Module diff --git a/Constants/ConstGen.vb b/Constants/ConstGen.vb index d761f8b..09beb2b 100644 --- a/Constants/ConstGen.vb +++ b/Constants/ConstGen.vb @@ -39,10 +39,4 @@ ' Sottodirettorio dell'Operation Solid Public Const OPERATIONSOLID_DIR As String = "OperationSolid" - Public Enum PairStage As Integer - FirstLine = 1 - SecondLine = 2 - FacePair = 3 - End Enum - End Module diff --git a/EgtStone3D.vbproj b/EgtStone3D.vbproj index 09052f6..77208ed 100644 --- a/EgtStone3D.vbproj +++ b/EgtStone3D.vbproj @@ -118,17 +118,11 @@ OptionWindowV.xaml - - PairV.xaml - ProjManagerV.xaml - - RotateV.xaml - SceneButtonV.xaml @@ -196,18 +190,10 @@ Designer MSBuild:Compile - - Designer - MSBuild:Compile - Designer MSBuild:Compile - - Designer - MSBuild:Compile - Designer MSBuild:Compile diff --git a/Move/MoveVM.vb b/Move/MoveVM.vb index a808576..9a1b9fc 100644 --- a/Move/MoveVM.vb +++ b/Move/MoveVM.vb @@ -3,12 +3,50 @@ Public Class MoveVM Inherits SceneUserControlVM +#Region "FIELDS & PROPERTIES" + +#Region "Messages" + Public ReadOnly Property TopBar_Msg_Stg0 As String + Get + Return EgtMsg(110023) + End Get + End Property + + Public ReadOnly Property TopBar_Msg_Stg1 As String + Get + Return EgtMsg(110025) + End Get + End Property + +#End Region ' Messages + + Private m_MsgList As New List(Of String)({TopBar_Msg_Stg0, TopBar_Msg_Stg1}) + Public ReadOnly Property MsgList As List(Of String) + Get + Return m_MsgList + End Get + End Property + + Private m_Stage As MoveStage = MoveStage.SelectPart + Private Property Stage As MoveStage + Get + Return m_Stage + End Get + Set(value As MoveStage) + m_Stage = value + DirectCast(ParamList(0), _TextBlockParam).MsgValue = MsgList(m_Stage) + End Set + End Property + +#End Region ' Fields & properties + #Region "CONTRUCTOR" Public Sub New() MyBase.New() - + Title = EGT_MOVE.ToUpper() LoadParamList() + Stage = If(Map.refSceneHostV.m_nIdPart = GDB_ID.NULL, MoveStage.SelectPart, MoveStage.InsertMovement) End Sub #End Region ' Contructor @@ -16,27 +54,39 @@ Public Class MoveVM #Region "METHODS" Public Overrides Sub LoadParamList() - Title = EgtMsg(110018).ToUpper() - ParamList.Add(New _TextBlockParam("Messaggio", EgtMsg(110005))) - ParamList.Add(New _TextBoxParam("X", "0")) - ParamList.Add(New _TextBoxParam("Y", "0")) - ParamList.Add(New _TextBoxParam("Z", "0")) + ParamList.Add(New _TextBlockParam("Messaggio", MsgList(Stage), Visibility.Visible)) + ParamList.Add(New _TextBoxParam("X", "0", Visibility.Visible)) + ParamList.Add(New _TextBoxParam("Y", "0", Visibility.Visible)) + ParamList.Add(New _TextBoxParam("Z", "0", Visibility.Visible)) End Sub + Public Sub AdvanceStage() + Stage += 1 + End Sub + + Public Function AtStage() + Return Stage + End Function + + Private Function ReadMoveInput() + ' recupero i valori nelle box + Dim x_TextBox As _TextBoxParam = DirectCast(ParamList(1), _TextBoxParam) + Dim y_TextBox As _TextBoxParam = DirectCast(ParamList(2), _TextBoxParam) + Dim z_TextBox As _TextBoxParam = DirectCast(ParamList(3), _TextBoxParam) + ' verifico che siano validi + If String.IsNullOrEmpty(x_TextBox.sValue) Then x_TextBox.sValue = "0" + If String.IsNullOrEmpty(y_TextBox.sValue) Then y_TextBox.sValue = "0" + If String.IsNullOrEmpty(z_TextBox.sValue) Then z_TextBox.sValue = "0" + ' restituisco il vettore + Return New Vector3d(CDbl(x_TextBox.sValue), + CDbl(y_TextBox.sValue), + CDbl(z_TextBox.sValue)) + End Function + Public Overrides Sub Conferma() ' se non avevo visualizzato la preview allora sposto il/i pezzo/i If Not Map.refSceneHostV.m_bPreviewShown Then - - Dim x_TextBox As _TextBoxParam = DirectCast(ParamList(1), _TextBoxParam) - Dim y_TextBox As _TextBoxParam = DirectCast(ParamList(2), _TextBoxParam) - Dim z_TextBox As _TextBoxParam = DirectCast(ParamList(3), _TextBoxParam) - - If String.IsNullOrEmpty(x_TextBox.Value) Then x_TextBox.Value = "0" - If String.IsNullOrEmpty(y_TextBox.Value) Then y_TextBox.Value = "0" - If String.IsNullOrEmpty(z_TextBox.Value) Then z_TextBox.Value = "0" - Dim vtMove As New Vector3d(CDbl(x_TextBox.Value), - CDbl(y_TextBox.Value), - CDbl(z_TextBox.Value)) + Dim vtMove As Vector3d = ReadMoveInput() '''' gestione dell'opzione 'AllSelected 'If Not AreSameVectorExact(vtMove, New Vector3d) Then ' If Not AllOption_Move.IsChecked Then @@ -101,27 +151,21 @@ Public Class MoveVM End Sub Public Overrides Sub ShowPreview() - If Map.refSceneHostV.m_bPreviewShown = False Then - Dim Btn As SceneBtn = DirectCast(Map.refSceneButtonV.DataContext, SceneButtonVM).GetButton(EGT_MOVE) - If TypeOf (Btn) Is _ToggleButton Then - If Not DirectCast(Btn, _ToggleButton).IsChecked Then Return - Else - EgtOutLog("CONFIG ERR: Il pulsante di Move è stato definito come Button anziché ToggleButton") - Return + Dim Btn As SceneBtn = DirectCast(Map.refSceneButtonV.DataContext, SceneButtonVM).GetButton(EGT_MOVE) + If TypeOf (Btn) Is _ToggleButton Then + If Not DirectCast(Btn, _ToggleButton).IsChecked Then Return + Else + EgtOutLog("CONFIG ERR: Il pulsante di Move è stato definito come Button anziché ToggleButton") + Return + End If + + Dim vtMove As Vector3d = ReadMoveInput() + If Map.refSceneHostV.m_nIdPart <> GDB_ID.NULL And Not AreSameVectorExact(vtMove, New Vector3d) Then + If Map.refSceneHostV.m_bPreviewShown = True Then + ' resetto il movimento precedente + If EgtLuaCallFunction("ASS.UndoTemp") Then AssLog("ASS.UndoTemp()") End If - Dim x_TextBox As _TextBoxParam = DirectCast(ParamList(1), _TextBoxParam) - Dim y_TextBox As _TextBoxParam = DirectCast(ParamList(2), _TextBoxParam) - Dim z_TextBox As _TextBoxParam = DirectCast(ParamList(3), _TextBoxParam) - - ' leggo i dati del vettore di movimento dalle TextBox in m_MoveUC - If Map.refSceneHostV.m_bPreviewShown Then Return - If String.IsNullOrEmpty(x_TextBox.Value) Then x_TextBox.Value = "0" - If String.IsNullOrEmpty(y_TextBox.Value) Then y_TextBox.Value = "0" - If String.IsNullOrEmpty(z_TextBox.Value) Then z_TextBox.Value = "0" - Dim vtMove As New Vector3d(CDbl(x_TextBox.Value), - CDbl(y_TextBox.Value), - CDbl(z_TextBox.Value)) '''' eventuale gestione di un'opzione 'All Selected 'If Not AllOption_Move.IsChecked And m_nIdPart <> -1 Then ' Dim PartSolidSelected As PartSolid = GetPartSolid(m_nIdPart) @@ -136,11 +180,7 @@ Public Class MoveVM ' Next 'End If - If Map.refSceneHostV.m_nIdPart <> GDB_ID.NULL And Not AreSameVectorExact(vtMove, New Vector3d) Then - SolidManagerM.Move(Map.refSceneHostV.m_nIdPart, vtMove, False, True) - Else - Annulla() - End If + SolidManagerM.Move(Map.refSceneHostV.m_nIdPart, vtMove, False, True) Map.refSceneHostV.m_bPreviewShown = True EgtDraw() @@ -168,6 +208,7 @@ Public Class MoveVM If EgtLuaSetGlobBoolVar("ASS.bSaveTemp", bSaveTemp) Then AssLog("ASS.bSaveTemp = " & bSaveTemp.ToString) ' rimuovo lo UC dalla griglia Map.refSceneButtonV.RemoveMoveUC() + SolidManagerM.ManageUndoRedo() End Sub #End Region ' Methods diff --git a/Pair/PairV.xaml b/Pair/PairV.xaml deleted file mode 100644 index 14f488f..0000000 --- a/Pair/PairV.xaml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - -