Files
egtbeamwall/EgtBEAMWALL.Core/BTLViewModel/BTLFeatureVM.vb
T
Demetrio Cassarino a12ab8f531 -pulizia codice
2024-06-13 17:36:10 +02:00

256 lines
6.4 KiB
VB.net

Imports System.Windows
Imports System.Windows.Media
Imports EgtUILib
Imports EgtWPFLib5
Public Class BTLFeatureVM
Inherits VMBase
Protected WithEvents m_BTLFeatureM As BTLFeatureM
Public ReadOnly Property BTLFeatureM As BTLFeatureM
Get
Return m_BTLFeatureM
End Get
End Property
Protected m_BTLPartM As BTLPartM
Public ReadOnly Property nFeatureId As Integer
Get
Return m_BTLFeatureM.nFeatureId
End Get
End Property
Public Overridable Property nSelGRP As Integer
Get
Return m_BTLFeatureM.nSelGRP
End Get
Set(value As Integer)
m_BTLFeatureM.nSelGRP = value
End Set
End Property
Public ReadOnly Property sDescGRP As String
Get
Dim sDescConstruction As String = String.Empty
If CalcBeamPrivateProfileGRP(m_BTLFeatureM.nSelGRP) = 0 Then
sDescConstruction = "L"
Else
sDescConstruction = "T"
End If
sDescConstruction &= m_BTLFeatureM.nPRC.ToString("000")
Return sDescConstruction
End Get
End Property
Public Property nPRC As Integer
Get
Return m_BTLFeatureM.nPRC
End Get
Set(value As Integer)
m_BTLFeatureM.nPRC = value
End Set
End Property
' Lato
Public Overridable Property nSelSIDE As Integer
Get
Return m_BTLFeatureM.nSelSIDE
End Get
Set(value As Integer)
m_BTLFeatureM.nSelSIDE = value
End Set
End Property
Public ReadOnly Property sName As String
Get
Return m_BTLFeatureM.sName
End Get
End Property
Public Overridable Property bDO As Boolean
Get
Return m_BTLFeatureM.bDO
End Get
Set(value As Boolean)
m_BTLFeatureM.bDO = value
End Set
End Property
Public Property nPRID As Integer
Get
Return m_BTLFeatureM.nPRID
End Get
Set(value As Integer)
m_BTLFeatureM.nPRID = value
End Set
End Property
Public Property sDES As String
Get
Return m_BTLFeatureM.sDES
End Get
Set(value As String)
m_BTLFeatureM.sDES = value
End Set
End Property
Public Property frFRAME As Frame3d
Get
Return m_BTLFeatureM.frFRAME
End Get
Set(value As Frame3d)
m_BTLFeatureM.frFRAME = value
End Set
End Property
' proprieta' che mostra la descrizione in interfaccia
Public ReadOnly Property sDesc As String
Get
Return sDescGRP & " [" & nPRID & "] " & sName
End Get
End Property
Public ReadOnly Property nState As CalcStates
Get
Return m_BTLFeatureM.nState
End Get
End Property
Public ReadOnly Property nCALC_ERR As Integer
Get
Return m_BTLFeatureM.nCALC_ERR
End Get
End Property
Public ReadOnly Property nCALC_ROT As Integer
Get
Return m_BTLFeatureM.nCALC_ROT
End Get
End Property
Public ReadOnly Property sCALC_MSG As String
Get
Return m_BTLFeatureM.sCALC_MSG
End Get
End Property
Public ReadOnly Property Calc_Background As SolidColorBrush
Get
If Not m_BTLFeatureM.bDO Then Return Brushes.Aqua
Select Case m_BTLFeatureM.nState
Case CalcStates.ERROR_, CalcStates.COLLISION
Return Brushes.Red
Case CalcStates.WARNING
Return Brushes.Orange
Case CalcStates.INFO, CalcStates.OK
Return Brushes.Green
Case CalcStates.NOTCALCULATED
Return Brushes.LightGray
Case Else
Return Brushes.Red
End Select
End Get
End Property
Public ReadOnly Property CALC_ROT_Visibility As Visibility
Get
Return If(m_BTLFeatureM.nCALC_ROT <> 0, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
Public ReadOnly Property CALC_ERR_Letter As String
Get
Select Case m_BTLFeatureM.nState
Case CalcStates.COLLISION
Return "c"
Case CalcStates.ERROR_
Return "e"
Case CalcStates.WARNING
Return "w"
Case CalcStates.INFO
Return "i"
Case Else
Return ""
End Select
End Get
End Property
Public ReadOnly Property CALC_ERR_Foreground As SolidColorBrush
Get
Select Case m_BTLFeatureM.nState
Case CalcStates.ERROR_, CalcStates.COLLISION
Return Brushes.Red
Case CalcStates.WARNING
Return Brushes.Orange
Case CalcStates.INFO
Return Brushes.Green
Case Else
Return Brushes.Red
End Select
End Get
End Property
' variabile che indica se rifare il pezzo
Private m_bRedo As Boolean = True
Public Property bRedo As Boolean
Get
Return m_bRedo
End Get
Set(value As Boolean)
m_bRedo = value
End Set
End Property
#Region "CONSTRUCTOR"
Sub New()
End Sub
Sub New(BTLFeatureM As BTLFeatureM)
m_BTLFeatureM = BTLFeatureM
m_BTLPartM = Nothing
NotifyPropertyChanged(NameOf(Calc_Background))
NotifyPropertyChanged(NameOf(CALC_ROT_Visibility))
NotifyPropertyChanged(NameOf(CALC_ERR_Letter))
NotifyPropertyChanged(NameOf(CALC_ERR_Foreground))
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
' funzione che seleziona la feature nella geometria
Public Sub SelGeomFeature()
EgtDeselectAll()
SelGeomFeature(nFeatureId)
End Sub
Private Sub SelGeomFeature(nMyFeatureId As Integer)
EgtSelectObj(nMyFeatureId)
Dim sVal As String = ""
If EgtGetInfo(nMyFeatureId, BTL_FTR_ADJID, sVal) Then
Dim vAdjId() As String = sVal.Split(","c)
For Each sAdjId In vAdjId
Dim nAdjId As Integer
If Integer.TryParse(sAdjId, nAdjId) Then
SelGeomFeature(nMyFeatureId + nAdjId)
End If
Next
End If
If EgtGetInfo(nMyFeatureId, BTL_FTR_AUXID, sVal) Then
Dim vAuxId() As String = sVal.Split(","c)
For Each sAuxId In vAuxId
Dim nAuxId As Integer
If Integer.TryParse(sAuxId, nAuxId) Then
EgtSelectObj(nMyFeatureId + nAuxId)
End If
Next
End If
End Sub
Public Overridable Sub RefreshFeature()
End Sub
#End Region ' METHODS
End Class