2025-11-12 11:15:07 +00:00
|
|
|
<UserControl x:Class="OperationControl.Controls.HeadingIndicator"
|
|
|
|
|
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:conv="clr-namespace:OperationControl.Converters"
|
|
|
|
|
mc:Ignorable="d"
|
|
|
|
|
d:DesignWidth="140" d:DesignHeight="140">
|
|
|
|
|
|
|
|
|
|
<UserControl.Resources>
|
|
|
|
|
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
|
|
|
|
<conv:NegateAngleConverter x:Key="NegateAngleConverter"/>
|
|
|
|
|
<conv:DifHeadingToColorConverter x:Key="DifHeadingToColorConverter"/>
|
|
|
|
|
</UserControl.Resources>
|
|
|
|
|
|
|
|
|
|
<!-- Moldura (igual ao IMU) -->
|
|
|
|
|
<Border x:Name="Chrome" CornerRadius="12" Padding="10" BorderThickness="2" Background="#111" BorderBrush="#2ECC71">
|
|
|
|
|
<Grid>
|
|
|
|
|
<!-- Container para manter tudo centralizado -->
|
|
|
|
|
<Viewbox Stretch="Uniform">
|
|
|
|
|
<Grid Width="300" Height="300">
|
|
|
|
|
|
|
|
|
|
<!-- CAMADA ROTATIVA: o “anel” -->
|
|
|
|
|
<Canvas x:Name="DialCanvas" Width="300" Height="300" RenderTransformOrigin="0.5,0.5">
|
|
|
|
|
<Canvas.RenderTransform>
|
|
|
|
|
<RotateTransform x:Name="DialRotation" Angle="0"/>
|
|
|
|
|
</Canvas.RenderTransform>
|
|
|
|
|
|
|
|
|
|
<!-- Círculo Base -->
|
|
|
|
|
<Ellipse Width="250" Height="250" Stroke="White" StrokeThickness="3" Canvas.Left="25" Canvas.Top="25"/>
|
|
|
|
|
|
|
|
|
|
<!-- Ticks menores (10°) -->
|
|
|
|
|
<ItemsControl ItemsSource="{Binding MinorAngles, RelativeSource={RelativeSource AncestorType=UserControl}}">
|
|
|
|
|
<ItemsControl.ItemsPanel>
|
|
|
|
|
<ItemsPanelTemplate>
|
|
|
|
|
<Canvas/>
|
|
|
|
|
</ItemsPanelTemplate>
|
|
|
|
|
</ItemsControl.ItemsPanel>
|
|
|
|
|
<ItemsControl.ItemTemplate>
|
|
|
|
|
<DataTemplate>
|
|
|
|
|
<Line X1="150" Y1="47" X2="150" Y2="57" Stroke="White" StrokeThickness="1.3" Opacity="0.75">
|
|
|
|
|
<Line.RenderTransform>
|
|
|
|
|
<RotateTransform Angle="{Binding}" CenterX="150" CenterY="150"/>
|
|
|
|
|
</Line.RenderTransform>
|
|
|
|
|
</Line>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
</ItemsControl.ItemTemplate>
|
|
|
|
|
</ItemsControl>
|
|
|
|
|
|
|
|
|
|
<!-- Ticks maiores (30°) -->
|
|
|
|
|
<ItemsControl ItemsSource="{Binding MajorAngles, RelativeSource={RelativeSource AncestorType=UserControl}}">
|
|
|
|
|
<ItemsControl.ItemsPanel>
|
|
|
|
|
<ItemsPanelTemplate>
|
|
|
|
|
<Canvas/>
|
|
|
|
|
</ItemsPanelTemplate>
|
|
|
|
|
</ItemsControl.ItemsPanel>
|
|
|
|
|
<ItemsControl.ItemTemplate>
|
|
|
|
|
<DataTemplate>
|
|
|
|
|
<Line X1="150" Y1="42" X2="150" Y2="60" Stroke="White" StrokeThickness="2">
|
|
|
|
|
<Line.RenderTransform>
|
|
|
|
|
<RotateTransform Angle="{Binding}" CenterX="150" CenterY="150"/>
|
|
|
|
|
</Line.RenderTransform>
|
|
|
|
|
</Line>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
</ItemsControl.ItemTemplate>
|
|
|
|
|
</ItemsControl>
|
|
|
|
|
|
|
|
|
|
<!-- Letras cardeais (rodarão junto) -->
|
|
|
|
|
<TextBlock Text="N" Foreground="White" FontWeight="Bold" FontSize="22" Canvas.Left="140" Canvas.Top="-10"/>
|
|
|
|
|
<TextBlock Text="S" Foreground="White" FontWeight="Bold" FontSize="22" Canvas.Left="140" Canvas.Bottom="-10"/>
|
|
|
|
|
<TextBlock Text="O" Foreground="White" FontWeight="Bold" FontSize="22" Canvas.Left="0" Canvas.Top="140"/>
|
|
|
|
|
<TextBlock Text="L" Foreground="White" FontWeight="Bold" FontSize="22" Canvas.Right="0" Canvas.Top="140"/>
|
|
|
|
|
</Canvas>
|
|
|
|
|
|
|
|
|
|
<!-- CAMADA FIXA: robô/seta central -->
|
|
|
|
|
<Grid IsHitTestVisible="False">
|
|
|
|
|
<!-- “robô”: retângulo + seta sempre apontando para o topo -->
|
|
|
|
|
<Canvas Width="300" Height="300">
|
|
|
|
|
<!-- corpo (exemplo simples) -->
|
|
|
|
|
<Rectangle Width="60" Height="2" Fill="#33FFFFFF" Canvas.Left="120" Canvas.Top="150"/>
|
|
|
|
|
<!-- seta do “nariz” do robô -->
|
|
|
|
|
<Polygon Points="150,35 143,55 157,55" Fill="Yellow"/>
|
|
|
|
|
<!-- linha vertical (lubber line) opcional -->
|
|
|
|
|
<Line X1="150" Y1="30" X2="150" Y2="270" Stroke="#66FFFFFF" StrokeThickness="1"/>
|
|
|
|
|
|
|
|
|
|
<Polygon x:Name="CourseArrow" Points="150,35 143,55 157,55" Fill="Green" Visibility="Collapsed">
|
|
|
|
|
<Polygon.RenderTransform>
|
2025-11-14 17:11:58 +00:00
|
|
|
<RotateTransform x:Name="CourseRotation" CenterX="150" CenterY="150"/>
|
2025-11-12 11:15:07 +00:00
|
|
|
</Polygon.RenderTransform>
|
|
|
|
|
</Polygon>
|
|
|
|
|
|
|
|
|
|
</Canvas>
|
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
|
|
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
|
2025-11-14 17:11:58 +00:00
|
|
|
<TextBlock x:Name="txtHeadingDif" Text="{Binding DifHeading, RelativeSource={RelativeSource AncestorType=UserControl}, StringFormat={}{0:0.0}°}" Foreground="White" FontWeight="Bold" FontSize="40" Opacity="0.95"/>
|
2025-11-12 11:15:07 +00:00
|
|
|
</Grid>
|
|
|
|
|
|
|
|
|
|
<Grid HorizontalAlignment="Left" VerticalAlignment="Top">
|
2025-11-14 17:11:58 +00:00
|
|
|
<TextBlock x:Name="txtHeadingCourse" Visibility="Collapsed" Text="{Binding CourseHeading, RelativeSource={RelativeSource AncestorType=UserControl}, StringFormat={}{0:0.0}°}" Foreground="Green" FontWeight="Bold" FontSize="35" Opacity="0.95" Margin="-20 -30 0 0"/>
|
2025-11-12 11:15:07 +00:00
|
|
|
</Grid>
|
|
|
|
|
|
|
|
|
|
<Grid HorizontalAlignment="Right" VerticalAlignment="Top">
|
2025-11-14 17:11:58 +00:00
|
|
|
<TextBlock x:Name="txtHeading" Visibility="Collapsed" Text="{Binding Heading, RelativeSource={RelativeSource AncestorType=UserControl}, StringFormat={}{0:0.0}°}" Foreground="Yellow" FontWeight="Bold" FontSize="35" Opacity="0.95" Margin="0 -30 -20 0"/>
|
2025-11-12 11:15:07 +00:00
|
|
|
</Grid>
|
|
|
|
|
|
|
|
|
|
</Grid>
|
|
|
|
|
</Viewbox>
|
|
|
|
|
|
|
|
|
|
</Grid>
|
|
|
|
|
</Border>
|
|
|
|
|
</UserControl>
|