701 lines
23 KiB
VB.net
701 lines
23 KiB
VB.net
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class SceneButtonVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Public Shared m_nIndexList As Integer = 0
|
|
Public Shared m_nIndexList_1 As Integer = 0
|
|
Public Shared m_nIndexList_2 As Integer = 0
|
|
|
|
Public m_SelOptionUC As SelOptionV
|
|
Public m_SceneUserControlV As SceneUserControlV
|
|
Public m_PairUC As SceneUserControlV
|
|
Public m_RotateUC As SceneUserControlV
|
|
Public m_MoveUC As SceneUserControlV
|
|
Public m_NewPanelUC As SceneUserControlV
|
|
Public m_EditPanelUC As SceneUserControlV
|
|
Public m_ParametricCompoUC As SceneUserControlV
|
|
|
|
Private m_TopListBtn As New List(Of SceneBtn)
|
|
Public Property TopListBtn As List(Of SceneBtn)
|
|
Get
|
|
Return m_TopListBtn
|
|
End Get
|
|
Set(value As List(Of SceneBtn))
|
|
m_TopListBtn = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_LeftListBtn As New List(Of SceneBtn)
|
|
Public Property LeftListBtn As List(Of SceneBtn)
|
|
Get
|
|
Return m_LeftListBtn
|
|
End Get
|
|
Set(value As List(Of SceneBtn))
|
|
m_LeftListBtn = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_RightListBtn As New List(Of SceneBtn)
|
|
Public Property RightListBtn As List(Of SceneBtn)
|
|
Get
|
|
Return m_RightListBtn
|
|
End Get
|
|
Set(value As List(Of SceneBtn))
|
|
m_RightListBtn = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_BottomListBtn As New List(Of SceneBtn)
|
|
Public Property BottomListBtn As List(Of SceneBtn)
|
|
Get
|
|
Return m_BottomListBtn
|
|
End Get
|
|
Set(value As List(Of SceneBtn))
|
|
m_BottomListBtn = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_BottomCenterListBtn As New List(Of SceneBtn)
|
|
Public Property BottomCenterListBtn As List(Of SceneBtn)
|
|
Get
|
|
Return m_BottomCenterListBtn
|
|
End Get
|
|
Set(value As List(Of SceneBtn))
|
|
m_BottomCenterListBtn = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_TopPanelListGroupBtn As New List(Of GroupSceneBtn)
|
|
Public Property TopPanelListGroupBtn As List(Of GroupSceneBtn)
|
|
Get
|
|
Return m_TopPanelListGroupBtn
|
|
End Get
|
|
Set(value As List(Of GroupSceneBtn))
|
|
m_TopPanelListGroupBtn = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_ParametricListGroupBtn As New List(Of GroupSceneBtn)
|
|
Public Property ParametricListGroupBtn As List(Of GroupSceneBtn)
|
|
Get
|
|
Return m_ParametricListGroupBtn
|
|
End Get
|
|
Set(value As List(Of GroupSceneBtn))
|
|
m_ParametricListGroupBtn = value
|
|
End Set
|
|
End Property
|
|
|
|
Friend Enum TopPanel As Integer
|
|
TOP_PANEL = 0
|
|
TOP_PANEL_1 = 1
|
|
End Enum
|
|
|
|
Private m_SelSelTopPanel As TopPanel = TopPanel.TOP_PANEL
|
|
Public Property SelTopPanel As Integer
|
|
Get
|
|
Return m_SelSelTopPanel
|
|
End Get
|
|
Set(value As Integer)
|
|
m_SelSelTopPanel = value
|
|
End Set
|
|
End Property
|
|
Friend Sub SetSelTopPanel(TopOtion As TopPanel)
|
|
m_SelSelTopPanel = TopOtion
|
|
NotifyPropertyChanged(NameOf(SelTopPanel))
|
|
End Sub
|
|
|
|
#End Region ' Fields & Properties
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
Map.SetRefSceneButtonVM(Me)
|
|
LoadButtons()
|
|
LoadGroupButtons(TOPPANELLIST_BTN, m_TopPanelListGroupBtn)
|
|
LoadGroupButtons("ParametricListBtn", m_ParametricListGroupBtn)
|
|
End Sub
|
|
|
|
#End Region ' Constructor
|
|
|
|
#Region "METHODS"
|
|
|
|
''' <summary>
|
|
''' Funzione che carica i bottoni
|
|
''' </summary>
|
|
Private Sub LoadButtons()
|
|
SetButtonsLocation(TOPLIST_BTN, m_TopListBtn)
|
|
SetButtonsLocation(LEFTLIST_BTN, m_LeftListBtn)
|
|
SetButtonsLocation(RIGHTLIST_BTN, m_RightListBtn)
|
|
SetButtonsLocation(BOTTOMLIST_BTN, m_BottomListBtn)
|
|
SetButtonsLocation(BOTTOMCENTERLIST_BTN, m_BottomCenterListBtn)
|
|
End Sub
|
|
|
|
Private Sub LoadGroupButtons(NameList As String, GroupSceneBtnList As List(Of GroupSceneBtn))
|
|
Dim Index As Integer = 1
|
|
Dim SubTitle As String = String.Empty
|
|
Dim sKeyTitle As String = NameList & "_" & Index.ToString()
|
|
While GetMainPrivateProfileString(sKeyTitle, ConstEgtStone3D.SUBTITLE, "", SubTitle) > 0
|
|
SetGroupButtonsLocation(sKeyTitle, GroupSceneBtnList)
|
|
Index += 1
|
|
sKeyTitle = NameList & "_" & Index.ToString()
|
|
End While
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Funzione che permette di posizionare i bottoni letti da file ini
|
|
''' </summary>
|
|
''' <param name="PositionList"></param>
|
|
''' <param name="ListBtn"></param>
|
|
Private Sub SetButtonsLocation(PositionList As String, ListBtn As List(Of SceneBtn))
|
|
Dim Index As Integer = 1
|
|
Dim sBtnString As String = String.Empty
|
|
While GetMainPrivateProfileString(PositionList, "Btn_" & Index.ToString, "", sBtnString) > 0
|
|
Dim sItems As String() = Split(sBtnString, ",")
|
|
If sItems.Count < 3 Then
|
|
' Errore di configurazione comando: mancano dei parametri
|
|
EgtOutLog("")
|
|
Else
|
|
If sItems(0) = "Button" Then
|
|
' Button
|
|
ListBtn.Add(New _Button(sItems(1), sItems(2), sItems(3)))
|
|
ElseIf sItems(0) = "ToggleButton" Then
|
|
' ToggelButton
|
|
ListBtn.Add(New _ToggleButton(sItems(1), sItems(2), sItems(3)))
|
|
ElseIf sItems(0) = "ButtonComboBox" And sItems.Count >= 4 Then
|
|
' Button che apre una combo box
|
|
ListBtn.Add(New _ButtonComboBox(sItems(1), sItems(2), sItems(3), sItems(4)))
|
|
End If
|
|
End If
|
|
Index += 1
|
|
sBtnString = String.Empty
|
|
End While
|
|
End Sub
|
|
|
|
Private Sub SetGroupButtonsLocation(PositionList As String, ListGroupBtn As List(Of GroupSceneBtn))
|
|
Dim LocalListSceneBtn As New List(Of SceneBtn)
|
|
Dim SubTitle As String = String.Empty
|
|
Dim Title As String
|
|
SetButtonsLocation(PositionList, LocalListSceneBtn)
|
|
GetMainPrivateProfileString(PositionList, ConstEgtStone3D.SUBTITLE, "", SubTitle)
|
|
Title = SplitSubTitle(SubTitle)
|
|
ListGroupBtn.Add(New GroupSceneBtn(LocalListSceneBtn, Title))
|
|
End Sub
|
|
|
|
Public Function IsTgBtnChecked(Flag As String) As Boolean
|
|
' cerco il bottone con il flag richiesto
|
|
Dim Btn As _ToggleButton = GetButton(Flag)
|
|
Dim bIsChecked As Boolean = False
|
|
If Not IsNothing(Btn) Then bIsChecked = Btn.IsChecked
|
|
' restituisco la sua proprietà IsChecked
|
|
Return bIsChecked
|
|
End Function
|
|
|
|
Public Function GetButton(Flag As String) As SceneBtn
|
|
' cerco il bottone con il flag richiesto
|
|
Dim Btn As SceneBtn = m_BottomListBtn.FirstOrDefault(Function(x) x.Flag = Flag)
|
|
If Not IsNothing(Btn) Then Return Btn
|
|
Btn = m_RightListBtn.FirstOrDefault(Function(x) x.Flag = Flag)
|
|
If Not IsNothing(Btn) Then Return Btn
|
|
Btn = m_TopListBtn.FirstOrDefault(Function(x) x.Flag = Flag)
|
|
If Not IsNothing(Btn) Then Return Btn
|
|
Btn = m_LeftListBtn.FirstOrDefault(Function(x) x.Flag = Flag)
|
|
If Not IsNothing(Btn) Then Return Btn
|
|
Btn = m_BottomCenterListBtn.FirstOrDefault(Function(x) x.Flag = Flag)
|
|
Return Btn
|
|
End Function
|
|
|
|
Private Function SplitSubTitle(SubTitle As String) As String
|
|
Dim subTitleList As String() = SubTitle.Split("/"c)
|
|
For IndexTitle As Integer = 0 To subTitleList.Count - 1
|
|
If IsNumeric(subTitleList(IndexTitle)) AndAlso Not EgtMsg(subTitleList(IndexTitle)).StartsWith("Msg") Then
|
|
Return EgtMsg(subTitleList(IndexTitle))
|
|
Else
|
|
Return subTitleList(IndexTitle + 1)
|
|
End If
|
|
Next
|
|
Return String.Empty
|
|
End Function
|
|
|
|
''' <summary>
|
|
''' Funzione per caricare l'user control
|
|
''' </summary>
|
|
''' <param name="SceneUC">User control generico</param>
|
|
Public Sub LoadUC(SceneUC As SceneUserControlV)
|
|
If Not IsNothing(m_PairUC) Then RemoveUC(m_PairUC)
|
|
If Not IsNothing(m_RotateUC) Then RemoveUC(m_RotateUC)
|
|
If Not IsNothing(m_MoveUC) Then RemoveUC(m_MoveUC)
|
|
If Not IsNothing(m_NewPanelUC) Then RemoveUC(m_NewPanelUC)
|
|
If Not IsNothing(m_EditPanelUC) Then RemoveUC(m_EditPanelUC)
|
|
If Not IsNothing(m_ParametricCompoUC) Then RemoveUC(m_ParametricCompoUC)
|
|
Grid.SetColumn(SceneUC, 0)
|
|
Grid.SetRow(SceneUC, 0)
|
|
Grid.SetColumnSpan(SceneUC, 2)
|
|
Grid.SetRowSpan(SceneUC, 5)
|
|
Map.refSceneButtonV.MainGrid.Children.Add(SceneUC)
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Funzione per rimuovere l'user control
|
|
''' </summary>
|
|
''' <param name="SceneUC">User control generico</param>
|
|
Friend Sub RemoveUC(SceneUC As SceneUserControlV)
|
|
Map.refSceneButtonV.MainGrid.Children.Remove(SceneUC)
|
|
SceneUC = Nothing
|
|
End Sub
|
|
|
|
#End Region ' Methods
|
|
|
|
End Class
|
|
|
|
' ------------------------------ GROUPSCENEBTN ------------------------------
|
|
|
|
Public Class GroupSceneBtn
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Private m_SubTitle As String
|
|
Public Property SubTitle As String
|
|
Get
|
|
Return m_SubTitle
|
|
End Get
|
|
Set(value As String)
|
|
m_SubTitle = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_TopPanelListBtn As New List(Of SceneBtn)
|
|
Public Property TopPanelListBtn As List(Of SceneBtn)
|
|
Get
|
|
Return m_TopPanelListBtn
|
|
End Get
|
|
Set(value As List(Of SceneBtn))
|
|
m_TopPanelListBtn = value
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Fields & Properties
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New(TopPanelListBtn As List(Of SceneBtn), sSubTitle As String)
|
|
m_TopPanelListBtn = TopPanelListBtn
|
|
m_SubTitle = sSubTitle
|
|
End Sub
|
|
|
|
#End Region ' Constructor
|
|
|
|
End Class
|
|
|
|
' ------------------------------ SCENEBTN ------------------------------
|
|
|
|
Public Class SceneBtn
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPETIES"
|
|
|
|
Private m_Name As String = String.Empty
|
|
Public Property Name As String
|
|
Get
|
|
Return m_Name
|
|
End Get
|
|
Set(value As String)
|
|
m_Name = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Img As String = String.Empty
|
|
Public Property Img As String
|
|
Get
|
|
Return m_Img
|
|
End Get
|
|
Set(value As String)
|
|
m_Img = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Flag As String = String.Empty
|
|
Public Property Flag As String
|
|
Get
|
|
Return m_Flag
|
|
End Get
|
|
Set(value As String)
|
|
m_Flag = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsEnabled As Boolean = True
|
|
Public Property IsEnabled As Boolean
|
|
Get
|
|
Return m_IsEnabled
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_IsEnabled = value
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Fields & Properties
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New(_Name As String, _Img As String, _Flag As String)
|
|
m_Name = _Name
|
|
m_Img = Map.refMainWindowVM.MainWindowM.sResourcesDir & "\" & _Img
|
|
m_Flag = _Flag
|
|
End Sub
|
|
|
|
#End Region ' Constructor
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "CmdBtn"
|
|
|
|
Private m_CmdBtn As ICommand
|
|
Public ReadOnly Property CmdBtn As ICommand
|
|
Get
|
|
If m_CmdBtn Is Nothing Then
|
|
m_CmdBtn = New Command(AddressOf MethodBtn)
|
|
End If
|
|
Return m_CmdBtn
|
|
End Get
|
|
End Property
|
|
|
|
Private Sub MethodBtn()
|
|
SceneCmd.Exec(m_Flag)
|
|
End Sub
|
|
|
|
#End Region ' CmdBtn
|
|
|
|
#End Region ' Commands
|
|
|
|
End Class
|
|
|
|
' ------------------------------ _BUTTON ------------------------------
|
|
|
|
Public Class _Button
|
|
Inherits SceneBtn
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New(_Name As String, _Img As String, _Flag As String)
|
|
MyBase.New(_Name, _Img, _Flag)
|
|
End Sub
|
|
|
|
#End Region ' Constructor
|
|
|
|
End Class
|
|
|
|
' ------------------------------ _TOOGLEBUTTON ------------------------------
|
|
|
|
Public Class _ToggleButton
|
|
Inherits SceneBtn
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Private m_IsChecked As Boolean = False
|
|
Public Property IsChecked As Boolean
|
|
Get
|
|
Return m_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_IsChecked = value
|
|
NotifyPropertyChanged(NameOf(IsChecked))
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Fields & Properties
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New(_Name As String, _Img As String, _Flag As String)
|
|
MyBase.New(_Name, _Img, _Flag)
|
|
End Sub
|
|
|
|
#End Region ' Constructor
|
|
|
|
End Class
|
|
|
|
' ------------------------------ _BUTTONCOMBOBOX ------------------------------
|
|
|
|
Public Class _ButtonComboBox
|
|
Inherits SceneBtn
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Private m_SourceList As New List(Of String)
|
|
Public Property SourceList As List(Of String)
|
|
Get
|
|
Return m_SourceList
|
|
End Get
|
|
Set(value As List(Of String))
|
|
m_SourceList = value
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Fields & Properties
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New(_Name As String, _Img As String, _Flag As String, _PrototypeList As String)
|
|
MyBase.New(_Name, _Img, _Flag)
|
|
'conversione da _PrototypeList a _List ''''' da implementare
|
|
m_SourceList = New List(Of String)({"Becca", "Bacca", "Bionda", "Mora"})
|
|
|
|
'm_SourceList = _List
|
|
End Sub
|
|
|
|
#End Region ' Constructor
|
|
|
|
End Class
|
|
|
|
' ------------------------------ SCENECMD ------------------------------
|
|
|
|
Module SceneCmd
|
|
|
|
#Region "METHODS"
|
|
|
|
Public Function ExecFile(Flag As String, nVeinCtx As Integer) As Boolean
|
|
Dim bNewParametricExsists As Boolean = False
|
|
If Flag.Contains(".lua") Then
|
|
If IsNothing(Map.refSceneButtonVM.m_ParametricCompoUC) Then Map.refSceneButtonVM.m_ParametricCompoUC = New SceneUserControlV
|
|
Dim LocalParametricCompo As New ParametricCompoVM(Flag, nVeinCtx)
|
|
If LocalParametricCompo.bFileExsist Then
|
|
Map.refSceneButtonVM.m_ParametricCompoUC.DataContext = LocalParametricCompo
|
|
Map.refSceneButtonVM.LoadUC(Map.refSceneButtonVM.m_ParametricCompoUC)
|
|
bNewParametricExsists = True
|
|
End If
|
|
End If
|
|
Return bNewParametricExsists
|
|
End Function
|
|
|
|
Public Function ExecMethod(Flag As String, nVeinCtx As Integer) As Boolean
|
|
Dim bNewMethodsExsists As Boolean = True
|
|
Select Case Flag
|
|
Case EGT_AUTOPAIR
|
|
EgtSetCurrentContext(nVeinCtx)
|
|
EgtLuaSetGlobIntVar("ASS.nVeinCtx", nVeinCtx)
|
|
EgtLuaCallFunction("ASS.PairAll")
|
|
Case EGT_UNPAIR
|
|
SolidManagerM.Unpair(Map.refSceneHostVM.m_nIdPart)
|
|
Case EGT_PAIR
|
|
If IsNothing(Map.refSceneButtonVM.m_PairUC) Then Map.refSceneButtonVM.m_PairUC = New SceneUserControlV
|
|
Map.refSceneButtonVM.m_PairUC.DataContext = New PairVM()
|
|
Map.refSceneButtonVM.LoadUC(Map.refSceneButtonVM.m_PairUC)
|
|
Case EGT_RESET_INTERS
|
|
SolidManagerM.ResetInters()
|
|
Case EGT_ROTATE
|
|
If IsNothing(Map.refSceneButtonVM.m_RotateUC) Then Map.refSceneButtonVM.m_RotateUC = New SceneUserControlV
|
|
Map.refSceneButtonVM.m_RotateUC.DataContext = New RotateVM()
|
|
Map.refSceneButtonVM.LoadUC(Map.refSceneButtonVM.m_RotateUC)
|
|
Case EGT_MOVE
|
|
If IsNothing(Map.refSceneButtonVM.m_MoveUC) Then Map.refSceneButtonVM.m_MoveUC = New SceneUserControlV
|
|
Map.refSceneButtonVM.m_MoveUC.DataContext = New MoveVM()
|
|
Map.refSceneButtonVM.LoadUC(Map.refSceneButtonVM.m_MoveUC)
|
|
Case EGT_UNDO
|
|
Undo()
|
|
Case EGT_REDO
|
|
Redo()
|
|
Case EGT_SEL_TYPE
|
|
Map.refSceneButtonV.MenuSelType.IsOpen = True
|
|
Case EGT_IMPORT_LOOP
|
|
ImportLoop()
|
|
Case EGT_CREATE_SOLID_LOOP
|
|
SolidManagerM.CreateSolidFromLoops(Map.refSceneHostVM.m_nIdPart)
|
|
Case EGT_PANEL
|
|
If IsNothing(Map.refSceneButtonVM.m_NewPanelUC) Then Map.refSceneButtonVM.m_NewPanelUC = New SceneUserControlV
|
|
Map.refSceneButtonVM.m_NewPanelUC.DataContext = New NewPanelVM()
|
|
Map.refSceneButtonVM.LoadUC(Map.refSceneButtonVM.m_NewPanelUC)
|
|
Map.refSceneHostVM.m_SelType = GDB_TY.CRV_LINE
|
|
SolidManagerM.ShowLoopEdges()
|
|
Case EGT_EXPORTPROJECT
|
|
ExportProjectNge()
|
|
Case EGT_DELETE
|
|
SolidManagerM.Delete(Map.refSceneHostVM.m_nIdPart)
|
|
Map.refSceneHostVM.m_nIdPart = GDB_ID.NULL
|
|
Case EGT_EDIT_PANEL
|
|
If IsNothing(Map.refSceneButtonVM.m_EditPanelUC) Then Map.refSceneButtonVM.m_EditPanelUC = New SceneUserControlV
|
|
Map.refSceneButtonVM.m_EditPanelUC.DataContext = New EditPanelVM()
|
|
Map.refSceneButtonVM.LoadUC(Map.refSceneButtonVM.m_EditPanelUC)
|
|
Case Else
|
|
EgtOutLog("La chiamata del metodo '" & Flag & "' non è andata a buon fine")
|
|
bNewMethodsExsists = False
|
|
End Select
|
|
Return bNewMethodsExsists
|
|
End Function
|
|
|
|
Public Sub Exec(Flag As String)
|
|
Dim nVeinCtx As Integer = Map.refSceneHostVM.MainScene.GetCtx()
|
|
|
|
If Not ExecFile(Flag, nVeinCtx) Then
|
|
ExecMethod(Flag, nVeinCtx)
|
|
End If
|
|
End Sub
|
|
|
|
Friend Sub Undo()
|
|
' se con questa operazione torno all'inizio disattivo il bottone undo
|
|
SolidManagerM.UndoEvent()
|
|
SolidManagerM.ManageUndoRedo()
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
Friend Sub Redo()
|
|
' se con questa operazione ho finito la storia disponibile disattivo il bottone redo
|
|
SolidManagerM.RedoEvent()
|
|
SolidManagerM.ManageUndoRedo()
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Funzione che permette di importare un file nge
|
|
''' </summary>
|
|
Private Sub ImportLoop()
|
|
' Recupero cartella dell'ultimo progetto aperto
|
|
Dim sDir As String = String.Empty 'Map.refSceneHostVM.MainController.GetCurrFile()
|
|
If String.IsNullOrWhiteSpace(sDir) Then
|
|
GetMainPrivateProfileString(S_MRUFILES, K_FILE & 1, "", sDir)
|
|
End If
|
|
If Not String.IsNullOrWhiteSpace(sDir) Then
|
|
sDir = System.IO.Path.GetDirectoryName(sDir)
|
|
End If
|
|
Dim ImportDialog As New EgtManageFileDialogV(Application.Current.MainWindow, New EgtManageFileDialogVM()) With {
|
|
.Title = EgtMsg(91127), ' Importa
|
|
.Filter = "nge files (*.nge)|*.nge",
|
|
.FilterIndex = 1,
|
|
.InitialDirectory = sDir,
|
|
.Mode = 1
|
|
}
|
|
If Not ImportDialog.ShowDialog() = Windows.Forms.DialogResult.OK Then Return
|
|
If String.IsNullOrEmpty(ImportDialog.FileName) Then Return
|
|
|
|
Dim sFilePath As String = ImportDialog.FileName
|
|
Map.refSceneHostVM.MainController.InsertProject(sFilePath, False)
|
|
|
|
' rinomino il part aggiungendo un UUID
|
|
Dim nPart As Integer = EgtGetLastPart()
|
|
Dim sName As String = String.Empty
|
|
EgtGetName(nPart, sName)
|
|
Dim sUUID As String = ""
|
|
EgtLuaCallFunction("TOOL.GetNewUUID")
|
|
EgtLuaGetGlobStringVar("TOOL.UUID", sUUID)
|
|
If sName <> String.Empty Then
|
|
sName = sUUID & "_" & sName
|
|
Else
|
|
sName = sUUID & "_ImportedLoop"
|
|
End If
|
|
EgtSetName(nPart, sName)
|
|
Dim nRefLay As Integer = EgtCreateGroup(nPart)
|
|
EgtSetName(nRefLay, "Ref")
|
|
End Sub
|
|
|
|
Public Sub EnableActionButtons()
|
|
'If (m_nIdPart = GDB_ID.NULL) Then Return
|
|
|
|
''abilito i bottoni che possono eseguire delle azioni
|
|
'Dim PartSolidSel As PartSolid = GetPartSolid(m_nIdPart)
|
|
'If Not IsNothing(PartSolidSel) And PartSolidSel.IsPaired() Then
|
|
' UnpairBtn.IsEnabled = True
|
|
' ExplodeBtn.IsEnabled = True
|
|
' ExplodeNormalsBtn.IsEnabled = True
|
|
'End If
|
|
End Sub
|
|
|
|
Public Sub DisableActionButtons()
|
|
''disabilito tutti i bottoni che eseguono azioni sul pezzo selezionato
|
|
'UnpairBtn.IsEnabled = False
|
|
'ExplodeBtn.IsEnabled = False
|
|
'ExplodeNormalsBtn.IsEnabled = False
|
|
End Sub
|
|
|
|
Public Function DeselectAll() As Boolean
|
|
Dim bDeselected As Boolean = True
|
|
Dim nOriId As Integer = GDB_ID.NULL
|
|
For Each PartSolidSel In m_PartSolidList
|
|
'' deseleziono nel nesting
|
|
'EgtGetInfo(PartSolidSel.PartId, KEY_ORI_ID, nOriId)
|
|
'If EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) AndAlso EgtExistsObj(nOriId) Then
|
|
' If Not (OmagOFFICEMap.refNestingTabVM.DeselectPart(nOriId, False)) Then
|
|
' bDeselected = False
|
|
' End If
|
|
'End If
|
|
EgtSetCurrentContext(m_nVeinCtx)
|
|
PartSolidSel.DeselectPart()
|
|
Next
|
|
Map.refSceneHostVM.m_nIdPart = GDB_ID.NULL
|
|
DisableActionButtons()
|
|
Return bDeselected
|
|
End Function
|
|
|
|
Public Sub AddPanel(nId As Integer)
|
|
Dim NewPanelVM As NewPanelVM = DirectCast(Map.refSceneButtonVM.m_NewPanelUC.DataContext, NewPanelVM)
|
|
NewPanelVM.AddPanel(nId)
|
|
End Sub
|
|
|
|
Public Sub ExportProjectNge()
|
|
' creo una copia del contesto corrente
|
|
Dim sSavePath As String = "C:\EgtData\EgtStone3D\Temp\export.nge"
|
|
EgtSaveFile(sSavePath, 2)
|
|
Dim nTempContext As Integer = EgtInitContext()
|
|
' setto il contesto temporaneo come corrente
|
|
EgtSetCurrentContext(nTempContext)
|
|
EgtOpenFile(sSavePath)
|
|
|
|
Dim nPart As Integer = EgtGetFirstPart()
|
|
Dim HorizontalOffset As Double = 0
|
|
While nPart <> GDB_ID.NULL
|
|
Dim nNextPart As Integer = EgtGetNext(nPart)
|
|
Dim sName As String = String.Empty
|
|
EgtGetName(nPart, sName)
|
|
If sName = "SOLID" Then
|
|
EgtErase(nPart)
|
|
Else
|
|
' accendo il part e il layer della regione
|
|
EgtSetStatus(nPart, GDB_ST.ON_)
|
|
Dim nRefLay As Integer = EgtGetFirstNameInGroup(nPart, "Region")
|
|
EgtSetStatus(nRefLay, GDB_ST.ON_)
|
|
' riporto il part nell'origine
|
|
EgtChangeGroupFrame(nPart, New Frame3d())
|
|
' lo posiziono affiancato agli altri
|
|
Dim vtMove As New Vector3d(HorizontalOffset, 0, 0)
|
|
EgtMove(nPart, vtMove, GDB_RT.GLOB)
|
|
Dim BBox As New BBox3d
|
|
EgtGetBBoxGlob(nPart, 0, BBox)
|
|
HorizontalOffset += BBox.DimX + 5
|
|
' pulisco le info di accoppiamento
|
|
EgtSetInfo(nPart, "Paired", "")
|
|
End If
|
|
nPart = nNextPart
|
|
End While
|
|
|
|
Dim nInfoLay As Integer = EgtCreateGroup(GDB_ID.ROOT)
|
|
EgtSetLevel(nInfoLay, GDB_LV.SYSTEM)
|
|
EgtSetName(nInfoLay, "EgtStone3D")
|
|
EgtSaveFile(sSavePath, 2)
|
|
|
|
' reimposto il contesto della scena principale e cancello il contesto temporaneo
|
|
EgtSetCurrentContext(SolidManagerM.m_nVeinCtx)
|
|
EgtDeleteContext(nTempContext)
|
|
End Sub
|
|
|
|
#End Region ' Methods
|
|
|
|
End Module
|
|
|
|
' ------------------------------ SPLITCONVERTER ------------------------------
|
|
|
|
Public Class SplitConverter
|
|
Implements IValueConverter
|
|
|
|
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
|
|
Dim sParam() As String = DirectCast(parameter, TextBlock).Text.Split("_"c)
|
|
Dim dParam As Double = CDbl(Map.refSceneButtonVM.TopPanelListGroupBtn(CInt(sParam(1))).TopPanelListBtn.Count()) + 1
|
|
Return (Math.Floor(dParam / 2)) * 35
|
|
End Function
|
|
|
|
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
|
|
Throw New NotImplementedException
|
|
End Function
|
|
|
|
End Class |