<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:primitives="clr-namespace:StructureHelper.Infrastructure.UI.GraphicalPrimitives"
                    >
    <!-- Beam shear section -->
    <DataTemplate x:Key="BeamShearSectionPrimitiveTemplate"
              DataType="primitives:BeamShearSectionPrimitive">
        <Canvas>
            <Rectangle
                Width="{Binding PositiveLength}"
                Height="{Binding FullDepth}"        
                StrokeThickness="0.01"
                Visibility="{Binding VisualProperty.IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
                >
                <Rectangle.Stroke>
                    <SolidColorBrush Color="{Binding VisualProperty.Color}"/>
                </Rectangle.Stroke>
                <Rectangle.Fill>
                    <SolidColorBrush Color="{Binding VisualProperty.Color}" Opacity="{Binding VisualProperty.Opacity}"/>
                </Rectangle.Fill>
                <Rectangle.ToolTip>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <TextBlock Margin="0,0,0,2" Text="Beam shear section: "/>
                        <TextBlock Grid.Column="1" Text="{Binding BeamShearSection.Name}"/>
                        <TextBlock Grid.Row="1" Text="Depth: "/>
                        <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding FullDepth, Converter={StaticResource LengthConverter}}"/>
                        <TextBlock Grid.Row="2" Text="Width: "/>
                        <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding WebWidth, Converter={StaticResource LengthConverter}}"/>
                        <TextBlock Grid.Row="3" Text="Effective depth: "/>
                        <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding EffectiveDepth, Converter={StaticResource LengthConverter}}"/>
                    </Grid>
                </Rectangle.ToolTip>
            </Rectangle>
            <Line
                X1="0"
                X2="{Binding PositiveLength}"
                Y1="{Binding BottomCover}"
                Y2="{Binding BottomCover}"
                Stroke="Black"
                StrokeThickness="0.012"
                StrokeDashArray="0.1 0.05"
                Visibility="{Binding VisualProperty.IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
                >
                <Line.ToolTip>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="25"/>
                            <RowDefinition Height="25"/>
                        </Grid.RowDefinitions>
                        <TextBlock Text="Reinforcement"/>
                        <TextBlock Grid.Row="1" Text="Area: "/>
                        <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding ReinforcementArea, Converter={StaticResource AreaConverter}}"/>
                    </Grid>
                </Line.ToolTip>
            </Line>
            <Rectangle
                Canvas.Left="{Binding SupportStartX}"
                Canvas.Top="{Binding SupportStartY}"
                Width="{Binding SupportWidth}"
                Height="{Binding SupportHeight}"
                Fill="LightGray"
                Stroke="Black"
                StrokeThickness="0.01"
                />
            <Path
                Data ="M 0 0 L 0.1 -0.1 L -0.1 -0.1 Z"
                Fill="DarkGray"
                Stroke="Black"
                StrokeThickness="0.005"
                />
        </Canvas>
    </DataTemplate>
    
    <DataTemplate x:Key="InclinedSectionPrimitiveTemplate"
              DataType="primitives:InclinedSectionPrimitive">
        <Canvas>
            <!--InclinedSection-->
            <Line
                X1="{Binding SectionStartX}"
                X2="{Binding SectionEndX}"
                Y1="{Binding SectionStartY}"
                Y2="{Binding SectionEndY}"
                StrokeThickness="0.01"
                StrokeDashArray="0.05 0.02"
                Visibility="{Binding VisualProperty.IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
                >
                <Line.Stroke>
                    <SolidColorBrush Color="{Binding VisualProperty.Color}" Opacity="{Binding VisualProperty.Opacity}"/>
                </Line.Stroke>
                <Line.ToolTip>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <TextBlock Margin="0,0,0,2" Text="Inclined section"/>
                        <TextBlock Grid.Row="1" Text="Start coordinate: "/>
                        <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding SectionStartX, Converter={StaticResource LengthConverter}}"/>
                        <TextBlock Grid.Row="2" Text="End coordinate: "/>
                        <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding SectionEndX, Converter={StaticResource LengthConverter}}"/>
                        <TextBlock Grid.Row="3" Text="Actual shear force: "/>
                        <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding ActualShearForce, Converter={StaticResource ForceConverter}}"/>
                        <TextBlock Grid.Row="4" Text="Ultimate shear force: "/>
                        <TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding UltimateShearForce, Converter={StaticResource ForceConverter}}"/>
                        <TextBlock Grid.Row="5" Text="Factor of using: "/>
                        <TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding FactorOfUsing, Converter={StaticResource PlainDouble}}"/>
                        <TextBlock Grid.Row="6" Text="Effective depth: "/>
                        <TextBlock Grid.Row="6" Grid.Column="1" Text="{Binding EffectiveDepth, Converter={StaticResource LengthConverter}}"/>
                        <TextBlock Grid.Row="7" Text="Span c/d ratio: "/>
                        <TextBlock Grid.Row="7" Grid.Column="1" Text="{Binding SpanRatio, Converter={StaticResource PlainDouble}}"/>
                    </Grid>
                </Line.ToolTip>
            </Line>
            <!--InclinedCrack-->
            <Line
                X1="{Binding CrackStartX}"
                X2="{Binding SectionEndX}"
                Y1="{Binding SectionStartY}"
                Y2="{Binding SectionEndY}"
                StrokeThickness="0.02"
                Visibility="{Binding VisualProperty.IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
                >
                <Line.Stroke>
                    <SolidColorBrush Color="{Binding VisualProperty.Color}" Opacity="{Binding VisualProperty.Opacity}"/>
                </Line.Stroke>
                <Line.ToolTip>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <TextBlock Margin="0,0,0,2" Text="Inclined crack"/>
                        <TextBlock Grid.Row="1" Text="Start coordinate: "/>
                        <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding CrackStartX, Converter={StaticResource LengthConverter}}"/>
                        <TextBlock Grid.Row="2" Text="End coordinate: "/>
                        <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding SectionEndX, Converter={StaticResource LengthConverter}}"/>
                        <TextBlock Grid.Row="3" Text="Ultimate shear force: "/>
                        <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding UltimateShearForce, Converter={StaticResource ForceConverter}}"/>
                        <TextBlock Grid.Row="4" Text="Concrete shear force: "/>
                        <TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding ConcreteShearForce, Converter={StaticResource ForceConverter}}"/>
                        <TextBlock Grid.Row="5" Text="Stirrup shear force: "/>
                        <TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding StirrupShearForce, Converter={StaticResource ForceConverter}}"/>
                        <TextBlock Grid.Row="6" Text="Span c0/d ratio: "/>
                        <TextBlock Grid.Row="6" Grid.Column="1" Text="{Binding CrackSpanRatio, Converter={StaticResource PlainDouble}}"/>
                    </Grid>
                </Line.ToolTip>
            </Line>
        </Canvas>
    </DataTemplate>

    <DataTemplate x:Key="StirrupByRebarPrimitiveTemplate"
              DataType="primitives:StirrupByRebarPrimitive">
        <Canvas>
            <Rectangle
                Width="{Binding Length}"
                Height="{Binding Depth}"        
                StrokeThickness="0.005"
                Canvas.Left="{Binding StartPoinX}"
                Canvas.Top="{Binding BottomPointY}"
                Visibility="{Binding VisualProperty.IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
                >
                <Rectangle.Stroke>
                    <SolidColorBrush Color="{Binding VisualProperty.Color}"/>
                </Rectangle.Stroke>
                <Rectangle.Fill>
                    <SolidColorBrush Color="{Binding VisualProperty.Color}" Opacity="{Binding VisualProperty.Opacity}"/>
                </Rectangle.Fill>
                <Rectangle.ToolTip>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <TextBlock Margin="0,0,0,2" Text="Stirrup by rebar: "/>
                        <TextBlock Grid.Column="1" Text="{Binding StirrupByRebar.Name}"/>
                        <TextBlock Grid.Row="1" Text="Diameter: "/>
                        <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding StirrupByRebar.Diameter, Converter={StaticResource LengthConverter}}"/>
                        <TextBlock Grid.Row="2" Text="Steel: "/>
                        <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding StirrupByRebar.Material.MaterialEntity.Name}"/>
                        <TextBlock Grid.Row="3" Text="Spacing: "/>
                        <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding StirrupByRebar.Spacing, Converter={StaticResource LengthConverter}}"/>
                        <TextBlock Grid.Row="4" Text="Leg count: "/>
                        <TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding StirrupByRebar.LegCount, Converter={StaticResource PlainDouble}}"/>
                        <TextBlock Grid.Row="5" Text="Density: "/>
                        <TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding Density, Converter={StaticResource DistributedLoadConverter}}"/>
                    </Grid>
                </Rectangle.ToolTip>
            </Rectangle>
        </Canvas>
    </DataTemplate>

    <DataTemplate x:Key="StirrupByDensityPrimitiveTemplate"
          DataType="primitives:StirrupByDensityPrimitive">
        <Canvas>
            <Rectangle
            Width="{Binding Length}"
            Height="{Binding Depth}"        
            StrokeThickness="0.005"
            Canvas.Left="{Binding StartPoinX}"
            Canvas.Top="{Binding BottomPointY}"
            Visibility="{Binding VisualProperty.IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
            >
                <Rectangle.Stroke>
                    <SolidColorBrush Color="{Binding VisualProperty.Color}"/>
                </Rectangle.Stroke>
                <Rectangle.Fill>
                    <SolidColorBrush Color="{Binding VisualProperty.Color}" Opacity="{Binding VisualProperty.Opacity}"/>
                </Rectangle.Fill>
                <Rectangle.ToolTip>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <TextBlock Margin="0,0,0,2" Text="Stirrup by density: "/>
                        <TextBlock Grid.Column="1" Text="{Binding StirrupByDensity.Name}"/>
                        <TextBlock Grid.Row="1" Text="Density: "/>
                        <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding StirrupByDensity.StirrupDensity, Converter={StaticResource DistributedLoadConverter}}"/>
                    </Grid>
                </Rectangle.ToolTip>
            </Rectangle>
        </Canvas>
    </DataTemplate>

    <DataTemplate x:Key="StirrupByInclinedRebarPrimitiveTemplate"
      DataType="primitives:StirrupByInclinedRebarPrimitive">
        <Canvas>
            <Line
                X1="{Binding StartPointX}"
                X2="{Binding EndPointX}"
                Y1="{Binding StartPointY}"
                Y2="{Binding EndPointY}"
                Visibility="{Binding VisualProperty.IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
                StrokeThickness="{Binding StirrupByInclinedRebar.RebarSection.Diameter}"
                >
                <Line.Stroke>
                    <SolidColorBrush Color="{Binding VisualProperty.Color}" Opacity="{Binding VisualProperty.Opacity}"/>
                </Line.Stroke>
                <Line.ToolTip>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <TextBlock Margin="0,0,0,2" Text="Inclinated rebar: "/>
                        <TextBlock Grid.Column="1" Text="{Binding StirrupByInclinedRebar.Name}"/>
                        <TextBlock Grid.Row="1" Text="Diameter: "/>
                        <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding StirrupByInclinedRebar.RebarSection.Diameter, Converter={StaticResource LengthConverter}}"/>
                        <TextBlock Grid.Row="2" Text="Material: "/>
                        <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding StirrupByInclinedRebar.RebarSection.Material.MaterialEntity.Name}"/>
                        <TextBlock Grid.Row="3" Text="Start coordinate: "/>
                        <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding StirrupByInclinedRebar.StartCoordinate, Converter={StaticResource LengthConverter}}"/>
                        <TextBlock Grid.Row="4" Text="End coordinate: "/>
                        <TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding EndPointX, Converter={StaticResource LengthConverter}}"/>
                        <TextBlock Grid.Row="5" Text="Angle of inclination: "/>
                        <TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding StirrupByInclinedRebar.AngleOfInclination, Converter={StaticResource PlainDouble}}"/>
                    </Grid>
                </Line.ToolTip>
            </Line>
            <Line
                X1="0"
                X2="{Binding StartPointX}"
                Y1="{Binding StartPointY}"
                Y2="{Binding StartPointY}"
                StrokeThickness="{Binding StirrupByInclinedRebar.RebarSection.Diameter}"
                Visibility="{Binding VisualProperty.IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
                >
                <Line.Stroke>
                    <SolidColorBrush Color="{Binding VisualProperty.Color}" Opacity="{Binding VisualProperty.Opacity}"/>
                </Line.Stroke>
            </Line>
            <Line
                X1="{Binding EndPointX}"
                X2="100"
                Y1="{Binding EndPointY}"
                Y2="{Binding EndPointY}"
                StrokeThickness="{Binding StirrupByInclinedRebar.RebarSection.Diameter}"
                Visibility="{Binding VisualProperty.IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
                >
                <Line.Stroke>
                    <SolidColorBrush Color="{Binding VisualProperty.Color}" Opacity="{Binding VisualProperty.Opacity}"/>
                </Line.Stroke>
            </Line>
        </Canvas>
    </DataTemplate>

    <DataTemplate x:Key="ConcentratedForcePrimitiveTemplate"
      DataType="primitives:ConcentratedForcePrimitive">
        <Canvas>
            <Canvas.RenderTransform>
                <TransformGroup>
                    <ScaleTransform
                        ScaleX="{Binding ScaleFactor}"
                        ScaleY="{Binding ScaleFactor}"/>
                    <TranslateTransform
                        X="{Binding TranslateX}"
                        Y="{Binding TranslateY}"
                        />
                </TransformGroup>
            </Canvas.RenderTransform>
            <Line
                X1="0"
                X2="0"
                Y1="-0.03"
                Y2="-0.3"
                Visibility="{Binding VisualProperty.IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
                StrokeThickness="0.05"
                >
                <Line.Stroke>
                    <SolidColorBrush Color="{Binding VisualProperty.Color}" Opacity="{Binding VisualProperty.Opacity}"/>
                </Line.Stroke>
                <Line.ToolTip>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <TextBlock Margin="0,0,0,2" Text="Force: "/>
                        <TextBlock Grid.Column="1" Text="{Binding ConcentratedForce.Name}"/>
                        <TextBlock Grid.Row="1" Text="Force value: "/>
                        <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding ConcentratedForce.ForceValue.Qy, Converter={StaticResource ForceConverter}}"/>
                    </Grid>
                </Line.ToolTip>
            </Line>
            <Path
                Data="M 0 0 L 0.1 -0.1 L 0 -0.07 L -0.1 -0.1 Z"
                Visibility="{Binding VisualProperty.IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
                StrokeThickness="0.005"
                >
                <Path.Fill>
                    <SolidColorBrush Color="{Binding VisualProperty.Color}" Opacity="{Binding VisualProperty.Opacity}"/>
                </Path.Fill>
                <Path.Stroke>
                    <SolidColorBrush Color="{Binding VisualProperty.Color}" Opacity="{Binding VisualProperty.Opacity}"/>
                </Path.Stroke>
            </Path>
        </Canvas>
    </DataTemplate>

    <DataTemplate x:Key="DistributedLoadPrimitiveTemplate"
        DataType="primitives:DistributedLoadPrimitive">
        <Canvas Visibility="{Binding VisualProperty.IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"  Opacity="{Binding VisualProperty.Opacity}">
            <Canvas.RenderTransform>
                <TransformGroup>
                    <ScaleTransform
                        ScaleX="1"
                        ScaleY="{Binding ScaleFactor}"/>
                    <TranslateTransform
                        X="{Binding TranslateX}"
                        Y="{Binding TranslateY}"
                        />
                </TransformGroup>
            </Canvas.RenderTransform>
            <Rectangle Height="0.2" Width="{Binding Length}" StrokeThickness="0.01">
                <Rectangle.Stroke>
                    <SolidColorBrush Color="{Binding VisualProperty.Color}"/>
                </Rectangle.Stroke>
                <Rectangle.Fill>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="{Binding VisualProperty.Color}" Offset="1"/>
                        <GradientStop Color="White" Offset="0"/>
                    </LinearGradientBrush>
                </Rectangle.Fill>
                <Rectangle.ToolTip>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <TextBlock Margin="0,0,0,2" Text="Distributed load: "/>
                        <TextBlock Grid.Column="1" Text="{Binding Name}"/>
                        <TextBlock Grid.Row="1" Text="Force value: "/>
                        <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding DistributedLoad.LoadValue.Qy, Converter={StaticResource DistributedLoadConverter}}"/>
                        <TextBlock Grid.Row="2" Text="Start point: "/>
                        <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding DistributedLoad.StartCoordinate, Converter={StaticResource LengthConverter}}"/>
                        <TextBlock Grid.Row="3" Text="End point: "/>
                        <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding DistributedLoad.EndCoordinate, Converter={StaticResource LengthConverter}}"/>
                    </Grid>
                </Rectangle.ToolTip>
            </Rectangle>
        </Canvas>
    </DataTemplate>


</ResourceDictionary>