90db656549
- Aggiunti componenti parametrici con anche componenti interni.
152 lines
7.0 KiB
VB.net
152 lines
7.0 KiB
VB.net
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class CompoSceneHostV
|
|
|
|
Private m_SelFromScene As Boolean = False
|
|
Friend ReadOnly Property SelFromScene As Boolean
|
|
Get
|
|
Return m_SelFromScene
|
|
End Get
|
|
End Property
|
|
|
|
Sub New()
|
|
' This call is required by the designer.
|
|
InitializeComponent()
|
|
' Creo riferimento a questa classe in CompoWindowMap
|
|
CompoWindowMap.SetRefCompoSceneHostV(Me)
|
|
' Inizializzazione Scena
|
|
PreInitializeScene()
|
|
CompoScene.Init()
|
|
PostInitializeScene()
|
|
' Imposto stato gestione mouse diretto della scena a nessuno
|
|
CompoScene.SetStatusNull()
|
|
EgtNewFile()
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
Private Sub PreInitializeScene()
|
|
' imposto colore di default
|
|
Dim DefColor As New Color3d(0, 0, 0)
|
|
GetMainPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor)
|
|
CompoScene.SetDefaultMaterial(DefColor)
|
|
' imposto colori sfondo
|
|
Dim BackTopColor As New Color3d(192, 192, 192)
|
|
GetMainPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor)
|
|
Dim BackBotColor As New Color3d(BackTopColor)
|
|
GetMainPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor)
|
|
CompoScene.SetViewBackground(BackTopColor, BackBotColor)
|
|
' imposto colore di evidenziazione
|
|
Dim MarkColor As New Color3d(255, 255, 0)
|
|
GetMainPrivateProfileColor(S_SCENE, K_MARK, MarkColor)
|
|
CompoScene.SetMarkMaterial(MarkColor)
|
|
' imposto colore per superfici selezionate
|
|
Dim SelSurfColor As New Color3d(255, 255, 192)
|
|
GetMainPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor)
|
|
CompoScene.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)
|
|
CompoScene.SetZoomWinAttribs(bOutline, ZwColor)
|
|
' imposto colore della linea di distanza
|
|
Dim DstLnColor As New Color3d(255, 0, 0)
|
|
GetMainPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor)
|
|
CompoScene.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)
|
|
CompoScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits)
|
|
End Sub
|
|
|
|
Private Sub PostInitializeScene()
|
|
' imposto tipo coordinate
|
|
CompoScene.SetGridCursorPos(True)
|
|
' modo di visualizzazione
|
|
Dim nShowMode As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWMODE, SM.SHADING)
|
|
EgtSetShowMode(DirectCast(nShowMode, SM))
|
|
' visualizzazione avanzata dei triangoli costituenti le superfici
|
|
Dim bShowTriaAdv As Boolean = (GetMainPrivateProfileInt(S_SCENE, K_SHOWTRIAADV, 1) <> 0)
|
|
EgtSetShowTriaAdv(bShowTriaAdv)
|
|
' tipo visualizzazione per Zmap
|
|
Dim nShowZmap As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWZMAP, 1)
|
|
EgtSetShowZmap(DirectCast(nShowZmap, ZSM), False)
|
|
' dati di griglia
|
|
Dim dSnapStep As Double = If(EgtUiUnitsAreMM(),
|
|
GetMainPrivateProfileDouble(S_GRID, K_SNAPSTEP, 10),
|
|
GetMainPrivateProfileDouble(S_GRID, K_SNAPSTEPINCH, 12.7))
|
|
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 New Color3d(160, 160, 160)
|
|
GetMainPrivateProfileColor(S_GRID, K_MINLNCOLOR, MinLnColor)
|
|
Dim MajLnColor As New Color3d(160, 160, 160)
|
|
GetMainPrivateProfileColor(S_GRID, K_MAJLNCOLOR, MajLnColor)
|
|
EgtSetGridFrame(Frame3d.GLOB)
|
|
EgtSetGridGeo(dSnapStep, nMinLineSStep, nMajLineSStep, nExtSStep)
|
|
EgtSetGridColor(MinLnColor, MajLnColor)
|
|
Dim bShowGrid As Boolean = (GetMainPrivateProfileInt(S_GRID, K_SHOWGRID, 1) <> 0)
|
|
EgtSetGridShow(bShowGrid, False)
|
|
End Sub
|
|
|
|
#Region "EVENTS"
|
|
|
|
Private Sub OnMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles CompoScene.OnMouseDownScene
|
|
' Si può selezionare solo con il tasto sinistro e se stato NULL
|
|
If e.Button <> Windows.Forms.MouseButtons.Left Or Not CompoScene.IsStatusNull() Then
|
|
Return
|
|
End If
|
|
' Si può selezionare solo se non si sta già editando un componente
|
|
If CompoWindowMap.refCompoWindowVM.CompoPage <> CompoWindowVM.CompoPageOpt.LIST Or IsNothing(CompoWindowMap.refCompoWindowVM.m_SelCompoFamily) Then
|
|
Return
|
|
End If
|
|
' Verifico se selezionato indicativo di componente (wall, door o window)
|
|
EgtSetObjFilterForSelWin(True, True, True, True, True)
|
|
Dim nSel As Integer
|
|
EgtSelect(e.Location, 2 * Scene.DIM_SEL, 2 * Scene.DIM_SEL, nSel)
|
|
Dim sCompo As String = String.Empty
|
|
Dim nId As Integer = EgtGetFirstObjInSelWin()
|
|
While nId <> GDB_ID.NULL
|
|
If EgtGetInfo(nId, CompoParamPageVM.INFO_CMP, sCompo) Then
|
|
Exit While
|
|
End If
|
|
nId = EgtGetNextObjInSelWin()
|
|
End While
|
|
If String.IsNullOrWhiteSpace(sCompo) Then Return
|
|
' Attivo stato selezione da scena
|
|
m_SelFromScene = True
|
|
' Salvo l'indice della superficie di selezione
|
|
Dim nSurfSelId As Integer = nId
|
|
' Recupero l'indice del componente
|
|
Dim sName As String = String.Empty
|
|
If Not EgtGetName(nId, sName) Then Return
|
|
Dim nCmp As Integer = -1
|
|
If Not StringToInt(sName, nCmp) Then Return
|
|
CompoWindowMap.refCompoWindowVM.m_SelInternalCompo = CompoWindowMap.refCompoListPageVM.CompoList.First(Function(x) x.LuaPath = sCompo & ".lua")
|
|
CompoWindowMap.refCompoWindowVM.CompoPage = CompoWindowVM.CompoPageOpt.PARAM
|
|
CompoWindowMap.refCompoParamPageVM.ReadSelInternalVariables(nId)
|
|
' Imposto l'indice del componente
|
|
If Not EgtLuaSetGlobIntVar(CompoParamPageVM.LUA_CMP_INDEX, nCmp) Then Return
|
|
' Evidenzio la sua regione di selezione
|
|
EgtSelectObj(nSurfSelId)
|
|
' Rendo visibili le eventuali etichette del componente
|
|
Dim nHLId As Integer = EgtGetFirstNameInGroup(EgtGetFirstGroupInGroup(GDB_ID.ROOT), "HoleLabels")
|
|
While nHLId <> GDB_ID.NULL
|
|
Dim nCmpInfo As Integer = 0
|
|
If EgtGetInfo(nHLId, "ID", nCmpInfo) AndAlso nCmp = nCmpInfo Then
|
|
EgtSetStatus(nHLId, GDB_ST.ON_)
|
|
Exit While
|
|
End If
|
|
nHLId = EgtGetNextName(nHLId, "HoleLabels")
|
|
End While
|
|
CompoScene.ZoomAll()
|
|
' Disattivo stato selezione da scena
|
|
m_SelFromScene = False
|
|
End Sub
|
|
|
|
#End Region ' Events
|
|
|
|
End Class
|