示例#1
0
        private List<VisitStatus> CreateVisitStatus()
        {
            List<VisitStatus> currentVisits = new List<VisitStatus>();

            if (currentSkeletons == null || currentSkeletons.Count == 0)
                return currentVisits;

            DateTime currentDateTime = DateTime.Now;
            foreach (WagSkeleton skeleton in currentSkeletons)
            {
                Vector movementDirection = new Vector();
                if (lastPositions.ContainsKey(skeleton.TrackingId))
                    movementDirection = ToolBox.GetMovementVector(lastPositions[skeleton.TrackingId], skeleton.HeadLocation);
                double movementDistance = movementDirection.Length;

                VisitStatus lastStatus = null;
                if (lastVisits != null)
                    lastStatus = lastVisits.FirstOrDefault(visit => visit.SkeletonId == skeleton.TrackingId);

                VisitStatus status = new VisitStatus()
                {
                    VisitId = lastStatus != null ? lastStatus.VisitId : ++visitCounter,
                    SkeletonId = skeleton.TrackingId,
                    FramesNotSeen = skeleton.FramesNotSeen,
                    VisitInit = lastStatus != null ? lastStatus.VisitInit : currentDateTime,
                    Zone = VisitorContr.DetectZone(skeleton),

                    IsControlling = controllerId == skeleton.TrackingId ? true : false,
                    WasControlling = lastControllerId == skeleton.TrackingId ? true : false,

                    HeadLocation = skeleton.HeadLocation,
                    HeadDirection = skeleton.HeadOrientation,

                    MovementDistance = movementDistance,
                    MovementDirection = movementDirection,

                    BodyAngle = skeleton.BodyOrientationAngle,

                    AttentionSimple = skeleton.AttentionSimple,
                    AttentionSocial = skeleton.AttentionSocial,

                    TouchInteraction = false,
                    GestureInteraction = false
                };
                currentVisits.Add(status);
            }

            return currentVisits;
        }
示例#2
0
        private Point CalculateVision(VisitStatus status)
        {
            LocationOrientationViewConverter converter = new LocationOrientationViewConverter();

            Point3D headLocation = status.HeadLocation;
            Vector3D headOrientation = status.HeadDirection;

            if (headOrientation.Length == 0)
                return new Point(-1, -1);

            int rowCount = STimSettings.ScreenGridRows;
            int colCount = STimSettings.ScreenGridColumns;

            Thickness convResult = (Thickness)converter.Convert(new object[] { headLocation, headOrientation, DisplayWidth, DisplayHeight, rowCount, colCount }, null, null, null);
            Point result = new Point() { X = convResult.Left / (DisplayWidth / colCount), Y = convResult.Top / (DisplayHeight / rowCount) };
            return result;
        }