Esempio n. 1
0
        public static TrackableHandTrackerSurrogate Convert(TrackablePocoTracker <IHand> tracker)
        {
            if (tracker == null)
            {
                return(null);
            }

            var surrogate = new TrackableHandTrackerSurrogate();

            foreach (var changeItem in tracker.ChangeMap)
            {
                switch (changeItem.Key.Name)
                {
                case "MainRing":
                    surrogate.MainRing = new EnvelopedObject <TrackableRing> {
                        Value = (TrackableRing)changeItem.Value.NewValue
                    };
                    break;

                case "SubRing":
                    surrogate.SubRing = new EnvelopedObject <TrackableRing> {
                        Value = (TrackableRing)changeItem.Value.NewValue
                    };
                    break;
                }
            }

            return(surrogate);
        }
Esempio n. 2
0
        public static TrackablePocoTracker <IHand> Convert(TrackableHandTrackerSurrogate surrogate)
        {
            if (surrogate == null)
            {
                return(null);
            }

            var tracker = new TrackablePocoTracker <IHand>();

            if (surrogate.MainRing != null)
            {
                tracker.ChangeMap.Add(TrackableHand.PropertyTable.MainRing, new TrackablePocoTracker <IHand> .Change {
                    NewValue = surrogate.MainRing.Value
                });
            }
            if (surrogate.SubRing != null)
            {
                tracker.ChangeMap.Add(TrackableHand.PropertyTable.SubRing, new TrackablePocoTracker <IHand> .Change {
                    NewValue = surrogate.SubRing.Value
                });
            }
            return(tracker);
        }