<UserControl x:Class="CtrEditor.ObjetosSim.ucValvulaFluido"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:CtrEditor.ObjetosSim">
    
    <UserControl.DataContext>
        <local:osValvulaFluido/>
    </UserControl.DataContext>
    
    <Grid>
        <Canvas RenderTransformOrigin="0.5,0.5">
            <Canvas.RenderTransform>
                <TransformGroup>
                    <RotateTransform Angle="{Binding Angulo}"/>
                </TransformGroup>
            </Canvas.RenderTransform>
            
            <!-- Cuerpo de la válvula -->
            <Rectangle Width="{Binding Ancho, Converter={StaticResource MeterToPixelConverter}}"
                       Height="{Binding Alto, Converter={StaticResource MeterToPixelConverter}}"
                       Fill="{Binding Color, Converter={StaticResource ColorToBrushConverter}}"
                       RadiusX="5" RadiusY="5"
                       Canvas.Left="{Binding OffsetXRectangulo, Converter={StaticResource MeterToPixelConverter}}"
                       Canvas.Top="{Binding OffsetYRectangulo, Converter={StaticResource MeterToPixelConverter}}"/>
            
            <!-- Indicador de apertura -->
            <Rectangle Width="{Binding AperturaVisual, Converter={StaticResource MeterToPixelConverter}}"
                       Height="{Binding GrosorIndicador, Converter={StaticResource MeterToPixelConverter}}"
                       Fill="{Binding ColorIndicador, Converter={StaticResource ColorToBrushConverter}}"
                       Canvas.Left="{Binding OffsetXIndicador, Converter={StaticResource MeterToPixelConverter}}"
                       Canvas.Top="{Binding OffsetYIndicador, Converter={StaticResource MeterToPixelConverter}}"/>
                       
            <!-- Texto con el valor numérico de apertura -->
            <TextBlock Text="{Binding ValorApertura, StringFormat='{}{0:P0}'}"
                       Canvas.Left="{Binding OffsetXTexto, Converter={StaticResource MeterToPixelConverter}}"
                       Canvas.Top="{Binding OffsetYTexto, Converter={StaticResource MeterToPixelConverter}}"
                       FontWeight="Bold"
                       Foreground="White"
                       FontSize="12"/>
        </Canvas>
    </Grid>
</UserControl>
