CtrEditor/ObjetosSim/HydraulicComponents/ucHydPipe.xaml

91 lines
3.8 KiB
XML

<UserControl x:Class="CtrEditor.ObjetosSim.ucHydPipe"
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:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:vm="clr-namespace:CtrEditor.ObjetosSim"
mc:Ignorable="d">
<!-- DataContext se establece desde el objeto padre -->
<Canvas RenderTransformOrigin="0,0">
<Canvas.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform Angle="{Binding Angulo}" />
<TranslateTransform />
</TransformGroup>
</Canvas.RenderTransform>
<!-- Cuerpo de la tubería -->
<Rectangle x:Name="rectPipe"
Width="{Binding Ancho, Converter={StaticResource MeterToPixelConverter}}"
Height="{Binding Alto, Converter={StaticResource MeterToPixelConverter}}"
Fill="{Binding ColorButton_oculto}"
Stroke="Black"
StrokeThickness="2"
RadiusX="5"
RadiusY="5">
<Rectangle.Effect>
<DropShadowEffect Color="Gray" ShadowDepth="2" Opacity="0.3"/>
</Rectangle.Effect>
</Rectangle>
<!-- Etiqueta con nombre de la tubería -->
<Viewbox Width="{Binding Ancho, Converter={StaticResource MeterToPixelConverter}}"
Height="{Binding Alto, Converter={StaticResource MeterToPixelConverter}}"
Stretch="Uniform">
<Label Content="{Binding Nombre}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontWeight="Bold"
FontSize="18"
Opacity="0.9"
Foreground="White"/>
</Viewbox>
<!-- Indicador de flujo -->
<Border x:Name="FlowIndicator"
Background="#AA000000"
CornerRadius="3"
Padding="3,1"
Canvas.Top="-25"
Canvas.Left="5">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding CurrentFlowLMin, StringFormat='{}{0:F1} L/min'}"
FontSize="8"
Foreground="White"
Margin="0,0,3,0"/>
<TextBlock Text="{Binding PressureDropBar, StringFormat='{}{0:F2} bar'}"
FontSize="8"
Foreground="Yellow"/>
</StackPanel>
</Border>
<!-- Indicador de dirección de flujo -->
<Path x:Name="FlowArrow"
Stroke="Yellow"
StrokeThickness="2"
Fill="Yellow"
Visibility="{Binding HasFlow, Converter={StaticResource BooleanToVisibilityConverter}}">
<Path.Data>
<GeometryGroup>
<LineGeometry StartPoint="10,0" EndPoint="30,0"/>
<PathGeometry>
<PathFigure StartPoint="25,-5">
<LineSegment Point="35,0"/>
<LineSegment Point="25,5"/>
</PathFigure>
</PathGeometry>
</GeometryGroup>
</Path.Data>
<Path.RenderTransform>
<TranslateTransform X="10" Y="{Binding Alto, Converter={StaticResource MeterToPixelConverter}, ConverterParameter=0.5}"/>
</Path.RenderTransform>
</Path>
</Canvas>
</UserControl>