Now an annotation has a list of gesture string and not simple gesture string. These are saved into and loaded from the ldt xml file.
authorcavaliet
Tue, 24 Nov 2009 11:35:07 +0100
changeset 225 b60e13ed75c8
parent 224 874de6d84a2e
child 226 c0661ecf943e
Now an annotation has a list of gesture string and not simple gesture string. These are saved into and loaded from the ldt xml file.
src/FingersDance.Control.Screen/UserControlScreen.xaml.cs
src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs
src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs
src/FingersDance.Data/Annotation.cs
src/FingersDance.GestureControl/Resources/Patterns.xml
src/FingersDance.ViewModel/AnnotationViewModel.cs
src/FingersDance.Views/TimelineAnnotationView.xaml
src/FingersDance/MainSurfaceWindow.xaml
src/FingersDance/MainSurfaceWindow.xaml.cs
--- a/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs	Tue Nov 24 07:50:17 2009 +0100
+++ b/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs	Tue Nov 24 11:35:07 2009 +0100
@@ -173,13 +173,15 @@
                             String aId = annotNode.Attribute("id").Value;
                             float begin = (float)annotNode.Attribute("begin");
                             float dur = (float)annotNode.Attribute("dur");
-                            String gt = annotNode.Element("gestureType").Value;
+                            String[] gt = annotNode.Element("gestureType").Value.Split(new Char[] { ',' });
+                            List<String> gtList = new List<String>();
+                            gtList.AddRange(gt);
                             String colorString = annotNode.Attribute("color").Value; // is type 0xRRGGBB
                             Byte r = Convert.ToByte(colorString.Substring(2, 2), 16);
                             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);
-                            Annotation Annotation = new Annotation(aId, begin, dur, gt, c);
+                            Annotation Annotation = new Annotation(aId, begin, dur, gtList, c);
                             la.Add(Annotation);
                             Data.AddAnnotation(Annotation);
                         }
--- a/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs	Tue Nov 24 07:50:17 2009 +0100
+++ b/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs	Tue Nov 24 11:35:07 2009 +0100
@@ -183,8 +183,11 @@
                     // 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;
+                    // We build the list of string
+                    List<String> gestList = new List<String>();
                     foreach (Gesture elt in grea.Gestures)
-                        UCTimeLine.addAnnotation((float)grea.Start, dur, elt.Name);
+                        gestList.Add(elt.Name);
+                    UCTimeLine.addAnnotation((float)grea.Start, dur, gestList);
                 }
                 else
                 {
@@ -195,12 +198,13 @@
                         foreach (Annotation annot in cut.AnnotList)
                         {
                             foreach(Gesture gest in grea.Gestures)
-                                if (annot.GestureType == gest.Name)
-                                {
-                                    // One of the gesture is enough for the annotation to be added
-                                    searchedAnnot.Add(annot);
-                                    break;
-                                }
+                                foreach(String annotGest in annot.GestureType)
+                                    if (annotGest == gest.Name)
+                                    {
+                                        // One of the gesture is enough for the annotation to be added
+                                        searchedAnnot.Add(annot);
+                                        break;
+                                    }
                         }
                     }
                     // The list was built. If the number of found annotations is >0, we send the list to the timeline
@@ -218,11 +222,12 @@
             {
                 foreach (Annotation annot in cut.AnnotList)
                 {
-                    if (annot.GestureType == gestureName)
-                    {
-                        // One of the gesture is enough for the annotation to be added
-                        searchedAnnot.Add(annot);
-                    }
+                    foreach (String annotGest in annot.GestureType)
+                        if (annotGest == gestureName)
+                        {
+                            // One of the gesture is enough for the annotation to be added
+                            searchedAnnot.Add(annot);
+                        }
                 }
             }
             // The list was built. If the number of found annotations is >0, we send the list to the timeline
--- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs	Tue Nov 24 07:50:17 2009 +0100
+++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs	Tue Nov 24 11:35:07 2009 +0100
@@ -302,7 +302,7 @@
 
         }
 
-        public void addAnnotation(float start, float dur, String gestureType)
+        public void addAnnotation(float start, float dur, List<String> gestureType)
         {
             addAnnotation(new AnnotationViewModel(new Annotation("temp", start, dur, gestureType, CurrentColor), 0));
         }
