From 0d0e24494a161b4523deebf7dede5d4fa29286e2 Mon Sep 17 00:00:00 2001 From: Demetrio Cassarino Date: Mon, 27 Jan 2025 10:12:09 +0100 Subject: [PATCH] -piccole modifiche e pulizia codice --- Constants/ConstEgtStone3D.vb | 23 +++++++++++++-- Constants/ConstGen.vb | 2 ++ EgtColorPicker/EgtColorPickerV.xaml | 21 ++------------ .../EgtManageFileDialogV.xaml.vb | 3 +- EgtManageFileDialog/EgtManageFileDialogVM.vb | 15 ---------- EgtMessageBox/EgtMessageBoxV.xaml | 1 + MainWindow/MainWindowM.vb | 9 ++++++ Pair/PairVM.vb | 3 +- Rotate/RotateVM.vb | 1 - SceneButton/SceneButtonV.xaml.vb | 17 ----------- SceneButton/SceneButtonVM.vb | 26 ++++++++--------- SceneHost/MySceneHostVM.vb | 10 ++++--- SceneHost/SceneHostV.xaml.vb | 24 +++++++-------- TopPanel/TopPanelVM.vb | 29 ++++++++++--------- TopPanel/TopPanelViewProspectiveV.xaml | 3 +- TopPanel/TopPanelViewV.xaml | 1 + Utility/EgtStone3DDarkDictionary.xaml | 5 ++-- Utility/EgtStone3DDefaultStyle.xaml | 22 ++++++++------ Utility/EgtStone3DDictionary.xaml | 5 ++-- 19 files changed, 103 insertions(+), 117 deletions(-) diff --git a/Constants/ConstEgtStone3D.vb b/Constants/ConstEgtStone3D.vb index 7afbf5e..39dc227 100644 --- a/Constants/ConstEgtStone3D.vb +++ b/Constants/ConstEgtStone3D.vb @@ -2,14 +2,29 @@ Public Const EGT_ROTATE As String = "Rotate" + Public Const EGT_AUTOPAIR As String = "AutoPair" Public Const EGT_PAIR As String = "Pair" - + Public Const EGT_UNPAIR As String = "Unpair" + Public Const EGT_RESET_INTERS As String = "ResetInters" + Public Const EGT_UNDO As String = "Undo" + Public Const EGT_REDO As String = "Redo" + Public Const EGT_SEL_TYPE As String = "SelType" + Public Const EGT_IMPORT_LOOP As String = "ImportLoop" + Public Const EGT_CREATE_SOLID_LOOP As String = "CreateSolidFromLoop" Public Const EGT_MOVE As String = "Move" - Public Const EGT_ALZ As String = "AddSplashTop" - Public Const EGT_FRO As String = "AddWaterfall" + Public Const EGT_X As String = "X" + Public Const EGT_Y As String = "Y" + Public Const EGT_Z As String = "Z" + Public Const EGT_XY As String = "XY" + Public Const EGT_YX As String = "YX" + Public Const EGT_YZ As String = "YZ" + Public Const EGT_ZY As String = "ZY" + Public Const EGT_ZX As String = "ZX" + Public Const EGT_XZ As String = "XZ" + Public Const ASSEMBLER_FILENAME As String = "AssemblerLog.txt" Public Const TERNA_FILENAME As String = "TernaVeinMatch.nge" Public Const CREATESOLID_FILENAME As String = "CreateSOLID_FromPartsInPark.lua" @@ -49,6 +64,8 @@ Public Const TABLE = "Table" + Public Const SUBTITLE = "SubTitle" + ' nome file cn in progetto Public Const KEY_ISOFILE_PATH = "IsoFilePath" diff --git a/Constants/ConstGen.vb b/Constants/ConstGen.vb index 09beb2b..a42f7ea 100644 --- a/Constants/ConstGen.vb +++ b/Constants/ConstGen.vb @@ -34,6 +34,8 @@ ' Sottodirettorio del Vein 3D Public Const VEIND3D_DIR As String = "Vein3D_Dir" + ' Sottodirettorio delle risorse + Public Const RESOURCES_DIR As String = "Resources" ' Sottodirettorio del Create Solid Public Const CREATESOLID_DIR As String = "CreateSolid" ' Sottodirettorio dell'Operation Solid diff --git a/EgtColorPicker/EgtColorPickerV.xaml b/EgtColorPicker/EgtColorPickerV.xaml index 3d305cd..75f5f42 100644 --- a/EgtColorPicker/EgtColorPickerV.xaml +++ b/EgtColorPicker/EgtColorPickerV.xaml @@ -29,6 +29,7 @@ @@ -41,12 +42,6 @@ Style="{StaticResource EgtColorPicker_Rect}"/> - - - @@ -80,6 +75,7 @@ @@ -92,12 +88,6 @@ Style="{StaticResource EgtColorPicker_Rect}"/> - - - @@ -119,6 +109,7 @@ @@ -131,12 +122,6 @@ Style="{StaticResource EgtColorPicker_Rect}"/> - - - ''' Inizializza la ComboBox per la scelta dei template ''' @@ -440,12 +431,6 @@ Public Class EgtManageFileDialogVM m_ViewModeList.Add(ItemVisualization) End Sub - 'Private Sub Directory_PropertyChanged(sender As Object, e As PropertyChangedEventArgs) - ' If e.PropertyName = "IsSelected" Then - ' 'UpdateSelRoot() - ' End If - 'End Sub - #End Region #Region "COMMANDS" diff --git a/EgtMessageBox/EgtMessageBoxV.xaml b/EgtMessageBox/EgtMessageBoxV.xaml index b230045..518b9f4 100644 --- a/EgtMessageBox/EgtMessageBoxV.xaml +++ b/EgtMessageBox/EgtMessageBoxV.xaml @@ -2,6 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5" + xmlns:EgtStone3D="clr-namespace:EgtStone3D" Title="{Binding sTitle}" SizeToContent="WidthAndHeight" WindowStartupLocation="CenterOwner" diff --git a/MainWindow/MainWindowM.vb b/MainWindow/MainWindowM.vb index b6efa53..f4380da 100644 --- a/MainWindow/MainWindowM.vb +++ b/MainWindow/MainWindowM.vb @@ -41,6 +41,13 @@ Public Class MainWindowM End Get End Property + Private m_sResourcesDir As String = String.Empty + Friend ReadOnly Property sResourcesDir As String + Get + Return m_sResourcesDir + End Get + End Property + Private m_sCreateSolidPath As String = String.Empty Friend ReadOnly Property sCreateSolidPath As String Get @@ -277,6 +284,8 @@ Public Class MainWindowM ' Leggo tema corrente Dim sThema As String = String.Empty GetMainPrivateProfileString(S_GENERAL, K_THEMA, "", sThema) + ' Impostazione direttorio delle risorse + m_sResourcesDir = m_sDataRoot & "\" & RESOURCES_DIR ' Info su opzioni chiave EgtOutLog("KeyOptions : " & bKey.ToString() & " " & m_nKeyOptions.ToString()) End Sub diff --git a/Pair/PairVM.vb b/Pair/PairVM.vb index 87554a1..561a61c 100644 --- a/Pair/PairVM.vb +++ b/Pair/PairVM.vb @@ -1,5 +1,4 @@ -Imports System.Windows.Threading -Imports EgtUILib +Imports EgtUILib Public Class PairVM Inherits SceneUserControlVM diff --git a/Rotate/RotateVM.vb b/Rotate/RotateVM.vb index 88e7bd3..613f509 100644 --- a/Rotate/RotateVM.vb +++ b/Rotate/RotateVM.vb @@ -1,5 +1,4 @@ Imports EgtUILib -Imports EgtWPFLib5 Public Class RotateVM Inherits SceneUserControlVM diff --git a/SceneButton/SceneButtonV.xaml.vb b/SceneButton/SceneButtonV.xaml.vb index 0bca6ba..e068d6d 100644 --- a/SceneButton/SceneButtonV.xaml.vb +++ b/SceneButton/SceneButtonV.xaml.vb @@ -93,23 +93,6 @@ m_MoveUC = Nothing End Sub - Public Sub LoadSceneUserControl() - If IsNothing(m_SceneUserControlV) Then - m_SceneUserControlV = New SceneUserControlV - Grid.SetColumn(m_SceneUserControlV, 0) - Grid.SetRow(m_SceneUserControlV, 0) - Grid.SetColumnSpan(m_SceneUserControlV, 2) - Grid.SetRowSpan(m_SceneUserControlV, 2) - MainGrid.Children.Add(m_SceneUserControlV) - End If - - End Sub - - Public Sub RemoveSceneUserControlV() - MainGrid.Children.Remove(m_SceneUserControlV) - m_SceneUserControlV = Nothing - End Sub - #End Region ' Methods End Class diff --git a/SceneButton/SceneButtonVM.vb b/SceneButton/SceneButtonVM.vb index b801160..8219aeb 100644 --- a/SceneButton/SceneButtonVM.vb +++ b/SceneButton/SceneButtonVM.vb @@ -98,7 +98,7 @@ Public Class SceneButtonVM Dim Index As Integer = 1 Dim SubTitle As String = String.Empty Dim sKeyTitle As String = TOPPANELLIST_BTN & "_" & Index.ToString() - While GetMainPrivateProfileString(sKeyTitle, "SubTitle", "", SubTitle) > 0 + While GetMainPrivateProfileString(sKeyTitle, ConstEgtStone3D.SUBTITLE, "", SubTitle) > 0 SetGroupButtonsLocation(sKeyTitle, m_TopPanelListGroupBtn) Index += 1 sKeyTitle = TOPPANELLIST_BTN & "_" & Index.ToString() @@ -131,7 +131,7 @@ Public Class SceneButtonVM ListBtn.Add(New _ButtonComboBox(sItems(1), sItems(2), sItems(3), sItems(4))) End If End If - Index = Index + 1 + Index += 1 sBtnString = String.Empty End While End Sub @@ -140,7 +140,7 @@ Public Class SceneButtonVM Dim LocalListSceneBtn As New List(Of SceneBtn) Dim SubTitle As String = String.Empty SetButtonsLocation(PositionList, LocalListSceneBtn) - GetMainPrivateProfileString(PositionList, "SubTitle", "", SubTitle) + GetMainPrivateProfileString(PositionList, ConstEgtStone3D.SUBTITLE, "", SubTitle) ListGroupBtn.Add(New GroupSceneBtn(LocalListSceneBtn, SubTitle)) End Sub @@ -221,8 +221,6 @@ Public Class SceneBtn #Region "FIELDS & PROPETIES" - Private m_ResourcesDir As String = "C:\EgtData\EgtSTONE3D\Resources\" - Private m_Name As String = String.Empty Public Property Name As String Get @@ -269,7 +267,7 @@ Public Class SceneBtn Sub New(_Name As String, _Img As String, _Flag As String) m_Name = _Name - m_Img = m_ResourcesDir & _Img + m_Img = Map.refMainWindowVM.MainWindowM.sResourcesDir & "\" & _Img m_Flag = _Flag End Sub @@ -379,36 +377,36 @@ Module SceneCmd Dim _SceneHostVM As SceneHostVM = DirectCast(Map.refSceneHostV.DataContext, SceneHostVM) Dim nVeinCtx As Integer = _SceneHostVM.MainScene.GetCtx() Select Case Flag - Case "AutoPair" + Case EGT_AUTOPAIR EgtSetCurrentContext(nVeinCtx) EgtLuaSetGlobIntVar("ASS.nVeinCtx", nVeinCtx) EgtLuaCallFunction("ASS.PairAll") - Case "Unpair" + Case EGT_UNPAIR SolidManagerM.Unpair(Map.refSceneHostV.m_nIdPart) Case EGT_PAIR Map.refSceneButtonV.LoadPairUC() - Case "ResetInters" + Case EGT_RESET_INTERS SolidManagerM.ResetInters() Case EGT_ROTATE Map.refSceneButtonV.LoadRotateUC() Case EGT_MOVE Map.refSceneButtonV.LoadMoveUC() - Case "Undo" + Case EGT_UNDO ' se con questa operazione torno all'inizio disattivo il bottone undo SolidManagerM.UndoEvent() SolidManagerM.ManageUndoRedo() EgtDraw() - Case "Redo" + Case EGT_REDO ' se con questa operazione ho finito la storia disponibile disattivo il bottone redo SolidManagerM.RedoEvent() SolidManagerM.ManageUndoRedo() EgtDraw() - Case "SelType" + Case EGT_SEL_TYPE Map.refSceneButtonV.MenuSelType.IsOpen = True - Case "ImportLoop" + Case EGT_IMPORT_LOOP 'ImportLoop() EgtInsertFile("D:\Temp\marmo\Vein3D\OutLoop.nge") - Case "CreateSolidFromLoop" + Case EGT_CREATE_SOLID_LOOP SolidManagerM.CreateSolidFromLoop(Map.refSceneHostV.m_nIdPart) Case EGT_ALZ Map.refSceneHostV.m_SelType = GDB_TY.CRV_LINE diff --git a/SceneHost/MySceneHostVM.vb b/SceneHost/MySceneHostVM.vb index cb145a3..5f9fdf7 100644 --- a/SceneHost/MySceneHostVM.vb +++ b/SceneHost/MySceneHostVM.vb @@ -194,10 +194,12 @@ Public Class MySceneHostVM End If Dim OpenFileDialog As New EgtManageFileDialogV(Application.Current.MainWindow, New EgtManageFileDialogVM()) With { .Title = EgtMsg(110015), - .Filter = "Icarus project(*.icrs)|*.icrs" & - "|New geometry EgalTech(*.nge)|*.nge", - .FilterIndex = 1, - .InitialDirectory = sDir + .Filter = "nge files (*.nge)|*.nge" & + "|vme files (*.vme)|*.vme", + .FileName = "New.vme", + .FilterIndex = 2, + .InitialDirectory = sDir, + .Mode = 1 } If Not OpenFileDialog.ShowDialog() = Windows.Forms.DialogResult.OK Then Return False sFilePath = OpenFileDialog.FileName diff --git a/SceneHost/SceneHostV.xaml.vb b/SceneHost/SceneHostV.xaml.vb index 5ae17f2..01c6695 100644 --- a/SceneHost/SceneHostV.xaml.vb +++ b/SceneHost/SceneHostV.xaml.vb @@ -92,7 +92,7 @@ Public Class SceneHostV 'debug 'EgtOpenFile("D:\\Temp\\marmo\\Vein3D\\piano_PREassemlbaggio.vme") - EgtOpenFile("D:\\Temp\\marmo\\Vein3D\\prima paretina.nge") + 'EgtOpenFile("D:\\Temp\\marmo\\Vein3D\\prima paretina.nge") 'EgtOpenFile("D:\\Temp\\marmo\\Vein3D\\FOO.nge") 'debug @@ -256,35 +256,35 @@ Public Class SceneHostV Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId)) Dim sName As String = String.Empty EgtGetName(nPartId, sName) - If sName = "Terna" Then + If sName = TERNA Then Dim sNameAx As String = String.Empty EgtGetName(EgtGetParent(nId), sNameAx) Dim PartSolidIdTempSel As PartSolidM = GetPartSolid(m_nIdPart) If IsNothing(PartSolidIdTempSel) Then Return 'PartSolidIdTempSel.Unpair() Select Case sNameAx - Case "X" + Case EGT_X Dim vtDir As New Vector3d Dim nLay As Integer = EgtGetFirstNameInGroup(PartSolidIdTempSel.TernaId, "AxisX") EgtStartVector(EgtGetFirstInGroup(nLay), GDB_RT.GLOB, vtDir) PartSolidIdTempSel.vtDrag = vtDir m_bDrag = True 'wnd_RotationInputDataV.Testo.Text = "α°" - Case "Y" + Case EGT_Y Dim vtDir As New Vector3d Dim nLay As Integer = EgtGetFirstNameInGroup(PartSolidIdTempSel.TernaId, "AxisY") EgtStartVector(EgtGetFirstInGroup(nLay), GDB_RT.GLOB, vtDir) PartSolidIdTempSel.vtDrag = vtDir m_bDrag = True 'wnd_RotationInputDataV.Testo.Text = "𝛃°" - Case "Z" + Case EGT_Z Dim vtDir As New Vector3d Dim nLay As Integer = EgtGetFirstNameInGroup(PartSolidIdTempSel.TernaId, "AxisZ") EgtStartVector(EgtGetFirstInGroup(nLay), GDB_RT.GLOB, vtDir) PartSolidIdTempSel.vtDrag = vtDir m_bDrag = True 'wnd_RotationInputDataV.Testo.Text = "𝛄°" - Case "XY", "YX" + Case EGT_XY, EGT_YX If (Keyboard.Modifiers And ModifierKeys.Shift) > 0 Then PartSolidIdTempSel.vtDrag = Vector3d.Z_AX m_bDrag = True @@ -295,7 +295,7 @@ Public Class SceneHostV nId = EgtGetNextObjInSelWin() Continue While End If - Case "YZ", "ZY" + Case EGT_YZ, EGT_ZY If (Keyboard.Modifiers And ModifierKeys.Shift) > 0 Then PartSolidIdTempSel.vtDrag = Vector3d.X_AX m_bDrag = True @@ -306,7 +306,7 @@ Public Class SceneHostV nId = EgtGetNextObjInSelWin() Continue While End If - Case "ZX", "XZ" + Case EGT_ZX, EGT_XZ If (Keyboard.Modifiers And ModifierKeys.Shift) > 0 Then PartSolidIdTempSel.vtDrag = Vector3d.Y_AX m_bDrag = True @@ -318,13 +318,13 @@ Public Class SceneHostV Continue While End If ' sennò procedo ad esseguire la rotazione attorno al segmento selezionato... - Case "AxisX" + Case AXISX 'wnd_RotationInputDataV.Testo.Text = "α°" GoTo Line1 - Case "AxisY" + Case AXISY 'wnd_RotationInputDataV.Testo.Text = "𝛃°" GoTo Line1 - Case "AxisZ" + Case AXISZ 'wnd_RotationInputDataV.Testo.Text = "𝛄°" GoTo Line1 Case Else @@ -670,8 +670,6 @@ Line1: If m_nIdPart = GDB_ID.NULL Then Return Dim ptCurr As Point3d EgtUnProjectPoint(e.Location, ptCurr) - - Dim PartSolidSel As PartSolidM = GetPartSolid(m_nIdPart) If IsNothing(PartSolidSel) Then Return If Not m_bRotate Then diff --git a/TopPanel/TopPanelVM.vb b/TopPanel/TopPanelVM.vb index d2c3dc1..5ccbdfc 100644 --- a/TopPanel/TopPanelVM.vb +++ b/TopPanel/TopPanelVM.vb @@ -121,7 +121,7 @@ Public Class TopPanelVM Public ReadOnly Property FileSourceSVG As String Get - Return "C:\EgtData\EgtStone3D\Resources\test.svg" + Return Map.refMainWindowVM.MainWindowM.sResourcesDir & "\test.svg" End Get End Property @@ -259,21 +259,22 @@ Public Class TopPanelVM End Property Private Sub OpenFile() - Dim OpenFileDialog As New EgtManageFileDialogV(Application.Current.MainWindow, New EgtManageFileDialogVM()) With { - .Title = EgtMsg(110015), - .Filter = "nge files (*.nge)|*.nge" & - "|vme files (*.vme)|*.vme", - .FileName = "New.vme", - .FilterIndex = 2, - .InitialDirectory = "C:\EgtData\EgtStone3D\Temp", - .Mode = 1 - } + 'Dim OpenFileDialog As New EgtManageFileDialogV(Application.Current.MainWindow, New EgtManageFileDialogVM()) With { + ' .Title = EgtMsg(110015), + ' .Filter = "nge files (*.nge)|*.nge" & + ' "|vme files (*.vme)|*.vme", + ' .FileName = "New.vme", + ' .FilterIndex = 2, + ' .InitialDirectory = "C:\EgtData\EgtStone3D\Temp", + ' .Mode = 1 + '} - If Not OpenFileDialog.ShowDialog() = Windows.Forms.DialogResult.OK Then Return - If String.IsNullOrEmpty(OpenFileDialog.FileName) Then Return + 'If Not OpenFileDialog.ShowDialog() = Windows.Forms.DialogResult.OK Then Return + 'If String.IsNullOrEmpty(OpenFileDialog.FileName) Then Return - Dim sFilePath As String = OpenFileDialog.FileName - EgtOpenFile(sFilePath) + 'Dim sFilePath As String = OpenFileDialog.FileName + 'EgtOpenFile(sFilePath) + OpenProject("") SolidManagerM.CreatePartSolid() EgtDraw() End Sub diff --git a/TopPanel/TopPanelViewProspectiveV.xaml b/TopPanel/TopPanelViewProspectiveV.xaml index 18c30f3..8fd00c5 100644 --- a/TopPanel/TopPanelViewProspectiveV.xaml +++ b/TopPanel/TopPanelViewProspectiveV.xaml @@ -15,7 +15,8 @@ diff --git a/TopPanel/TopPanelViewV.xaml b/TopPanel/TopPanelViewV.xaml index aed222c..5eba305 100644 --- a/TopPanel/TopPanelViewV.xaml +++ b/TopPanel/TopPanelViewV.xaml @@ -16,6 +16,7 @@ diff --git a/Utility/EgtStone3DDarkDictionary.xaml b/Utility/EgtStone3DDarkDictionary.xaml index cfe07b0..8e8ca6b 100644 --- a/Utility/EgtStone3DDarkDictionary.xaml +++ b/Utility/EgtStone3DDarkDictionary.xaml @@ -18,7 +18,7 @@ - + @@ -81,7 +81,8 @@ - + + diff --git a/Utility/EgtStone3DDefaultStyle.xaml b/Utility/EgtStone3DDefaultStyle.xaml index 9f4927b..b5c785c 100644 --- a/Utility/EgtStone3DDefaultStyle.xaml +++ b/Utility/EgtStone3DDefaultStyle.xaml @@ -336,7 +336,7 @@ - + @@ -412,7 +412,6 @@ - @@ -2116,6 +2115,11 @@ + + diff --git a/Utility/EgtStone3DDictionary.xaml b/Utility/EgtStone3DDictionary.xaml index 22b68b0..b53ea9a 100644 --- a/Utility/EgtStone3DDictionary.xaml +++ b/Utility/EgtStone3DDictionary.xaml @@ -18,7 +18,7 @@ - + @@ -81,7 +81,8 @@ - + +