author | PAMPHILE Jonathan <pamphile@efrei.fr> |
Thu, 19 Nov 2009 18:05:52 +0100 | |
changeset 215 | d13dbcf861d7 |
parent 214 | beebae32b1ed |
child 216 | 45d2dff788f2 |
--- a/src/FingersDance.Control.Player/UserControlPlayer.xaml Thu Nov 19 18:37:26 2009 +0100 +++ b/src/FingersDance.Control.Player/UserControlPlayer.xaml Thu Nov 19 18:05:52 2009 +0100 @@ -8,7 +8,7 @@ xmlns:FingersDance_Control_Player="clr-namespace:FingersDance.Control.Player" x:Class="FingersDance.Control.Player.UserControlPlayer" x:Name="UserControl" AllowDrop="True" Custom:SurfaceDragDrop.DragOver="Play_Pause_area_DragOver" Custom:SurfaceDragDrop.DragEnter="Play_Pause_area_DragEnter" Custom:SurfaceDragDrop.DragLeave="Play_Pause_area_DragLeave" Custom:SurfaceDragDrop.Drop="Play_Pause_area_Drop" - Width="560" Height="400" + Width="560" Height="423" xmlns:GestureControl="clr-namespace:GestureControl;assembly=GestureControl"> <UserControl.Resources> <Storyboard x:Key="OnClick1"/> @@ -150,6 +150,334 @@ <SplineDoubleKeyFrame KeyTime="00:00:01" Value="1" KeySpline="0,0,0.5,1"/> </DoubleAnimationUsingKeyFrames> </Storyboard> + <Style x:Key="SurfaceRadioButtonStyle1" TargetType="{x:Type Custom:SurfaceRadioButton}"> + <Setter Property="HorizontalContentAlignment" Value="Left"/> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="Foreground" Value="Black"/> + <Setter Property="BorderBrush" Value="Transparent"/> + <Setter Property="Padding" Value="5,0,0,0"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type Custom:SurfaceRadioButton}"> + <ControlTemplate.Resources> + <Storyboard x:Key="ThreeStateExit"> + <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ThreeStateMark" Storyboard.TargetProperty="(UIElement.Opacity)"> + <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"/> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + <Storyboard x:Key="Press"> + <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="GlowBorder" Storyboard.TargetProperty="(UIElement.Opacity)"> + <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1"/> + </DoubleAnimationUsingKeyFrames> + <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="GlowBorder" Storyboard.TargetProperty="(FrameworkElement.Margin)"> + <SplineThicknessKeyFrame KeyTime="00:00:00.1000000" Value="-2"/> + </ThicknessAnimationUsingKeyFrames> + </Storyboard> + <Storyboard x:Key="Checked"> + <DoubleAnimation Duration="00:00:00.2000000" Storyboard.TargetName="Checkmark" Storyboard.TargetProperty="Opacity" To="1"/> + </Storyboard> + <Storyboard x:Key="Release"> + <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="GlowBorder" Storyboard.TargetProperty="(UIElement.Opacity)"> + <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/> + <SplineDoubleKeyFrame KeySpline="0.5,0.5,0.5,1" KeyTime="00:00:00.5000000" Value="0"/> + </DoubleAnimationUsingKeyFrames> + <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="GlowBorder" Storyboard.TargetProperty="(FrameworkElement.Margin)"> + <SplineThicknessKeyFrame KeyTime="00:00:00" Value="-2"/> + <SplineThicknessKeyFrame KeySpline="0.5,0.5,0.5,1" KeyTime="00:00:00.5000000" Value="2"/> + </ThicknessAnimationUsingKeyFrames> + </Storyboard> + <Storyboard x:Key="Unchecked"> + <DoubleAnimation Duration="00:00:00.2000000" Storyboard.TargetName="Checkmark" Storyboard.TargetProperty="Opacity" To="0"/> + </Storyboard> + <Storyboard x:Key="ThreeStateEnter"> + <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ThreeStateMark" Storyboard.TargetProperty="(UIElement.Opacity)"> + <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="0.9"/> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </ControlTemplate.Resources> + <BulletDecorator x:Name="bulletDecorator" MinHeight="30" MinWidth="30" Height="Auto" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Background="Transparent"> + <BulletDecorator.Bullet> + <Grid MinHeight="30" MinWidth="30" Width="30" Height="30" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"> + <Rectangle x:Name="Base" Fill="{TemplateBinding Background}" Stroke="Transparent" StrokeThickness="1" RadiusX="15" RadiusY="15" Margin="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> + <Rectangle x:Name="Button" Fill="#33A4B4BD" StrokeThickness="1" RadiusX="15" RadiusY="15" Margin="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"> + <Rectangle.Stroke> + <LinearGradientBrush EndPoint="0,0" StartPoint="0,1"> + <GradientStop Color="#66000000" Offset="0"/> + <GradientStop Color="#33000000" Offset="1"/> + </LinearGradientBrush> + </Rectangle.Stroke> + </Rectangle> + <Rectangle x:Name="RenderOverlay" StrokeThickness="1" RadiusX="15" RadiusY="15" Margin="3" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"> + <Rectangle.Fill> + <RadialGradientBrush GradientOrigin="0.5,0.072"> + <RadialGradientBrush.RelativeTransform> + <TransformGroup> + <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="-2.281" ScaleY="-1.484"/> + <SkewTransform AngleX="0" AngleY="0" CenterX="0.5" CenterY="0.5"/> + <RotateTransform Angle="359.337" CenterX="0.5" CenterY="0.5"/> + <TranslateTransform X="-0.001" Y="-0.126"/> + </TransformGroup> + </RadialGradientBrush.RelativeTransform> + <GradientStop Color="Transparent" Offset="0.205"/> + <GradientStop Color="#26000000" Offset="0.652"/> + </RadialGradientBrush> + </Rectangle.Fill> + <Rectangle.Stroke> + <LinearGradientBrush EndPoint="0,1" StartPoint="0,0"> + <GradientStop Color="#7FFFFFFF" Offset="0"/> + <GradientStop Color="#0CFFFFFF" Offset="1"/> + </LinearGradientBrush> + </Rectangle.Stroke> + </Rectangle> + <Microsoft_Surface_Presentation_Generic:SurfaceShadowChrome x:Name="GlowBorder" Margin="2" Opacity="0" Color="White" CornerRadius="{Binding ActualHeight, ElementName=GlowBorder}"/> + <Rectangle x:Name="Checkmark" Fill="{x:Null}" StrokeThickness="7" RadiusX="6" RadiusY="6" Margin="8" Opacity="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"> + <Rectangle.Stroke> + <LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1"> + <GradientStop Color="#FF292929" Offset="1"/> + <GradientStop Color="Red" Offset="0.276"/> + </LinearGradientBrush> + </Rectangle.Stroke> + </Rectangle> + <Rectangle x:Name="ThreeStateMark" StrokeThickness="1" RadiusX="13" RadiusY="13" Margin="6" Opacity="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Fill="Red"> + <Rectangle.Stroke> + <LinearGradientBrush EndPoint="0,0" StartPoint="0,1"> + <GradientStop Color="#66000000" Offset="0"/> + <GradientStop Color="#33000000" Offset="1"/> + </LinearGradientBrush> + </Rectangle.Stroke> + </Rectangle> + </Grid> + </BulletDecorator.Bullet> + <Grid HorizontalAlignment="Stretch" Margin="5,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"> + <Grid x:Name="ContentBox" HorizontalAlignment="Stretch" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Background="Transparent"> + <ContentPresenter x:Name="Content" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" ClipToBounds="False" RenderTransformOrigin="0.5,0.5" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}"/> + </Grid> + </Grid> + </BulletDecorator> + <ControlTemplate.Triggers> + <MultiTrigger> + <MultiTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ThreeStateMark" Storyboard.TargetProperty="(UIElement.Opacity)"> + <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="0.9"/> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </MultiTrigger.EnterActions> + <MultiTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ThreeStateMark" Storyboard.TargetProperty="(UIElement.Opacity)"> + <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"/> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </MultiTrigger.ExitActions> + <MultiTrigger.Conditions> + <Condition Property="IsThreeState" Value="True"/> + <Condition Property="IsChecked" Value="{x:Null}"/> + </MultiTrigger.Conditions> + </MultiTrigger> + <Trigger Property="IsChecked" Value="False"> + <Trigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Duration="00:00:00.2000000" Storyboard.TargetName="Checkmark" Storyboard.TargetProperty="Opacity" To="0"/> + </Storyboard> + </BeginStoryboard> + </Trigger.EnterActions> + <Trigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Duration="00:00:00.2000000" Storyboard.TargetName="Checkmark" Storyboard.TargetProperty="Opacity" To="1"/> + </Storyboard> + </BeginStoryboard> + </Trigger.ExitActions> + </Trigger> + <Trigger Property="IsChecked" Value="True"> + <Trigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Duration="00:00:00.2000000" Storyboard.TargetName="Checkmark" Storyboard.TargetProperty="Opacity" To="1"/> + </Storyboard> + </BeginStoryboard> + </Trigger.EnterActions> + <Trigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Duration="00:00:00.2000000" Storyboard.TargetName="Checkmark" Storyboard.TargetProperty="Opacity" To="0"/> + </Storyboard> + </BeginStoryboard> + </Trigger.ExitActions> + </Trigger> + <Trigger Property="IsPressed" Value="True"> + <Trigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="GlowBorder" Storyboard.TargetProperty="(UIElement.Opacity)"> + <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1"/> + </DoubleAnimationUsingKeyFrames> + <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="GlowBorder" Storyboard.TargetProperty="(FrameworkElement.Margin)"> + <SplineThicknessKeyFrame KeyTime="00:00:00.1000000" Value="-2"/> + </ThicknessAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </Trigger.EnterActions> + <Trigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="GlowBorder" Storyboard.TargetProperty="(UIElement.Opacity)"> + <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/> + <SplineDoubleKeyFrame KeySpline="0.5,0.5,0.5,1" KeyTime="00:00:00.5000000" Value="0"/> + </DoubleAnimationUsingKeyFrames> + <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="GlowBorder" Storyboard.TargetProperty="(FrameworkElement.Margin)"> + <SplineThicknessKeyFrame KeyTime="00:00:00" Value="-2"/> + <SplineThicknessKeyFrame KeySpline="0.5,0.5,0.5,1" KeyTime="00:00:00.5000000" Value="2"/> + </ThicknessAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </Trigger.ExitActions> + </Trigger> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Fill" TargetName="Button" Value="#00000000"/> + <Setter Property="Stroke" TargetName="Button" Value="#33000000"/> + <Setter Property="Foreground" Value="#A5333333"/> + <Setter Property="Fill" TargetName="RenderOverlay" Value="#00000000"/> + <Setter Property="Stroke" TargetName="Checkmark" Value="#33000000"/> + <Setter Property="Opacity" TargetName="RenderOverlay" Value="0.5"/> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + <Style.BasedOn> + <Style TargetType="{x:Type ButtonBase}"> + <Setter Property="SnapsToDevicePixels" Value="True"/> + <Setter Property="FocusVisualStyle"> + <Setter.Value> + <Style> + <Setter Property="Control.Template"> + <Setter.Value> + <ControlTemplate/> + </Setter.Value> + </Setter> + </Style> + </Setter.Value> + </Setter> + <Setter Property="FontFamily" Value="Segoe UI"/> + <Setter Property="FontSize" Value="10"/> + <Setter Property="Foreground" Value="Black"/> + <Setter Property="Background" Value="#33A4B4BD"/> + <Setter Property="BorderBrush"> + <Setter.Value> + <LinearGradientBrush EndPoint="0,1" StartPoint="0,0"> + <GradientStop Color="#7FFFFFFF" Offset="0"/> + <GradientStop Color="#0CFFFFFF" Offset="1"/> + </LinearGradientBrush> + </Setter.Value> + </Setter> + <Setter Property="BorderThickness" Value="1"/> + <Setter Property="HorizontalContentAlignment" Value="Center"/> + <Setter Property="VerticalContentAlignment" Value="Center"/> + <Setter Property="Padding" Value="15,6"/> + <Setter Property="IsTabStop" Value="False"/> + <Setter Property="Focusable" Value="False"/> + <Setter Property="MinWidth" Value="30"/> + <Setter Property="MinHeight" Value="30"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type ButtonBase}"> + <ControlTemplate.Resources> + <Storyboard x:Key="Press"> + <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(UIElement.Opacity)"> + <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1"/> + </DoubleAnimationUsingKeyFrames> + <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(FrameworkElement.Margin)"> + <SplineThicknessKeyFrame KeyTime="00:00:00.1000000" Value="-3"/> + </ThicknessAnimationUsingKeyFrames> + </Storyboard> + <Storyboard x:Key="Release"> + <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(UIElement.Opacity)"> + <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/> + <SplineDoubleKeyFrame KeySpline="0.5,0.5,0.5,1" KeyTime="00:00:00.5000000" Value="0"/> + </DoubleAnimationUsingKeyFrames> + <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(FrameworkElement.Margin)"> + <SplineThicknessKeyFrame KeyTime="00:00:00" Value="-3"/> + <SplineThicknessKeyFrame KeySpline="0.5,0.5,0.5,1" KeyTime="00:00:00.5000000" Value="1"/> + </ThicknessAnimationUsingKeyFrames> + </Storyboard> + </ControlTemplate.Resources> + <Grid x:Name="Grid" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"> + <Border x:Name="Shadow" Margin="1,1,1,0" BorderBrush="#33000000" BorderThickness="0,0,0,1" CornerRadius="6" Padding="1"/> + <Rectangle x:Name="Base" Fill="{TemplateBinding Background}" StrokeThickness="1" RadiusX="5" RadiusY="5" Margin="1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"> + <Rectangle.Stroke> + <LinearGradientBrush EndPoint="0,0" StartPoint="0,1"> + <GradientStop Color="#66000000" Offset="0"/> + <GradientStop Color="#33000000" Offset="1"/> + </LinearGradientBrush> + </Rectangle.Stroke> + </Rectangle> + <Rectangle x:Name="RenderOverlay" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1" RadiusX="4" RadiusY="4" Margin="2" Opacity="1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"> + <Rectangle.Fill> + <LinearGradientBrush EndPoint="0,0" StartPoint="0,1"> + <GradientStop Color="#26000000" Offset="0"/> + <GradientStop Color="#4CFFFFFF" Offset="1"/> + </LinearGradientBrush> + </Rectangle.Fill> + </Rectangle> + <Microsoft_Surface_Presentation_Generic:SurfaceShadowChrome x:Name="Glow" Margin="1" Opacity="0" Color="White" CornerRadius="4"/> + <ContentPresenter x:Name="Content" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RenderTransformOrigin="0.5,0.5" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}"> + <ContentPresenter.RenderTransform> + <TranslateTransform X="0" Y="-1"/> + </ContentPresenter.RenderTransform> + </ContentPresenter> + </Grid> + <ControlTemplate.Triggers> + <Trigger Property="IsPressed" Value="True"> + <Trigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(UIElement.Opacity)"> + <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1"/> + </DoubleAnimationUsingKeyFrames> + <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(FrameworkElement.Margin)"> + <SplineThicknessKeyFrame KeyTime="00:00:00.1000000" Value="-3"/> + </ThicknessAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </Trigger.EnterActions> + <Trigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(UIElement.Opacity)"> + <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/> + <SplineDoubleKeyFrame KeySpline="0.5,0.5,0.5,1" KeyTime="00:00:00.5000000" Value="0"/> + </DoubleAnimationUsingKeyFrames> + <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(FrameworkElement.Margin)"> + <SplineThicknessKeyFrame KeyTime="00:00:00" Value="-3"/> + <SplineThicknessKeyFrame KeySpline="0.5,0.5,0.5,1" KeyTime="00:00:00.5000000" Value="1"/> + </ThicknessAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </Trigger.ExitActions> + </Trigger> + <Trigger Property="IsEnabled" Value="True"/> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Fill" TargetName="RenderOverlay" Value="#0CFFFFFF"/> + <Setter Property="Stroke" TargetName="RenderOverlay" Value="#33FFFFFF"/> + <Setter Property="Stroke" TargetName="Base" Value="#33000000"/> + <Setter Property="BorderBrush" TargetName="Shadow" Value="#00000000"/> + <Setter Property="Foreground" Value="#A5333333"/> + <Setter Property="Background" Value="Transparent"/> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + </Style.BasedOn> + </Style> </UserControl.Resources> <UserControl.Triggers> <EventTrigger RoutedEvent="FrameworkElement.Loaded"> @@ -159,26 +487,28 @@ <BeginStoryboard Storyboard="{StaticResource Rect4Annotation}"/> </EventTrigger> </UserControl.Triggers> - <Grid x:Name="LayoutRoot" Width="{Binding Path=ActualWidth, ElementName=UserControl, Mode=Default}" Height="{Binding Path=ActualHeight, ElementName=UserControl, Mode=Default}" Background="{x:Null}"> - <Viewbox Margin="0,0,0,0" Width="{Binding Path=ActualWidth, ElementName=UserControl, Mode=Default}" Height="{Binding Path=ActualHeight, ElementName=UserControl, Mode=Default}" Stretch="Uniform" AllowDrop="True"> - <Grid Width="560" Height="400" HorizontalAlignment="Left" x:Name="GridPlayer"> + <Grid x:Name="LayoutRoot" Background="{x:Null}"> + <Viewbox Stretch="Uniform" AllowDrop="True"> + <Grid Width="556.439" Height="423" x:Name="GridPlayer"> <Grid.RowDefinitions> - <RowDefinition Height="0.898*"/> - <RowDefinition Height="0.102*"/> + <RowDefinition Height="0.849*"/> + <RowDefinition Height="0.151*"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> - <ColumnDefinition Width="0.912*"/> - <ColumnDefinition Width="0.088*"/> + <ColumnDefinition Width="0.917*"/> + <ColumnDefinition Width="0.083*"/> </Grid.ColumnDefinitions> - <FingersDance_Control_Player:UserControlInfoUser Margin="0,-0.498,0,11.298" x:Name="usercontrolInfoUser" Grid.Column="0" Grid.Row="1" Height="30"/> - <MediaElement x:Name="MediaElementVideo" MediaOpened="MediaElementVideo_MediaOpened" Stretch="Fill" ScrubbingEnabled="False" StretchDirection="Both" Grid.Column="0" Grid.Row="0" /> - <StackPanel Opacity="1" Background="{x:Null}" x:Name="StackPanelAnnotation" Height="Auto" d:LayoutOverrides="Height" Margin="0,77,0,0" Grid.Column="1" Grid.Row="0"> + <FingersDance_Control_Player:UserControlInfoUser Margin="0,-0.425,-0.465,0" x:Name="usercontrolInfoUser" Grid.Column="0" Grid.Row="1" Height="30" VerticalAlignment="Top"/> + <MediaElement x:Name="MediaElementVideo" MediaOpened="MediaElementVideo_MediaOpened" Stretch="Fill" ScrubbingEnabled="False" StretchDirection="Both" Grid.Column="0" Grid.Row="0" Margin="0,0,-0.465,-0.073" /> + <StackPanel Opacity="1" Background="{x:Null}" x:Name="StackPanelAnnotation" Height="Auto" d:LayoutOverrides="Height" Margin="0.465,77,-3.561,-0.074" Grid.Column="1" Grid.Row="0"> <Rectangle x:Name="rect1" Width="50" Height="50" Fill="{x:Null}" Stroke="#FF000000" Margin="0.14,0"/> <Rectangle x:Name="rect2" Width="50" Height="50" Fill="{x:Null}" Stroke="#FF000000"/> <Rectangle x:Name="rect3" Width="50" Height="50" Fill="{x:Null}" Stroke="#FF000000"/> <Rectangle x:Name="rect4" Width="50" Height="50" Fill="{x:Null}" Stroke="#FF000000" VerticalAlignment="Bottom"/> </StackPanel> - <GestureControl:GestureControl HorizontalAlignment="Stretch" x:Name="gestureControl" VerticalAlignment="Stretch" Content="" Grid.Row="0" GestureEvent="GestureDetected"/> + <GestureControl:GestureControl HorizontalAlignment="Stretch" x:Name="gestureControl" VerticalAlignment="Stretch" Content="" Grid.Row="0" GestureEvent="GestureDetected" Margin="0,0,-0.465,-0.073"/> + <Custom:SurfaceRadioButton x:Name="AnnotationButton" ContactLeave="AnnotationButton_ContactLeave" HorizontalAlignment="Left" Margin="0,29.575,0,4.297" Width="3" Height="1" Content="SurfaceRadioButton" Style="{DynamicResource SurfaceRadioButtonStyle1}" Grid.Row="1"/> + <Label x:Name="AnnotationLabel" Margin="30,29.575,0,0" Content="" Foreground="White" HorizontalAlignment="Left" Width="203" Grid.Row="1" VerticalAlignment="Top" Height="30"/> </Grid> </Viewbox> </Grid>
--- a/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs Thu Nov 19 18:37:26 2009 +0100 +++ b/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs Thu Nov 19 18:05:52 2009 +0100 @@ -33,10 +33,18 @@ public event EventHandler PlayerStopOrPause; public event EventHandler NewGestureRegognized; + double _Time = 0; + double _StartAnnotation = -1; + List<Gesture> _Gestures = new List<Gesture>(); + public double Time { get { return gestureControl.time; } - set { gestureControl.time = value; } + set + { + gestureControl.time = value; + _Time = value; + } } #region constructors @@ -49,6 +57,7 @@ //Control User Info usercontrolInfoUser.LabelSession.Content = "Seance Test"; usercontrolInfoUser.LabelUser.Content = "User Test"; + MediaElementVideo.Volume = 0; } #endregion @@ -195,8 +204,7 @@ return; } if (!e.Gesture.Name.Equals("PLAY-PAUSE")) - if (NewGestureRegognized != null) - NewGestureRegognized(this, e); + _Gestures.Add(e.Gesture); } catch { } } @@ -435,5 +443,27 @@ default: break; } } + + private void AnnotationButton_ContactLeave(object sender, ContactEventArgs e) + { + try + { + if (_StartAnnotation == -1) + { + _StartAnnotation = _Time; + AnnotationLabel.Content = "Annotation en cours"; + } + else + { + if (NewGestureRegognized != null) + NewGestureRegognized(null, new GestureEventArg(_Gestures, _StartAnnotation, _Time)); + _Gestures.Clear(); + _StartAnnotation = -1; + AnnotationLabel.Content = ""; + AnnotationButton.IsChecked = false; + } + } + catch { } + } } } \ No newline at end of file
--- a/src/FingersDance.Control.Screen/FingersDance.Control.Screen.csproj Thu Nov 19 18:37:26 2009 +0100 +++ b/src/FingersDance.Control.Screen/FingersDance.Control.Screen.csproj Thu Nov 19 18:05:52 2009 +0100 @@ -119,6 +119,10 @@ <Resource Include="Resources\WindowBackground.jpg" /> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\FingersDance.ActionFactory\FingersDance.Factory.csproj"> + <Project>{C7B905EA-0678-4DA0-8EF8-7F9CBD22818E}</Project> + <Name>FingersDance.Factory</Name> + </ProjectReference> <ProjectReference Include="..\FingersDance.Control.ListVideo\FingersDance.Control.ListVideo.csproj"> <Project>{072436EC-FCD5-4A55-96AA-0047BF25BD37}</Project> <Name>FingersDance.Control.ListVideo</Name>
--- a/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs Thu Nov 19 18:37:26 2009 +0100 +++ b/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs Thu Nov 19 18:05:52 2009 +0100 @@ -13,6 +13,7 @@ using FingersDance.Control.SessionInput; using FingersDance.ViewModels; using FingersDance.Data; +using FingersDance.Factory; namespace FingersDance.Control.Screen { @@ -160,6 +161,7 @@ loadedProject.Description = loadedLdt.Root.Element("project").Attribute("abstract").Value; loadedProject.Cuttings = new List<Cutting>(); XElement cuttingsParentNode = loadedLdt.Root.Element("annotations").Element("content"); + DataDictionary Data = (new DataFactory()).Data; foreach (XElement cuttingNode in cuttingsParentNode.Elements()) { List<Annotation> la = new List<Annotation>(); @@ -174,7 +176,9 @@ Byte g = Convert.ToByte(colorString.Substring(4, 2), 16); Byte b = Convert.ToByte(colorString.Substring(6, 2), 16); Color c = Color.FromRgb(r, g, b); - la.Add(new Annotation(aId, begin, dur, gt, c)); + Annotation Annotation = new Annotation(aId, begin, dur, gt, c); + la.Add(Annotation); + Data.AddAnnotation(Annotation); } loadedProject.Cuttings.Add(new Cutting(cuttingNode.Attribute("id").Value,cuttingNode.Element("title").Value,la)); }
--- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs Thu Nov 19 18:37:26 2009 +0100 +++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs Thu Nov 19 18:05:52 2009 +0100 @@ -361,15 +361,20 @@ } } - + public void UserControlPlayer_NewGestureRegognized(object sender, EventArgs e) { - GestureRoutedEventArgs grea = (GestureRoutedEventArgs)e; - Console.WriteLine("Timeline NewGestureRegognized " + grea.Gesture.Name + ", " + grea.Gesture.Start + ", " + grea.Gesture.End); - // If the stroke has been drawed very fast, end and start can be the same, so we add a little length. - float dur = (float)(grea.Gesture.End - grea.Gesture.Start); - if (dur == 0) dur = (float)0.5; - addAnnotation(new AnnotationViewModel(new Annotation("temp",(float)grea.Gesture.Start, (float)(grea.Gesture.End-grea.Gesture.Start), grea.Gesture.Name, CurrentColor), 0)); + try + { + GestureEventArg grea = (GestureEventArg)e; + //Console.WriteLine("Timeline NewGestureRegognized " + grea.Gesture.Name + ", " + grea.Gesture.Start + ", " + grea.Gesture.End); + // If the stroke has been drawed very fast, end and start can be the same, so we add a little length. + float dur = (float)(grea.End - grea.Start); + if (dur == 0) dur = (float)0.5; + foreach(Gesture elt in grea.Gestures) + addAnnotation(new AnnotationViewModel(new Annotation("temp", (float)grea.Start, (float)(grea.End - grea.Start), elt.Name, CurrentColor), 0)); + } + catch { } } private void listview_PreviewContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
--- a/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml Thu Nov 19 18:37:26 2009 +0100 +++ b/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml Thu Nov 19 18:05:52 2009 +0100 @@ -23,8 +23,8 @@ <Grid x:Name="GridSyncSource" Margin="174,0,0,0" Background="{x:Null}"> <FingersDance_Control_SyncSource:UserControlSyncSource x:Name="UserControlSyncSource" HorizontalAlignment="Left" VerticalAlignment="Top" Width="{Binding Path=ActualWidth, ElementName=GridSyncSource, Mode=Default}" Margin="0,0,0,0" Height="{Binding Path=ActualHeight, ElementName=GridSyncSource, Mode=Default}"/> </Grid> - <Grid HorizontalAlignment="Left" Width="170" x:Name="GridMenu" Background="{x:Null}" Margin="0,49,0,0"> - <FingersDance_Control_Menu:UserControlMenu x:Name="UCMenu" Width="{Binding Path=ActualWidth, ElementName=GridMenu, Mode=Default}" Height="{Binding Path=ActualHeight, ElementName=GridMenu, Mode=Default}" Margin="0,0,0,0"/> + <Grid HorizontalAlignment="Left" Width="170" x:Name="GridMenu" Background="{x:Null}" Margin="0,49,0,148"> + <FingersDance_Control_Menu:UserControlMenu x:Name="UCMenu" Width="{Binding Path=ActualWidth, ElementName=GridMenu, Mode=Default}" Height="{Binding Path=ActualHeight, ElementName=GridMenu, Mode=Default}" Margin="0"/> </Grid> </Grid> </UserControl> \ No newline at end of file
--- a/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs Thu Nov 19 18:37:26 2009 +0100 +++ b/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs Thu Nov 19 18:05:52 2009 +0100 @@ -35,6 +35,8 @@ double lastdeltaOrientation = 0; int lastSoundlevel = 0; bool rise = true; //rise is true if the curse of the volume is positive + int LastElipseNB = 0; + #endregion #region Properties @@ -73,7 +75,7 @@ private void InitializeDefinitions() { - for (byte k = 1; k <= 5; k++) + for (byte k = 1; k <= 25; k++) { ByteTagVisualizationDefinition tagDef = new ByteTagVisualizationDefinition(); // The tag value that this definition will respond to. @@ -107,17 +109,20 @@ TagVisuSoundControl tagsoundcontrol = (TagVisuSoundControl)e.TagVisualization; deltaOrientation = (tagsoundcontrol.Orientation - baseOrientation) % 360; + if (deltaOrientation < 0) deltaOrientation = 360 + deltaOrientation; int niveau = (int)(deltaOrientation / 36); + + //if (((niveau == 9) || (niveau == 8) || (niveau == 7)) && lastSoundlevel == 0) if (((niveau == 9) || (niveau == 8)) && lastSoundlevel == 0) rise = false; //else if (((niveau == 1) || (niveau == 2) || (niveau == 3)) && lastSoundlevel == 0) else if (((niveau == 1) || (niveau == 2)) && lastSoundlevel == 0) rise = true; - + if (!rise) { niveau = (niveau - 10) % 10; @@ -125,21 +130,30 @@ //--Elipse visibility int elipseNB = tagsoundcontrol.TagVisuSoundLevelUpdate(niveau); //Set the Sound of the Player. - if(elipseNB != -1) + if ((LastElipseNB <1 && deltaOrientation - lastdeltaOrientation < 0) || (LastElipseNB > 9 && deltaOrientation - lastdeltaOrientation > 0)) + baseOrientation += deltaOrientation - lastdeltaOrientation; + else { - UserControlSyncSource.setUserPlayerVolume(elipseNB/10.0); + if (elipseNB != -1) + { + UserControlSyncSource.setUserPlayerVolume(elipseNB / 10.0); + lastSoundlevel = niveau; + LastElipseNB = elipseNB; + tagsoundcontrol.volumeModel.Content = (elipseNB / 10.0).ToString(); + lastdeltaOrientation = deltaOrientation; + } } - lastSoundlevel = niveau; - tagsoundcontrol.volumeModel.Content = elipseNB;//deltaOrientation.ToString(); + } - } private void OnVisualizationAdded(object sender, TagVisualizerEventArgs e) { TagVisuSoundControl tagsoundcontrol = (TagVisuSoundControl)e.TagVisualization; - + LastElipseNB = 5; + lastdeltaOrientation = 0; + switch (tagsoundcontrol.VisualizedTag.Byte.Value) { - case 1: + case 24: try { /*
--- a/src/FingersDance.GestureControl/GestureControl.csproj Thu Nov 19 18:37:26 2009 +0100 +++ b/src/FingersDance.GestureControl/GestureControl.csproj Thu Nov 19 18:05:52 2009 +0100 @@ -83,6 +83,7 @@ <ItemGroup> <Compile Include="DoubleHalfConverter.cs" /> <Compile Include="Gesture.cs" /> + <Compile Include="GestureEventArg.cs" /> <Compile Include="GestureRoutedEventArgs.cs" /> <Compile Include="GestureVector.cs" /> <Compile Include="Properties\AssemblyInfo.cs">
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FingersDance.GestureControl/GestureEventArg.cs Thu Nov 19 18:05:52 2009 +0100 @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using GestureControl; +using System.Windows.Input; +using System.Windows; + +namespace GestureControl +{ + public class GestureEventArg : RoutedEventArgs + { + public List<Gesture> Gestures { get; private set; } + public double Start, End; + + public GestureEventArg() : base() { } + public GestureEventArg(List<Gesture> gestures, double start, double end) : base() { this.Gestures = gestures; this.Start = start; this.End = end; } + } +}
--- a/src/FingersDance.GestureControl/GestureVector.cs Thu Nov 19 18:37:26 2009 +0100 +++ b/src/FingersDance.GestureControl/GestureVector.cs Thu Nov 19 18:05:52 2009 +0100 @@ -37,7 +37,7 @@ /// <param name="precision"></param> public SurfaceGesture(List<SurfaceGesturePoint> list, int precision) { - this.Precision = 20; + this.Precision = precision; this.Generate(list); } #endregion @@ -124,590 +124,62 @@ /// </summary> /// <param name="list"></param> private void Generate(List<SurfaceGesturePoint> list) - { - SurfaceGestureVectorDirection lastDirection = SurfaceGestureVectorDirection.NONE; - int lastPoint = 0; - SurfaceGesturePoint LastChange = list[0]; - - /////// TEST/////////// - if (this.GenerateCourb(list, 5) == true) - return; + { this.Clear(); - /////////////////////// - - for (int i = 0; i < list.Count - 1; i++) + if (list.Count < 2) { - if (GetHorizontal(list[lastPoint], list[i + 1]) == SurfaceGestureVectorDirection.UP && lastDirection != SurfaceGestureVectorDirection.UP) - { - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UP, Lenght = (Math.Abs(LastChange.Y - list[i + 1].Y)), Origin = list[lastPoint] }); - LastChange = list[i + 1]; - lastDirection = SurfaceGestureVectorDirection.UP; - } - else if (GetHorizontal(list[lastPoint], list[i + 1]) == SurfaceGestureVectorDirection.DOWN && lastDirection != SurfaceGestureVectorDirection.DOWN) - { - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWN, Lenght = (Math.Abs(LastChange.Y - list[i + 1].Y)), Origin = list[lastPoint] }); - LastChange = list[i + 1]; - lastDirection = SurfaceGestureVectorDirection.DOWN; - } - else if (GetHorizontal(list[lastPoint], list[i + 1]) == SurfaceGestureVectorDirection.UPLEFT && lastDirection != SurfaceGestureVectorDirection.UPLEFT) - { - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UPLEFT, Lenght = (Math.Abs(LastChange.Y - list[i + 1].Y)), Origin = list[lastPoint] }); - LastChange = list[i + 1]; - lastDirection = SurfaceGestureVectorDirection.UPLEFT; - } - else if (GetHorizontal(list[lastPoint], list[i + 1]) == SurfaceGestureVectorDirection.UPRIGHT && lastDirection != SurfaceGestureVectorDirection.UPRIGHT) - { - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UPRIGHT, Lenght = (Math.Abs(LastChange.Y - list[i + 1].Y)), Origin = list[lastPoint] }); - LastChange = list[i + 1]; - lastDirection = SurfaceGestureVectorDirection.UPRIGHT; - } - else if (GetHorizontal(list[lastPoint], list[i + 1]) == SurfaceGestureVectorDirection.DOWNLEFT && lastDirection != SurfaceGestureVectorDirection.DOWNLEFT) - { - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWNLEFT, Lenght = (Math.Abs(LastChange.Y - list[i + 1].Y)), Origin = list[lastPoint] }); - LastChange = list[i + 1]; - lastDirection = SurfaceGestureVectorDirection.DOWNLEFT; - } - else if (GetHorizontal(list[lastPoint], list[i + 1]) == SurfaceGestureVectorDirection.DOWNRIGHT && lastDirection != SurfaceGestureVectorDirection.DOWNRIGHT) - { - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWNRIGHT, Lenght = (Math.Abs(LastChange.Y - list[i + 1].Y)), Origin = list[lastPoint] }); - LastChange = list[i + 1]; - lastDirection = SurfaceGestureVectorDirection.DOWNRIGHT; - } - else if (GetVertical(list[lastPoint], list[i + 1]) == SurfaceGestureVectorDirection.LEFT && lastDirection != SurfaceGestureVectorDirection.LEFT) - { - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.LEFT, Lenght = (Math.Abs(LastChange.X - list[i + 1].X)), Origin = list[lastPoint] }); - LastChange = list[i + 1]; - lastDirection = SurfaceGestureVectorDirection.LEFT; - } - else if (GetVertical(list[lastPoint], list[i + 1]) == SurfaceGestureVectorDirection.RIGHT && lastDirection != SurfaceGestureVectorDirection.RIGHT) - { - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.RIGHT, Lenght = (Math.Abs(LastChange.X - list[i + 1].X)), Origin = list[lastPoint] }); - LastChange = list[i + 1]; - lastDirection = SurfaceGestureVectorDirection.RIGHT; - } - else if (GetVertical(list[lastPoint], list[i + 1]) == SurfaceGestureVectorDirection.UPLEFT && lastDirection != SurfaceGestureVectorDirection.UPLEFT) - { - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UPLEFT, Lenght = (Math.Abs(LastChange.Y - list[i + 1].Y)), Origin = list[lastPoint] }); - LastChange = list[i + 1]; - lastDirection = SurfaceGestureVectorDirection.UPLEFT; - } - else if (GetVertical(list[lastPoint], list[i + 1]) == SurfaceGestureVectorDirection.UPRIGHT && lastDirection != SurfaceGestureVectorDirection.UPRIGHT) - { - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UPRIGHT, Lenght = (Math.Abs(LastChange.Y - list[i + 1].Y)), Origin = list[lastPoint] }); - LastChange = list[i + 1]; - lastDirection = SurfaceGestureVectorDirection.UPRIGHT; - } - else if (GetVertical(list[lastPoint], list[i + 1]) == SurfaceGestureVectorDirection.DOWNLEFT && lastDirection != SurfaceGestureVectorDirection.DOWNLEFT) - { - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWNLEFT, Lenght = (Math.Abs(LastChange.Y - list[i + 1].Y)), Origin = list[lastPoint] }); - LastChange = list[i + 1]; - lastDirection = SurfaceGestureVectorDirection.DOWNLEFT; - } - else if (GetVertical(list[lastPoint], list[i + 1]) == SurfaceGestureVectorDirection.DOWNRIGHT && lastDirection != SurfaceGestureVectorDirection.DOWNRIGHT) - { - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWNRIGHT, Lenght = (Math.Abs(LastChange.Y - list[i + 1].Y)), Origin = list[lastPoint] }); - LastChange = list[i + 1]; - lastDirection = SurfaceGestureVectorDirection.DOWNRIGHT; - } - ++lastPoint; + this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.TAP, Lenght = 0 }); + return; } - // Analyse des extrémités de la gesture - /* + List<SurfaceGesturePoint> Points = new List<SurfaceGesturePoint>(); + List<SurfaceGestureVector> Vectors = new List<SurfaceGestureVector>(); + for (int index = 1; index <= list.Count; index++) + { + if (index == list.Count / 2 || index == list.Count) + { + SurfaceGestureVector verctorTemp = AnalysePoints(Points); + if (Vectors.Count == 0 || !Vectors[Vectors.Count - 1].Direction.Equals(verctorTemp.Direction)) + Vectors.Add(verctorTemp); + Points.Clear(); + } + else + Points.Add(list[index]); + } + foreach (SurfaceGestureVector elt in Vectors) + this.Add(elt); + } + + SurfaceGestureVector AnalysePoints(List<SurfaceGesturePoint> list) + { double diffX = Math.Abs(list[0].X - list[list.Count - 1].X); double diffY = Math.Abs(list[0].Y - list[list.Count - 1].Y); if (diffX < 10 && diffY > 10) { - this.Clear(); - if (up > down) - return (new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UP, Lenght = up }); + if (list[0].Y > list[list.Count - 1].Y) + return (new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UP, Lenght = 0, Origin = list[0] }); else - return (new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWN, Lenght = down }); + return (new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWN, Lenght = 0, Origin = list[0] }); } else if (diffY < 10 && diffX > 10) { - this.Clear(); - if (left > right) - return (new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.LEFT, Lenght = left }); + if (list[list.Count - 1].X > list[0].X) + return (new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.RIGHT, Lenght = 0, Origin = list[0] }); else - return (new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.RIGHT, Lenght = right }); - } - - */ - - // Analyse détaillée de la gesture - - List<SurfaceGestureVector> ThisTemp = new List<SurfaceGestureVector>(); - List<SurfaceGestureVector> temp = new List<SurfaceGestureVector>(); - List<SurfaceGestureVector> Tempo = new List<SurfaceGestureVector>(); - - if ((this.Count / 10) >= 1) - { - /* - for (int i = 1; i < this.Count + 1; i++) - { - temp.Add(this[i-1]); - if (i % 7 == 0) - { - SurfaceGestureVector result = Analyse(temp); - if (ThisTemp.Count == 0 || !ThisTemp[ThisTemp.Count - 1].Direction.Equals(result.Direction)) - ThisTemp.Add(result); - else - ThisTemp[ThisTemp.Count - 1].Lenght += result.Lenght; - temp.Clear(); - } - } - if (temp.Count > 0) - { - SurfaceGestureVector result = Analyse(temp); - if (ThisTemp[ThisTemp.Count - 1].Direction.Equals(result.Direction)) - ThisTemp[ThisTemp.Count - 1].Lenght += result.Lenght; - else - ThisTemp.Add(result); - temp.Clear(); - } - this.Clear(); - foreach(SurfaceGestureVector elt in ThisTemp) - this.Add(elt); - */ - switch (this.Count / 10) - { - case 1: - ThisTemp.Add(Analyse(this)); - this.Clear(); - if (ThisTemp.Count > 1) - { - double up = 0, down = 0, left = 0, right = 0, upleft = 0, upright = 0, downleft = 0, downright = 0; - foreach (SurfaceGestureVector elt in ThisTemp) - { - switch (elt.Direction) - { - case SurfaceGestureVectorDirection.DOWN: - down += elt.Lenght; - break; - case SurfaceGestureVectorDirection.DOWNLEFT: - downleft += elt.Lenght; - break; - case SurfaceGestureVectorDirection.DOWNRIGHT: - downright += elt.Lenght; - break; - case SurfaceGestureVectorDirection.LEFT: - left += elt.Lenght; - break; - case SurfaceGestureVectorDirection.RIGHT: - right += elt.Lenght; - break; - case SurfaceGestureVectorDirection.UP: - up += elt.Lenght; - break; - case SurfaceGestureVectorDirection.UPLEFT: - upleft += elt.Lenght; - break; - case SurfaceGestureVectorDirection.UPRIGHT: - upright += elt.Lenght; - break; - default: - break; - } - } - if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(up)) - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UP, Lenght = up, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(upleft)) - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UPLEFT, Lenght = upleft, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(upright)) - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UPRIGHT, Lenght = upright, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(down)) - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWN, Lenght = down, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(downleft)) - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWNLEFT, Lenght = downleft, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(downright)) - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWNRIGHT, Lenght = downright, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(left)) - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.LEFT, Lenght = left, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(right)) - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.RIGHT, Lenght = right, Origin = null }); - } - else - this.Add(ThisTemp[0]); - break; - case 2: - for (int index = 1; index <= this.Count; index++) - { - if (index == this.Count / 2 || index == this.Count) - { - ThisTemp.Add(Analyse(temp)); - if (ThisTemp.Count > 1) - { - double up = 0, down = 0, left = 0, right = 0, upleft = 0, upright = 0, downleft = 0, downright = 0; - foreach (SurfaceGestureVector elt in ThisTemp) - { - - switch (elt.Direction) - { - case SurfaceGestureVectorDirection.DOWN: - down += elt.Lenght; - break; - case SurfaceGestureVectorDirection.DOWNLEFT: - downleft += elt.Lenght; - break; - case SurfaceGestureVectorDirection.DOWNRIGHT: - downright += elt.Lenght; - break; - case SurfaceGestureVectorDirection.LEFT: - left += elt.Lenght; - break; - case SurfaceGestureVectorDirection.RIGHT: - right += elt.Lenght; - break; - case SurfaceGestureVectorDirection.UP: - up += elt.Lenght; - break; - case SurfaceGestureVectorDirection.UPLEFT: - upleft += elt.Lenght; - break; - case SurfaceGestureVectorDirection.UPRIGHT: - upright += elt.Lenght; - break; - } - } - if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(up)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UP, Lenght = up, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(upleft)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UPLEFT, Lenght = upleft, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(upright)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UPRIGHT, Lenght = upright, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(down)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWN, Lenght = down, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(downleft)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWNLEFT, Lenght = downleft, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(downright)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWNRIGHT, Lenght = downright, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(left)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.LEFT, Lenght = left, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(right)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.RIGHT, Lenght = right, Origin = null }); - } - else - Tempo.Add(ThisTemp[0]); - } - else - ThisTemp.Add(this[index]); - } - this.Clear(); - if (Tempo[0].Direction.Equals(Tempo[1].Direction)) - this.Add(Tempo[0]); - else - foreach (SurfaceGestureVector elt in Tempo) - this.Add(elt); - break; - case 3: - for (int index = 1; index <= this.Count; index++) - { - if (index == this.Count / 3 || index == this.Count) - { - ThisTemp.Add(Analyse(temp)); - if (ThisTemp.Count > 1) - { - double up = 0, down = 0, left = 0, right = 0, upleft = 0, upright = 0, downleft = 0, downright = 0; - foreach (SurfaceGestureVector elt in ThisTemp) - { - - switch (elt.Direction) - { - case SurfaceGestureVectorDirection.DOWN: - down += elt.Lenght; - break; - case SurfaceGestureVectorDirection.DOWNLEFT: - downleft += elt.Lenght; - break; - case SurfaceGestureVectorDirection.DOWNRIGHT: - downright += elt.Lenght; - break; - case SurfaceGestureVectorDirection.LEFT: - left += elt.Lenght; - break; - case SurfaceGestureVectorDirection.RIGHT: - right += elt.Lenght; - break; - case SurfaceGestureVectorDirection.UP: - up += elt.Lenght; - break; - case SurfaceGestureVectorDirection.UPLEFT: - upleft += elt.Lenght; - break; - case SurfaceGestureVectorDirection.UPRIGHT: - upright += elt.Lenght; - break; - } - } - if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(up)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UP, Lenght = up, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(upleft)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UPLEFT, Lenght = upleft, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(upright)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UPRIGHT, Lenght = upright, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(down)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWN, Lenght = down, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(downleft)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWNLEFT, Lenght = downleft, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(downright)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWNRIGHT, Lenght = downright, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(left)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.LEFT, Lenght = left, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(right)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.RIGHT, Lenght = right, Origin = null }); - } - else - Tempo.Add(ThisTemp[0]); - } - else - ThisTemp.Add(this[index]); - } - this.Clear(); - if (Tempo[0].Direction.Equals(Tempo[1].Direction) && Tempo[0].Direction.Equals(Tempo[2].Direction)) - this.Add(Tempo[0]); - else - foreach (SurfaceGestureVector elt in Tempo) - this.Add(elt); - break; - default: - for (int index = 1; index <= this.Count; index++) - { - if (index == this.Count / 4 || index == this.Count) - { - ThisTemp.Add(Analyse(temp)); - if (ThisTemp.Count > 1) - { - double up = 0, down = 0, left = 0, right = 0, upleft = 0, upright = 0, downleft = 0, downright = 0; - foreach (SurfaceGestureVector elt in ThisTemp) - { - - switch (elt.Direction) - { - case SurfaceGestureVectorDirection.DOWN: - down += elt.Lenght; - break; - case SurfaceGestureVectorDirection.DOWNLEFT: - downleft += elt.Lenght; - break; - case SurfaceGestureVectorDirection.DOWNRIGHT: - downright += elt.Lenght; - break; - case SurfaceGestureVectorDirection.LEFT: - left += elt.Lenght; - break; - case SurfaceGestureVectorDirection.RIGHT: - right += elt.Lenght; - break; - case SurfaceGestureVectorDirection.UP: - up += elt.Lenght; - break; - case SurfaceGestureVectorDirection.UPLEFT: - upleft += elt.Lenght; - break; - case SurfaceGestureVectorDirection.UPRIGHT: - upright += elt.Lenght; - break; - } - } - if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(up)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UP, Lenght = up, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(upleft)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UPLEFT, Lenght = upleft, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(upright)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UPRIGHT, Lenght = upright, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(down)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWN, Lenght = down, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(downleft)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWNLEFT, Lenght = downleft, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(downright)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWNRIGHT, Lenght = downright, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(left)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.LEFT, Lenght = left, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(right)) - Tempo.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.RIGHT, Lenght = right, Origin = null }); - } - else - Tempo.Add(ThisTemp[0]); - } - else - ThisTemp.Add(this[index]); - } - this.Clear(); - if (Tempo[0].Direction.Equals(Tempo[1].Direction) && Tempo[0].Direction.Equals(Tempo[2].Direction) && Tempo[0].Direction.Equals(Tempo[3].Direction)) - this.Add(Tempo[0]); - else - foreach (SurfaceGestureVector elt in Tempo) - this.Add(elt); - break; - } - } - else - { - ThisTemp.Add(Analyse(this)); - this.Clear(); - if (ThisTemp.Count > 1) - { - double up = 0, down = 0, left = 0, right = 0, upleft = 0, upright = 0, downleft = 0, downright = 0; - foreach (SurfaceGestureVector elt in ThisTemp) - { - - switch (elt.Direction) - { - case SurfaceGestureVectorDirection.DOWN: - down += elt.Lenght; - break; - case SurfaceGestureVectorDirection.DOWNLEFT: - downleft += elt.Lenght; - break; - case SurfaceGestureVectorDirection.DOWNRIGHT: - downright += elt.Lenght; - break; - case SurfaceGestureVectorDirection.LEFT: - left += elt.Lenght; - break; - case SurfaceGestureVectorDirection.RIGHT: - right += elt.Lenght; - break; - case SurfaceGestureVectorDirection.UP: - up += elt.Lenght; - break; - case SurfaceGestureVectorDirection.UPLEFT: - upleft += elt.Lenght; - break; - case SurfaceGestureVectorDirection.UPRIGHT: - upright += elt.Lenght; - break; - } - } - if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(up)) - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UP, Lenght = up, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(upleft)) - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UPLEFT, Lenght = upleft, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(upright)) - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UPRIGHT, Lenght = upright, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(down)) - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWN, Lenght = down, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(downleft)) - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWNLEFT, Lenght = downleft, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(downright)) - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWNRIGHT, Lenght = downright, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(left)) - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.LEFT, Lenght = left, Origin = null }); - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(right)) - this.Add(new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.RIGHT, Lenght = right, Origin = null }); - } - else - this.Add(ThisTemp[0]); - } - } - - private SurfaceGestureVector Analyse(List<SurfaceGestureVector> list) - { - // Analyse de la forme - - double up = 0, down = 0, left = 0, right = 0, upleft = 0, upright = 0, downleft = 0, downright = 0; - foreach (SurfaceGestureVector elt in list) - { - - switch (elt.Direction) - { - case SurfaceGestureVectorDirection.DOWN: - down += elt.Lenght; - break; - case SurfaceGestureVectorDirection.DOWNLEFT: - downleft += elt.Lenght; - break; - case SurfaceGestureVectorDirection.DOWNRIGHT: - downright += elt.Lenght; - break; - case SurfaceGestureVectorDirection.LEFT: - left += elt.Lenght; - break; - case SurfaceGestureVectorDirection.RIGHT: - right += elt.Lenght; - break; - case SurfaceGestureVectorDirection.UP: - up += elt.Lenght; - break; - case SurfaceGestureVectorDirection.UPLEFT: - upleft += elt.Lenght; - break; - case SurfaceGestureVectorDirection.UPRIGHT: - upright += elt.Lenght; - break; - } - } - /* - //double cupleft = 0, cupright = 0, cdownleft = 0, cdownright = 0; - - - if (list.Count > 2) - { - double min = 180; - for (int i = 1; i < list.Count - 2; i++) - { - double a = GetDistancePoints(list[list.Count - 1].Origin, list[0].Origin); - double b = GetDistancePoints(list[i].Origin, list[0].Origin); - double c = GetDistancePoints(list[i].Origin, list[list.Count - 1].Origin); - double angle = 180 * (Math.Acos((b * b + c * c - a * a) / (2 * b * c))) / Math.PI ; - min = Math.Min(angle > 0 ? angle : 180, min); - } - if(min<130) - return new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.NONE, Lenght = up, Origin = list[0].Origin }; - } - - if (up < 4 && upleft < 4 && upright < 4 && down < 4 && downleft < 4 && downright < 4 && right < 4 && left < 4) - return new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.TAP, Lenght = 0 }; - if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(up)) - return new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UP, Lenght = up, Origin = list[0].Origin }; - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(upleft)) - return new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UPLEFT, Lenght = upleft, Origin = list[0].Origin }; - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(upright)) - return new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UPRIGHT, Lenght = upright, Origin = list[0].Origin }; - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(down)) - return new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWN, Lenght = down, Origin = list[0].Origin }; - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(downleft)) - return new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWNLEFT, Lenght = downleft, Origin = list[0].Origin }; - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(downright)) - return new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWNRIGHT, Lenght = downright, Origin = list[0].Origin }; - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(left)) - return new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.LEFT, Lenght = left, Origin = list[0].Origin }; - else if (Math.Max(up, Math.Max(upleft, Math.Max(upright, Math.Max(down, Math.Max(downleft, Math.Max(left, Math.Max(downright, right))))))).Equals(right)) - return new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.RIGHT, Lenght = right, Origin = list[0].Origin }; - else - return (new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.NONE, Lenght = 0, Origin = list[0].Origin }); - */ - - double diffX = Math.Abs(list[0].Origin.X - list[list.Count - 1].Origin.X); - double diffY = Math.Abs(list[0].Origin.Y - list[list.Count - 1].Origin.Y); - - if (diffX < 10 && diffY > 10) - { - if (list[0].Origin.Y > list[list.Count - 1].Origin.Y) - return (new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UP, Lenght = up, Origin = list[0].Origin }); - else - return (new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWN, Lenght = down, Origin = list[0].Origin }); - } - else if (diffY < 10 && diffX > 10) - { - if (list[list.Count - 1].Origin.X > list[0].Origin.X) - return (new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.LEFT, Lenght = left, Origin = list[0].Origin }); - else - return (new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.RIGHT, Lenght = right, Origin = list[0].Origin }); + return (new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.LEFT, Lenght = 0, Origin = list[0] }); } else if (diffX > 10 && diffY > 10) { - if (list[0].Origin.Y > list[list.Count - 1].Origin.Y && list[list.Count - 1].Origin.X > list[0].Origin.X) - return new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UPLEFT, Lenght = upleft, Origin = list[0].Origin }; - else if (list[0].Origin.Y > list[list.Count - 1].Origin.Y && list[list.Count - 1].Origin.X < list[0].Origin.X) - return new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UPRIGHT, Lenght = upright, Origin = list[0].Origin }; - else if (list[0].Origin.Y < list[list.Count - 1].Origin.Y && list[list.Count - 1].Origin.X > list[0].Origin.X) - return new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWNLEFT, Lenght = downleft, Origin = list[0].Origin }; + if (list[0].Y > list[list.Count - 1].Y && list[list.Count - 1].X > list[0].X) + return new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UPRIGHT, Lenght = 0, Origin = list[0] }; + else if (list[0].Y > list[list.Count - 1].Y && list[list.Count - 1].X < list[0].X) + return new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UPLEFT, Lenght = 0, Origin = list[0] }; + else if (list[0].Y < list[list.Count - 1].Y && list[list.Count - 1].X > list[0].X) + return new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWNRIGHT, Lenght = 0, Origin = list[0] }; else - return new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.UPRIGHT, Lenght = upright, Origin = list[0].Origin }; + return new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.DOWNLEFT, Lenght = 0, Origin = list[0] }; } else return new SurfaceGestureVector { Direction = SurfaceGestureVectorDirection.TAP, Lenght = 0 }; @@ -718,41 +190,21 @@ if (p1.Y < p2.Y) { // go up - if (Math.Abs(p2.Y - p1.Y) > this.Precision) + if (Math.Abs(p2.X - p1.X) < Math.Abs(p2.Y - p1.Y)) + return SurfaceGestureVectorDirection.DOWN; + else { - if (Math.Abs(p2.X - p1.X) < Math.Abs(p2.Y - p1.Y)) - return SurfaceGestureVectorDirection.DOWN; + if (p1.X < p2.X) + return SurfaceGestureVectorDirection.DOWNRIGHT; else - { - if (p1.X < p2.X) - return SurfaceGestureVectorDirection.DOWNRIGHT; - else - return SurfaceGestureVectorDirection.DOWNLEFT; - } + return SurfaceGestureVectorDirection.DOWNLEFT; } - else - { - if (p1.X < p2.X) - return SurfaceGestureVectorDirection.DOWNRIGHT; - else - return SurfaceGestureVectorDirection.DOWNLEFT; - } } else { // go down - if (Math.Abs(p1.Y - p2.Y) > this.Precision) - { - if (Math.Abs(p1.X - p2.X) < Math.Abs(p1.Y - p2.Y)) - return SurfaceGestureVectorDirection.UP; - else - { - if (p1.X < p2.X) - return SurfaceGestureVectorDirection.UPRIGHT; - else - return SurfaceGestureVectorDirection.UPLEFT; - } - } + if (Math.Abs(p1.X - p2.X) < Math.Abs(p1.Y - p2.Y)) + return SurfaceGestureVectorDirection.UP; else { if (p1.X < p2.X) @@ -768,18 +220,8 @@ if (p1.X < p2.X) { // go left - if (Math.Abs(p2.X - p1.X) > this.Precision) - { - if (Math.Abs(p2.Y - p1.Y) < Math.Abs(p2.X - p1.X)) - return SurfaceGestureVectorDirection.RIGHT; - else - { - if (p1.Y < p2.Y) - return SurfaceGestureVectorDirection.DOWNRIGHT; - else - return SurfaceGestureVectorDirection.UPRIGHT; - } - } + if (Math.Abs(p2.Y - p1.Y) < Math.Abs(p2.X - p1.X)) + return SurfaceGestureVectorDirection.RIGHT; else { if (p1.Y < p2.Y) @@ -790,19 +232,9 @@ } else { - // go right - if (Math.Abs(p1.X - p2.X) > this.Precision) - { - if (Math.Abs(p1.Y - p2.Y) < Math.Abs(p1.X - p2.X)) - return SurfaceGestureVectorDirection.LEFT; - else - { - if (p1.Y < p2.Y) - return SurfaceGestureVectorDirection.DOWNLEFT; - else - return SurfaceGestureVectorDirection.UPLEFT; - } - } + // go right= + if (Math.Abs(p1.Y - p2.Y) < Math.Abs(p1.X - p2.X)) + return SurfaceGestureVectorDirection.LEFT; else { if (p1.Y < p2.Y) @@ -829,4 +261,4 @@ } #endregion } -} +} \ No newline at end of file
--- a/src/FingersDance.GestureControl/Resources/Patterns.xml Thu Nov 19 18:37:26 2009 +0100 +++ b/src/FingersDance.GestureControl/Resources/Patterns.xml Thu Nov 19 18:05:52 2009 +0100 @@ -1,37 +1,78 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <Patterns> + <Pattern> - <Name>UP</Name> + <Name>TRIGGER</Name> <Childs> <Child> - <Name>UP</Name> + <Name>RIGHT</Name> <Directions> - <Direction>Up</Direction> + <Direction>Right</Direction> + </Directions> + </Child> + <Child> + <Name>TAP</Name> + <Directions> + <Direction>TAP</Direction> </Directions> </Child> </Childs> </Pattern> + <Pattern> - <Name>LEFT</Name> + <Name>CONTRE POINTS</Name> <Childs> <Child> - <Name>Up</Name> + <Name>TAP</Name> <Directions> - <Direction>Up</Direction> + <Direction>TAP</Direction> </Directions> </Child> <Child> - <Name>Up</Name> + <Name>TAP</Name> <Directions> - <Direction>Up</Direction> + <Direction>TAP</Direction> </Directions> </Child> </Childs> </Pattern> + <Pattern> - <Name>RIGHT</Name> + <Name>CONTRE PESANTEUR</Name> + <Childs> + <Child> + <Name>UPRIGHT-DOWNRIGHT</Name> + <Directions> + <Direction>Upright</Direction> + <Direction>Downright</Direction> + </Directions> + </Child> + </Childs> + </Pattern> + + <Pattern> + <Name>AVEC PESANTEUR</Name> <Childs> <Child> + <Name>DOWNRIGHT-UPRIGHT</Name> + <Directions> + <Direction>Downright</Direction> + <Direction>Upright</Direction> + </Directions> + </Child> + </Childs> + </Pattern> + + <Pattern> + <Name>ALIGNEMENT</Name> + <Childs> + <Child> + <Name>RIGHT</Name> + <Directions> + <Direction>Right</Direction> + </Directions> + </Child> + <Child> <Name>RIGHT</Name> <Directions> <Direction>Right</Direction> @@ -39,8 +80,61 @@ </Child> </Childs> </Pattern> + <Pattern> - <Name>PAUSE</Name> + <Name>CONTACT VISUEL</Name> + <Childs> + <Child> + <Name>DOWNRIGHT-DOWNLEFT</Name> + <Directions> + <Direction>Downright</Direction> + <Direction>Downleft</Direction> + </Directions> + </Child> + <Child> + <Name>DOWNLEFT-DOWNRIGHT</Name> + <Directions> + <Direction>Downleft</Direction> + <Direction>Downright</Direction> + </Directions> + </Child> + </Childs> + </Pattern> + + <Pattern> + <Name>MOUVEMENT CONTRAINTE</Name> + <Childs> + <Child> + <Name>DOWNLEFT-DOWNRIGHT</Name> + <Directions> + <Direction>Downleft</Direction> + <Direction>Downright</Direction> + </Directions> + </Child> + <Child> + <Name>DOWNRIGHT-DOWNLEFT</Name> + <Directions> + <Direction>Downright</Direction> + <Direction>Downleft</Direction> + </Directions> + </Child> + </Childs> + </Pattern> + + <Pattern> + <Name>UN DANSEUR</Name> + <Childs> + <Child> + <Name>DOWN</Name> + <Directions> + <Direction>Down</Direction> + </Directions> + </Child> + </Childs> + </Pattern> + + <Pattern> + <Name>DEUX DANSEURS</Name> <Childs> <Child> <Name>DOWN</Name> @@ -56,42 +150,134 @@ </Child> </Childs> </Pattern> + <Pattern> - <Name>PAUSE</Name> + <Name>TROIS DANSEURS</Name> + <Childs> + <Child> + <Name>DOWN</Name> + <Directions> + <Direction>Down</Direction> + </Directions> + </Child> + <Child> + <Name>DOWN</Name> + <Directions> + <Direction>Down</Direction> + </Directions> + </Child> + <Child> + <Name>DOWN</Name> + <Directions> + <Direction>Down</Direction> + </Directions> + </Child> + </Childs> + </Pattern> + + <Pattern> + <Name>QUATRE DANSEURS</Name> + <Childs> + <Child> + <Name>DOWN</Name> + <Directions> + <Direction>Down</Direction> + </Directions> + </Child> + <Child> + <Name>DOWN</Name> + <Directions> + <Direction>Down</Direction> + </Directions> + </Child> + <Child> + <Name>DOWN</Name> + <Directions> + <Direction>Down</Direction> + </Directions> + </Child> + <Child> + <Name>DOWN</Name> + <Directions> + <Direction>Down</Direction> + </Directions> + </Child> + </Childs> + </Pattern> + + <Pattern> + <Name>TOUS LES DANSEURS</Name> + <Childs> + <Child> + <Name>DOWN</Name> + <Directions> + <Direction>Down</Direction> + </Directions> + </Child> + <Child> + <Name>DOWN</Name> + <Directions> + <Direction>Down</Direction> + </Directions> + </Child> + <Child> + <Name>DOWN</Name> + <Directions> + <Direction>Down</Direction> + </Directions> + </Child> + <Child> + <Name>DOWN</Name> + <Directions> + <Direction>Down</Direction> + </Directions> + </Child> + <Child> + <Name>DOWN</Name> + <Directions> + <Direction>Down</Direction> + </Directions> + </Child> + </Childs> + </Pattern> + + <Pattern> + <Name>CONTACT TABLE/DANSEUR</Name> <Childs> <Child> <Name>DOWNRIGHT</Name> <Directions> - <Direction>DownRight</Direction> + <Direction>Downright</Direction> </Directions> </Child> <Child> - <Name>DOWNRIGHT</Name> + <Name>DOWNLEFT</Name> <Directions> - <Direction>DownRight</Direction> + <Direction>Downleft</Direction> </Directions> </Child> </Childs> </Pattern> <Pattern> - <Name>PAUSE</Name> + <Name>CONTACT TABLE-DANSEUR</Name> <Childs> <Child> <Name>DOWNLEFT</Name> <Directions> - <Direction>DownLeft</Direction> + <Direction>Downleft</Direction> </Directions> </Child> <Child> - <Name>DOWNLEFT</Name> + <Name>DOWNRIGHT</Name> <Directions> - <Direction>DownLeft</Direction> + <Direction>Downright</Direction> </Directions> </Child> </Childs> </Pattern> + <Pattern> - <Name>PLAY</Name> + <Name>PLAY-PAUSE</Name> <Childs> <Child> <Name>TAP</Name> @@ -101,4 +287,5 @@ </Child> </Childs> </Pattern> + </Patterns> \ No newline at end of file
--- a/src/FingersDance/FingersDance.csproj Thu Nov 19 18:37:26 2009 +0100 +++ b/src/FingersDance/FingersDance.csproj Thu Nov 19 18:05:52 2009 +0100 @@ -143,9 +143,9 @@ <Content Include="Resources\oneflat.wmv"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> - <Content Include="Resources\videos.xml"> + <Resource Include="Resources\videos.xml"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> - </Content> + </Resource> <Resource Include="FingersDance.xml" /> </ItemGroup> <ItemGroup>