EgtCAM5 :
- Cambiati nomi classi e file.
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
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 <> m_IsSelected) Then
|
||||
m_IsSelected = value
|
||||
If value Then
|
||||
' recupero l'Id del nuovo oggetto selezionato
|
||||
Application.Msn.NotifyColleagues(Application.ISRIGHTCLICKEDLAYERTREEITEM, False)
|
||||
If m_MarkOnSel Then
|
||||
Application.Msn.NotifyColleagues(Application.UPDATEOBJINOBJTREE, Me.Id)
|
||||
Else
|
||||
Application.Msn.NotifyColleagues(Application.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
|
||||
Application.Msn.NotifyColleagues(Application.ISRIGHTCLICKEDLAYERTREEITEM, True)
|
||||
Application.Msn.NotifyColleagues(Application.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_OnOff As Boolean
|
||||
Public Property OnOff As Boolean
|
||||
Get
|
||||
Return m_OnOff
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If m_OnOff <> value Then
|
||||
m_OnOff = value
|
||||
' se abilitato, eseguo operazione
|
||||
If m_SendCmd Then
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, Id)
|
||||
If value Then
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SHOW)
|
||||
Else
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.HIDE)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
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
|
||||
@@ -0,0 +1,120 @@
|
||||
<UserControl x:Class="ManageLayerExpanderView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
|
||||
xmlns:expression="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
|
||||
xmlns:local="clr-namespace:EgtCAM5">
|
||||
|
||||
<Expander IsExpanded="True" Style="{StaticResource ExpanderStyle}">
|
||||
<Expander.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding HeaderName}" Margin="0,0,5,0"/>
|
||||
<Ellipse Height="10" Width="10" Fill="{Binding HeaderColor}" />
|
||||
</StackPanel>
|
||||
</Expander.Header>
|
||||
|
||||
<StackPanel>
|
||||
|
||||
<UniformGrid Rows="1">
|
||||
<Button Content="{Binding NewPartMsg}" Command="{Binding NewPartCommand}" Height="30"/>
|
||||
<Button Content="{Binding NewLayerMsg}" Command="{Binding NewLayerCommand}" Height="30"/>
|
||||
<Button Content="{Binding ColorMsg}" Command="{Binding LayerColorCommand}" Height="30"/>
|
||||
</UniformGrid>
|
||||
|
||||
<TreeView Name="LayerTreeView" MinHeight="150" MaxHeight="250"
|
||||
ItemsSource="{Binding Path=LayerList}"
|
||||
VirtualizingStackPanel.IsVirtualizing = "True"
|
||||
VirtualizingStackPanel.VirtualizationMode = "Recycling">
|
||||
<interactivity:Interaction.Triggers>
|
||||
<interactivity:EventTrigger EventName="MouseDoubleClick">
|
||||
<interactivity:InvokeCommandAction Command="{Binding TreeViewDoubleClickCommand}"/>
|
||||
</interactivity:EventTrigger>
|
||||
</interactivity:Interaction.Triggers>
|
||||
<TreeView.Resources>
|
||||
<!--Modifico DataTemplate del ToolItem per poter inserire immagine e testo-->
|
||||
<HierarchicalDataTemplate DataType="{x:Type local:LayerTreeViewItem}" ItemsSource="{Binding Items}">
|
||||
<Grid>
|
||||
<interactivity:Interaction.Triggers>
|
||||
<interactivity:EventTrigger EventName="MouseUp">
|
||||
<interactivity:InvokeCommandAction Command="{Binding Path=DataContext.TreeViewMouseUpCommand,RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" CommandParameter="{Binding ElementName=LayerTreeView,Path=SelectedItem}"/>
|
||||
</interactivity:EventTrigger>
|
||||
<interactivity:EventTrigger EventName="PreviewMouseRightButtonDown">
|
||||
<expression:ChangePropertyAction PropertyName="IsRightSelected" Value="true" TargetObject="{Binding}"/>
|
||||
</interactivity:EventTrigger>
|
||||
</interactivity:Interaction.Triggers>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<ToggleButton Style="{StaticResource EgtCAM5_LampToggleButton}" Grid.Column="0" IsChecked="{Binding OnOff}" Focusable="False" Height="15" Width="15" Margin="0,0,5,0"/>
|
||||
<Image Grid.Column="1" Source="{Binding PictureString}" Height="15" Margin="0,0,5,0"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding Name}" Margin="0,0,5,0"/>
|
||||
<Ellipse Grid.Column="3" Height="10" Width="10" Fill="{Binding LayerColor}" />
|
||||
|
||||
</Grid>
|
||||
</HierarchicalDataTemplate>
|
||||
</TreeView.Resources>
|
||||
|
||||
<!--Style dei nodi CathegoryItem che li riquadra di azzurro quando clicckati ed elimina l'ombra grigia
|
||||
che si presenta quando la categoria rimane vuota (ombra causata dal multibinding).-->
|
||||
<TreeView.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type TreeViewItem}">
|
||||
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Setter Property="IsEnabled" Value="{Binding IsEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</Style>
|
||||
</TreeView.ItemContainerStyle>
|
||||
<TreeView.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Command="{Binding SelectCommand}">
|
||||
<MenuItem.Header>
|
||||
<TextBlock Text="{Binding SelectMsg}"/>
|
||||
</MenuItem.Header>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding DeselectCommand}">
|
||||
<MenuItem.Header>
|
||||
<TextBlock Text="{Binding DeselectMsg}"/>
|
||||
</MenuItem.Header>
|
||||
</MenuItem>
|
||||
<Separator/>
|
||||
<MenuItem Command="{Binding NameCommand}">
|
||||
<MenuItem.Header>
|
||||
<TextBlock Text="{Binding NameMsg}"/>
|
||||
</MenuItem.Header>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding InfoCommand}">
|
||||
<MenuItem.Header>
|
||||
<TextBlock Text="{Binding InfoMsg}"/>
|
||||
</MenuItem.Header>
|
||||
</MenuItem>
|
||||
<Separator/>
|
||||
<MenuItem Command="{Binding RelocateCommand}">
|
||||
<MenuItem.Header>
|
||||
<TextBlock Text="{Binding RelocateMsg}"/>
|
||||
</MenuItem.Header>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding CopyCommand}">
|
||||
<MenuItem.Header>
|
||||
<TextBlock Text="{Binding CopyMsg}"/>
|
||||
</MenuItem.Header>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding DeleteCommand}">
|
||||
<MenuItem.Header>
|
||||
<TextBlock Text="{Binding DeleteMsg}"/>
|
||||
</MenuItem.Header>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding SaveCommand}">
|
||||
<MenuItem.Header>
|
||||
<TextBlock Text="{Binding SaveMsg}"/>
|
||||
</MenuItem.Header>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</TreeView.ContextMenu>
|
||||
</TreeView>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,3 @@
|
||||
Public Class ManageLayerExpanderView
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,857 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports EgtUILib
|
||||
Imports EgtCAM5.IniFile
|
||||
|
||||
Namespace EgtCAM5
|
||||
|
||||
Public Class ManageLayerExpanderViewModel
|
||||
Inherits ViewModelBase
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
' Expander Header Properties
|
||||
Private m_HeaderName As String
|
||||
Public Property HeaderName As String
|
||||
Get
|
||||
Return m_HeaderName
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_HeaderName = value
|
||||
OnPropertyChanged("HeaderName")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_HeaderColor As SolidColorBrush
|
||||
Public Property HeaderColor As SolidColorBrush
|
||||
Get
|
||||
Return m_HeaderColor
|
||||
End Get
|
||||
Set(value As SolidColorBrush)
|
||||
m_HeaderColor = value
|
||||
OnPropertyChanged("HeaderColor")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdNewPart As ICommand
|
||||
Private m_cmdNewLayer As ICommand
|
||||
Private m_cmdLayerColor As ICommand
|
||||
Private m_cmdTreeViewDoubleClick As ICommand
|
||||
Private m_cmdTreeViewMouseUp As ICommand
|
||||
Private m_cmdTreeViewMouseRightButton As ICommand
|
||||
Private m_cmdSelect As ICommand
|
||||
Private m_cmdDeselect As ICommand
|
||||
Private m_cmdName As ICommand
|
||||
Private m_cmdInfo As ICommand
|
||||
Private m_cmdRelocate As ICommand
|
||||
Private m_cmdCopy As ICommand
|
||||
Private m_cmdDelete As ICommand
|
||||
Private m_cmdSave As ICommand
|
||||
|
||||
' Lista dei layer
|
||||
Private m_LayerList As New ObservableCollection(Of LayerTreeViewItem)
|
||||
Public Property LayerList As ObservableCollection(Of LayerTreeViewItem)
|
||||
Get
|
||||
Return m_LayerList
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of LayerTreeViewItem))
|
||||
m_LayerList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_IsRightClickedTreeItem As Boolean
|
||||
Public ReadOnly Property IsRightClickedTreeItem As Integer
|
||||
Get
|
||||
Return m_RightClickedTreeItemId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_RightClickedTreeItemId As Integer
|
||||
Public ReadOnly Property RightClickedTreeItemId As Integer
|
||||
Get
|
||||
Return m_RightClickedTreeItemId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Public ReadOnly Property NewPartMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 2)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property NewLayerMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 3)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property ColorMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 4)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property SelectMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 6)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property DeselectMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 7)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property NameMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 8)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property InfoMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 9)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property RelocateMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 10)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property CopyMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 11)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property DeleteMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 12)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property SaveMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 13)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New()
|
||||
'Imposto tempo di evidenziazione delle entità clickate
|
||||
ObjTreeTimer.Interval = TimeSpan.FromMilliseconds(1000)
|
||||
Application.Msn.Register(Application.LOADOBJTREE, Sub()
|
||||
LoadObjTree()
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.UPDATEOBJINOBJTREE, Sub(nId As Integer)
|
||||
UpdateObjInObjTree(nId)
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.UPDATEOBJINOBJTREENOMARK, Sub(nId As Integer)
|
||||
UpdateObjInObjTreeNoMark(nId)
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.SELECTIDINOBJTREE, Sub(nId As Integer)
|
||||
SelectIdInObjTree(nId, True)
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.SELECTIDINOBJTREENOMARK, Sub(nId As Integer)
|
||||
SelectIdInObjTree(nId, False)
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.CLEAROBJTREE, Sub()
|
||||
ClearObjTree()
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.UPDATEOBJTREE, Sub()
|
||||
UpdateObjTree()
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.UPDATEHEADERNAME, Sub(HeaderName As String)
|
||||
Me.HeaderName = HeaderName
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.UPDATEHEADERCOLOR, Sub(HeaderColor As Color3d)
|
||||
Me.HeaderColor = New SolidColorBrush(Color.FromArgb(CByte(HeaderColor.A * 255 / 100), CByte(HeaderColor.R), CByte(HeaderColor.G), CByte(HeaderColor.B)))
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.UPDATEOBJTREEOLDID, Sub(ObjTreeOldId As Integer)
|
||||
Me.m_nObjTreeOldId = ObjTreeOldId
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.RIGHTCLICKEDLAYERTREEITEM, Sub(Id As Integer)
|
||||
EgtResetMark(m_RightClickedTreeItemId)
|
||||
m_RightClickedTreeItemId = Id
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.ISRIGHTCLICKEDLAYERTREEITEM, Sub(Value As Boolean)
|
||||
m_IsRightClickedTreeItem = Value
|
||||
End Sub)
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region ' Constructor
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "NewPartCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property NewPartCommand As ICommand
|
||||
Get
|
||||
If m_cmdNewPart Is Nothing Then
|
||||
m_cmdNewPart = New RelayCommand(AddressOf NewPart)
|
||||
End If
|
||||
Return m_cmdNewPart
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub NewPart(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.NEWPART)
|
||||
' Seleziono nell'albero il layer del pezzo appena creato
|
||||
SelectIdInObjTree(EgtGetCurrLayer(), False)
|
||||
End Sub
|
||||
|
||||
#End Region ' NewPartCommand
|
||||
|
||||
#Region "NewLayerCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property NewLayerCommand As ICommand
|
||||
Get
|
||||
If m_cmdNewLayer Is Nothing Then
|
||||
m_cmdNewLayer = New RelayCommand(AddressOf NewLayer)
|
||||
End If
|
||||
Return m_cmdNewLayer
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub NewLayer(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.NEWLAYER)
|
||||
' Seleziono nell'albero il layer appena creato
|
||||
SelectIdInObjTree(EgtGetCurrLayer(), False)
|
||||
End Sub
|
||||
|
||||
#End Region ' NewLayerCommand
|
||||
|
||||
#Region "LayerColorCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property LayerColorCommand As ICommand
|
||||
Get
|
||||
If m_cmdLayerColor Is Nothing Then
|
||||
m_cmdLayerColor = New RelayCommand(AddressOf LayerColor)
|
||||
End If
|
||||
Return m_cmdLayerColor
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub LayerColor(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.LAYERCOLOR)
|
||||
Application.Msn.NotifyColleagues(Application.LOADOBJTREE)
|
||||
End Sub
|
||||
|
||||
#End Region ' LayerColorCommand
|
||||
|
||||
#Region "TreeViewDoubleClickCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property TreeViewDoubleClickCommand As ICommand
|
||||
Get
|
||||
If m_cmdTreeViewDoubleClick Is Nothing Then
|
||||
m_cmdTreeViewDoubleClick = New RelayCommand(AddressOf TreeViewDoubleClick)
|
||||
End If
|
||||
Return m_cmdTreeViewDoubleClick
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub TreeViewDoubleClick(ByVal param As Object)
|
||||
If m_nObjTreeOldId <> GDB_ID.NULL Then
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, m_nObjTreeOldId)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SETCURRPARTLAYER)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' TreeViewDoubleClickCommand
|
||||
|
||||
#Region "TreeViewMouseRightButtonCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property TreeViewMouseRightButtonCommand As ICommand
|
||||
Get
|
||||
If m_cmdTreeViewMouseRightButton Is Nothing Then
|
||||
m_cmdTreeViewMouseRightButton = New RelayCommand(AddressOf TreeViewMouseRightButton)
|
||||
End If
|
||||
Return m_cmdTreeViewMouseRightButton
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub TreeViewMouseRightButton(ByVal param As Object)
|
||||
If m_nObjTreeOldId <> GDB_ID.NULL Then
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, m_nObjTreeOldId)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SETCURRPARTLAYER)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' TreeViewMouseRightButtonCommand
|
||||
|
||||
#Region "TreeViewMouseUpCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property TreeViewMouseUpCommand As ICommand
|
||||
Get
|
||||
If m_cmdTreeViewMouseUp Is Nothing Then
|
||||
m_cmdTreeViewMouseUp = New RelayCommand(AddressOf TreeViewMouseUp)
|
||||
End If
|
||||
Return m_cmdTreeViewMouseUp
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub TreeViewMouseUp(ByVal param As Object)
|
||||
' determino Id di eventuale item sotto il mouse
|
||||
Dim nId As Integer = GDB_ID.NULL
|
||||
If m_IsRightClickedTreeItem Then
|
||||
nId = m_RightClickedTreeItemId
|
||||
Else
|
||||
nId = m_nObjTreeOldId
|
||||
End If
|
||||
' se Id coincide con il corrente
|
||||
If nId <> GDB_ID.NULL Then 'And nId = m_nObjTreeOldId Then
|
||||
' evidenzio
|
||||
EgtSetMark(nId)
|
||||
EgtDraw()
|
||||
' lancio timer per successiva de-evidenziazione
|
||||
ObjTreeTimer.Stop()
|
||||
ObjTreeTimer.Start()
|
||||
End If
|
||||
' se rilascio tasto destro
|
||||
'If e.Button = Windows.Forms.MouseButtons.Right Then
|
||||
' ' Id pezzo sotto il mouse
|
||||
' m_nObjTreeMenuId = nId
|
||||
' ' verifico stato visualizzazione per abilitare voci menù
|
||||
' Dim nStat As GDB_ST = GDB_ST.ON_
|
||||
' Dim bOn As Boolean = EgtGetCalcStatus(m_nObjTreeMenuId, nStat) And nStat <> GDB_ST.OFF
|
||||
' For Each Item As ToolStripItem In ContextMenuTreeView1.Items
|
||||
' If Item.Name = "cmdSetName" Or Item.Name = "cmdSetInfo" Then
|
||||
' Item.Enabled = True
|
||||
' Else
|
||||
' Item.Enabled = bOn
|
||||
' End If
|
||||
' Next
|
||||
' 'ContextMenuTreeView1.Show(TreeView1, e.Location)
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
#End Region ' TreeViewMouseUpCommand
|
||||
|
||||
#Region "SelectCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property SelectCommand As ICommand
|
||||
Get
|
||||
If m_cmdSelect Is Nothing Then
|
||||
m_cmdSelect = New RelayCommand(AddressOf SelectCmd)
|
||||
End If
|
||||
Return m_cmdSelect
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub SelectCmd(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SELECTPARTLAYEROBJ)
|
||||
End Sub
|
||||
|
||||
#End Region ' SelectCommand
|
||||
|
||||
#Region "DeselectCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property DeselectCommand As ICommand
|
||||
Get
|
||||
If m_cmdDeselect Is Nothing Then
|
||||
m_cmdDeselect = New RelayCommand(AddressOf Deselect)
|
||||
End If
|
||||
Return m_cmdDeselect
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub Deselect(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.DESELECTPARTLAYEROBJ)
|
||||
End Sub
|
||||
|
||||
#End Region ' DeselectCommand
|
||||
|
||||
#Region "NameCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property NameCommand As ICommand
|
||||
Get
|
||||
If m_cmdName Is Nothing Then
|
||||
m_cmdName = New RelayCommand(AddressOf Name)
|
||||
End If
|
||||
Return m_cmdName
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub Name(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SETNAME)
|
||||
End Sub
|
||||
|
||||
#End Region ' NameCommand
|
||||
|
||||
#Region "InfoCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property InfoCommand As ICommand
|
||||
Get
|
||||
If m_cmdInfo Is Nothing Then
|
||||
m_cmdInfo = New RelayCommand(AddressOf Info)
|
||||
End If
|
||||
Return m_cmdInfo
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub Info(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SETINFO)
|
||||
End Sub
|
||||
|
||||
#End Region ' InfoCommand
|
||||
|
||||
#Region "RelocateCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property RelocateCommand As ICommand
|
||||
Get
|
||||
If m_cmdRelocate Is Nothing Then
|
||||
m_cmdRelocate = New RelayCommand(AddressOf Relocate)
|
||||
End If
|
||||
Return m_cmdRelocate
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub Relocate(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.RELOCATEPARTLAYEROBJ)
|
||||
End Sub
|
||||
|
||||
#End Region ' RelocateCommand
|
||||
|
||||
#Region "CopyCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property CopyCommand As ICommand
|
||||
Get
|
||||
If m_cmdCopy Is Nothing Then
|
||||
m_cmdCopy = New RelayCommand(AddressOf Copy)
|
||||
End If
|
||||
Return m_cmdCopy
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub Copy(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.COPYPARTLAYEROBJ)
|
||||
End Sub
|
||||
|
||||
#End Region ' CopyCommand
|
||||
|
||||
#Region "DeleteCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property DeleteCommand As ICommand
|
||||
Get
|
||||
If m_cmdDelete Is Nothing Then
|
||||
m_cmdDelete = New RelayCommand(AddressOf Delete)
|
||||
End If
|
||||
Return m_cmdDelete
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub Delete(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.DELETE)
|
||||
End Sub
|
||||
|
||||
#End Region ' DeleteCommand
|
||||
|
||||
#Region "SaveCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property SaveCommand As ICommand
|
||||
Get
|
||||
If m_cmdSave Is Nothing Then
|
||||
m_cmdSave = New RelayCommand(AddressOf Save)
|
||||
End If
|
||||
Return m_cmdSave
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub Save(ByVal param As Object)
|
||||
Dim sDir As String = String.Empty
|
||||
GetPrivateProfileString(S_GENERAL, K_LASTNGEOBJDIR, "", sDir)
|
||||
Dim nType As NGE = DirectCast(GetPrivateProfileInt(S_GEOMDB, K_SAVETYPE, NGE.CMPTEXT), NGE)
|
||||
Application.Msn.NotifyColleagues(Application.SAVEOBJECT, New SaveObjectParam(m_RightClickedTreeItemId, sDir, nType))
|
||||
End Sub
|
||||
|
||||
#End Region ' SaveCommand
|
||||
|
||||
#End Region ' Commands
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Private WithEvents ObjTreeTimer As New System.Windows.Threading.DispatcherTimer
|
||||
Private m_nObjTreeOldId As Integer = GDB_ID.NULL
|
||||
Private m_nObjTreeMenuId As Integer = GDB_ID.NULL
|
||||
Private m_bEnableUpdateObjInObjTree As Boolean = True
|
||||
|
||||
Private Sub ObjTreeTickEvent(source As Object, e As EventArgs) Handles ObjTreeTimer.Tick
|
||||
Dim nId As Integer = GDB_ID.NULL
|
||||
If m_IsRightClickedTreeItem Then
|
||||
nId = m_RightClickedTreeItemId
|
||||
Else
|
||||
nId = m_nObjTreeOldId
|
||||
End If
|
||||
If nId <> GDB_ID.NULL Then
|
||||
EgtResetMark(nId)
|
||||
EgtDraw()
|
||||
End If
|
||||
ObjTreeTimer.Stop()
|
||||
End Sub
|
||||
|
||||
Public Sub LoadObjTree()
|
||||
LayerTreeViewItem.m_SendCmd = False
|
||||
Dim nOldId As Integer = ClearObjTree()
|
||||
AddGroupInObjTree(GDB_ID.ROOT, GDB_LV.USER, 0, LayerList)
|
||||
If nOldId <> GDB_ID.NULL Then
|
||||
m_bEnableUpdateObjInObjTree = False
|
||||
SelectIdInObjTree(nOldId, True)
|
||||
m_bEnableUpdateObjInObjTree = True
|
||||
Else
|
||||
Application.Msn.NotifyColleagues(Application.SETINFOBOX, String.Empty)
|
||||
End If
|
||||
LayerTreeViewItem.m_SendCmd = True
|
||||
End Sub
|
||||
|
||||
Private Function ClearObjTree() As Integer
|
||||
Dim nOldId As Integer = RevertOldIdInObjTree()
|
||||
LayerList.Clear()
|
||||
Return nOldId
|
||||
End Function
|
||||
|
||||
Private Sub AddGroupInObjTree(ByVal nGroupId As Integer, ByVal nLevel As Integer, ByVal nDepth As Integer, ByRef PrevNodColl As ObservableCollection(Of LayerTreeViewItem))
|
||||
|
||||
Dim CurrNodColl As ObservableCollection(Of LayerTreeViewItem)
|
||||
|
||||
If nGroupId = GDB_ID.ROOT Then
|
||||
CurrNodColl = PrevNodColl
|
||||
Else
|
||||
' livello
|
||||
Dim nObjLev As Integer = GDB_LV.USER
|
||||
EgtGetLevel(nGroupId, nObjLev)
|
||||
If nObjLev = GDB_LV.TEMP Then
|
||||
nLevel = GDB_LV.TEMP
|
||||
ElseIf nLevel = GDB_LV.USER Then
|
||||
nLevel = nObjLev
|
||||
End If
|
||||
' tipo
|
||||
Dim nGroupType As Integer = 0 ' 0=gruppo generico, 1=pezzo, 2=layer
|
||||
If nLevel = GDB_LV.USER Then
|
||||
nGroupType = nDepth
|
||||
End If
|
||||
' nome
|
||||
Dim sName As String = String.Empty
|
||||
Dim sText As String = String.Empty
|
||||
If EgtGetName(nGroupId, sName) Then
|
||||
If nGroupType = 1 Then
|
||||
sText = sName + " (Part " + nGroupId.ToString + ")"
|
||||
ElseIf nGroupType = 2 Then
|
||||
sText = sName + " (Layer " + nGroupId.ToString + ")"
|
||||
Else
|
||||
sText = sName + " (Group " + nGroupId.ToString + ")"
|
||||
End If
|
||||
Else
|
||||
If nGroupType = 1 Then
|
||||
sText = "Part " + nGroupId.ToString
|
||||
ElseIf nGroupType = 2 Then
|
||||
sText = "Layer " + nGroupId.ToString
|
||||
Else
|
||||
sText = "Group " + nGroupId.ToString
|
||||
End If
|
||||
End If
|
||||
' per visualizzare oggetti di livello diverso da utente, si deve avere il permesso
|
||||
If nLevel <> GDB_LV.USER And m_nUserLevel < 5 Then
|
||||
Return
|
||||
End If
|
||||
' inserisco il nodo nell'albero
|
||||
Dim CurrColor As Color3d
|
||||
EgtGetCalcColor(nGroupId, CurrColor)
|
||||
Dim sImage As String = TypeToImageInObjTree(GDB_TY.GROUP, nGroupType)
|
||||
Dim CurrNod As LayerTreeViewItem = New LayerTreeViewItem(nGroupId, sText, sImage, CurrColor)
|
||||
PrevNodColl.Add(CurrNod)
|
||||
CurrNodColl = CurrNod.Items
|
||||
Dim nStat As Integer = GDB_ST.ON_
|
||||
EgtGetStatus(nGroupId, nStat)
|
||||
CurrNod.OnOff = (nStat <> GDB_ST.OFF)
|
||||
End If
|
||||
|
||||
Dim nObjs As Integer = EgtGetGroupObjs(nGroupId)
|
||||
If (nObjs > 275000) Then
|
||||
Dim sText As String = "Too many entities (" + nObjs.ToString() + ")"
|
||||
CurrNodColl.Add(New LayerTreeViewItem(GDB_ID.NULL, sText))
|
||||
Return
|
||||
End If
|
||||
|
||||
Dim nId As Integer = EgtGetFirstInGroup(nGroupId)
|
||||
While nId <> GDB_ID.NULL
|
||||
'recupero il tipo di nodo
|
||||
Dim nType As Integer = EgtGetType(nId)
|
||||
'se gruppo
|
||||
If nType = GDB_TY.GROUP Then
|
||||
AddGroupInObjTree(nId, nLevel, nDepth + 1, CurrNodColl)
|
||||
'se oggetto geometrico
|
||||
ElseIf nType >= GDB_TY.GEO_VECTOR Then
|
||||
Dim sTitle As String = String.Empty
|
||||
EgtGetTitle(nId, sTitle)
|
||||
Dim sName As String = String.Empty
|
||||
Dim sText As String = String.Empty
|
||||
If EgtGetName(nId, sName) Then
|
||||
sText = sName + " (" + sTitle + " " + nId.ToString + ")"
|
||||
Else
|
||||
sText = sTitle + " " + nId.ToString
|
||||
End If
|
||||
Dim CurrColor As New Color3d(0, 0, 0, 0)
|
||||
EgtGetColor(nId, CurrColor)
|
||||
Dim sImage As String = TypeToImageInObjTree(nType, nDepth)
|
||||
Dim CurrNod As LayerTreeViewItem = New LayerTreeViewItem(nId, sText, sImage, CurrColor)
|
||||
CurrNodColl.Add(CurrNod)
|
||||
Dim nStat As Integer = GDB_ST.ON_
|
||||
EgtGetStatus(nId, nStat)
|
||||
CurrNod.OnOff = (nStat <> GDB_ST.OFF)
|
||||
End If
|
||||
'passo al successivo
|
||||
nId = EgtGetNext(nId)
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Private Function TypeToImageInObjTree(ByVal nType As Integer, ByVal nSubType As Integer) As String
|
||||
|
||||
Select Case nType
|
||||
Case GDB_TY.GROUP
|
||||
If nSubType = 1 Then
|
||||
Return "/Resources/TreeView/Folder.png"
|
||||
ElseIf nSubType = 2 Then
|
||||
Return "/Resources/TreeView/Folder.png"
|
||||
Else
|
||||
Return "/Resources/TreeView/Group.ico"
|
||||
End If
|
||||
Case GDB_TY.GEO_VECTOR
|
||||
Return "/Resources/TreeView/Vector.ico"
|
||||
Case GDB_TY.GEO_POINT
|
||||
Return "/Resources/TreeView/Point.ico"
|
||||
Case GDB_TY.GEO_FRAME
|
||||
Return "/Resources/TreeView/Frame.ico"
|
||||
Case GDB_TY.CRV_LINE
|
||||
Return "/Resources/TreeView/Line.ico"
|
||||
Case GDB_TY.CRV_ARC
|
||||
Return "/Resources/TreeView/Arc.ico"
|
||||
Case GDB_TY.CRV_BEZ
|
||||
Return "/Resources/TreeView/CBezier.ico"
|
||||
Case GDB_TY.CRV_COMPO
|
||||
Return "/Resources/TreeView/CCompo.ico"
|
||||
Case GDB_TY.SRF_MESH
|
||||
Return "/Resources/TreeView/STriMesh.ico"
|
||||
Case GDB_TY.SRF_FRGN
|
||||
Return "/Resources/TreeView/SFlatRegion.ico"
|
||||
Case GDB_TY.VOL_ZMAP
|
||||
Return "/Resources/TreeView/VolZmap.ico"
|
||||
Case GDB_TY.EXT_TEXT
|
||||
Return "/Resources/TreeView/Text.ico"
|
||||
End Select
|
||||
Return ""
|
||||
End Function
|
||||
|
||||
Private Sub UpdateObjTree()
|
||||
' per aggiornare l'albero senza ricostruirlo da capo
|
||||
' se c'è una entità corrente, ne aggiorno i dati
|
||||
If m_nObjTreeOldId <> GDB_ID.NULL Then
|
||||
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, m_nObjTreeOldId)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub UpdateObjInObjTree(nId As Integer)
|
||||
If m_bEnableUpdateObjInObjTree Then
|
||||
' ripristino eventuale vecchio oggetto selezionato
|
||||
RevertOldIdInObjTree()
|
||||
' stampa dei dati del nuovo oggetto
|
||||
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, nId)
|
||||
' evidenzio l'oggetto
|
||||
EgtSetMark(nId)
|
||||
m_nObjTreeOldId = nId
|
||||
' imposto il ridisegno della scena
|
||||
EgtDraw()
|
||||
' lancio timer per successiva de-evidenziazione
|
||||
ObjTreeTimer.Stop()
|
||||
ObjTreeTimer.Start()
|
||||
Else
|
||||
' stampa dei dati del nuovo oggetto
|
||||
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, nId)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub UpdateObjInObjTreeNoMark(nId As Integer)
|
||||
If m_bEnableUpdateObjInObjTree Then
|
||||
' ripristino eventuale vecchio oggetto selezionato
|
||||
RevertOldIdInObjTree()
|
||||
' stampa dei dati del nuovo oggetto
|
||||
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, nId)
|
||||
' salvo id corrente
|
||||
m_nObjTreeOldId = nId
|
||||
Else
|
||||
' stampa dei dati del nuovo oggetto
|
||||
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, nId)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function RevertOldIdInObjTree() As Integer
|
||||
' salvo il vecchio Id
|
||||
Dim nOldId As Integer = m_nObjTreeOldId
|
||||
' se non nullo...
|
||||
If EgtExistsObj(m_nObjTreeOldId) Then
|
||||
' smarco l'oggetto
|
||||
EgtResetMark(m_nObjTreeOldId)
|
||||
' annullo oggetto da ripristinare
|
||||
m_nObjTreeOldId = GDB_ID.NULL
|
||||
End If
|
||||
Return nOldId
|
||||
End Function
|
||||
|
||||
Private Function SelectIdInObjTree(nId As Integer, bMark As Boolean) As Boolean
|
||||
Dim tNode As LayerTreeViewItem = SearchIdInLayerList(LayerList, nId, True)
|
||||
If Not IsNothing(tNode) Then
|
||||
If Not bMark Then LayerTreeViewItem.m_MarkOnSel = False
|
||||
tNode.IsSelected = True
|
||||
If Not bMark Then LayerTreeViewItem.m_MarkOnSel = True
|
||||
tNode.IsExpanded = True
|
||||
m_nObjTreeOldId = nId
|
||||
Return True
|
||||
Else
|
||||
m_nObjTreeOldId = GDB_ID.NULL
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Function SearchIdInLayerList(Tree As ObservableCollection(Of LayerTreeViewItem), nId As Integer, bExpand As Boolean) As LayerTreeViewItem
|
||||
For Each Item In Tree
|
||||
If Item.Id = nId Then
|
||||
If bExpand Then Item.IsExpanded = True
|
||||
Return Item
|
||||
ElseIf Item.Items.Count() > 0 Then
|
||||
Dim Item2 As LayerTreeViewItem = SearchIdInLayerList(Item.Items, nId, bExpand)
|
||||
If Not IsNothing(Item2) Then
|
||||
If bExpand Then Item.IsExpanded = True
|
||||
Return Item2
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
'Private Sub MenuObjTree_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) Handles ContextMenuTreeView1.ItemClicked
|
||||
' If e.ClickedItem.Name = "cmdSelectPartLayObj" Then
|
||||
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
|
||||
' m_Controller.ExecuteCommand(CMD.SELECTPARTLAYEROBJ)
|
||||
' ElseIf e.ClickedItem.Name = "cmdDeselectPartLayObj" Then
|
||||
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
|
||||
' m_Controller.ExecuteCommand(CMD.DESELECTPARTLAYEROBJ)
|
||||
' ElseIf e.ClickedItem.Name = "cmdSetName" Then
|
||||
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
|
||||
' m_Controller.ExecuteCommand(CMD.SETNAME)
|
||||
' ElseIf e.ClickedItem.Name = "cmdSetInfo" Then
|
||||
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
|
||||
' m_Controller.ExecuteCommand(CMD.SETINFO)
|
||||
' ElseIf e.ClickedItem.Name = "cmdRelocatePartLayObj" Then
|
||||
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
|
||||
' m_Controller.ExecuteCommand(CMD.RELOCATEPARTLAYEROBJ)
|
||||
' ElseIf e.ClickedItem.Name = "cmdCopyPartLayObj" Then
|
||||
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
|
||||
' m_Controller.ExecuteCommand(CMD.COPYPARTLAYEROBJ)
|
||||
' ElseIf e.ClickedItem.Name = "cmdDeletePartLayObj" Then
|
||||
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
|
||||
' m_Controller.ExecuteCommand(CMD.DELETE)
|
||||
' ElseIf e.ClickedItem.Name = "cmdSavePartLay" Then
|
||||
' ContextMenuTreeView1.Close()
|
||||
' Dim sDir As String = String.Empty
|
||||
' GetPrivateProfileString(S_GENERAL, K_LASTNGEOBJDIR, "", sDir, m_sIniFile)
|
||||
' Dim nType As NGE = GetPrivateProfileInt(S_GEOMDB, K_SAVETYPE, NGE.CMPTEXT, m_sIniFile)
|
||||
' m_Controller.SaveObject(m_nObjTreeMenuId, sDir, nType)
|
||||
' End If
|
||||
'End Sub
|
||||
|
||||
#End Region ' Methods
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
Reference in New Issue
Block a user