<UserControl x:Class="MECF.Framework.UI.Client.IndustrialControl.PipeLineKnot"
             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:MECF.Framework.UI.Client.IndustrialControl" xmlns:converters="clr-namespace:MECF.Framework.UI.Client.IndustrialControl.Converters"
             mc:Ignorable="d" Height="50" Width="140">
    <UserControl.Resources>
        <converters:MultiplesValueConverter x:Key="multiConverter"></converters:MultiplesValueConverter>
        <converters:VisibilityConverter x:Key="visibilityConverter"></converters:VisibilityConverter>
    </UserControl.Resources>
    <Grid>
        <Grid>
            <Grid x:Name="grid1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=0.2}"/>
                    <ColumnDefinition Width="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=2}"/>
                    <ColumnDefinition Width="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=0.2}"/>
                </Grid.ColumnDefinitions>
                <Canvas x:Name="canvas1" Grid.Column="1"  Height="{Binding ElementName=grid1,Path=ActualHeight}"  Panel.ZIndex="1" ClipToBounds="True">
                    <!--<Rectangle
                    Width="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=2}" 
                    Height="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=1}"
                    Fill="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path= ThroughInnerColor}"
                    Stretch="Fill">
                    
                </Rectangle>-->
                    <Ellipse x:Name="ellipe1"  Width="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=2}" 
                         Height="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=2}" Margin="0,0,0,0"
                         Canvas.Left="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=0}"
                         Canvas.Top="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=0}" StrokeThickness="20">
                        <Ellipse.Fill>
                            <RadialGradientBrush RadiusX="0.5" RadiusY="0.5" GradientOrigin="0.5,0.5">
                                <GradientStop Color="Transparent" Offset="0"/>
                                <GradientStop Color="Transparent" Offset="0.5"/>
                                <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=EdgeColor}" Offset="0.5"></GradientStop>
                                <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=CenterColor}" Offset="0.75"></GradientStop>
                                <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=EdgeColor}" Offset="1"></GradientStop>
                            </RadialGradientBrush>
                        </Ellipse.Fill>
                    </Ellipse>

                </Canvas>
                <Canvas x:Name="canvas0" Grid.Column="0"  Grid.ColumnSpan="2"  Height="{Binding ElementName=grid1,Path=ActualHeight}" Panel.ZIndex="2"  ClipToBounds="True" >
                    <!--<Rectangle  HorizontalAlignment="Left" 
                        Width="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=0.7}" 
                         Height="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=0.4}"
                         Canvas.Top="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=0.6}"
                           Canvas.Left="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=0}"
                       Stretch="Fill" VerticalAlignment="Bottom">
                    <Rectangle.Fill>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                            <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=EdgeColor}" Offset="0"></GradientStop>
                            <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=CenterColor}" Offset="0.5"></GradientStop>
                            <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=EdgeColor}" Offset="1"></GradientStop>
                        </LinearGradientBrush>
                    </Rectangle.Fill>
                </Rectangle>-->
                    <Polygon x:Name="polygon1" Points="0,30 0,50 40,50 20,30">
                        <Polygon.Fill>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=EdgeColor}" Offset="0"></GradientStop>
                                <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=CenterColor}" Offset="0.5"></GradientStop>
                                <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=EdgeColor}" Offset="1"></GradientStop>
                            </LinearGradientBrush>
                        </Polygon.Fill>
                    </Polygon>
                </Canvas>
                <Canvas x:Name="canvas2" Grid.Column="1" Grid.ColumnSpan="2" Height="{Binding ElementName=grid1,Path=ActualHeight}" Panel.ZIndex="3" 
                     
                    ClipToBounds="True">
                    <Polygon x:Name="polygon2" Points="20,30 0,50 40,50 40,30">
                        <Polygon.Fill>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=EdgeColor}" Offset="0"></GradientStop>
                                <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=CenterColor}" Offset="0.5"></GradientStop>
                                <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=EdgeColor}" Offset="1"></GradientStop>
                            </LinearGradientBrush>
                        </Polygon.Fill>
                    </Polygon>
                    <!--<Rectangle  HorizontalAlignment="Left"
                        Width="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=0.7}" 
                         Height="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=0.4}"
                          Canvas.Top="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=0.6}"
                           Canvas.Left="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=1.6}"
                       Stretch="Fill">
                    <Rectangle.Fill>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                            <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=EdgeColor}" Offset="0"></GradientStop>
                            <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=CenterColor}" Offset="0.5"></GradientStop>
                            <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=EdgeColor}" Offset="1"></GradientStop>
                        </LinearGradientBrush>
                    </Rectangle.Fill>
                </Rectangle>-->
                </Canvas>

                <!--<Canvas x:Name="canvas1"  Height="{Binding ElementName=grid1,Path=ActualHeight}"  ClipToBounds="True">
                <Ellipse x:Name="ellipe1"  Width="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=2}" 
                         Height="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=2}" Margin="0,0,0,0"
                         Canvas.Left="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=0}"
                         Canvas.Top="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=0}">
                <Ellipse.Fill>
                    <RadialGradientBrush RadiusX="0.5" RadiusY="0.5" GradientOrigin="0.5,0.5">
                            <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=EdgeColor}" Offset="0"></GradientStop>
                            <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=CenterColor}" Offset="0.5"></GradientStop>
                            <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=EdgeColor}" Offset="1"></GradientStop>
                    </RadialGradientBrush>
                </Ellipse.Fill>
            </Ellipse>
            </Canvas>-->
                <!--"M 845,279.985C 931.658,279.985 1018.34,279.985 1105,279.985C 1105,299.983 1105,319.987 1105,339.985C 1028.01,339.985 950.992,339.985 874,339.985C 848.163,339.985 800.702,346.404 784,334.985C 781.812,178.668 732.256,94.5063 596,68.9849C 560.374,62.3121 512.668,64.0407 480,72.9849C 449.745,81.2685 422.874,94.0963 401,110.985C 359.798,142.796 336.036,193.961 323,253.985C 318.45,274.936 323.166,324.932 313,339.985C 208.677,339.985 104.323,339.985 0,339.985C 0,319.987 0,299.983 0,279.985C 86.3247,279.985 172.675,279.985 259,279.985C 258.786,238.704 275.928,201.062 289,170.985C 339.73,54.2648 477.485,-40.0917 653,16.9849C 741.485,45.7598 792.051,111.087 825,195.985C 834.218,219.737 844.7,248.709 845,279.985 Z"-->
                <!--<Canvas x:Name="canvas1"  Height="{Binding ElementName=grid1,Path=ActualHeight}"  ClipToBounds="True">
                <Path Data="M 940.501,475.001C 940.501,477.335 -164.499,477.335 -164.499,475.001C -93.5065,475.001 -22.4923,475.001 48.5006,475.001C 62.926,475.002 113.357,478.137 118.501,471.001C 119.167,462.336 119.834,453.667 120.501,445.001C 124.167,426.003 127.834,407 131.501,388.001C 150.136,325.703 182.058,274.512 229.501,241.001C 253.792,223.843 284.618,212.15 317.501,204.001C 336.832,202.002 356.169,200.001 375.501,198.001C 528.987,197.863 604.716,267.379 640.501,384.001C 649.058,411.89 650.279,443.097 656.5,474.001C 751.158,474.335 845.843,474.668 940.501,475.001 Z"
                     
 Stretch="Fill" StrokeThickness="10"  x:Name="pathThrough"    
                      Width="250.532"
                 Height="85" Canvas.Left="1.234" Canvas.Top="10">
                    <Path.Stroke>
                        <LinearGradientBrush  StartPoint="0.4,0.9" EndPoint="0.4,1">
                            <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=EdgeColor}" Offset="0"></GradientStop>
                            <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=CenterColor}" Offset="0.5"></GradientStop>
                            <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=EdgeColor}" Offset="1"></GradientStop>
                        </LinearGradientBrush>
                    </Path.Stroke>
                </Path>

            </Canvas>-->
                <!--" "-->
                <!--
            
            <Rectangle  Stretch="Fill">
                <Rectangle.Fill>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                        <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLine}},Path=EdgeColor}" Offset="0"></GradientStop>
                        <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLine}},Path=CenterColor}" Offset="0.5"></GradientStop>
                        <GradientStop Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLine}},Path=EdgeColor}" Offset="1"></GradientStop>
                    </LinearGradientBrush>
                </Rectangle.Fill>
            </Rectangle>-->
            </Grid>
            <Path x:Name="path1" 
              Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=PipeLineActive,Converter={StaticResource visibilityConverter}}"
              StrokeThickness="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=PipeLineWidth}" 
              StrokeDashOffset="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=LineOffect}" StrokeDashArray="5,5" 
              Height="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=0.6}"  
              Width="{Binding ElementName=grid1,Path=ActualHeight,Converter={StaticResource multiConverter},ConverterParameter=4}"
              Stretch="Fill">
                <Path.Stroke>
                    <SolidColorBrush Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLineKnot}},Path=ActiveLineCenterColor}"></SolidColorBrush>
                </Path.Stroke>
            </Path>
        </Grid>
    </Grid>
    <!--<Path x:Name="path1" 
              Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLine}},Path=PipeLineActive,Converter={StaticResource visibilityConverter}}"
              StrokeThickness="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLine}},Path=PipeLineWidth}" 
              StrokeDashOffset="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLine}},Path=LineOffect}" StrokeDashArray="5,5">
            <Path.Stroke>
                <SolidColorBrush Color="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:PipeLine}},Path=ActiveLineCenterColor}"></SolidColorBrush>
            </Path.Stroke>
        </Path>-->
</UserControl>
