<!--
NavisworksTransport 检测动画页签视图 - 采用与类别设置和分层管理一致的Navisworks 2026风格

功能说明：
1. 动画参数设置：速度、帧率、持续时间、循环播放、平滑过渡等
2. 播放控制：开始、暂停、停止动画，显示播放进度和状态
3. 碰撞检测：运行碰撞检测、查看检测报告、显示检测结果摘要
4. 动画预览：提供操作指导和状态反馈

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

            <!-- 动画控制页面特有的样式 -->
            <Style x:Key="ProgressBarStyle" TargetType="ProgressBar">
                <Setter Property="Height" Value="20"/>
                <Setter Property="Foreground" Value="{StaticResource NavisworksSecondaryBrush}"/>
                <Setter Property="Background" Value="{StaticResource NavisworksButtonBrush}"/>
                <Setter Property="BorderBrush" Value="{StaticResource NavisworksPrimaryBrush}"/>
                <Setter Property="BorderThickness" Value="1"/>
            </Style>

            <Style x:Key="SliderStyle" TargetType="Slider">
                <Setter Property="Foreground" Value="{StaticResource NavisworksSecondaryBrush}"/>
                <Setter Property="Height" Value="20"/>
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>

    <ScrollViewer VerticalScrollBarVisibility="Auto" Padding="10">
        <StackPanel>
            
            <!-- 区域1: 动画参数设置 -->
            <Border BorderBrush="#FFD4E7FF" BorderThickness="1" CornerRadius="0" Padding="10">
                <StackPanel>
                    <Label Content="动画参数设置" Style="{StaticResource SectionHeaderStyle}"/>
                    
                    <!-- 动画参数设置 -->
                    <Grid Margin="0,5,0,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="帧率:" Style="{StaticResource ParameterLabelStyle}"/>
                        <ComboBox Grid.Column="1" 
                                  ItemsSource="{Binding AvailableFrameRates}" 
                                  SelectedItem="{Binding SelectedFrameRate}"/>
                        <Label Grid.Column="2" Content="帧/秒" Style="{StaticResource UnitLabelStyle}"/>
                        <Label Grid.Column="3"
                                Content="持续时间:"
                                Style="{StaticResource ParameterLabelStyle}"/>
                        <TextBox Grid.Column="4"
                                Text="{Binding AnimationDuration, Mode=TwoWay, UpdateSourceTrigger=LostFocus, Converter={StaticResource EditableNumberConverter}, ConverterParameter=0.0###, ValidatesOnExceptions=True, NotifyOnValidationError=True}"
                                Style="{StaticResource ParameterInputStyle}"/>
                        <Label Grid.Column="5" Content="秒" Style="{StaticResource UnitLabelStyle}"/>
                    </Grid>
                    
                </StackPanel>
            </Border>
            
            <!-- 区域2: 碰撞检测参数 -->
            <Border BorderBrush="#FFD4E7FF" BorderThickness="1" CornerRadius="0" Margin="0,10,0,0" Padding="10">
                <StackPanel>
                    <Label Content="碰撞检测参数" Style="{StaticResource SectionHeaderStyle}"/>
                    
                    <Grid Margin="0,5,0,0">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>

                        <!-- 检测容差 -->
                        <StackPanel Grid.Row="0">
                            <Label Content="检测容差(米)"
                                Style="{StaticResource ParameterLabelStyle}"
                                HorizontalAlignment="Center"/>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <Slider Grid.Column="0"
                                        Value="{Binding DetectionTolerance, Mode=TwoWay}"
                                        Minimum="0.0"
                                        Maximum="0.2"
                                        TickFrequency="0.01"
                                        Style="{StaticResource SliderStyle}"/>
                                <TextBlock Grid.Column="1"
                                           Text="{Binding DetectionTolerance, StringFormat={}{0:F2}}"
                                           VerticalAlignment="Center"/>
                            </Grid>
                        </StackPanel>

                        <!-- 步长、速度和路径长度显示 -->
                        <Grid Grid.Row="1" Margin="0,5,0,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <!-- 步长 -->
                            <TextBlock Grid.Column="0"
                                       Text="{Binding CollisionDetectionAccuracy, StringFormat='步长： {0:F3} 米'}"
                                       VerticalAlignment="Center"/>

                            <!-- 速度 -->
                            <TextBlock Grid.Column="1"
                                       Text="{Binding MovementSpeed, StringFormat='速度： {0:F2} 米/秒'}"
                                       VerticalAlignment="Center"/>

                            <!-- 路径长度 -->
                            <TextBlock Grid.Column="2"
                                       Text="{Binding PathLength, StringFormat='路径长度： {0:F2} 米'}"
                                       VerticalAlignment="Center"/>
                        </Grid>
                        
                    </Grid>
                </StackPanel>
            </Border>
            
            <!-- 区域2.5: 指定碰撞检测对象 -->
            <Border BorderBrush="#FFD4E7FF" BorderThickness="1" CornerRadius="0" Margin="0,10,0,0" Padding="10">
                <StackPanel>
                    <Label Content="指定碰撞检测对象" Style="{StaticResource SectionHeaderStyle}"/>
                    
                    <TextBlock Text="{Binding ManualCollisionTargetSummary}"
                               Style="{StaticResource StatusTextStyle}"/>

                    <StackPanel Orientation="Vertical" Margin="0,5,0,0">
                        <CheckBox Content="启用手工指定模式"
                                  IsChecked="{Binding IsManualCollisionTargetEnabled}"
                                  FontWeight="SemiBold"/>
                    </StackPanel>

                    <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
                        <Button Content="从选择添加"
                                Command="{Binding ApplyManualTargetsFromSelectionCommand}"
                                Style="{StaticResource SecondaryButtonStyle}"/>
                        <Button Content="清除所有"
                                Command="{Binding ClearManualTargetsCommand}"
                                Style="{StaticResource SecondaryButtonStyle}"
                                IsEnabled="{Binding HasManualCollisionTargets}"
                                Background="#FFFFE6E6"
                                Foreground="#FF8B0000"/>
                        <Button Content="全部高亮"
                                Command="{Binding HighlightManualTargetsCommand}"
                                Style="{StaticResource SecondaryButtonStyle}"
                                IsEnabled="{Binding HasManualCollisionTargets}"/>
                        <Button Content="清除高亮"
                                Command="{Binding ClearManualHighlightsCommand}"
                                Style="{StaticResource SecondaryButtonStyle}"
                                IsEnabled="{Binding HasManualCollisionTargets}"/>
                    </StackPanel>

                    <StackPanel Margin="0,5,0,0"
                                IsEnabled="{Binding IsManualCollisionTargetEnabled}">
                        <Label Content="已选对象列表"
                               Style="{StaticResource SectionHeaderStyle}"/>

                        <ListView ItemsSource="{Binding ManualCollisionTargets}"
                                  Margin="0,5,0,0"
                                  Visibility="{Binding HasManualCollisionTargets, Converter={StaticResource BoolToVisibilityConverter}}"
                                  MinHeight="60"
                                  MaxHeight="200"
                                  BorderBrush="#FFE2E8F0"
                                  BorderThickness="1"
                                  SelectionChanged="OnManualTargetSelectionChanged">
                                    <ListView.View>
                                        <GridView>
                                            <GridViewColumn Header="序号" Width="45">
                                                <GridViewColumn.CellTemplate>
                                                    <DataTemplate>
                                                        <TextBlock Text="{Binding Index}"
                                                                   HorizontalAlignment="Center"/>
                                                    </DataTemplate>
                                                </GridViewColumn.CellTemplate>
                                            </GridViewColumn>
                                            <GridViewColumn Header="检测对象" Width="275">
                                                <GridViewColumn.CellTemplate>
                                                    <DataTemplate>
                                                        <StackPanel>
                                                            <TextBlock Text="{Binding DisplayName}" FontWeight="SemiBold"/>
                                                            <TextBlock Text="{Binding ModelPath}"
                                                                       Style="{StaticResource StatusTextStyle}"/>
                                                        </StackPanel>
                                                    </DataTemplate>
                                                </GridViewColumn.CellTemplate>
                                            </GridViewColumn>
                                            <GridViewColumn Header="操作" Width="80">
                                                <GridViewColumn.CellTemplate>
                                                    <DataTemplate>
                                                        <Button Content="移除"
                                                                Command="{Binding DataContext.RemoveManualTargetCommand, RelativeSource={RelativeSource AncestorType=ListView}}"
                                                                CommandParameter="{Binding}"
                                                                Style="{StaticResource SecondaryButtonStyle}"/>
                                                    </DataTemplate>
                                                </GridViewColumn.CellTemplate>
                                            </GridViewColumn>
                                        </GridView>
                                    </ListView.View>
                                </ListView>
                            </StackPanel>
                        </StackPanel>
                    </Border>

            <!-- 区域2.6: 检测排除对象 -->
            <Border BorderBrush="#FFFFE4E1" BorderThickness="1" CornerRadius="0" Margin="0,10,0,0" Padding="10" Background="#FFFFFAFA">
                <StackPanel>
                    <Label Content="检测排除对象" Style="{StaticResource SectionHeaderStyle}" Foreground="#FF8B4513"/>
                    
                    <TextBlock Text="{Binding ExcludedObjectSummary}"
                               Style="{StaticResource StatusTextStyle}"/>

                    <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
                        <Button Content="从选择添加"
                                Command="{Binding AddExcludedObjectsFromSelectionCommand}"
                                Style="{StaticResource SecondaryButtonStyle}"/>
                        <Button Content="清除所有"
                                Command="{Binding ClearExcludedObjectsCommand}"
                                Style="{StaticResource SecondaryButtonStyle}"
                                IsEnabled="{Binding HasExcludedObjects}"
                                Background="#FFFFE6E6"
                                Foreground="#FF8B0000"/>
                        <Button Content="全部高亮"
                                Command="{Binding HighlightAllExcludedObjectsCommand}"
                                Style="{StaticResource SecondaryButtonStyle}"
                                IsEnabled="{Binding HasExcludedObjects}"/>
                        <Button Content="清除高亮"
                                Command="{Binding ClearExcludedHighlightCommand}"
                                Style="{StaticResource SecondaryButtonStyle}"
                                IsEnabled="{Binding HasExcludedObjects}"/>
                    </StackPanel>

                    <StackPanel Margin="0,5,0,0">
                        <Label Content="已排除对象列表"
                               Style="{StaticResource SectionHeaderStyle}"/>

                        <ListView x:Name="ExcludedObjectsListView"
                                  ItemsSource="{Binding ExcludedObjects}"
                                  Margin="0,5,0,0"
                                  Visibility="{Binding HasExcludedObjects, Converter={StaticResource BoolToVisibilityConverter}}"
                                  MinHeight="60"
                                  MaxHeight="200"
                                  BorderBrush="#FFE2E8F0"
                                  BorderThickness="1"
                                  SelectionChanged="ExcludedObjectsListView_SelectionChanged">
                            <ListView.View>
                                <GridView>
                                    <GridViewColumn Header="序号" Width="45">
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding Index}"
                                                           HorizontalAlignment="Center"/>
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>
                                    <GridViewColumn Header="排除对象" Width="275">
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <StackPanel>
                                                    <TextBlock Text="{Binding DisplayName}" FontWeight="SemiBold"/>
                                                    <TextBlock Text="{Binding ModelPath}"
                                                               Style="{StaticResource StatusTextStyle}"/>
                                                </StackPanel>
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>
                                    <GridViewColumn Header="操作" Width="80">
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <Button Content="移除"
                                                        Command="{Binding DataContext.RemoveExcludedObjectCommand, RelativeSource={RelativeSource AncestorType=ListView}}"
                                                        CommandParameter="{Binding}"
                                                        Style="{StaticResource SecondaryButtonStyle}"/>
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>
                                </GridView>
                            </ListView.View>
                        </ListView>
                        
                        <TextBlock Text="暂无排除对象"
                                   Style="{StaticResource StatusTextStyle}"
                                   Visibility="{Binding HasExcludedObjects, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=Inverse}"
                                   HorizontalAlignment="Center"
                                   Margin="0,10"/>
                    </StackPanel>
                </StackPanel>
            </Border>

            <!-- 区域3: 生成动画 -->
            <Border BorderBrush="#FFD4E7FF" BorderThickness="1" CornerRadius="0" Margin="0,10,0,0" Padding="10">
                <StackPanel>
                    <Label Content="生成动画" Style="{StaticResource SectionHeaderStyle}"/>
                    
                    <!-- 移动物体来源选择 -->
                    <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
                        <CheckBox Content="使用虚拟物体" 
                                     IsChecked="{Binding UseVirtualObject}" 
                                     VerticalAlignment="Center"/>
                    </StackPanel>
                    
                    <!-- 方式1：选择模型物体 -->
                    <Grid Margin="0,5,0,0"
                          Visibility="{Binding UseVirtualObject, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=Inverse}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        
                        <Label Grid.Column="0" Content="移动物体:" Style="{StaticResource ParameterLabelStyle}"/>
                        <TextBox Grid.Column="1"
                                 Text="{Binding SelectedAnimatedObjectName, TargetNullValue='未选择移动物体'}"
                                 Style="{StaticResource ReadOnlyTextBoxStyle}"
                                 IsReadOnly="True"/>
                        <StackPanel Grid.Column="2" Orientation="Horizontal" Margin="10,0,0,0">
                            <Button Content="选择物体" 
                                    Command="{Binding SelectAnimatedObjectCommand}" 
                                    Style="{StaticResource SecondaryButtonStyle}"/>
                            <Button Content="调整物体" 
                                    Command="{Binding EditObjectRotationCommand}" 
                                    IsEnabled="{Binding HasSelectedAnimatedObject}"
                                    Style="{StaticResource SecondaryButtonStyle}"/>
                            <Button Content="清除" 
                                    Command="{Binding ClearAnimatedObjectCommand}" 
                                    IsEnabled="{Binding HasSelectedAnimatedObject}"
                                    Style="{StaticResource SecondaryButtonStyle}"
                                    Background="#FFFFE6E6"
                                    Foreground="#FF8B0000"/>
                        </StackPanel>
                    </Grid>
                    
                    <!-- 方式2：虚拟物体 -->
                    <Grid Margin="0,5,0,0"
                          Visibility="{Binding UseVirtualObject, Converter={StaticResource BoolToVisibilityConverter}}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        
                        <Label Grid.Column="0" Content="虚拟物体:" Style="{StaticResource ParameterLabelStyle}"/>
                        <TextBlock Grid.Column="1" 
                                   VerticalAlignment="Center"
                                   FontWeight="SemiBold"
                                   Foreground="#FF2B579A"
                                   Background="#FFF5F5F5">
                            <Run Text="长 "/>
                            <Run Text="{Binding VirtualObjectLengthInMeters, StringFormat=F1, Mode=OneWay}"/>
                            <Run Text="m × 宽 "/>
                            <Run Text="{Binding VirtualObjectWidthInMeters, StringFormat=F1, Mode=OneWay}"/>
                            <Run Text="m × 高 "/>
                            <Run Text="{Binding VirtualObjectHeightInMeters, StringFormat=F1, Mode=OneWay}"/>
                            <Run Text="m"/>
                        </TextBlock>
                        <Button Grid.Column="2" 
                                Content="调整物体" 
                                Command="{Binding EditObjectRotationCommand}" 
                                Style="{StaticResource SecondaryButtonStyle}"
                                Margin="10,0,0,0"/>
                    </Grid>
                    
                    <!-- 虚拟物体提示 -->
                    <TextBlock Text="提示：虚拟物体尺寸来自路径编辑中的物体参数设置" 
                               Style="{StaticResource StatusTextStyle}"
                               Foreground="#FF666666"
                               Margin="5,0,0,5"
                               Visibility="{Binding UseVirtualObject, Converter={StaticResource BoolToVisibilityConverter}}"/>
                    
                    <!-- 选择路径 -->
                    <Grid Margin="0,5,0,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        
                        <Label Grid.Column="0" Content="移动路径:" Style="{StaticResource ParameterLabelStyle}"/>
                        <TextBlock Grid.Column="1" 
                                   Text="{Binding CurrentPathRoute.Name, StringFormat='当前路径: {0}', TargetNullValue='当前路径: 未选择'}" 
                                   VerticalAlignment="Center"
                                   FontWeight="SemiBold"
                                   Foreground="{Binding CurrentPathRoute, Converter={x:Null}, TargetNullValue='#FF999999'}"
                                   Background="#FFF5F5F5"/>
                    </Grid>
                    
                    <!-- 路径信息 -->
                    <TextBlock Text="{Binding CurrentPathRoute.Points.Count, StringFormat='路径点数: {0}个', TargetNullValue='路径点数: 0个'}" 
                               Style="{StaticResource StatusTextStyle}"
                               Margin="5,0,0,0"/>
                    
                    <!-- 生成动画按钮 -->
                    <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
                        <Button Content="生成动画" 
                                Command="{Binding GenerateAnimationCommand}" 
                                IsEnabled="{Binding CanGenerateAnimation}" 
                                Style="{StaticResource SecondaryButtonStyle}"
                                Margin="0,0,10,0"/>
                        <Button Content="添加到批处理" 
                                Command="{Binding AddToBatchQueueCommand}" 
                                IsEnabled="{Binding CanGenerateAnimation}" 
                                Style="{StaticResource ActionButtonStyle}"/>
                    </StackPanel>
                    
                    <!-- 生成状态提示 -->
                    <TextBlock Text="提示：需要同时选择移动物体和移动路径才能生成动画" 
                               Style="{StaticResource StatusTextStyle}"
                               Foreground="#FF666666"
                               Margin="0,5,0,0"
                               Visibility="{Binding CanGenerateAnimation, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=Inverse}"/>
                </StackPanel>
            </Border>
            
            <!-- 区域4: 专业级媒体播放控制 -->
            <Border BorderBrush="#FFD4E7FF" BorderThickness="1" CornerRadius="0" Margin="0,10,0,0" Padding="10">
                <StackPanel>
                    <Label Content="播放控制" Style="{StaticResource SectionHeaderStyle}"/>
                    
                    <!-- 专业级媒体控制条 -->
                    <views:MediaControlBar DataContext="{Binding}" Margin="0,5,0,0"/>
                    
                </StackPanel>
            </Border>
            
            <!-- 区域5: 碰撞检测结果 -->
            <Border BorderBrush="#FFD4E7FF" BorderThickness="1" CornerRadius="0" Margin="0,10,0,0" Padding="10">
                <StackPanel>
                    <Label Content="碰撞检测结果" Style="{StaticResource SectionHeaderStyle}"/>
                    
                    <!-- 报告按钮 -->
                    <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
                        <Button Content="查看碰撞报告" 
                                Command="{Binding ViewCollisionReportCommand}" 
                                IsEnabled="{Binding HasClashDetectiveResults}"
                                Style="{StaticResource ActionButtonStyle}"/>
                        <Button Content="结果高亮"
                                Command="{Binding HighlightClashDetectiveResultsCommand}"
                                IsEnabled="{Binding HasClashDetectiveResults}"
                                Style="{StaticResource SecondaryButtonStyle}"/>
                        <Button Content="清除高亮"
                                Command="{Binding ClearClashDetectiveHighlightsCommand}"
                                IsEnabled="{Binding HasClashDetectiveResults}"
                                Style="{StaticResource SecondaryButtonStyle}"/>
                        <Button Content="线框模式"
                                Command="{Binding ToggleWireframeModeCommand}"
                                Style="{StaticResource SecondaryButtonStyle}"/>
                    </StackPanel>

                    <!-- 高级 -->
                    <Expander IsExpanded="False" Margin="0,8,0,0" Header="高级" Foreground="{StaticResource NavisworksPrimaryBrush}">
                        <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
                            <Button Content="预计算高亮"
                                    Command="{Binding HighlightPrecomputedCollisionResultsCommand}"
                                    IsEnabled="{Binding HasClashDetectiveResults}"
                                    Style="{StaticResource SecondaryButtonStyle}"/>
                            <Button Content="清除预计算高亮"
                                    Command="{Binding ClearPrecomputedCollisionHighlightsCommand}"
                                    IsEnabled="{Binding HasClashDetectiveResults}"
                                    Style="{StaticResource SecondaryButtonStyle}"/>
                        </StackPanel>
                    </Expander>
                </StackPanel>
            </Border>
            
            <!-- 区域6: 碰撞检测历史 -->
            <Border BorderBrush="#FFD4E7FF" BorderThickness="1" CornerRadius="0" Margin="0,10,0,0" Padding="10">
                <StackPanel>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        
                        <Label Grid.Column="0" Content="碰撞检测历史" Style="{StaticResource SectionHeaderStyle}"/>
                        <Button Grid.Column="1" 
                                Content="刷新" 
                                Command="{Binding RefreshClashDetectiveResultsCommand}"
                                Style="{StaticResource SecondaryButtonStyle}"/>
                    </Grid>

                    <TextBlock Text="当前路径暂无碰撞检测结果"
                                Style="{StaticResource StatusTextStyle}"
                                Foreground="#FF777777"
                                Visibility="{Binding HasClashDetectiveResults, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=Inverse}"
                                Margin="0,5,0,0"/>

                    <ListView x:Name="ClashDetectiveResultsListView"
                                ItemsSource="{Binding ClashDetectiveResults}"
                                Margin="0,5,0,0"
                                Visibility="{Binding HasClashDetectiveResults, Converter={StaticResource BoolToVisibilityConverter}}"
                                MinHeight="120"
                                MaxHeight="200"
                                BorderBrush="#FFE2E8F0"
                                BorderThickness="1"
                                SelectionMode="Single"
                                SelectionChanged="OnClashDetectiveResultSelectionChanged">
                        <ListView.View>
                            <GridView>
                                <GridViewColumn Header="测试名称" Width="140">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding Record.TestName}" 
                                                        FontWeight="SemiBold"
                                                        TextTrimming="CharacterEllipsis"
                                                        ToolTip="{Binding Record.TestName}"/>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                                <GridViewColumn Header="创建时间" Width="100">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding TestTimeDisplay}" 
                                                        HorizontalAlignment="Center"/>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                                <GridViewColumn Header="碰撞数" Width="60">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding CollisionCountDisplay}" 
                                                        HorizontalAlignment="Center"/>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                                <GridViewColumn Header="操作" Width="180">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Horizontal">
                                                <Button Content="高亮"
                                                        Command="{Binding ViewCommand}"
                                                        Style="{StaticResource SecondaryButtonStyle}"
                                                        Margin="0,0,4,0"/>
                                                <Button Content="报告"
                                                        Command="{Binding ReportCommand}"
                                                        Style="{StaticResource SecondaryButtonStyle}"
                                                        Margin="0,0,4,0"/>
                                                <Button Content="删除"
                                                        Command="{Binding DeleteCommand}"
                                                        Style="{StaticResource SecondaryButtonStyle}"
                                                        Background="#FFFFE6E6"
                                                        Foreground="#FF8B0000"/>
                                            </StackPanel>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                            </GridView>
                        </ListView.View>
                    </ListView>
                </StackPanel>
            </Border>
            
