<UserControl x:Class="CtrEditor.ObjetosSim.ucTransporteGuiasUnion"
             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:vm="clr-namespace:CtrEditor.ObjetosSim"
             xmlns:uc="clr-namespace:CtrEditor.ObjetosSim.UserControls"
             mc:Ignorable="d">

    <UserControl.Resources>
        <!-- Define the VisualBrush for the conveyor belt pattern -->
        <VisualBrush x:Key="BeltBrushA" TileMode="Tile" Viewport="0,0,20,10" ViewportUnits="Absolute" Viewbox="0,0,20,10" ViewboxUnits="Absolute">
            <VisualBrush.Transform>
                <TransformGroup>
                    <TranslateTransform/>
                </TransformGroup>
            </VisualBrush.Transform>
            <VisualBrush.Visual>
                <Canvas>
                    <Rectangle Fill="#FFBFBFBF" Width="10" Height="10"/>
                    <Rectangle Fill="LightGray" Width="10" Height="10" Canvas.Left="10"/>
                </Canvas>
            </VisualBrush.Visual>
        </VisualBrush>
        <VisualBrush x:Key="BeltBrushB" TileMode="Tile" Viewport="0,0,20,10" ViewportUnits="Absolute" Viewbox="0,0,20,10" ViewboxUnits="Absolute">
            <VisualBrush.Transform>
                <TransformGroup>
                    <TranslateTransform/>
                </TransformGroup>
            </VisualBrush.Transform>
            <VisualBrush.Visual>
                <Canvas>
                    <Rectangle Fill="#FFBFBFBF" Width="10" Height="10"/>
                    <Rectangle Fill="LightGray" Width="10" Height="10" Canvas.Left="10"/>
                </Canvas>
            </VisualBrush.Visual>
        </VisualBrush>

    </UserControl.Resources>

    <UserControl.DataContext>
        <vm:osTransporteGuiasUnion Color="Red"/>
    </UserControl.DataContext>

    <Grid>
        <Canvas x:Name="Canvas" RenderTransformOrigin="0,0">
            <Canvas.RenderTransform>
                <TransformGroup>
                    <ScaleTransform/>
                    <SkewTransform/>
                    <RotateTransform Angle="{Binding Angulo}"/>
                    <TranslateTransform/>
                </TransformGroup>
            </Canvas.RenderTransform>
            <Rectangle x:Name="TransporteA" Width="{Binding AnchoTransporte_oculto, Converter={StaticResource MeterToPixelConverter},ConverterParameter=1}" 
                       Height="{Binding Alto, Converter={StaticResource MeterToPixelConverter}}"            
            Fill="{StaticResource BeltBrushA}"                       
                       />
            <Rectangle x:Name="TransporteB" Width="{Binding AnchoTransporte_oculto, Converter={StaticResource MeterToPixelConverter},ConverterParameter=1}" 
                       Height="{Binding Alto, Converter={StaticResource MeterToPixelConverter}}"            
            Fill="{StaticResource BeltBrushB}" 
                       Canvas.Top="{Binding Alto, Converter={StaticResource MeterToPixelConverter},ConverterParameter=1.05}"
                       Canvas.Left="{Binding AnchoRecto, Converter={StaticResource MeterToPixelConverter},ConverterParameter=1}"
                       />

            <uc:ThreeLinesControl x:Name="GuiaSuperior" AnchoRecto="{Binding AnchoRecto, Converter={StaticResource MeterToPixelConverter},ConverterParameter=1}" 
                                  AnchoCentro="{Binding AnchoCentral, Converter={StaticResource MeterToPixelConverter},ConverterParameter=1}"
                                  Altura="{Binding Alto, Converter={StaticResource MeterToPixelConverter},ConverterParameter=1}" 
                                  AltoGuia="{Binding AltoGuia, Converter={StaticResource MeterToPixelConverter},ConverterParameter=1}" 
                                  Canvas.Top="{Binding Distance, Converter={StaticResource MeterToPixelConverter},ConverterParameter=-1}" Color="{Binding Color}"/>

            <uc:ThreeLinesControl x:Name="GuiaInferior" AnchoRecto="{Binding AnchoRecto, Converter={StaticResource MeterToPixelConverter},ConverterParameter=1}" 
                                  AnchoCentro="{Binding AnchoCentral, Converter={StaticResource MeterToPixelConverter},ConverterParameter=1}"
                                  Altura="{Binding Alto, Converter={StaticResource MeterToPixelConverter},ConverterParameter=1}" 
                                  AltoGuia="{Binding AltoGuia, Converter={StaticResource MeterToPixelConverter},ConverterParameter=1}"
                                  Color="{Binding Color}">
                                    
                        <Canvas.Top>
                            <MultiBinding Converter="{StaticResource SumConverter}">
                                <Binding Path="Alto" Converter="{StaticResource MeterToPixelConverter}" ConverterParameter="1.0" />
                                <Binding Path="Distance" Converter="{StaticResource MeterToPixelConverter}" ConverterParameter="1.0" />
                            </MultiBinding>
                        </Canvas.Top>
            </uc:ThreeLinesControl>            
        </Canvas>
    </Grid>
</UserControl>
