Describes a single relationship between two joints. The relationship has two joints and two parts; a beginning relationship and an ending relationship
 public GestureComponentState(GestureComponent component)
 {
     _component = component;
     Reset();
 }
Esempio n. 2
0
        public Gesture ParseGestureComponentsFromXml(XmlReader reader, Gesture gesture)
        {
            var              firstjoint  = reader.GetAttribute("FirstJoint");
            var              secondjoint = reader.GetAttribute("SecondJoint");
            JointType        firstjointtype;
            JointType        secondjointtype;
            GestureComponent component;

            if (firstjoint != null)
            {
                firstjointtype = (JointType)(Enum.Parse(typeof(JointType), firstjoint));
                Messages.Add("First Joint: " + firstjoint);
            }
            else
            {
                return(gesture);
            }

            if (secondjoint != null)
            {
                secondjointtype = (JointType)(Enum.Parse(typeof(JointType), secondjoint));
                Messages.Add("Second Joint: " + secondjoint);
            }
            else
            {
                return(gesture);
            }

            var beginningrelationship = reader.GetAttribute("BeginningRelationship");
            var endingrelationship    = reader.GetAttribute("EndingRelationship");


            var endingrelationshippos    = JointRelationship.None;
            var beginningrelationshippos = JointRelationship.None;


            if (endingrelationship != null)
            {
                endingrelationshippos = (JointRelationship)(Enum.Parse(typeof(JointRelationship), endingrelationship));
                Messages.Add("Ending Relationship: " + endingrelationship);
            }

            if (beginningrelationship != null)
            {
                beginningrelationshippos = (JointRelationship)(Enum.Parse(typeof(JointRelationship), beginningrelationship));
                Messages.Add("Beginning Relationship: " + beginningrelationship);
            }

            if (beginningrelationshippos != JointRelationship.None)
            {
                component = new GestureComponent(firstjointtype, secondjointtype, endingrelationshippos,
                                                 beginningrelationshippos);
            }
            else
            {
                component = new GestureComponent(firstjointtype, secondjointtype, endingrelationshippos);
            }

            gesture.Components.Add(component);
            Messages.Add("Component added to gesture:" + gesture.Description);

            return(gesture);
        }
Esempio n. 3
0
 public GestureComponentState(GestureComponent component)
 {
     _component = component;
     Reset();
 }
Esempio n. 4
0
        public Gesture ParseGestureComponentsFromXml(XmlReader reader, Gesture gesture)
        {
            var firstjoint = reader.GetAttribute("FirstJoint");
            var secondjoint = reader.GetAttribute("SecondJoint");
            JointType firstjointtype;
            JointType secondjointtype;
            GestureComponent component;

            if (firstjoint != null)
            {
                firstjointtype = (JointType)(Enum.Parse(typeof(JointType), firstjoint));
                Messages.Add("First Joint: " + firstjoint);
            }
            else
            {
                return gesture;
            }

            if (secondjoint != null)
            {
                secondjointtype = (JointType)(Enum.Parse(typeof(JointType), secondjoint));
                Messages.Add("Second Joint: " + secondjoint);
            }
            else
            {
                return gesture;
            }

            var beginningrelationship = reader.GetAttribute("BeginningRelationship");
            var endingrelationship = reader.GetAttribute("EndingRelationship");

            var endingrelationshippos = JointRelationship.None;
            var beginningrelationshippos = JointRelationship.None;

            if (endingrelationship != null)
            {
                endingrelationshippos = (JointRelationship)(Enum.Parse(typeof(JointRelationship), endingrelationship));
                Messages.Add("Ending Relationship: " + endingrelationship);
            }

            if (beginningrelationship != null)
            {
                beginningrelationshippos = (JointRelationship)(Enum.Parse(typeof(JointRelationship), beginningrelationship));
                Messages.Add("Beginning Relationship: " + beginningrelationship);
            }

            if (beginningrelationshippos != JointRelationship.None)
            {
                component = new GestureComponent(firstjointtype, secondjointtype, endingrelationshippos,
                                                     beginningrelationshippos);
            }
            else
            {
                component = new GestureComponent(firstjointtype, secondjointtype, endingrelationshippos);
            }

            gesture.Components.Add(component);
            Messages.Add("Component added to gesture:" + gesture.Description);

            return gesture;
        }