<!-- 区域7: 碰撞构件清单 -->
            <Border BorderBrush="#FFD4E7FF" BorderThickness="1" CornerRadius="0" Margin="0,10,0,0" Padding="10">
                <StackPanel>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>

                        <Label Grid.Column="0" Content="碰撞构件清单" Style="{StaticResource SectionHeaderStyle}"/>
                        <Button Grid.Column="1"
                                Content="清除高亮"
                                Command="{Binding ClearClashDetectiveHighlightsCommand}"
                                Style="{StaticResource SecondaryButtonStyle}"/>
                    </Grid>

                    <TextBlock Text="请先在碰撞检测历史中选择一个检测结果"
                                Style="{StaticResource StatusTextStyle}"
                                Foreground="#FF777777"
                                Visibility="{Binding ClashDetectiveResults.Count, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=Inverse}"
                                Margin="0,5,0,0"/>

                    <ListView ItemsSource="{Binding SelectedClashDetectiveResult.CollisionObjects}"
                                Margin="0,5,0,0"
                                Visibility="{Binding SelectedClashDetectiveResult.CollisionObjects.Count, Converter={StaticResource BoolToVisibilityConverter}}"
                                MinHeight="120"
                                MaxHeight="200"
                                BorderBrush="#FFE2E8F0"
                                BorderThickness="1"
                                SelectionMode="Single"
                                SelectionChanged="OnCollisionObjectSelectionChanged">
                        <ListView.View>
                            <GridView>
                                <GridViewColumn Header="序号" Width="50">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding Index}"
                                                       HorizontalAlignment="Center"/>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                                <GridViewColumn Header="构件名称" Width="320">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <StackPanel>
                                                <TextBlock Text="{Binding DisplayName}"
                                                            FontWeight="SemiBold"
                                                            TextTrimming="CharacterEllipsis"
                                                            ToolTip="{Binding DisplayName}"/>
                                                <TextBlock Text="{Binding ModelPath}"
                                                           Style="{StaticResource StatusTextStyle}"
                                                           TextTrimming="CharacterEllipsis"
                                                           ToolTip="{Binding ModelPath}"/>
                                            </StackPanel>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                            </GridView>
                        </ListView.View>
                    </ListView>
                </StackPanel>
            </Border>
            
            <!-- 区域8: 当前路径信息 -->
            <Border BorderBrush="#FFD4E7FF" BorderThickness="1" CornerRadius="0" Margin="0,10,0,0" Padding="10">
                <StackPanel>
                    <Label Content="当前路径信息" Style="{StaticResource SectionHeaderStyle}"/>
                    
                    <!-- 当前路径信息 -->
                    <Grid Margin="0,5,0,0">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        
                        <TextBlock Grid.Row="0" 
                                   Text="{Binding CurrentPathRoute.Name, StringFormat='当前路径: {0}', TargetNullValue='当前路径: 未选择'}" 
                                   FontWeight="SemiBold" 
                                   Foreground="#FF2B579A"/>
                        
                        <TextBlock Grid.Row="1" 
                                   Text="{Binding CurrentPathRoute.Points.Count, StringFormat='路径点数: {0}个', TargetNullValue='路径点数: 0个'}" 
                                   Style="{StaticResource StatusTextStyle}"/>
                    </Grid>
                </StackPanel>
            </Border>
            
        </StackPanel>
    </ScrollViewer>
</UserControl>