@@ -327,7 +327,9 @@
                 // if not, we mark the beginning
                 if (annotOk == true)
                 {
-                    Annotation annotation = new Annotation("s_" + System.Guid.NewGuid(), AnnotTcBegin, 0, gestureType, CurrentColor);
+                    List<String> ls = new List<String>();
+                    ls.Add(gestureType);
+                    Annotation annotation = new Annotation("s_" + System.Guid.NewGuid(), AnnotTcBegin, 0, ls, CurrentColor);
                     cut.AnnotList.Add(annotation);
                     tv.DataContext = new CuttingViewModel(cut, AnnotWidth, tv.ScaleX);
                     AnnotWaiting = true;
@@ -353,7 +355,9 @@
                 if (annotOk == true)
                 {
                     cut.AnnotList.RemoveAt(cut.AnnotList.Count - 1);
-                    Annotation annotation = new Annotation("s_" + System.Guid.NewGuid(), AnnotTcBegin, currentDuration, gestureType, CurrentColor);
+                    List<String> ls = new List<String>();
+                    ls.Add(gestureType);
+                    Annotation annotation = new Annotation("s_" + System.Guid.NewGuid(), AnnotTcBegin, currentDuration, ls, CurrentColor);
                     cut.AnnotList.Add(annotation);
                     //Console.WriteLine("currentTimecode = " + AnnotTcBegin + ", curDur = " + currentDuration + ", nb = " + cut.AnnotList.Count + ", res = " + (AnnotTcBegin - (cut.AnnotList.Count * AnnotWidth)));
                     tv.DataContext = new CuttingViewModel(cut, AnnotWidth, tv.ScaleX);
--- a/src/FingersDance.Data/Annotation.cs	Tue Nov 24 07:50:17 2009 +0100
+++ b/src/FingersDance.Data/Annotation.cs	Tue Nov 24 11:35:07 2009 +0100
@@ -11,10 +11,10 @@
         private String _id;
         private float _tcBegin;
         private float _dur;
-        private String _gestureType;
+        private List<String> _gestureType;
         private Color _color;
 
-        public Annotation(String idPar, float tcBeginPar, float durPar, String gesturePar, Color colorPar)
+        public Annotation(String idPar, float tcBeginPar, float durPar, List<String> gesturePar, Color colorPar)
         {
             this._id = idPar;
             this._tcBegin = tcBeginPar;
@@ -53,12 +53,12 @@
                 _dur = value;
             }
         }
-        public String GestureType
+        public List<String> GestureType
         {
             get { return _gestureType; }
             set
             {
-                if (value == _gestureType || String.IsNullOrEmpty(value))
+                if (value == _gestureType)
                     return;
                 _gestureType = value;
             }
--- a/src/FingersDance.GestureControl/Resources/Patterns.xml	Tue Nov 24 07:50:17 2009 +0100
+++ b/src/FingersDance.GestureControl/Resources/Patterns.xml	Tue Nov 24 11:35:07 2009 +0100
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <Patterns>
   <Pattern>
-    <Name>UN DANSEUR</Name>
+    <Name>1 DANSEUR</Name>
     <Childs>
       <Child>
         <Name>DOWN</Name>
@@ -13,7 +13,7 @@
   </Pattern>
 
   <Pattern>
-    <Name>DEUX DANSEURS</Name>
+    <Name>2 DANSEURS</Name>
     <Childs>
       <Child>
         <Name>DOWN</Name>
@@ -31,7 +31,7 @@
   </Pattern>
 
   <Pattern>
-    <Name>TROIS DANSEURS</Name>
+    <Name>3 DANSEURS</Name>
     <Childs>
       <Child>
         <Name>DOWN</Name>
@@ -191,7 +191,7 @@
   </Pattern>
   
   <Pattern>
-    <Name>IMAGE AVANT</Name>
+    <Name>MVT IMAGE AVANT</Name>
     <Childs>
       <Child>
         <Name>TAP</Name>
@@ -209,7 +209,7 @@
   </Pattern>
   
   <Pattern>
-    <Name>IMAGE ARRIERE</Name>
+    <Name>MVT IMAGE ARRIERE</Name>
     <Childs>
       <Child>
         <Name>TAP</Name>
--- a/src/FingersDance.ViewModel/AnnotationViewModel.cs	Tue Nov 24 07:50:17 2009 +0100
+++ b/src/FingersDance.ViewModel/AnnotationViewModel.cs	Tue Nov 24 11:35:07 2009 +0100
@@ -63,12 +63,12 @@
                 base.OnPropertyChanged("Dur");
             }
         }
