Files
icarus/Icarus/TSFEditor/TFSEditorVM.vb
Emmanuele Sassi 60758454ed - aggiunto FeedIncrement
- migliorata gestione colore sfondo con wait
2022-12-27 13:37:21 +01:00

915 lines
28 KiB
VB.net

Imports System.Collections.ObjectModel
Imports System.Collections.Specialized
Imports System.Windows.Threading
Imports EgtUILib
Imports EgtWPFLib5
Public Class TFSEditorVM
Inherits VMBase
Private m_Selection_Timer As New DispatcherTimer
Private m_bCollectionChanging As Boolean = False
#Region "FIELDS & PROPERTIES"
Public Enum MediaTypes As Integer
HEIGHT = 1
SECTIONCHANGE = 2
SELECTION = 3
SELECTION_WAIT = 4
FEED_INCREMENT = 5
End Enum
Public Enum Filters As Integer
NULL = 0
TIME_LOWER = 1
TIME_OK = 2
TIME_UPPER = 3
SPEED_MIN = 4
SPEED_MAX = 5
End Enum
Private m_dSpeedMin As Double
Public ReadOnly Property dSpeedMin As Double
Get
Return m_dSpeedMin
End Get
End Property
Private m_dSpeedMax As Double
Public ReadOnly Property dSpeedMax As Double
Get
Return m_dSpeedMax
End Get
End Property
Private m_LayerList_View As CollectionView = Nothing
Private m_LayerList As New ObservableCollection(Of TFSLayer)
Public ReadOnly Property LayerList As ObservableCollection(Of TFSLayer)
Get
Return m_LayerList
End Get
End Property
Private m_SelLayers As New ObservableCollection(Of TFSLayer)
Public Property SelLayers As ObservableCollection(Of TFSLayer)
Get
Return m_SelLayers
End Get
Set(value As ObservableCollection(Of TFSLayer))
m_SelLayers = value
End Set
End Property
Private m_MediaTypeList As New List(Of String)({"Slice Number", "Section change", "Selection", "Selection Wait", "Feed Increment"})
Public ReadOnly Property MediaTypeList As List(Of String)
Get
Return m_MediaTypeList
End Get
End Property
Private m_nSelMediaType As MediaTypes
Public Property ghSelMediaType As Integer
Get
Return m_nSelMediaType - 1
End Get
Set(value As Integer)
m_nSelMediaType = value + 1
Select Case m_nSelMediaType
Case MediaTypes.HEIGHT
SetMediaHeightVisibility(True)
SetFCurrVisibility(False)
SetDifference_Visibility(False)
SetWaitVisibility(False)
SetFeedIncrementVisibility(False)
SetSetVisibility(False)
SetMediaVisibility(True)
Case MediaTypes.SECTIONCHANGE
SetMediaHeightVisibility(False)
SetFCurrVisibility(False)
SetDifference_Visibility(True)
SetWaitVisibility(False)
SetFeedIncrementVisibility(False)
SetSetVisibility(False)
SetMediaVisibility(True)
Case MediaTypes.SELECTION
SetMediaHeightVisibility(False)
SetFCurrVisibility(True)
SetDifference_Visibility(False)
SetWaitVisibility(False)
SetFeedIncrementVisibility(False)
SetSetVisibility(True)
SetMediaVisibility(True)
Case MediaTypes.SELECTION_WAIT
SetMediaHeightVisibility(False)
SetFCurrVisibility(False)
SetDifference_Visibility(False)
SetWaitVisibility(True)
SetFeedIncrementVisibility(False)
SetSetVisibility(True)
SetMediaVisibility(False)
Case MediaTypes.FEED_INCREMENT
SetMediaHeightVisibility(False)
SetFCurrVisibility(False)
SetDifference_Visibility(False)
SetWaitVisibility(False)
SetFeedIncrementVisibility(True)
SetSetVisibility(True)
SetMediaVisibility(False)
End Select
End Set
End Property
Private m_nMediaHeight As Integer
Public Property sMediaHeight As String
Get
Return m_nMediaHeight
End Get
Set(value As String)
Dim nNewValue As Integer = 0
If Integer.TryParse(value, nNewValue) Then
m_nMediaHeight = nNewValue
Else
NotifyPropertyChanged(NameOf(sMediaHeight))
End If
End Set
End Property
Private m_MediaHeight_Visibility As Visibility
Public ReadOnly Property MediaHeight_Visibility As Visibility
Get
Return m_MediaHeight_Visibility
End Get
End Property
Private Sub SetMediaHeightVisibility(bValue As Boolean)
m_MediaHeight_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
NotifyPropertyChanged(NameOf(MediaHeight_Visibility))
End Sub
Private m_nDifference As Integer
Public Property sDifference As String
Get
Return m_nDifference
End Get
Set(value As String)
Dim nNewValue As Integer = 0
If Integer.TryParse(value, nNewValue) Then
m_nDifference = nNewValue
Else
NotifyPropertyChanged(NameOf(sDifference))
End If
End Set
End Property
Private m_Difference_Visibility As Visibility = Visibility.Collapsed
Public ReadOnly Property Difference_Visibility As Visibility
Get
Return m_Difference_Visibility
End Get
End Property
Private Sub SetDifference_Visibility(bValue As Boolean)
m_Difference_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
NotifyPropertyChanged(NameOf(Difference_Visibility))
End Sub
Private m_dFCurr As Double
Public Property sFCurr As String
Get
Return LenToString(m_dFCurr, 2)
End Get
Set(value As String)
Dim nNewValue As Integer = 0
If StringToLen(value, nNewValue) Then
m_dFCurr = nNewValue
Else
NotifyPropertyChanged(NameOf(sFCurr))
End If
End Set
End Property
Private m_FCurr_Visibility As Visibility = Visibility.Collapsed
Public ReadOnly Property FCurr_Visibility As Visibility
Get
Return m_FCurr_Visibility
End Get
End Property
Private Sub SetFCurrVisibility(bValue As Boolean)
m_FCurr_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
NotifyPropertyChanged(NameOf(FCurr_Visibility))
End Sub
Private m_dWait As Double
Public Property sWait As String
Get
Return LenToString(m_dWait, 2)
End Get
Set(value As String)
Dim nNewValue As Integer = 0
If StringToLen(value, nNewValue) Then
m_dWait = nNewValue
Else
NotifyPropertyChanged(NameOf(sWait))
End If
End Set
End Property
Private m_Wait_Visibility As Visibility = Visibility.Collapsed
Public ReadOnly Property Wait_Visibility As Visibility
Get
Return m_Wait_Visibility
End Get
End Property
Private Sub SetWaitVisibility(bValue As Boolean)
m_Wait_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
NotifyPropertyChanged(NameOf(Wait_Visibility))
End Sub
Private m_dFeedIncrement As Double
Public Property sFeedIncrement As String
Get
Return DoubleToString(m_dFeedIncrement, 0)
End Get
Set(value As String)
Dim nNewValue As Integer = 0
If StringToLen(value, nNewValue) Then
m_dFeedIncrement = nNewValue
Else
NotifyPropertyChanged(NameOf(sFeedIncrement))
End If
End Set
End Property
Private m_FeedIncrement_Visibility As Visibility = Visibility.Collapsed
Public ReadOnly Property FeedIncrement_Visibility As Visibility
Get
Return m_FeedIncrement_Visibility
End Get
End Property
Private Sub SetFeedIncrementVisibility(bValue As Boolean)
m_FeedIncrement_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
NotifyPropertyChanged(NameOf(FeedIncrement_Visibility))
End Sub
Private m_Media_Visibility As Visibility = Visibility.Visible
Public ReadOnly Property Media_Visibility As Visibility
Get
Return m_Media_Visibility
End Get
End Property
Private Sub SetMediaVisibility(bValue As Boolean)
m_Media_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
NotifyPropertyChanged(NameOf(Media_Visibility))
End Sub
Private m_Set_Visibility As Visibility = Visibility.Collapsed
Public ReadOnly Property Set_Visibility As Visibility
Get
Return m_Set_Visibility
End Get
End Property
Private Sub SetSetVisibility(bValue As Boolean)
m_Set_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
NotifyPropertyChanged(NameOf(Set_Visibility))
End Sub
Private m_FilterList As New List(Of String)({"", "Time Lower", "Time Ok", "Time Upper", "Speed Min", "Speed Max"})
Public ReadOnly Property FilterList As List(Of String)
Get
Return m_FilterList
End Get
End Property
Private m_nSelFilter As Filters
Public Property nSelFilter As Integer
Get
Return m_nSelFilter
End Get
Set(value As Integer)
m_nSelFilter = value
m_LayerList_View.Refresh()
End Set
End Property
Private m_bColExtend As Boolean = False
Public ReadOnly Property ColExtend_Visibility As Visibility
Get
Return If(m_bColExtend, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
Public ReadOnly Property ControlWidth As Double
Get
Return If(m_bColExtend, 600, 300)
End Get
End Property
Private m_bTFSEditor_IsEnabled As Boolean = True
Public ReadOnly Property bTFSEditor_IsEnabled As Boolean
Get
Return m_bTFSEditor_IsEnabled
End Get
End Property
Friend Sub SetTFSEditorIsEnabled(bValue As Boolean)
m_bTFSEditor_IsEnabled = bValue
NotifyPropertyChanged(NameOf(bTFSEditor_IsEnabled))
End Sub
Private m_bWaitingTime As Boolean = False
Public Property bWaitingTime As Boolean
Get
Return m_bWaitingTime
End Get
Set(value As Boolean)
m_bWaitingTime = value
Dim nLayTFSCalcId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, LAY_TFSCALC)
If m_bWaitingTime Then
EgtSetInfo(nLayTFSCalcId, KEY_EMITWAITINGTIME, True)
Else
EgtRemoveInfo(nLayTFSCalcId, KEY_EMITWAITINGTIME)
End If
' aggiorno background di tutte le righe
For Each Layer In m_LayerList
Layer.NotifyPropertyChanged(NameOf(Layer.Background))
Next
NotifyPropertyChanged(NameOf(ColWait_Visibility))
End Set
End Property
Public ReadOnly Property ColWait_Visibility As Visibility
Get
Return If(m_bWaitingTime, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
' Definizione comandi
Private m_cmdSet As ICommand
Private m_cmdMedia As ICommand
Private m_cmdReset As ICommand
Private m_cmdExtend As ICommand
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTORS"
Sub New()
' Creo riferimento a questa classe in EgtCAM5Map
Map.SetRefTFSEditorVM(Me)
m_nSelMediaType = MediaTypes.HEIGHT
NotifyPropertyChanged(NameOf(ghSelMediaType))
m_LayerList_View = CollectionViewSource.GetDefaultView(m_LayerList)
m_LayerList_View.Filter = AddressOf LayerFilter
AddHandler m_SelLayers.CollectionChanged, AddressOf SelLayers_CollectionChanged
UpdateSpeedMinMax()
' inizializzo contatore per aggiornare grafica su selezione
m_Selection_Timer.Interval = TimeSpan.FromMilliseconds(10)
AddHandler m_Selection_Timer.Tick, AddressOf SelectionTimer_Tick
End Sub
#End Region ' CONSTRUCTORS
#Region "METHODS"
Private Sub SelLayers_CollectionChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
m_bCollectionChanging = True
Select Case e.Action
Case NotifyCollectionChangedAction.Add
For Each AddedSelLayer In e.NewItems
For Each nSliceId In AddedSelLayer.GeomSliceIdList
EgtSelectObj(nSliceId)
Next
Next
Case NotifyCollectionChangedAction.Remove
For Each RemovedSelLayer In e.OldItems
For Each nSliceId In RemovedSelLayer.GeomSliceIdList
EgtDeselectObj(nSliceId)
Next
Next
Case NotifyCollectionChangedAction.Replace
Case NotifyCollectionChangedAction.Move
Case NotifyCollectionChangedAction.Reset
EgtDeselectAll()
End Select
m_Selection_Timer.Start()
m_bCollectionChanging = False
End Sub
Private Sub SelectionTimer_Tick()
If Not m_bCollectionChanging Then
m_Selection_Timer.Stop()
EgtDraw()
End If
End Sub
Friend Sub Refresh()
m_LayerList.Clear()
Dim nLayTFSCalcId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, LAY_TFSCALC)
Dim nTFSLayerId As Integer = EgtGetFirstInGroup(nLayTFSCalcId)
While nTFSLayerId <> GDB_ID.NULL
m_LayerList.Add(New TFSLayer(nTFSLayerId))
nTFSLayerId = EgtGetNext(nTFSLayerId)
End While
End Sub
Private Function LayerFilter(Layer As Object) As Boolean
Dim CurrLayer As TFSLayer = DirectCast(Layer, TFSLayer)
Select Case m_nSelFilter
Case Filters.NULL
Return True
Case Filters.TIME_LOWER
Return CurrLayer.dTCurr < CurrLayer.dTMin
Case Filters.TIME_OK
Return CurrLayer.dTCurr >= CurrLayer.dTMin AndAlso CurrLayer.dTCurr <= CurrLayer.dTMax
Case Filters.TIME_UPPER
Return CurrLayer.dTCurr > CurrLayer.dTMax
Case Filters.SPEED_MIN
Return CurrLayer.dSpeed <= m_dSpeedMin
Case Filters.SPEED_MAX
Return CurrLayer.dSpeed >= m_dSpeedMax
End Select
Return True
End Function
Friend Sub UpdateSpeedMinMax()
m_dSpeedMin = GetPrivateProfileDouble(S_MACH_PRINTING3D, K_SPEED_MIN, 0, CurrentMachine.sMachIniFile)
m_dSpeedMax = GetPrivateProfileDouble(S_MACH_PRINTING3D, K_SPEED_MAX, 50000, CurrentMachine.sMachIniFile)
End Sub
#End Region ' METHODS
#Region "COMMANDS"
#Region "Set"
''' <summary>
''' Returns a command that do CPlaneTop.
''' </summary>
Public ReadOnly Property Set_Command As ICommand
Get
If m_cmdSet Is Nothing Then
m_cmdSet = New Command(AddressOf SetCmd)
End If
Return m_cmdSet
End Get
End Property
''' <summary>
''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand.
''' </summary>
Public Sub SetCmd()
If m_LayerList.Count <= 0 Then Return
Select Case m_nSelMediaType
Case MediaTypes.SELECTION
For Each Layer In m_SelLayers
Layer.SetFCurr(m_dFCurr)
Next
Case MediaTypes.SELECTION_WAIT
For Each Layer In m_SelLayers
Layer.SetTWait(m_dWait)
Next
Case MediaTypes.FEED_INCREMENT
For Each Layer In m_SelLayers
Layer.SetFCurr(Layer.dFCurr * (m_dFeedIncrement / 100))
Next
End Select
'' salvo selezione corrente
'Dim SelIndexList As New List(Of Integer)
'For Each SelLayer In m_SelLayers
' SelIndexList.Add(SelLayer.nIndex)
'Next
'' ricalcolo valori
'Map.refSliceManagerVM.CalcSlice(False, True)
'' ripristino layer selezionati
'For Each Index In SelIndexList
' Dim NewLayer As TFSLayer = m_LayerList.FirstOrDefault(Function(x) x.nIndex = Index)
' If Not IsNothing(NewLayer) Then
' m_SelLayers.Add(NewLayer)
' End If
'Next
End Sub
#End Region ' Set
#Region "Media"
''' <summary>
''' Returns a command that do CPlaneTop.
''' </summary>
Public ReadOnly Property Media_Command As ICommand
Get
If m_cmdMedia Is Nothing Then
m_cmdMedia = New Command(AddressOf Media)
End If
Return m_cmdMedia
End Get
End Property
''' <summary>
''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand.
''' </summary>
Public Sub Media()
If m_LayerList.Count <= 0 Then Return
Select Case m_nSelMediaType
Case MediaTypes.HEIGHT
If m_nMediaHeight <= 0 Then Return
For Index = 0 To Math.Ceiling(m_LayerList.Count() / m_nMediaHeight) - 1
Dim dFSum As Double = 0
Dim dFIndex As Double = 0
For Index2 = (m_nMediaHeight * Index) To Math.Min(m_nMediaHeight * (Index + 1), m_LayerList.Count() - 1)
dFSum += m_LayerList(Index2).sFCurr
dFIndex += 1
Next
Dim dNewFCurr As Double = dFSum / dFIndex
For Index2 = (m_nMediaHeight * Index) To Math.Min(m_nMediaHeight * (Index + 1), m_LayerList.Count() - 1)
m_LayerList(Index2).SetFCurr(dNewFCurr)
Next
Next
Case MediaTypes.SECTIONCHANGE
Dim ChangeIndexList As New List(Of Integer)({0})
Dim dPrevLength As Double = m_LayerList(0).dLength
' recupero punti di rottura
For Index = 1 To m_LayerList.Count() - 1
Dim dCurrLength = m_LayerList(Index)
If dPrevLength < m_LayerList(Index).dLength * (1 - (m_nDifference / 100)) OrElse dPrevLength > m_LayerList(Index).dLength * (1 + (m_nDifference / 100)) Then
ChangeIndexList.Add(Index)
End If
dPrevLength = m_LayerList(Index).dLength
Next
If ChangeIndexList(ChangeIndexList.Count - 1) <> m_LayerList.Count() - 1 Then
ChangeIndexList.Add(m_LayerList.Count() - 1)
End If
' ricalcolo media sugli intervalli trovati
For Index = 0 To ChangeIndexList.Count() - 2
Dim dFSum As Double = 0
Dim dFIndex As Double = 0
For Index2 = ChangeIndexList(Index) To ChangeIndexList(Index + 1)
dFSum += m_LayerList(Index2).sFCurr
dFIndex += 1
Next
Dim dNewFCurr As Double = dFSum / dFIndex
For Index2 = ChangeIndexList(Index) To ChangeIndexList(Index + 1)
m_LayerList(Index2).SetFCurr(dNewFCurr)
Next
Next
Case MediaTypes.SELECTION
If m_SelLayers.Count <= 0 Then Return
Dim dFSum As Double = 0
Dim dFIndex As Double = 0
For Each Layer In m_SelLayers
dFSum += Layer.sFCurr
dFIndex += 1
Next
Dim dNewFCurr As Double = dFSum / dFIndex
For Each Layer In m_SelLayers
Layer.SetFCurr(dNewFCurr)
Next
End Select
' salvo selezione corrente
Dim SelIndexList As New List(Of Integer)
For Each SelLayer In m_SelLayers
SelIndexList.Add(SelLayer.nIndex)
Next
'' ricalcolo valori
'Map.refSliceManagerVM.CalcSlice(False, True)
'' ripristino layer selezionati
'For Each Index In SelIndexList
' Dim NewLayer As TFSLayer = m_LayerList.FirstOrDefault(Function(x) x.nIndex = Index)
' If Not IsNothing(NewLayer) Then
' m_SelLayers.Add(NewLayer)
' End If
'Next
End Sub
#End Region ' Media
#Region "Reset"
''' <summary>
''' Returns a command that do CPlaneTop.
''' </summary>
Public ReadOnly Property Reset_Command As ICommand
Get
If m_cmdReset Is Nothing Then
m_cmdReset = New Command(AddressOf Reset)
End If
Return m_cmdReset
End Get
End Property
''' <summary>
''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand.
''' </summary>
Public Sub Reset()
' cancello gruppo della tabella
Dim nLayTFSCalcId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, LAY_TFSCALC)
EgtEmptyGroup(nLayTFSCalcId)
For Each CurrPart In Map.refTopPanelVM.PartList
EgtSetInfo(CurrPart.nPartId, MAC_TORECALC_TFS, True)
Next
Map.refSliceManagerVM.CalcSlice(False)
End Sub
#End Region ' Reset
#Region "Extend"
''' <summary>
''' Returns a command that do CPlaneTop.
''' </summary>
Public ReadOnly Property Extend_Command As ICommand
Get
If m_cmdExtend Is Nothing Then
m_cmdExtend = New Command(AddressOf Extend)
End If
Return m_cmdExtend
End Get
End Property
''' <summary>
''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand.
''' </summary>
Public Sub Extend()
m_bColExtend = Not m_bColExtend
NotifyPropertyChanged(NameOf(ColExtend_Visibility))
NotifyPropertyChanged(NameOf(ControlWidth))
End Sub
#End Region ' Extend
#End Region ' COMMANDS
End Class
Public Class TFSLayer
Inherits VMBase
Private m_nId As Integer
Public ReadOnly Property nId As Integer
Get
Return m_nId
End Get
End Property
Private m_nIndex As Integer
Public ReadOnly Property nIndex As Integer
Get
Return m_nIndex
End Get
End Property
Private m_dLength As Double
Public ReadOnly Property dLength As Double
Get
Return m_dLength
End Get
End Property
Public ReadOnly Property sLength As String
Get
Return LenToString(m_dLength, 0)
End Get
End Property
Private m_dTMin As Double
Public ReadOnly Property dTMin As Double
Get
Return m_dTMin
End Get
End Property
Public ReadOnly Property sTMin As String
Get
Return DoubleToString(m_dTMin, 0)
End Get
End Property
Private m_dTTrg As Double
Public ReadOnly Property sTTrg As String
Get
Return DoubleToString(m_dTTrg, 0)
End Get
End Property
Private m_dTMax As Double
Public ReadOnly Property dTMax As Double
Get
Return m_dTMax
End Get
End Property
Public ReadOnly Property sTMax As String
Get
Return DoubleToString(m_dTMax, 0)
End Get
End Property
Private m_dTCurr As Double
Public ReadOnly Property dTCurr As Double
Get
Return m_dTCurr
End Get
End Property
Public ReadOnly Property sTCurr As String
Get
Return DoubleToString(m_dTCurr, 0)
End Get
End Property
Private m_dTWait As Double
Public Property sTWait As String
Get
Return LenToString(m_dTWait, 0)
End Get
Set(value As String)
Dim dNewValue As Double
If StringToLen(value, dNewValue) Then
m_dTWait = dNewValue
EgtSetInfo(nId, "WaitingTime", m_dTWait)
m_bTWait_IsModified = True
' Imposto flag di ricalcolo generate
EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_TFS, True)
NotifyPropertyChanged(NameOf(Background))
Else
NotifyPropertyChanged(NameOf(sTWait))
End If
End Set
End Property
Friend Sub SetTWait(value As Double)
m_dTWait = value
EgtSetInfo(nId, "WaitingTime", m_dTWait)
m_bTWait_IsModified = True
' Imposto flag di ricalcolo generate
EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_TFS, True)
NotifyPropertyChanged(NameOf(Background))
NotifyPropertyChanged(NameOf(sTWait))
End Sub
Private m_bTWait_IsModified As Boolean
Public ReadOnly Property bTWait_IsModified As Boolean
Get
Return m_bTWait_IsModified
End Get
End Property
Private m_dFMin As Double
Public ReadOnly Property sFMin As String
Get
Return LenToString(m_dFMin, 0)
End Get
End Property
Private m_dFTrg As Double
Public ReadOnly Property sFTrg As String
Get
Return LenToString(m_dFTrg, 0)
End Get
End Property
Private m_dFMax As Double
Public ReadOnly Property sFMax As String
Get
Return LenToString(m_dFMax, 0)
End Get
End Property
Private m_dFCurr As Double
Public Property sFCurr As String
Get
Return LenToString(m_dFCurr, 0)
End Get
Set(value As String)
Dim dNewValue As Double
If StringToLen(value, dNewValue) Then
m_dFCurr = dNewValue
EgtSetInfo(nId, "FCur", m_dFCurr)
m_bFCurr_IsModified = True
' Imposto flag di ricalcolo generate
EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_TFS, True)
NotifyPropertyChanged(NameOf(Background))
Else
NotifyPropertyChanged(NameOf(sFCurr))
End If
End Set
End Property
Friend Sub SetFCurr(value As Double)
m_dFCurr = value
EgtSetInfo(nId, "FCur", m_dFCurr)
m_bFCurr_IsModified = True
' Imposto flag di ricalcolo generate
EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_TFS, True)
NotifyPropertyChanged(NameOf(Background))
NotifyPropertyChanged(NameOf(sFCurr))
End Sub
Public ReadOnly Property dFCurr As Double
Get
Return m_dFCurr
End Get
End Property
Private m_bFCurr_IsModified As Boolean
Public ReadOnly Property bFCurr_IsModified As Boolean
Get
Return m_bFCurr_IsModified
End Get
End Property
Private m_dSpeed As Double
Public ReadOnly Property dSpeed As Double
Get
Return m_dSpeed
End Get
End Property
Public ReadOnly Property sSpeed As String
Get
Return DoubleToString(m_dSpeed, 0)
End Get
End Property
Private m_GeomSliceIdList As New List(Of Integer)
Public ReadOnly Property GeomSliceIdList As List(Of Integer)
Get
Return m_GeomSliceIdList
End Get
End Property
Public ReadOnly Property Background As SolidColorBrush
Get
If m_bFCurr_IsModified OrElse m_bTWait_IsModified Then
Return Brushes.White
ElseIf (Not Map.refTFSEditorVM.bWaitingTime AndAlso m_dTCurr + 1 < m_dTMin) OrElse (Map.refTFSEditorVM.bWaitingTime AndAlso m_dTCurr + m_dTWait + 1 < m_dTMin) Then
Return Brushes.Red
ElseIf m_dTCurr - 1 > m_dTMax Then
Return Brushes.MediumOrchid
Else
Return Brushes.LightGreen
End If
End Get
End Property
Public ReadOnly Property Foreground As SolidColorBrush
Get
If m_bFCurr_IsModified OrElse m_bTWait_IsModified Then
Return Brushes.Black
ElseIf m_dSpeed <= Map.refTFSEditorVM.dSpeedMin OrElse m_dSpeed >= Map.refTFSEditorVM.dSpeedMax Then
Return Brushes.DeepSkyBlue
Else
Return Brushes.Black
End If
End Get
End Property
Public ReadOnly Property FontWeight As FontWeight
Get
If m_bFCurr_IsModified OrElse m_bTWait_IsModified Then
Return FontWeights.Normal
ElseIf m_dSpeed <= Map.refTFSEditorVM.dSpeedMin OrElse m_dSpeed >= Map.refTFSEditorVM.dSpeedMax Then
Return FontWeights.Bold
Else
Return FontWeights.Normal
End If
End Get
End Property
Sub New(nId As Integer)
m_nId = nId
Dim sIndex As String = ""
EgtGetName(nId, sIndex)
Integer.TryParse(sIndex, m_nIndex)
EgtGetInfo(nId, KEY_LENGTH, m_dLength)
EgtGetInfo(nId, KEY_TMIN, m_dTMin)
EgtGetInfo(nId, KEY_TTRG, m_dTTrg)
EgtGetInfo(nId, KEY_TMAX, m_dTMax)
EgtGetInfo(nId, KEY_TCUR, m_dTCurr)
EgtGetInfo(nId, KEY_TWAIT, m_dTWait)
EgtGetInfo(nId, KEY_FMIN, m_dFMin)
EgtGetInfo(nId, KEY_FTRG, m_dFTrg)
EgtGetInfo(nId, KEY_FMAX, m_dFMax)
EgtGetInfo(nId, KEY_FCUR, m_dFCurr)
EgtGetInfo(nId, KEY_SPEED, m_dSpeed)
If EgtGetInfo(nId, KEY_SLICEID, sIndex) Then
Dim sSliceIdList() As String = sIndex.Split(";"c)
If sSliceIdList.Count > 0 Then
For Each sSliceId In sSliceIdList
Dim nSliceId As Integer = GDB_ID.NULL
If Integer.TryParse(sSliceId, nSliceId) Then
m_GeomSliceIdList.Add(nSliceId)
End If
Next
End If
End If
NotifyPropertyChanged(NameOf(Background))
End Sub
Sub New(nId As Integer, nIndex As Integer, dLength As Double, dTMin As Double, dTTrg As Double, dTMax As Double, dTCurr As Double, dTWait As Double, dFMin As Double, dFTrg As Double, dFMax As Double, dFCurr As Double, dSpeed As Double)
m_nId = nId
m_nIndex = nIndex
m_dLength = dLength
m_dTMin = dTMin
m_dTTrg = dTTrg
m_dTMax = dTMax
m_dTCurr = dTCurr
m_dTWait = dTWait
m_dFMin = dFMin
m_dFTrg = dFTrg
m_dFMax = dFMax
m_dFCurr = dFCurr
m_dSpeed = dSpeed
End Sub
End Class