158 lines
5.1 KiB
VB.net
158 lines
5.1 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports EgtUILib
|
|
|
|
Public Class LayerTreeViewItem
|
|
Inherits TreeViewItemBase
|
|
|
|
Friend Shared m_SendCmd As Boolean = True
|
|
Friend Shared m_MarkOnSel As Boolean = True
|
|
|
|
Private m_Id As Integer
|
|
Public ReadOnly Property Id As Integer
|
|
Get
|
|
Return m_Id
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Property that determines if the Tool is selected or not
|
|
''' </summary>
|
|
Public Overrides Property IsSelected As Boolean
|
|
Get
|
|
Return m_isSelected
|
|
End Get
|
|
Set(value As Boolean)
|
|
If value Then Map.refDrawOptionPanelVM.SetInfoRowIsExpanded(value)
|
|
If (value <> m_isSelected) Then
|
|
m_isSelected = value
|
|
If value Then
|
|
' recupero l'Id del nuovo oggetto selezionato
|
|
Map.refManageLayerExpanderVM.IsRightClickedLayerTreeItem(False)
|
|
If m_MarkOnSel Then
|
|
Map.refManageLayerExpanderVM.UpdateObjInObjTree(Me.Id)
|
|
Else
|
|
Map.refManageLayerExpanderVM.UpdateObjInObjTreeNoMark(Me.Id)
|
|
End If
|
|
End If
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsRightSelected As Boolean
|
|
''' <summary>
|
|
''' Property that determines if the Tool is selected or not
|
|
''' </summary>
|
|
Public Property IsRightSelected As Boolean
|
|
Get
|
|
Return m_IsRightSelected
|
|
End Get
|
|
Set(value As Boolean)
|
|
' In realtà il valore di value è insignificante perchè la cosa importante è che il click esegua questo Set
|
|
m_IsRightSelected = value
|
|
Map.refManageLayerExpanderVM.IsRightClickedLayerTreeItem(True)
|
|
Map.refManageLayerExpanderVM.RightClickedLayerTreeItem(Me.Id)
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Items As New ObservableCollection(Of LayerTreeViewItem)
|
|
Public Property Items As ObservableCollection(Of LayerTreeViewItem)
|
|
Get
|
|
Return m_Items
|
|
End Get
|
|
Set(value As ObservableCollection(Of LayerTreeViewItem))
|
|
m_Items = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_bOnOff As Boolean = True
|
|
Public Property OnOff As Boolean
|
|
Get
|
|
Return m_bOnOff
|
|
End Get
|
|
Set(value As Boolean)
|
|
'If Map.refProjectVM.GetController().GetStep() <> 0 Then Return
|
|
If m_bOnOff <> value Then
|
|
m_bOnOff = value
|
|
' se abilitato, eseguo operazione
|
|
If m_SendCmd Then
|
|
If value Then
|
|
EgtSetStatus(Id, GDB_ST.ON_)
|
|
Else
|
|
EgtSetStatus(Id, GDB_ST.OFF)
|
|
End If
|
|
EgtDraw()
|
|
End If
|
|
Dim bOnOffGroup As Boolean = ((Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift) AndAlso Items.Count > 0
|
|
If bOnOffGroup Then
|
|
EgtEnableCommandLogger()
|
|
' abilito/disabilito tutti i nodi del livello sotto di esso (e non oltre)
|
|
For Each Node In Items
|
|
Node.m_bOnOff = value
|
|
' se abilitato, eseguo operazione
|
|
If m_SendCmd Then
|
|
Dim nStat As Integer
|
|
EgtGetStatus(Node.Id, nStat)
|
|
If value AndAlso nStat <> GDB_ST.ON_ Then
|
|
EgtSetStatus(Node.Id, GDB_ST.ON_)
|
|
ElseIf Not value AndAlso nStat <> GDB_ST.OFF Then
|
|
EgtSetStatus(Node.Id, GDB_ST.OFF)
|
|
End If
|
|
End If
|
|
Node.NotifyPropertyChanged(NameOf(OnOff))
|
|
Next
|
|
EgtDisableCommandLogger()
|
|
EgtDraw()
|
|
End If
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_bHidden As Boolean = False
|
|
Public ReadOnly Property IsHidden As Visibility
|
|
Get
|
|
Return If(m_bHidden, Visibility.Hidden, Visibility.Visible)
|
|
End Get
|
|
End Property
|
|
Public Sub SetHidden(bVal As Boolean)
|
|
If bVal <> m_bHidden Then
|
|
m_bHidden = bVal
|
|
NotifyPropertyChanged("IsHidden")
|
|
End If
|
|
End Sub
|
|
|
|
Private m_sPictureString As String
|
|
Public Property PictureString As String
|
|
Get
|
|
Return m_sPictureString
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_sPictureString Then
|
|
m_sPictureString = value
|
|
NotifyPropertyChanged("PictureString")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_LayerColor As SolidColorBrush
|
|
Public Property LayerColor As SolidColorBrush
|
|
Get
|
|
Return m_LayerColor
|
|
End Get
|
|
Set(value As SolidColorBrush)
|
|
m_LayerColor = value
|
|
End Set
|
|
End Property
|
|
|
|
Sub New(Id As Integer, Name As String, Image As String, CurrColor As Color3d)
|
|
MyBase.New(Name)
|
|
Me.m_Id = Id
|
|
Me.PictureString = Image
|
|
Me.LayerColor = New SolidColorBrush(Color.FromArgb(CByte(CurrColor.A * 255 / 100), CByte(CurrColor.R), CByte(CurrColor.G), CByte(CurrColor.B)))
|
|
End Sub
|
|
|
|
Sub New(Id As Integer, Name As String)
|
|
MyBase.New(Name)
|
|
End Sub
|
|
|
|
End Class
|