169 lines
7.8 KiB
VB.net
169 lines
7.8 KiB
VB.net
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
Imports System.IO
|
|
|
|
Public Class MySceneHostVM
|
|
Inherits SceneHostVM
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
MyBase.New()
|
|
AssLogM.InitAssLog()
|
|
End Sub
|
|
|
|
#End Region ' Constructor
|
|
|
|
#Region "METHODS"
|
|
|
|
Overrides Sub InitScene()
|
|
' Inizializzazione Scena
|
|
PreInitializeScene()
|
|
' Se tutto bene
|
|
'If MainScene.Init() And Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.BASE) Then
|
|
If MainScene.Init() Then
|
|
PostInitializeScene()
|
|
' modo di visualizzazione
|
|
EgtSetView(VT.ISO_SE)
|
|
' Imposto stato gestione mouse diretto della scena a nessuno
|
|
MainScene.SetStatusNull()
|
|
'MainScene.SetStatusAnalyze() ' debug
|
|
EgtSetCurrentContext(MainScene.GetCtx())
|
|
Return
|
|
End If
|
|
'' Problemi
|
|
'' Se manca la chiave
|
|
'If Map.refMainWindowVM.MainWindowM.nKeyLevel = -1 Or Map.refMainWindowVM.MainWindowM.nKeyLevel = -2 Then
|
|
' EgtOutLog("Missing Dongle")
|
|
' ' Box di avviso chiave mancante : "Chiave non presente. \n Inserirla e riavviare il programma." "Errore"
|
|
' Dim sText As String = EgtMsg(10102) & vbCrLf & EgtMsg(10103)
|
|
' Dim sTitle As String = EgtMsg(10101)
|
|
' MessageBox.Show(sText, sTitle, MessageBoxButton.OK, MessageBoxImage.Error)
|
|
' ' Altrimenti manca la licenza
|
|
'Else
|
|
' EgtOutLog("Problems with Licence")
|
|
' ' Box di avviso licenza con problemi : "Programma senza licenza. \n Caricala e riavvia il programma." "Errore"
|
|
' Dim sText As String = EgtMsg(10105) & vbCrLf & EgtMsg(10106)
|
|
' Dim sTitle As String = EgtMsg(10101)
|
|
' If MessageBox.Show(sText, sTitle, MessageBoxButton.OKCancel, MessageBoxImage.Error) = MessageBoxResult.OK Then
|
|
' ' Apro dialogo per richiesta file licenza
|
|
' Dim LicDlg As New Microsoft.Win32.OpenFileDialog() With {
|
|
' .DefaultExt = ".lic",
|
|
' .Filter = "Licences (.lic)|*.lic",
|
|
' .CheckFileExists = True,
|
|
' .ValidateNames = True
|
|
' }
|
|
' If LicDlg.ShowDialog() = True Then
|
|
' ' Recupero il direttorio del file
|
|
' 'Dim sDir As String = Path.GetDirectoryName(LicDlg.FileName)
|
|
' Dim sDir As String = LicDlg.FileName
|
|
' ' Se il file non è già nel direttorio di configurazione lo copio
|
|
' If Not String.Equals(Path.GetFullPath(sDir), Path.GetFullPath(Map.refMainWindowVM.MainWindowM.sConfigDir), StringComparison.OrdinalIgnoreCase) Then
|
|
' Try
|
|
' File.Copy(LicDlg.FileName, Path.Combine(Map.refMainWindowVM.MainWindowM.sConfigDir, LicDlg.SafeFileName), True)
|
|
' Catch ex As Exception
|
|
' End Try
|
|
' End If
|
|
' ' Imposto il nuovo file di licenza nell'Ini
|
|
' WriteMainPrivateProfileString(S_GENERAL, K_LICENCE, LicDlg.SafeFileName)
|
|
' End If
|
|
' End If
|
|
' End If
|
|
'' Chiudo il programma
|
|
'End
|
|
End Sub
|
|
|
|
Private Sub PreInitializeScene()
|
|
' imposto colore di default
|
|
Dim DefColor As New Color3d(0, 0, 0)
|
|
GetMainPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor)
|
|
MainScene.SetDefaultMaterial(DefColor)
|
|
' imposto colori sfondo
|
|
Dim BackTopColor As New Color3d(0, 123, 167)
|
|
GetMainPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor)
|
|
Dim BackBotColor As New Color3d(BackTopColor)
|
|
GetMainPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor)
|
|
MainScene.SetViewBackground(BackTopColor, BackBotColor)
|
|
' imposto spessore linee
|
|
Dim nLineWidth As Integer = 1
|
|
nLineWidth = GetMainPrivateProfileInt(S_SCENE, K_LINEWIDTH, nLineWidth)
|
|
MainScene.SetLineWidth(nLineWidth)
|
|
' imposto colore di evidenziazione
|
|
Dim MarkColor As New Color3d(255, 255, 0)
|
|
GetMainPrivateProfileColor(S_SCENE, K_MARK, MarkColor)
|
|
MainScene.SetMarkMaterial(MarkColor)
|
|
' imposto colore per superfici selezionate
|
|
Dim SelSurfColor As New Color3d(255, 255, 192)
|
|
GetMainPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor)
|
|
MainScene.SetSelSurfMaterial(SelSurfColor)
|
|
' imposto tipo e colore del rettangolo di zoom
|
|
Dim bOutline As Boolean = True
|
|
Dim ZwColor As New Color3d(0, 0, 0)
|
|
GetMainPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor)
|
|
MainScene.SetZoomWinAttribs(bOutline, ZwColor)
|
|
' imposto colore della linea di distanza
|
|
Dim DstLnColor As New Color3d(255, 0, 0)
|
|
GetMainPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor)
|
|
MainScene.SetDistLineMaterial(DstLnColor)
|
|
' imposto parametri OpenGL
|
|
Dim nDriver As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DRIVER, 3)
|
|
Dim b2Buff As Boolean = (GetMainPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1) <> 0)
|
|
Dim nColorBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_COLORBITS, 32)
|
|
Dim nDepthBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32)
|
|
MainScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits)
|
|
End Sub
|
|
|
|
Private Sub PostInitializeScene()
|
|
' Impostazioni Controller
|
|
MainController.SetScene(MainScene)
|
|
MainController.SetSurfTmTolerance(0.05)
|
|
MainController.SetUseCustomColors(True, S_SCENE, K_CUSTOMCOLORS)
|
|
' imposto unità di misura per interfaccia utente
|
|
Dim bMmUnits As Boolean = GetMainPrivateProfileInt(S_SCENE, K_MMUNITS, 1) <> 0
|
|
EgtSetUiUnits(bMmUnits)
|
|
'Map.refMyStatusBarVM.SetMeasureUnit(nMeasureUnit <> 0)
|
|
' imposto visualizzazione riferimento globale
|
|
EgtSetGlobFrameShow(True)
|
|
' imposto i dati della griglia
|
|
Dim bGridVisibility As Boolean = (GetMainPrivateProfileInt(S_GRID, K_SHOWGRID, 1) <> 0)
|
|
Dim dSnapStepMm As Double = GetMainPrivateProfileDouble(S_GRID, K_SNAPSTEP, 10)
|
|
Dim dSnapStepInch As Double = GetMainPrivateProfileDouble(S_GRID, K_SNAPSTEPINCH, 10)
|
|
Dim nMinLineSStep As Integer = GetMainPrivateProfileInt(S_GRID, K_MINLINESSTEP, 1)
|
|
Dim nMajLineSStep As Integer = GetMainPrivateProfileInt(S_GRID, K_MAJLINESSTEP, 10)
|
|
Dim nExtSStep As Integer = GetMainPrivateProfileInt(S_GRID, K_EXTSSTEP, 50)
|
|
Dim MinLnColor As Color3d = New Color3d(160, 160, 160)
|
|
GetMainPrivateProfileColor(S_GRID, K_MINLNCOLOR, MinLnColor)
|
|
Dim MajLnColor As Color3d = New Color3d(160, 160, 160)
|
|
GetMainPrivateProfileColor(S_GRID, K_MAJLNCOLOR, MajLnColor)
|
|
EgtSetGridFrame(Frame3d.GLOB)
|
|
If bMmUnits Then
|
|
EgtSetGridGeo(dSnapStepMm, nMinLineSStep, nMajLineSStep, nExtSStep)
|
|
Else
|
|
EgtSetGridGeo(dSnapStepInch, nMinLineSStep, nMajLineSStep, nExtSStep)
|
|
End If
|
|
EgtSetGridColor(MinLnColor, MajLnColor)
|
|
EgtSetGridShow(bGridVisibility, bGridVisibility)
|
|
' imposto tipo coordinate
|
|
MainScene.SetGridCursorPos(True)
|
|
' visualizzazione avanzata dei triangoli costituenti le superfici
|
|
Dim bShowTriaAdv As Boolean = (GetMainPrivateProfileInt(S_SCENE, K_SHOWTRIAADV, 1) <> 0)
|
|
EgtSetShowTriaAdv(bShowTriaAdv)
|
|
' visualizzazione direzione curve
|
|
Dim bShowCurveDirection As Boolean = (GetMainPrivateProfileInt(S_SCENE, K_CURVEDIR, 0) <> 0)
|
|
EgtSetShowCurveDirection(bShowCurveDirection)
|
|
' tipo visualizzazione per Zmap
|
|
Dim nShowZmap As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWZMAP, 1)
|
|
EgtSetShowZmap(DirectCast(nShowZmap, ZSM), False)
|
|
' dimensione lineare max in pixel delle textures
|
|
Dim nTxrMaxLinPix As Integer = GetMainPrivateProfileInt(S_SCENE, K_TEXMAXLINPIX, 4096)
|
|
EgtSetTextureMaxLinPixels(nTxrMaxLinPix)
|
|
' tipo snap point
|
|
MainScene.SetSnapPointType(SP.PT_GRID)
|
|
' nascondo input box
|
|
'Map.refFreeContourInputVM.ResetInputBox()
|
|
End Sub
|
|
|
|
#End Region ' Methods
|
|
|
|
End Class
|