2e6f6216fa
- aggiornamento.
170 lines
6.4 KiB
VB.net
170 lines
6.4 KiB
VB.net
Imports System.Text
|
|
Imports EgtUILib.EgtInterface
|
|
Imports EgtUILib.GenInterface
|
|
|
|
Public Class Form1
|
|
|
|
Private m_sIniFile As String = String.Empty
|
|
|
|
Private Sub MainForm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
|
|
m_sIniFile = Application.StartupPath & "\EgtDemo1.ini"
|
|
'Inizializzazione generale di EgtInterface
|
|
EgtInit(0, "TestEngine.log")
|
|
Dim sKey As String = String.Empty
|
|
GetPrivateProfileString("General", "Key", "", sKey, m_sIniFile)
|
|
EgtSetKey(sKey)
|
|
' imposto dir font Nfe e font default
|
|
Dim sNfeDir As String = String.Empty
|
|
GetPrivateProfileString("GeomDB", "NfeFontDir", "", sNfeDir, m_sIniFile)
|
|
Dim sDefFont As String = String.Empty
|
|
GetPrivateProfileString("GeomDB", "DefaultFont", "", sDefFont, m_sIniFile)
|
|
EgtSetFont(sNfeDir, sDefFont)
|
|
' imposto direttorio di default per libreria Lua
|
|
Dim sLuaLibsDir As String = String.Empty
|
|
GetPrivateProfileString("Lua", "LibsDir", "", sLuaLibsDir, m_sIniFile)
|
|
EgtSetLuaLibs(sLuaLibsDir)
|
|
'Impostazioni particolari vista 2
|
|
Dim DefColor As New Color3d(128, 128, 0)
|
|
Scene2.SetDefaultMaterial(DefColor)
|
|
Scene2.SetViewAttributes(2, True, 16, 16)
|
|
Dim BackTopColor As New Color3d(255, 255, 255)
|
|
Dim BackBotColor As New Color3d(168, 168, 168)
|
|
Scene2.SetViewBackground(BackTopColor, BackBotColor)
|
|
'Inizializzazione delle viste
|
|
Scene1.Init()
|
|
'Eventuali impostazioni modificabili vista 1 (vanno fatte dopo Init)
|
|
Scene2.Init()
|
|
'Impostazioni modificabili vista 2 (vanno fatte dopo Init)
|
|
EgtSetMarkAttribs(New Color3d(128, 255, 255))
|
|
EgtSetGeoLineAttribs(New Color3d(0, 255, 0))
|
|
EgtSetWinRectAttribs(False, New Color3d(255, 128, 128, 30))
|
|
EgtSetGridShow(True, True)
|
|
'Attiva scena 1
|
|
OnMouseDownScene(Scene1)
|
|
'Posizione e dimensioni del Form
|
|
If ModifierKeys <> Keys.Shift Then
|
|
Dim nFlag As Integer
|
|
Dim nLeft As Integer
|
|
Dim nTop As Integer
|
|
Dim nWidth As Integer
|
|
Dim nHeight As Integer
|
|
GetPrivateProfileWinPos("General", "WinPlace", nFlag, nLeft, nTop, nWidth, nHeight, m_sIniFile)
|
|
Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
|
|
Me.Location = New Point(nLeft, nTop)
|
|
Me.Size = New Size(nWidth, nHeight)
|
|
WindowState = IIf(nFlag = 1, FormWindowState.Maximized, FormWindowState.Normal)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub MainForm_FormClosing(sender As System.Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
|
|
'Salvo posizione Form
|
|
Dim nFlag As Integer = IIf(Me.WindowState = FormWindowState.Maximized, 1, 0)
|
|
WritePrivateProfileWinPos("General", "WinPlace", nFlag, Me.Left, Me.Top, Me.Width, Me.Height, m_sIniFile)
|
|
'Terminazione generale di EgtInterface
|
|
EgtExit()
|
|
End Sub
|
|
|
|
Private Sub OnMouseSelectedObj(ByVal sender As Object, ByVal nId As Integer, ByVal bLast As Boolean) Handles Scene1.OnMouseSelectedObj, Scene2.OnMouseSelectedObj
|
|
If EgtIsSelectedObj(nId) Then
|
|
EgtDeselectObj(nId)
|
|
Else
|
|
EgtSelectObj(nId)
|
|
End If
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
Private Sub OnMouseSelectedPart(ByVal sender As Object, ByVal nId As Integer) Handles Scene1.OnMouseSelectedPart
|
|
' recupero il pezzo
|
|
Dim nPartId = EgtGetParent(EgtGetParent(nId))
|
|
If EgtGetParent(nPartId) <> GDB_ID.ROOT Then
|
|
Return
|
|
End If
|
|
' eseguo la selezione ed aggiorno
|
|
EgtSelectPartObjs(nPartId)
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
Private Sub OnMouseSelectedLayer(ByVal sender As Object, ByVal nId As Integer) Handles Scene1.OnMouseSelectedLayer
|
|
' recupero il layer
|
|
Dim nLayerId = EgtGetParent(nId)
|
|
If EgtGetParent(EgtGetParent(nLayerId)) <> GDB_ID.ROOT Then
|
|
Return
|
|
End If
|
|
' eseguo la selezione ed aggiorno
|
|
EgtSelectLayerObjs(nLayerId)
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
Private Sub OnMouseAnalyzed(ByVal sender As Object, ByVal nId As Integer) Handles Scene1.OnMouseAnalyzed, Scene2.OnMouseAnalyzed
|
|
Dim sOut As String = String.Empty
|
|
If (EgtGeoObjDump(nId, sOut)) Then
|
|
EgtSetMark(nId)
|
|
EgtDraw()
|
|
Dim AnalDlg As New AnalyzeDlg
|
|
AnalDlg.SetText(sOut)
|
|
AnalDlg.ShowDialog()
|
|
End If
|
|
EgtResetMark(nId)
|
|
EgtDraw()
|
|
TsInfo1.btnAnalyze.Checked = False
|
|
sender.ResetStatusAnalyze()
|
|
End Sub
|
|
|
|
Private Sub OnMouseDownScene(ByVal sender As Object) Handles Scene1.OnMouseDownScene, Scene2.OnMouseDownScene
|
|
If sender.GetCtx() = 1 Then
|
|
RadioButton1.Checked = True
|
|
Else
|
|
RadioButton2.Checked = True
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) Handles Scene1.OnCursorPos, Scene2.OnCursorPos
|
|
If sender.GetCtx() = 1 Then
|
|
StatusCoord1.Text = sCursorPos
|
|
Else
|
|
StatusCoord2.Text = sCursorPos
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub OnShowDistance(ByVal sender As Object, ByVal sDistance As String) Handles Scene1.OnShowDistance, Scene2.OnShowDistance
|
|
If sender.GetCtx() = 1 Then
|
|
StatusOutput1.Text = sDistance
|
|
Else
|
|
StatusOutput2.Text = sDistance
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub OnCloseGetDist1(ByVal sender As Object) Handles Scene1.OnCloseGetDist, Scene2.OnCloseGetDist
|
|
If sender.GetCtx() = 1 Then
|
|
StatusOutput1.Text = " "
|
|
Else
|
|
StatusOutput2.Text = " "
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub RadioButton1_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButton1.CheckedChanged
|
|
TsInfo1.btnGetDist.Checked = False
|
|
TsInfo1.btnAnalyze.Checked = False
|
|
If RadioButton1.Checked Then
|
|
EnableView(Scene1)
|
|
Else
|
|
EnableView(Scene2)
|
|
End If
|
|
Dim nShowMode As Integer = EgtGetShowMode()
|
|
TsRendering1.btnWireframe.Checked = (nShowMode = SM.WIREFRAME)
|
|
TsRendering1.btnHiddenLine.Checked = (nShowMode = SM.HIDDENLINE)
|
|
TsRendering1.btnShading.Checked = (nShowMode = SM.SHADING)
|
|
End Sub
|
|
|
|
Private Sub EnableView(ByRef scene As EgtUILib.Scene)
|
|
EgtSetCurrentContext(scene.GetCtx())
|
|
TsMain1.SetScene(scene)
|
|
TsRendering1.SetScene(scene)
|
|
TsLookFrom1.SetScene(scene)
|
|
TsZoom1.SetScene(scene)
|
|
TsExec1.SetScene(scene)
|
|
TsInfo1.SetScene(scene)
|
|
End Sub
|
|
|
|
End Class
|