<!--
NavisworksTransport 主控制面板 - 采用与其他视图一致的Navisworks 2026风格

功能说明：
1. 分层管理：模型分层控制和可见性管理
2. 类别设置：物流类别设置和属性管理
3. 路径编辑：3D路径规划和编辑功能
4. 检测动画：路径动画生成和碰撞检测
5. 系统管理：日志管理、插件设置和性能监控

设计原则：与Navisworks 2026风格一致，480像素宽度，现代化UI布局
-->
<UserControl x:Class="NavisworksTransport.UI.WPF.LogisticsControlPanel"
             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:views="clr-namespace:NavisworksTransport.UI.WPF.Views"
             xmlns:converters="clr-namespace:NavisworksTransport.UI.WPF.Converters"
             mc:Ignorable="d" 
             d:DesignHeight="700" d:DesignWidth="480">
             
    <UserControl.Resources>
        <!-- 引用共享的Navisworks 2026样式资源 -->
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/TransportPlugin;component/src/UI/WPF/Resources/NavisworksStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            
            <!-- 转换器资源 -->
            <BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
            <converters:BoolToBrushConverter x:Key="BoolToBrushConverter"/>
            <converters:BoolToOpacityConverter x:Key="BoolToOpacityConverter"/>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        
        <!-- 主内容区域 -->
        <TabControl Grid.Row="0" 
                    Name="MainTabControl" 
                    Style="{StaticResource NavisworksTabControlStyle}"
                    Margin="10,10,10,5">
                <TabItem Header="分层管理" Name="LayerManagementTab" Style="{StaticResource NavisworksTabItemStyle}">
                    <Border Background="White" CornerRadius="0">
                        <ContentControl x:Name="LayerManagementContent" Margin="0"/>
                    </Border>
                </TabItem>
                
                <TabItem Header="类别设置" Name="ModelSettingsTab" Style="{StaticResource NavisworksTabItemStyle}">
                    <Border Background="White" CornerRadius="0">
                        <ContentControl x:Name="ModelSettingsContent" Margin="0"/>
                    </Border>
                </TabItem>
                
                <TabItem Header="路径编辑" Name="PathEditingTab" Style="{StaticResource NavisworksTabItemStyle}">
                    <Border Background="White" CornerRadius="0">
                        <ContentControl x:Name="PathEditingContent" Margin="0"/>
                    </Border>
                </TabItem>
                
                <TabItem Header="检测动画" Name="AnimationControlTab" Style="{StaticResource NavisworksTabItemStyle}">
                    <Border Background="White" CornerRadius="0">
                        <ContentControl x:Name="AnimationControlContent" Margin="0"/>
                    </Border>
                </TabItem>
                
                <TabItem Header="批处理任务" Name="BatchTaskManagementTab" Style="{StaticResource NavisworksTabItemStyle}">
                    <Border Background="White" CornerRadius="0">
                        <ContentControl x:Name="BatchTaskManagementContent" Margin="0"/>
                    </Border>
                </TabItem>
                
                <TabItem Header="系统管理" Name="SystemManagementTab" Style="{StaticResource NavisworksTabItemStyle}">
                    <Border Background="White" CornerRadius="0">
                        <views:SystemManagementView x:Name="SystemManagementView" Margin="0"/>
                    </Border>
                </TabItem>
            </TabControl>
        
        <!-- 底部操作栏 -->
        <Border Grid.Row="1" 
                BorderBrush="#FFD4E7FF" 
                BorderThickness="1" 
                CornerRadius="0" 
                Background="#FFF8FBFF"
                Margin="10,5,10,10" 
                Padding="12,8">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                
                <!-- 左侧：状态信息 -->
                <Grid Grid.Column="0" Margin="4,6,8,6">
                    <ProgressBar Height="20"
                                Value="{Binding ProgressPercentage}"
                                IsIndeterminate="{Binding IsIndeterminateProgress}"
                                Visibility="{Binding IsProcessing, Converter={StaticResource BoolToVisibilityConverter}}"/>
                    
                    <TextBlock Text="{Binding StatusText}"
                              HorizontalAlignment="Left"
                              VerticalAlignment="Center"
                              FontSize="10"
                              Margin="2,0,0,0"/>
                </Grid>
                
                <!-- 中间：渲染模式快捷按钮 -->
                <StackPanel Grid.Column="1" 
                            Orientation="Horizontal"
                            HorizontalAlignment="Center">
                    <ToggleButton IsChecked="{Binding ShowControlVisualization}"
                                  ToolTip="控制点连线"
                                  Width="28" Height="24"
                                  Margin="2,0">
                        <TextBlock Text="CP" FontSize="9" FontWeight="Bold"
                                   Foreground="{Binding ShowControlVisualization, Converter={StaticResource BoolToBrushConverter}, ConverterParameter=Green}"/>
                    </ToggleButton>
                    <ToggleButton IsChecked="{Binding ShowPathLines}"
                                  IsEnabled="{Binding CanUsePathLines}"
                                  ToolTip="路径线"
                                  Width="28" Height="24"
                                  Margin="2,0"
                                  Opacity="{Binding CanUsePathLines, Converter={StaticResource BoolToOpacityConverter}}">
                        <TextBlock Text="LN" FontSize="9" FontWeight="Bold"
                                   Foreground="{Binding ShowPathLines, Converter={StaticResource BoolToBrushConverter}, ConverterParameter=Blue}"/>
                    </ToggleButton>
                    <ToggleButton IsChecked="{Binding ShowObjectSpace}"
                                  ToolTip="通行空间"
                                  Width="28" Height="24"
                                  Margin="2,0">
                        <TextBlock Text="SP" FontSize="9" FontWeight="Bold"
                                   Foreground="{Binding ShowObjectSpace, Converter={StaticResource BoolToBrushConverter}, ConverterParameter=Orange}"/>
                    </ToggleButton>
                    
                    <!-- 分隔符 -->
                    <TextBlock Text="|" 
                               VerticalAlignment="Center" 
                               Margin="8,0,6,0" 
                               Foreground="#FFCCCCCC"
                               FontSize="14"/>

                    <!-- 选择对象剖面盒开关 -->
                    <ToggleButton IsChecked="{Binding IsSelectionClipBoxEnabled}"
                                  ToolTip="剖面盒（聚焦当前选择对象）"
                                  Width="28" Height="24"
                                  Margin="2,0">
                        <Viewbox Width="18" Height="18" Stretch="Uniform">
                            <Canvas Width="20" Height="20">
                                <Path Data="M 2,6 L 14,6 L 14,18 L 2,18 Z M 2,6 L 6,2 L 18,2 L 14,6 M 14,18 L 18,14 L 18,2 L 14,6"
                                      Stroke="{Binding IsSelectionClipBoxEnabled, Converter={StaticResource BoolToBrushConverter}, ConverterParameter=Green}"
                                      StrokeThickness="1.3"
                                      Fill="Transparent"/>
                                <Rectangle Canvas.Left="6"
                                           Canvas.Top="10"
                                           Width="4"
                                           Height="4"
                                           Stroke="{Binding IsSelectionClipBoxEnabled, Converter={StaticResource BoolToBrushConverter}, ConverterParameter=Green}"
                                           StrokeThickness="1.2"
                                           Fill="Transparent"/>
                            </Canvas>
                        </Viewbox>
                    </ToggleButton>

                    <!-- 路径剖面盒开关 -->
                    <ToggleButton IsChecked="{Binding IsClipBoxEnabled}"
                                  ToolTip="剖面盒（聚焦当前路径）"
                                  Width="28" Height="24"
                                  Margin="2,0">
                        <Viewbox Width="18" Height="18" Stretch="Uniform">
                            <Canvas Width="20" Height="20">
                                <Path Data="M 2,6 L 14,6 L 14,18 L 2,18 Z M 2,6 L 6,2 L 18,2 L 14,6 M 14,18 L 18,14 L 18,2 L 14,6"
                                      Stroke="{Binding IsClipBoxEnabled, Converter={StaticResource BoolToBrushConverter}, ConverterParameter=Green}"
                                      StrokeThickness="1.3"
                                      Fill="Transparent"/>
                                <Polyline Points="5.5,13 7.2,11 8.1,12 10.5,10"
                                          Stroke="{Binding IsClipBoxEnabled, Converter={StaticResource BoolToBrushConverter}, ConverterParameter=Green}"
                                          StrokeThickness="1.2"
                                          StrokeLineJoin="Round"
                                          StrokeStartLineCap="Round"
                                          StrokeEndLineCap="Round"/>
                            </Canvas>
                        </Viewbox>
                    </ToggleButton>
                </StackPanel>

                <!-- 右侧：原有按钮 -->
                <StackPanel Grid.Column="2" Orientation="Horizontal" Margin="0,0,-6,0">
                    <TextBlock Text="|" 
                               VerticalAlignment="Center" 
                               Margin="4,0,6,0" 
                               Foreground="#FFCCCCCC"
                               FontSize="14"/>
                    <Button Content="帮助"
                            Click="HelpButton_Click" 
                            Style="{StaticResource SecondaryButtonStyle}"
                            ToolTip="查看插件使用说明和操作指南"/>
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</UserControl>
