331 lines
20 KiB
XML
331 lines
20 KiB
XML
<!--
|
||
NavisworksTransport 分层管理页签视图 - 重构优化版本
|
||
功能优化:
|
||
1. 移除独立楼层分析区域,整合到预览功能中
|
||
2. 将遍历深度控件移到分层策略选择框后面
|
||
3. 用预览分层替代楼层分析,错误信息在预览列表中显示
|
||
4. 移除输出目录显示,改为点击保存时弹出文件对话框
|
||
5. 重命名和重布局按钮:执行分层→分层保存,保存选中项→保存当前选择项
|
||
|
||
设计原则:简化操作流程、整合相关功能、与Navisworks 2026风格一致
|
||
-->
|
||
<UserControl x:Class="NavisworksTransport.UI.WPF.Views.LayerManagementView"
|
||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||
xmlns:converters="clr-namespace:NavisworksTransport.UI.WPF.Converters"
|
||
mc:Ignorable="d"
|
||
d:DesignHeight="700" d:DesignWidth="420">
|
||
|
||
<UserControl.Resources>
|
||
<ResourceDictionary>
|
||
<ResourceDictionary.MergedDictionaries>
|
||
<ResourceDictionary Source="pack://application:,,,/NavisworksTransportPlugin;component/src/UI/WPF/Resources/NavisworksStyles.xaml"/>
|
||
</ResourceDictionary.MergedDictionaries>
|
||
|
||
<!-- 转换器资源 -->
|
||
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
|
||
<converters:IndexConverter x:Key="IndexConverter"/>
|
||
</ResourceDictionary>
|
||
</UserControl.Resources>
|
||
|
||
<ScrollViewer VerticalScrollBarVisibility="Auto" Padding="10">
|
||
<StackPanel>
|
||
|
||
<!-- 区域1: 自定义分层属性 -->
|
||
<Border BorderBrush="#FFD4E7FF" BorderThickness="1" CornerRadius="0" Margin="0,0,0,15" Padding="12">
|
||
<StackPanel>
|
||
<Label Content="自定义分层属性" Style="{StaticResource SectionHeaderStyle}"/>
|
||
|
||
<!-- 模型选择状态显示 -->
|
||
<Grid Margin="0,5,0,15">
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="Auto"/>
|
||
</Grid.RowDefinitions>
|
||
|
||
<TextBlock Grid.Row="0"
|
||
Text="{Binding SelectedModelsText}"
|
||
FontWeight="SemiBold"
|
||
Foreground="#FF2B579A"
|
||
Margin="0,0,0,5"/>
|
||
</Grid>
|
||
|
||
<!-- 自定义分层属性设置功能 -->
|
||
<Expander Header="自定义分层属性"
|
||
IsExpanded="False"
|
||
Margin="0,5,0,0">
|
||
<StackPanel Margin="10,10,0,5">
|
||
<!-- 使用提示信息 -->
|
||
<TextBlock Text="为选中的模型设置自定义分层属性,用于后续的分层导出和路径规划"
|
||
Style="{StaticResource StatusTextStyle}"
|
||
Foreground="#FF666666"
|
||
Margin="0,0,0,10"
|
||
TextWrapping="Wrap"/>
|
||
|
||
<!-- 第一行:分层属性选择 -->
|
||
<Grid Margin="0,0,0,10">
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition Width="Auto"/>
|
||
<ColumnDefinition Width="120"/>
|
||
<ColumnDefinition Width="Auto"/>
|
||
<ColumnDefinition Width="120"/>
|
||
<ColumnDefinition Width="*"/>
|
||
</Grid.ColumnDefinitions>
|
||
|
||
<Label Grid.Column="0" Content="分层属性:" Style="{StaticResource ParameterLabelStyle}"/>
|
||
<ComboBox Grid.Column="1"
|
||
x:Name="LayerParameterComboBox"
|
||
ItemsSource="{Binding LayerParameterOptions}"
|
||
SelectedItem="{Binding SelectedLayerParameter}"
|
||
Margin="5,2" IsEnabled="{Binding IsNotProcessing}"
|
||
ToolTip="选择分层属性类型">
|
||
</ComboBox>
|
||
|
||
<Label Grid.Column="2" Content="属性值:" VerticalAlignment="Center" Margin="15,0,0,0"/>
|
||
<TextBox Grid.Column="3"
|
||
Text="{Binding SelectedParameterValue}"
|
||
Style="{StaticResource ParameterInputStyle}"
|
||
ToolTip="输入属性值,如F1、F2、北区、南区等"/>
|
||
</Grid>
|
||
|
||
<!-- 操作按钮区域 -->
|
||
<StackPanel Orientation="Horizontal"
|
||
HorizontalAlignment="Center"
|
||
Margin="0,5,0,5">
|
||
<Button Content="设置分层属性"
|
||
Style="{StaticResource ActionButtonStyle}"
|
||
Command="{Binding SetLayerAttributeCommand}"
|
||
IsEnabled="{Binding CanSetLayerAttribute}"
|
||
ToolTip="为选中的模型设置分层属性"/>
|
||
<Button Content="清除分层属性"
|
||
Style="{StaticResource ActionButtonStyle}"
|
||
Command="{Binding ClearLayerAttributeCommand}"
|
||
IsEnabled="{Binding CanClearLayerAttribute}"
|
||
ToolTip="清除选中模型的分层属性"/>
|
||
<Button Content="查看分层属性"
|
||
Style="{StaticResource SecondaryButtonStyle}"
|
||
Command="{Binding ViewLayerAttributeCommand}"
|
||
IsEnabled="{Binding HasSelectedItems}"
|
||
ToolTip="查看选中模型的当前分层属性"/>
|
||
</StackPanel>
|
||
|
||
<!-- 分层属性显示区域 -->
|
||
<GroupBox Header="当前分层属性" Margin="0,10,0,0"
|
||
Visibility="{Binding ShowLayerAttributeInfo, Converter={StaticResource BoolToVisibilityConverter}}">
|
||
<StackPanel Margin="10">
|
||
<TextBlock Text="{Binding CurrentLayerAttributeInfo}"
|
||
Style="{StaticResource StatusTextStyle}"
|
||
TextWrapping="Wrap"
|
||
Margin="0,5"/>
|
||
</StackPanel>
|
||
</GroupBox>
|
||
</StackPanel>
|
||
</Expander>
|
||
</StackPanel>
|
||
</Border>
|
||
|
||
<!-- 区域2: 分层预览与保存 -->
|
||
<Border BorderBrush="#FFD4E7FF" BorderThickness="1" CornerRadius="0" Margin="0,0,0,15" Padding="12">
|
||
<StackPanel>
|
||
<Label Content="分层预览与保存" Style="{StaticResource SectionHeaderStyle}"/>
|
||
|
||
<!-- 分层策略和深度选择 -->
|
||
<Grid Margin="0,5,0,10">
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="Auto"/>
|
||
</Grid.RowDefinitions>
|
||
|
||
<!-- 第一行:分层策略、自定义选项、深度选择和预览按钮 -->
|
||
<Grid Grid.Row="0">
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition Width="Auto"/>
|
||
<ColumnDefinition Width="Auto"/>
|
||
<ColumnDefinition Width="Auto"/>
|
||
<ColumnDefinition Width="Auto"/>
|
||
<ColumnDefinition Width="Auto"/>
|
||
<ColumnDefinition Width="Auto"/>
|
||
</Grid.ColumnDefinitions>
|
||
|
||
<Label Grid.Column="0" Content="分层策略:" VerticalAlignment="Center"/>
|
||
|
||
<ComboBox Grid.Column="1"
|
||
ItemsSource="{Binding SplitStrategies}"
|
||
SelectedItem="{Binding SelectedSplitStrategy}"
|
||
Margin="5,2" IsEnabled="{Binding IsNotProcessing}"/>
|
||
|
||
<!-- 自定义分层二级选项 -->
|
||
<ComboBox Grid.Column="2"
|
||
ItemsSource="{Binding CustomLayerOptions}"
|
||
SelectedItem="{Binding SelectedCustomLayerOption}"
|
||
Margin="5,2"
|
||
IsEnabled="{Binding IsNotProcessing}"
|
||
Visibility="{Binding ShowCustomLayerOptions, Converter={StaticResource BoolToVisibilityConverter}}"
|
||
ToolTip="选择自定义分层的具体类型"/>
|
||
|
||
<Label Grid.Column="3" Content="遍历深度:" VerticalAlignment="Center" Margin="10,0,0,0"/>
|
||
<ComboBox Grid.Column="4"
|
||
SelectedItem="{Binding SelectedDepth}"
|
||
ItemsSource="{Binding DepthOptions}"
|
||
Margin="5,2" IsEnabled="{Binding IsNotProcessing}"/>
|
||
<Button Grid.Column="5"
|
||
Content="预览"
|
||
Style="{StaticResource SecondaryButtonStyle}"
|
||
Command="{Binding PreviewSplitCommand}"
|
||
IsEnabled="{Binding CanPreviewSplit}"
|
||
Margin="10,2,0,2"/>
|
||
</Grid>
|
||
|
||
<!-- 第二行:说明文字 -->
|
||
<TextBlock Grid.Row="1"
|
||
Text="(1级=第1级节点,2级=第2级节点...,全部=所有级别)"
|
||
Style="{StaticResource StatusTextStyle}"
|
||
Margin="0,3,0,0"/>
|
||
</Grid>
|
||
|
||
<!-- 导出选项设置 -->
|
||
<Expander Header="NWD文件导出选项" IsExpanded="False" Margin="0,5,0,5">
|
||
<StackPanel Margin="10,10,0,5">
|
||
<TextBlock Text="配置NWD文件导出选项(对应Navisworks导出对话框选项)"
|
||
Style="{StaticResource StatusTextStyle}"
|
||
Margin="0,0,0,8"/>
|
||
<StackPanel>
|
||
<CheckBox Content="嵌入ReCap和纹理数据"
|
||
IsChecked="{Binding EmbedXrefs}"
|
||
Margin="0,0,0,5"
|
||
ToolTip="将外部引用和纹理数据嵌入到导出的NWD文件中"/>
|
||
<TextBlock Text="⚠️ 注意:嵌入纹理数据可能导致导出失败或程序崩溃,建议在小模型上使用"
|
||
Style="{StaticResource StatusTextStyle}"
|
||
Foreground="#FFFF6600"
|
||
FontStyle="Italic"
|
||
Margin="0,0,0,8"/>
|
||
<CheckBox Content="阻止导出对象特性"
|
||
IsChecked="{Binding PreventObjectPropertyExport}"
|
||
Margin="0,0,0,5"
|
||
ToolTip="导出时不包含对象的属性信息,可减小文件大小"/>
|
||
</StackPanel>
|
||
</StackPanel>
|
||
</Expander>
|
||
|
||
<!-- 分层预览结果和操作按钮 -->
|
||
<GroupBox Header="分层预览结果" Margin="0,10,0,0" MinHeight="200">
|
||
<Grid>
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="*"/>
|
||
<RowDefinition Height="Auto"/>
|
||
</Grid.RowDefinitions>
|
||
|
||
<!-- 预览列表 -->
|
||
<ListView Grid.Row="0"
|
||
ItemsSource="{Binding SplitPreviewResults}"
|
||
SelectedItem="{Binding SelectedPreviewResult}"
|
||
Visibility="{Binding ShowPreviewResults, Converter={StaticResource BoolToVisibilityConverter}}"
|
||
Margin="0,0,0,10">
|
||
<ListView.View>
|
||
<GridView>
|
||
<GridViewColumn Header="序号" Width="50">
|
||
<GridViewColumn.CellTemplate>
|
||
<DataTemplate>
|
||
<TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=ListViewItem}, Converter={StaticResource IndexConverter}}"
|
||
HorizontalAlignment="Center"/>
|
||
</DataTemplate>
|
||
</GridViewColumn.CellTemplate>
|
||
</GridViewColumn>
|
||
<GridViewColumn Header="分层名称" DisplayMemberBinding="{Binding LayerName}" Width="120"/>
|
||
<GridViewColumn Header="分层属性" DisplayMemberBinding="{Binding LayerAttribute}" Width="80"/>
|
||
<GridViewColumn Header="是否保存" Width="80">
|
||
<GridViewColumn.HeaderContainerStyle>
|
||
<Style TargetType="GridViewColumnHeader">
|
||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||
</Style>
|
||
</GridViewColumn.HeaderContainerStyle>
|
||
<GridViewColumn.CellTemplate>
|
||
<DataTemplate>
|
||
<CheckBox IsChecked="{Binding IsSelectedForSave}"
|
||
HorizontalAlignment="Center"
|
||
VerticalAlignment="Center"
|
||
ToolTip="选中的分层将被保存"/>
|
||
</DataTemplate>
|
||
</GridViewColumn.CellTemplate>
|
||
</GridViewColumn>
|
||
</GridView>
|
||
</ListView.View>
|
||
</ListView>
|
||
|
||
<StackPanel Grid.Row="0"
|
||
VerticalAlignment="Center"
|
||
Visibility="{Binding ShowPreviewPrompt, Converter={StaticResource BoolToVisibilityConverter}}">
|
||
<TextBlock Text="点击[预览]生成分层列表,或查看错误信息"
|
||
Style="{StaticResource StatusTextStyle}"
|
||
HorizontalAlignment="Center"/>
|
||
</StackPanel>
|
||
|
||
<!-- 操作按钮区域 -->
|
||
<StackPanel Grid.Row="1"
|
||
Orientation="Horizontal"
|
||
HorizontalAlignment="Center"
|
||
Margin="0,5,0,5">
|
||
<Button Content="单独显示"
|
||
Style="{StaticResource SecondaryButtonStyle}"
|
||
Command="{Binding IsolateSelectedLayerCommand}"
|
||
IsEnabled="{Binding CanIsolateSelectedLayer}"
|
||
ToolTip="隐藏其他分层,只显示选中的分层内容"
|
||
Margin="0,0,8,0"/>
|
||
<Button Content="显示所有"
|
||
Style="{StaticResource SecondaryButtonStyle}"
|
||
Command="{Binding ShowAllLayersCommand}"
|
||
IsEnabled="{Binding IsNotProcessing}"
|
||
ToolTip="显示所有分层内容"
|
||
Margin="0,0,15,0"/>
|
||
<Button Content="分层保存"
|
||
Style="{StaticResource ActionButtonStyle}"
|
||
Command="{Binding ExecuteSplitCommand}"
|
||
IsEnabled="{Binding CanExecuteSplit}"/>
|
||
</StackPanel>
|
||
</Grid>
|
||
</GroupBox>
|
||
</StackPanel>
|
||
</Border>
|
||
|
||
<!-- 区域3: 选择集保存 -->
|
||
<Border BorderBrush="#FFD4E7FF" BorderThickness="1" CornerRadius="0" Margin="0,0,0,15" Padding="12">
|
||
<StackPanel>
|
||
<Label Content="选择集保存" Style="{StaticResource SectionHeaderStyle}"/>
|
||
|
||
<!-- 选择状态和保存选项 -->
|
||
<Grid Margin="0,5,0,15">
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="Auto"/>
|
||
</Grid.RowDefinitions>
|
||
|
||
<TextBlock Grid.Row="0"
|
||
Text="将当前选择树中的选中内容保存为独立nwd文件"
|
||
Style="{StaticResource StatusTextStyle}"
|
||
Margin="0,0,0,8"/>
|
||
|
||
<TextBlock Grid.Row="1"
|
||
Text="{Binding CurrentSelectionText}"
|
||
FontWeight="SemiBold"
|
||
Foreground="#FF2B579A"
|
||
Margin="0,0,0,10"/>
|
||
</Grid>
|
||
|
||
<!-- 保存按钮区域 -->
|
||
<StackPanel Orientation="Horizontal"
|
||
HorizontalAlignment="Center"
|
||
Margin="0,5,0,0">
|
||
<Button Content="保存当前选择项"
|
||
Style="{StaticResource ActionButtonStyle}"
|
||
Command="{Binding SaveSelectedItemsCommand}"
|
||
IsEnabled="{Binding HasSelectedItems}"/>
|
||
</StackPanel>
|
||
</StackPanel>
|
||
</Border>
|
||
|
||
</StackPanel>
|
||
</ScrollViewer>
|
||
</UserControl> |