4c807a08be
- aggiustamenti vari pre-rilascio.
242 lines
8.2 KiB
VB.net
242 lines
8.2 KiB
VB.net
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class SliderManagerVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Public Enum ViewSliderType As Integer
|
|
NULL = 0
|
|
ONLY_SELECTED = 1
|
|
UNTIL_SELECTED = 2
|
|
FROM_SELECTED = 3
|
|
End Enum
|
|
|
|
Private m_nLayerIndex As Integer = 0
|
|
Public Property nLayerIndex As Integer
|
|
Get
|
|
Return m_nLayerIndex
|
|
End Get
|
|
Set(value As Integer)
|
|
If IsNothing(Map.refTopPanelVM.SelPart) Then Return
|
|
Select Case m_nSelViewSlider
|
|
Case ViewSliderType.ONLY_SELECTED
|
|
' se diverso da nullo nascondo precedente
|
|
If m_nLayerIndex > 0 Then EgtSetStatus(Map.refTopPanelVM.SelPart.LayerList(m_nLayerIndex - 1).nLayerId, GDB_ST.OFF)
|
|
m_nLayerIndex = value
|
|
' se diverso da nullo visualizzo corrente
|
|
If m_nLayerIndex > 0 Then EgtSetStatus(Map.refTopPanelVM.SelPart.LayerList(m_nLayerIndex - 1).nLayerId, GDB_ST.ON_)
|
|
Case ViewSliderType.UNTIL_SELECTED
|
|
Dim LayerIndex As Integer = If(m_nLayerIndex > 0, m_nLayerIndex, 1)
|
|
If value > m_nLayerIndex Then
|
|
For Index = LayerIndex + 1 To value
|
|
EgtSetStatus(Map.refTopPanelVM.SelPart.LayerList(Index - 1).nLayerId, GDB_ST.ON_)
|
|
Next
|
|
ElseIf value < m_nLayerIndex Then
|
|
For Index = value + 1 To LayerIndex
|
|
EgtSetStatus(Map.refTopPanelVM.SelPart.LayerList(Index - 1).nLayerId, GDB_ST.OFF)
|
|
Next
|
|
End If
|
|
m_nLayerIndex = value
|
|
Case ViewSliderType.FROM_SELECTED
|
|
Dim LayerIndex As Integer = If(m_nLayerIndex > 0, m_nLayerIndex, 1)
|
|
If value > m_nLayerIndex Then
|
|
For Index = LayerIndex To value
|
|
EgtSetStatus(Map.refTopPanelVM.SelPart.LayerList(Index - 1).nLayerId, GDB_ST.OFF)
|
|
Next
|
|
ElseIf value < m_nLayerIndex Then
|
|
For Index = value To LayerIndex
|
|
EgtSetStatus(Map.refTopPanelVM.SelPart.LayerList(Index - 1).nLayerId, GDB_ST.ON_)
|
|
Next
|
|
End If
|
|
m_nLayerIndex = value
|
|
End Select
|
|
NotifyPropertyChanged(NameOf(ghShowValue))
|
|
EgtDraw()
|
|
End Set
|
|
End Property
|
|
|
|
Public ReadOnly Property ghShowValue As String
|
|
Get
|
|
Dim dH As Double = 0
|
|
If Not IsNothing(Map.refTopPanelVM.CurrMachining) Then
|
|
If Map.refTopPanelVM.CurrMachining.bCurrSlicing45 Then
|
|
Return m_nLayerIndex
|
|
Else
|
|
Return m_nLayerIndex & " (" & DoubleToString(m_nLayerIndex * Map.refTopPanelVM.CurrMachining.dCurrStrandH, 0) & "mm)"
|
|
End If
|
|
Else
|
|
Return m_nLayerIndex
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ghShowMaximum As String
|
|
Get
|
|
Dim dH As Double = 0
|
|
If Not IsNothing(Map.refTopPanelVM.CurrMachining) Then
|
|
If Map.refTopPanelVM.CurrMachining.bCurrSlicing45 Then
|
|
Return m_nLayerIndex_Maximum
|
|
Else
|
|
Return m_nLayerIndex_Maximum & " (" & DoubleToString(m_nLayerIndex_Maximum * Map.refTopPanelVM.CurrMachining.dCurrStrandH, 0) & "mm)"
|
|
End If
|
|
Else
|
|
Return m_nLayerIndex_Maximum
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Private m_dLayerAdvancement As Double
|
|
Public Property dLayerAdvancement As Double
|
|
Get
|
|
Return m_dLayerAdvancement
|
|
End Get
|
|
Set(value As Double)
|
|
m_dLayerAdvancement = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_LayerIndex_Visibility As Visibility = Visibility.Collapsed
|
|
Public Property LayerIndex_Visibility As Visibility
|
|
Get
|
|
Return m_LayerIndex_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_LayerIndex_Visibility = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_LayerAdvancement_Visibility As Visibility = Visibility.Collapsed
|
|
Public Property LayerAdvancement_Visibility As Visibility
|
|
Get
|
|
Return m_LayerAdvancement_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_LayerAdvancement_Visibility = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_nLayerIndex_Minimum As Double
|
|
Public Property nLayerIndex_Minimum As Double
|
|
Get
|
|
Return m_nLayerIndex_Minimum
|
|
End Get
|
|
Set(value As Double)
|
|
m_nLayerIndex_Minimum = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_nLayerIndex_Maximum As Double
|
|
Public Property nLayerIndex_Maximum As Double
|
|
Get
|
|
Return m_nLayerIndex_Maximum
|
|
End Get
|
|
Set(value As Double)
|
|
m_nLayerIndex_Maximum = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_ViewSliderList As New List(Of String)({"Only Selected", "Till Selected", "From Selected"})
|
|
Public ReadOnly Property ViewSliderList As List(Of String)
|
|
Get
|
|
Return m_ViewSliderList
|
|
End Get
|
|
End Property
|
|
|
|
Private m_nSelViewSlider As ViewSliderType
|
|
Public Property ghSelViewSlider As Integer
|
|
Get
|
|
Return m_nSelViewSlider - 1
|
|
End Get
|
|
Set(value As Integer)
|
|
m_nSelViewSlider = value + 1
|
|
WriteMainPrivateProfileString(S_PRINTING3D, K_VIEWSLIDER, m_nSelViewSlider)
|
|
' ciclo tutti i layer per nasconderli/mostrarli
|
|
If IsNothing(Map.refTopPanelVM.SelPart) OrElse IsNothing(Map.refTopPanelVM.SelPart.LayerList) Then Return
|
|
Select Case m_nSelViewSlider
|
|
Case ViewSliderType.ONLY_SELECTED
|
|
For Each Layer In Map.refTopPanelVM.SelPart.LayerList
|
|
If Layer.nLayerIndex = m_nLayerIndex Then
|
|
EgtSetStatus(Layer.nLayerId, GDB_ST.ON_)
|
|
Else
|
|
EgtSetStatus(Layer.nLayerId, GDB_ST.OFF)
|
|
End If
|
|
Next
|
|
Case ViewSliderType.UNTIL_SELECTED
|
|
For Each Layer In Map.refTopPanelVM.SelPart.LayerList
|
|
If Layer.nLayerIndex <= m_nLayerIndex Then
|
|
EgtSetStatus(Layer.nLayerId, GDB_ST.ON_)
|
|
Else
|
|
EgtSetStatus(Layer.nLayerId, GDB_ST.OFF)
|
|
End If
|
|
Next
|
|
Case ViewSliderType.FROM_SELECTED
|
|
For Each Layer In Map.refTopPanelVM.SelPart.LayerList
|
|
If Layer.nLayerIndex >= m_nLayerIndex Then
|
|
EgtSetStatus(Layer.nLayerId, GDB_ST.ON_)
|
|
Else
|
|
EgtSetStatus(Layer.nLayerId, GDB_ST.OFF)
|
|
End If
|
|
Next
|
|
End Select
|
|
EgtDraw()
|
|
End Set
|
|
End Property
|
|
Friend Sub SetSelViewSlider(value As ViewSliderType)
|
|
m_nSelViewSlider = value
|
|
NotifyPropertyChanged(NameOf(ghSelViewSlider))
|
|
End Sub
|
|
|
|
#End Region ' FIELDS & PROPERTIES
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
' Creo riferimento a questa classe in Map
|
|
Map.SetRefSliderManagerVM(Me)
|
|
' leggo valore default ViewSlider
|
|
Dim nViewSlider As Integer = GetMainPrivateProfileInt(S_PRINTING3D, K_VIEWSLIDER, 1)
|
|
SetSelViewSlider(nViewSlider)
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTOR
|
|
|
|
#Region "METHODS"
|
|
|
|
Friend Sub SetSliderVisibility(bValue As Boolean)
|
|
Dim Visibility As Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
|
|
m_LayerIndex_Visibility = Visibility
|
|
m_LayerAdvancement_Visibility = Visibility
|
|
NotifyPropertyChanged(NameOf(LayerIndex_Visibility))
|
|
NotifyPropertyChanged(NameOf(LayerAdvancement_Visibility))
|
|
End Sub
|
|
|
|
Friend Sub RefreshSlider(nMin As Integer, nMax As Integer)
|
|
m_nLayerIndex_Minimum = nMin
|
|
m_nLayerIndex_Maximum = nMax
|
|
NotifyPropertyChanged(NameOf(nLayerIndex_Minimum))
|
|
NotifyPropertyChanged(NameOf(nLayerIndex_Maximum))
|
|
NotifyPropertyChanged(NameOf(ghShowMaximum))
|
|
nLayerIndex = m_nLayerIndex
|
|
End Sub
|
|
|
|
Friend Sub SetLayerIndexToMax()
|
|
nLayerIndex = m_nLayerIndex_Maximum
|
|
NotifyPropertyChanged(NameOf(nLayerIndex))
|
|
End Sub
|
|
|
|
Friend Sub SetLayerIndexToMin()
|
|
nLayerIndex = m_nLayerIndex_Minimum
|
|
NotifyPropertyChanged(NameOf(nLayerIndex))
|
|
End Sub
|
|
|
|
Friend Sub SetLayerIndexToZero()
|
|
nLayerIndex = 0
|
|
NotifyPropertyChanged(NameOf(nLayerIndex))
|
|
End Sub
|
|
|
|
#End Region ' METHODS
|
|
|
|
End Class
|