-        public String GestureType
+        public List<String> GestureType
         {
             get { return a.GestureType; }
             set
             {
-                if (value == a.GestureType || String.IsNullOrEmpty(value))
+                if (value == a.GestureType)
                     return;
                 a.GestureType = value;
                 base.OnPropertyChanged("GestureType");
--- a/src/FingersDance.Views/TimelineAnnotationView.xaml	Tue Nov 24 07:50:17 2009 +0100
+++ b/src/FingersDance.Views/TimelineAnnotationView.xaml	Tue Nov 24 11:35:07 2009 +0100
@@ -18,7 +18,8 @@
                                >
         <Grid>
             <Rectangle Fill="Black" HorizontalAlignment="Left" VerticalAlignment="Top" Width="{Binding Path=Dur}" Height="40" Opacity="0.0"/>
-            <TextBox HorizontalAlignment="Left" Text="{Binding Path=GestureType}" Width="40" Margin="0,20,0,0" Visibility="{Binding Path=Dur, Converter={StaticResource myVisibilityConverter}}">
+            <TextBox HorizontalAlignment="Left" Text="{Binding Path=GestureType[0]}" Width="40" Margin="0,20,0,0"
+                     Visibility="{Binding Path=Dur, Converter={StaticResource myVisibilityConverter}}" Background="Black" Foreground="White" BorderThickness="0">
                 <TextBox.RenderTransform>
                     <ScaleTransform ScaleX="{Binding Path=ScaleX}"/>
                 </TextBox.RenderTransform>
--- a/src/FingersDance/MainSurfaceWindow.xaml	Tue Nov 24 07:50:17 2009 +0100
+++ b/src/FingersDance/MainSurfaceWindow.xaml	Tue Nov 24 11:35:07 2009 +0100
@@ -6,14 +6,8 @@
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
     xmlns:FingersDance_Control_UserPanel="clr-namespace:FingersDance.Control.UserPanel;assembly=FingersDance.Control.UserPanel"
     xmlns:FingersDance_Control_Pivot="clr-namespace:FingersDance.Control.Pivot;assembly=FingersDance.Control.Pivot"
-    
-    
     xmlns:FingersDance_Control_SessionInput1="clr-namespace:FingersDance.Control.SessionInput;assembly=FingersDance.Control.SaisieSeance"
-    
-    
     xmlns:Microsoft_Surface_Presentation_Generic="clr-namespace:Microsoft.Surface.Presentation.Generic;assembly=Microsoft.Surface.Presentation.Generic"
-    
-    
     x:Class="FingersDance.SurfaceWindow1"
     Title="FingersDance"
     Width="1024" Height="768" x:Name="mainSurfaceWindow" 
--- a/src/FingersDance/MainSurfaceWindow.xaml.cs	Tue Nov 24 07:50:17 2009 +0100
+++ b/src/FingersDance/MainSurfaceWindow.xaml.cs	Tue Nov 24 11:35:07 2009 +0100
@@ -58,7 +58,7 @@
             AddActivationHandlers();
             // Add credit text
             CreditsText1.Text = CreditsText2.Text = CreditsText3.Text = CreditsText4.Text =
-                "MICROSOFT :\nPierre-Louis Xech\n\nEFREI :\nSantiago Aria\nRiley Ikni\nJonathan Pamphile\nAmine Tarari\n\nSTRATE COLLEGE :\nAnnabelle Eugénia\nHuieun Kim\nBaptiste Lanne\nIoana Ocnarescu\nVanessa Reiser\nDominique Sciamma\n\nINSTITUT DE RECHERCHE ET D'INNOVATION\nThibaut Cavalié\nYves-Marie Haussonne\nVincent Puig";
+                "MICROSOFT :\nPierre-Louis Xech\n\nEFREI :\nSantiago Arias\nRiley Ikni\nJonathan Pamphile\n\nSTRATE COLLEGE :\nAnnabelle Eugénia\nHuieun Kim\nBaptiste Lanne\nIoana Ocnarescu\nVanessa Reiser\nDominique Sciamma\n\nINSTITUT DE RECHERCHE ET D'INNOVATION\nThibaut Cavalié\nYves-Marie Haussonne\nVincent Puig";
         }
         #endregion
 
@@ -642,11 +642,11 @@
                                                          new XAttribute("date", DateTime.Now.Day.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Year.ToString()),
                                                          new XAttribute("color", "0x" + annot.Color.ToString().Substring(3)), // Color.ToString() return #AARRGGBB and we keep only 0xRRGGBB
                                                          new XAttribute("src", ""),
-                                                         new XElement("title", annot.GestureType),
+                                                         new XElement("title", String.Join(",", annot.GestureType.ToArray())),
                                                          new XElement("abstract"),
                                                          new XElement("audio"),
                                                          new XElement("tags"),
-                                                         new XElement("gestureType", annot.GestureType)));
+                                                         new XElement("gestureType", String.Join(",", annot.GestureType.ToArray()))));
                 }
                 annotContent.Add(cutNode);
             }