226 lines
12 KiB
XML
226 lines
12 KiB
XML
<UserControl x:Class="CtrEditor.ObjetosSim.ucHydTank"
|
|
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:local="clr-namespace:CtrEditor.ObjetosSim"
|
|
xmlns:vm="clr-namespace:CtrEditor.ObjetosSim"
|
|
mc:Ignorable="d">
|
|
|
|
<!-- DataContext se establece desde el objeto padre, no aquí -->
|
|
<UserControl.DataContext>
|
|
<vm:osHydTank />
|
|
</UserControl.DataContext>
|
|
|
|
<Canvas RenderTransformOrigin="0,0">
|
|
<Canvas.RenderTransform>
|
|
<TransformGroup>
|
|
<ScaleTransform />
|
|
<SkewTransform />
|
|
<RotateTransform Angle="{Binding Angulo}" />
|
|
<TranslateTransform />
|
|
</TransformGroup>
|
|
</Canvas.RenderTransform>
|
|
|
|
<!-- Contenedor principal del tanque -->
|
|
<Grid Width="{Binding Tamano, Converter={StaticResource MeterToPixelConverter}}"
|
|
Height="{Binding Tamano, Converter={StaticResource MeterToPixelConverter}}">
|
|
|
|
<!-- Fondo del tanque (contenedor vacío) -->
|
|
<Rectangle x:Name="rectTankContainer"
|
|
Fill="LightGray"
|
|
Stroke="DarkGray"
|
|
StrokeThickness="2"
|
|
RadiusX="5"
|
|
RadiusY="5"/>
|
|
|
|
<!-- Nivel del líquido - 3 secciones -->
|
|
|
|
<!-- Sección secundaria (abajo) -->
|
|
<Rectangle x:Name="rectSecondaryLevel"
|
|
Fill="{Binding SecondaryLevelColor}"
|
|
Stroke="DarkBlue"
|
|
StrokeThickness="0.5"
|
|
RadiusX="3"
|
|
RadiusY="3"
|
|
VerticalAlignment="Bottom"
|
|
Margin="4,4,4,4">
|
|
<Rectangle.Height>
|
|
<MultiBinding Converter="{StaticResource TankLevelToHeightConverter}">
|
|
<Binding Path="SecondaryDisplayPercentage"/>
|
|
<Binding Path="Tamano"/>
|
|
</MultiBinding>
|
|
</Rectangle.Height>
|
|
</Rectangle>
|
|
|
|
<!-- Sección de mezcla (medio) -->
|
|
<Rectangle x:Name="rectMixLevel"
|
|
Fill="{Binding MixLevelColor}"
|
|
Stroke="Purple"
|
|
StrokeThickness="0.5"
|
|
RadiusX="3"
|
|
RadiusY="3"
|
|
VerticalAlignment="Bottom">
|
|
<Rectangle.Height>
|
|
<MultiBinding Converter="{StaticResource TankLevelToHeightConverter}">
|
|
<Binding Path="MixDisplayPercentage"/>
|
|
<Binding Path="Tamano"/>
|
|
</MultiBinding>
|
|
</Rectangle.Height>
|
|
<Rectangle.Margin>
|
|
<MultiBinding Converter="{StaticResource TankSectionMarginConverter}">
|
|
<Binding Path="SecondaryDisplayPercentage"/>
|
|
<Binding Path="Tamano"/>
|
|
</MultiBinding>
|
|
</Rectangle.Margin>
|
|
</Rectangle>
|
|
|
|
<!-- Sección primaria (arriba) -->
|
|
<Rectangle x:Name="rectPrimaryLevel"
|
|
Fill="{Binding PrimaryLevelColor}"
|
|
Stroke="DarkGreen"
|
|
StrokeThickness="0.5"
|
|
RadiusX="3"
|
|
RadiusY="3"
|
|
VerticalAlignment="Bottom">
|
|
<Rectangle.Height>
|
|
<MultiBinding Converter="{StaticResource TankLevelToHeightConverter}">
|
|
<Binding Path="PrimaryDisplayPercentage"/>
|
|
<Binding Path="Tamano"/>
|
|
</MultiBinding>
|
|
</Rectangle.Height>
|
|
<Rectangle.Margin>
|
|
<MultiBinding Converter="{StaticResource TankSectionMarginConverter}">
|
|
<Binding Path="SecondaryDisplayPercentage"/>
|
|
<Binding Path="MixDisplayPercentage"/>
|
|
<Binding Path="Tamano"/>
|
|
</MultiBinding>
|
|
</Rectangle.Margin>
|
|
</Rectangle>
|
|
|
|
<!-- Líneas de nivel (marcas visuales) -->
|
|
<Canvas>
|
|
<!-- Línea de nivel máximo -->
|
|
<Line X1="0" Y1="8" X2="{Binding ActualWidth, ElementName=rectTankContainer}" Y2="8"
|
|
Stroke="Red" StrokeThickness="1" StrokeDashArray="2,2" Opacity="0.7"/>
|
|
|
|
<!-- Línea de nivel medio -->
|
|
<Line X1="0" Y1="{Binding MidLevelY}" X2="{Binding ActualWidth, ElementName=rectTankContainer}" Y2="{Binding MidLevelY}"
|
|
Stroke="Orange" StrokeThickness="1" StrokeDashArray="2,2" Opacity="0.5"/>
|
|
|
|
<!-- Línea de nivel mínimo -->
|
|
<Line X1="0" Y1="{Binding MinLevelY}" X2="{Binding ActualWidth, ElementName=rectTankContainer}" Y2="{Binding MinLevelY}"
|
|
Stroke="Red" StrokeThickness="1" StrokeDashArray="2,2" Opacity="0.7"/>
|
|
</Canvas>
|
|
|
|
<!-- Texto del porcentaje de llenado -->
|
|
<TextBlock Text="{Binding FillPercentage, StringFormat='{}{0:F0}%'}"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
Foreground="White"
|
|
FontWeight="Bold"
|
|
FontSize="12"
|
|
Effect="{StaticResource DropShadowEffect}"/>
|
|
|
|
<!-- Indicador de tipo de tanque y fluido -->
|
|
<Grid HorizontalAlignment="Left" VerticalAlignment="Top" Margin="2,2,0,0">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- Tipo de tanque -->
|
|
<Border Grid.Row="0" Background="Navy" CornerRadius="2" Padding="3,1">
|
|
<TextBlock Text="{Binding TankTypeIndicator}"
|
|
Foreground="White"
|
|
FontWeight="Bold"
|
|
FontSize="8" />
|
|
</Border>
|
|
|
|
<!-- Tipo de fluido -->
|
|
<Border Grid.Row="1" Background="DarkGreen" CornerRadius="2" Padding="2,1" Margin="0,1,0,0">
|
|
<TextBlock Text="{Binding CurrentFluidDescription}"
|
|
Foreground="White"
|
|
FontSize="6"
|
|
FontWeight="SemiBold"
|
|
TextTrimming="CharacterEllipsis"
|
|
MaxWidth="40"/>
|
|
</Border>
|
|
</Grid>
|
|
</Grid>
|
|
|
|
<!-- Panel de información mejorado -->
|
|
<Grid Canvas.Top="{Binding Tamano, Converter={StaticResource MeterToPixelConverter}, ConverterParameter=1.08}"
|
|
Width="{Binding Tamano, Converter={StaticResource MeterToPixelConverter}}">
|
|
|
|
<!-- Fondo semitransparente para el panel de información -->
|
|
<Border Background="#CC000000" CornerRadius="3" Margin="0,2,0,0" Padding="2">
|
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
|
|
|
|
<!-- Fila superior: Presión y Nivel -->
|
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,1">
|
|
<!-- Presión actual -->
|
|
<Border Background="#FF1E90FF" CornerRadius="2" Padding="3,2" Margin="1">
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock Text="P:" Foreground="White" FontSize="7" FontWeight="Bold"/>
|
|
<TextBlock Text="{Binding CurrentPressure, StringFormat='{}{0:F1}'}"
|
|
Foreground="White" FontSize="7" FontWeight="SemiBold" Margin="1,0,0,0"/>
|
|
<TextBlock Text="bar" Foreground="White" FontSize="6" Opacity="0.9" Margin="1,0,0,0"/>
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- Nivel actual -->
|
|
<Border Background="#FF32CD32" CornerRadius="2" Padding="3,2" Margin="1">
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock Text="N:" Foreground="White" FontSize="7" FontWeight="Bold"/>
|
|
<TextBlock Text="{Binding CurrentLevelM, StringFormat='{}{0:F2}'}"
|
|
Foreground="White" FontSize="7" FontWeight="SemiBold" Margin="1,0,0,0"/>
|
|
<TextBlock Text="m" Foreground="White" FontSize="6" Opacity="0.9" Margin="1,0,0,0"/>
|
|
</StackPanel>
|
|
</Border>
|
|
</StackPanel>
|
|
|
|
<!-- Fila inferior: Flujos -->
|
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,1">
|
|
<!-- Flujo de entrada -->
|
|
<Border Background="#FF228B22" CornerRadius="2" Padding="3,2" Margin="1">
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock Text="↓" Foreground="White" FontSize="8" FontWeight="Bold"/>
|
|
<TextBlock Text="{Binding InletFlow, StringFormat='{}{0:F1}'}"
|
|
Foreground="White" FontSize="7" FontWeight="SemiBold" Margin="1,0,0,0"/>
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- Flujo de salida -->
|
|
<Border Background="#FFDC143C" CornerRadius="2" Padding="3,2" Margin="1">
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock Text="↑" Foreground="White" FontSize="8" FontWeight="Bold"/>
|
|
<TextBlock Text="{Binding OutletFlow, StringFormat='{}{0:F1}'}"
|
|
Foreground="White" FontSize="7" FontWeight="SemiBold" Margin="1,0,0,0"/>
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- Balance de flujo -->
|
|
<Border Background="{Binding FlowBalanceColor}" CornerRadius="2" Padding="3,2" Margin="1">
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock Text="Δ:" Foreground="White" FontSize="7" FontWeight="Bold"/>
|
|
<TextBlock Text="{Binding FlowBalance, StringFormat='{}{0:F1}'}"
|
|
Foreground="White" FontSize="7" FontWeight="SemiBold" Margin="1,0,0,0"/>
|
|
</StackPanel>
|
|
</Border>
|
|
</StackPanel>
|
|
|
|
<!-- Unidades comunes -->
|
|
<TextBlock Text="L/min"
|
|
Foreground="White"
|
|
FontSize="6"
|
|
HorizontalAlignment="Center"
|
|
Opacity="0.8"
|
|
Margin="0,1,0,0"/>
|
|
</StackPanel>
|
|
</Border>
|
|
</Grid>
|
|
</Canvas>
|
|
|
|
</UserControl>
|