Commit 6df06c71 authored by Alexander Krause's avatar Alexander Krause

fixes for static fields

parent e0739219
......@@ -18,8 +18,7 @@ namespace ExplorVizGestureControl.Gestures
public class ContinuousGestureDetector
{
#region Variables
private CoordinateMapper coordinateMapper = null;
private GestureDatabase gestureDatabase = null;
private CoordinateMapper coordinateMapper = null;
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
private static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
......@@ -68,14 +67,14 @@ namespace ExplorVizGestureControl.Gestures
#endregion
public void DetectContinousGestures(GestureDatabase database)
public void DetectContinousGestures()
{
if (delayTimer.busy) return;
gestureDatabase = database;
handRight = gestureDatabase.handRight;
handLeft = gestureDatabase.handLeft;
phiz = gestureDatabase.phiz;
handRight = GestureDatabase.handRight;
handLeft = GestureDatabase.handLeft;
phiz = GestureDatabase.phiz;
// Detect and handle continuous gestures
......@@ -108,11 +107,11 @@ namespace ExplorVizGestureControl.Gestures
{
if (gripActive) return;
if (gestureDatabase.BothHandsParallel(2) &&
gestureDatabase.BothHandsAboveSpineBase() &&
gestureDatabase.RightHandBelowRightShoulder() &&
gestureDatabase.LeftHandBelowLeftShoulder() &&
gestureDatabase.BothHandsOpen())
if (GestureDatabase.BothHandsParallel(2) &&
GestureDatabase.BothHandsAboveSpineBase() &&
GestureDatabase.RightHandBelowRightShoulder() &&
GestureDatabase.LeftHandBelowLeftShoulder() &&
GestureDatabase.BothHandsOpen())
{
if (!rotationActive)
{
......@@ -161,8 +160,8 @@ namespace ExplorVizGestureControl.Gestures
{
if (gripActive) return;
int scrollValue = 0;
double distance = gestureDatabase.spineBase.Z - gestureDatabase.oldSpineBase.Z;
int scrollValue = 0;
double distance = GestureDatabase.spineBase.Z - GestureDatabase.oldSpineBase.Z;
//if (distance > dynamicValues["scrollForwardFactor"] ||
// distance < dynamicValues["scrollBackwardFactor"])
......@@ -182,7 +181,7 @@ namespace ExplorVizGestureControl.Gestures
private void HandleGripAndSelection()
{
if (gestureDatabase.DragObject())
if (GestureDatabase.DragObject())
{
if (!gripActive)
{
......
......@@ -40,9 +40,9 @@ namespace ExplorVizGestureControl.Gestures
#endregion
#region Gesture recognition
public void gestureRecognition(GestureDatabase gestureDatabase)
public void gestureRecognition()
{
foreach (KeyValuePair<string, Func<bool>> entry in gestureDatabase.GestureDictionary)
foreach (KeyValuePair<string, Func<bool>> entry in GestureDatabase.GestureDictionary)
{
if (entry.Value.Invoke() && !this.timerForNextGesture.busy)
......
......@@ -30,8 +30,7 @@ namespace ExplorVizGestureControl
private Body[] bodies;
private BodyFrameReader bodyReader;
private ContinuousGestureDetector continuousGestureDetector;
private GestureDatabase gestureDatabase;
private ContinuousGestureDetector continuousGestureDetector;
private DiscreteGestureDetector discreteGestureDetector;
private KinectJointFilter filter = new KinectJointFilter();
......@@ -69,8 +68,7 @@ namespace ExplorVizGestureControl
FrameworkElement xamlElement = new FrameworkElement();
xamlElement.Style = (Style)this.FindResource("Stream");
continuousGestureDetector = new ContinuousGestureDetector();
gestureDatabase = new GestureDatabase();
continuousGestureDetector = new ContinuousGestureDetector();
discreteGestureDetector = new DiscreteGestureDetector(continuousGestureDetector);
filter.Init();
......@@ -124,16 +122,16 @@ namespace ExplorVizGestureControl
filter.UpdateFilter(body);
CameraSpacePoint[] filteredJoints = filter.GetFilteredJoints();
Vector3D[] accumulatedJoints = jointAccumulator.accumulateJoints(filteredJoints);
gestureDatabase.refreshJoints(filteredJoints, accumulatedJoints, body.HandRightState, body.HandLeftState);
discreteGestureDetector.gestureRecognition(gestureDatabase);
GestureDatabase.refreshJoints(filteredJoints, accumulatedJoints, body.HandRightState, body.HandLeftState);
discreteGestureDetector.gestureRecognition();
if (drawBody)
{
bodyStream.DrawBodies(gestureDatabase);
bodyStream.DrawBodies();
cleanBitmap = false;
}
if (discreteGestureDetector.detectContinousGestures)
continuousGestureDetector.DetectContinousGestures(gestureDatabase);
continuousGestureDetector.DetectContinousGestures();
}
}
if ((!AnyBodyTracked() && !cleanBitmap) || !drawBody)
......
......@@ -35,7 +35,6 @@ namespace ExplorVizGestureControl.StreamsAndDrawing
private int displayWidth = 480;
private int displayHeight = 270;
private List<Pen> bodyColors;
private GestureDatabase database;
#endregion
#region Constructor
......@@ -105,10 +104,9 @@ namespace ExplorVizGestureControl.StreamsAndDrawing
}
public void DrawBodies(GestureDatabase gestureDatabase)
public void DrawBodies()
{
database = gestureDatabase;
CameraSpacePoint[] filteredJoints = database.filteredJoints;
CameraSpacePoint[] filteredJoints = GestureDatabase.filteredJoints;
using (DrawingContext dc = this.drawingGroup.Open())
{
......@@ -162,28 +160,28 @@ namespace ExplorVizGestureControl.StreamsAndDrawing
ColorSpacePoint phizColorSpacePoint = new ColorSpacePoint();
CameraSpacePoint phizCameraSpacePoint = new CameraSpacePoint();
List<Point> phizLines = new List<Point>();
phizCameraSpacePoint.X = (float)database.phiz.topRightCorner.X;
phizCameraSpacePoint.Y = (float)database.phiz.topRightCorner.Y;
phizCameraSpacePoint.Z = (float)database.phiz.z;
phizCameraSpacePoint.X = (float)GestureDatabase.phiz.topRightCorner.X;
phizCameraSpacePoint.Y = (float)GestureDatabase.phiz.topRightCorner.Y;
phizCameraSpacePoint.Z = (float)GestureDatabase.phiz.z;
phizColorSpacePoint = coordinateMapper.MapCameraPointToColorSpace(phizCameraSpacePoint);
phizLines.Add(new Point(phizColorSpacePoint.X / 4, phizColorSpacePoint.Y / 4));
phizCameraSpacePoint.X = (float)database.phiz.botRightCorner.X;
phizCameraSpacePoint.Y = (float)database.phiz.botRightCorner.Y;
phizCameraSpacePoint.Z = (float)database.phiz.z;
phizCameraSpacePoint.X = (float)GestureDatabase.phiz.botRightCorner.X;
phizCameraSpacePoint.Y = (float)GestureDatabase.phiz.botRightCorner.Y;
phizCameraSpacePoint.Z = (float)GestureDatabase.phiz.z;
phizColorSpacePoint = coordinateMapper.MapCameraPointToColorSpace(phizCameraSpacePoint);
phizLines.Add(new Point(phizColorSpacePoint.X / 4, phizColorSpacePoint.Y / 4));
phizCameraSpacePoint.X = (float)database.phiz.topLeftCorner.X;
phizCameraSpacePoint.Y = (float)database.phiz.topLeftCorner.Y;
phizCameraSpacePoint.Z = (float)database.phiz.z;
phizCameraSpacePoint.X = (float)GestureDatabase.phiz.topLeftCorner.X;
phizCameraSpacePoint.Y = (float)GestureDatabase.phiz.topLeftCorner.Y;
phizCameraSpacePoint.Z = (float)GestureDatabase.phiz.z;
phizColorSpacePoint = coordinateMapper.MapCameraPointToColorSpace(phizCameraSpacePoint);
phizLines.Add(new Point(phizColorSpacePoint.X / 4, phizColorSpacePoint.Y / 4));
phizCameraSpacePoint.X = (float)database.phiz.botLeftCorner.X;
phizCameraSpacePoint.Y = (float)database.phiz.botLeftCorner.Y;
phizCameraSpacePoint.Z = (float)database.phiz.z;
phizCameraSpacePoint.X = (float)GestureDatabase.phiz.botLeftCorner.X;
phizCameraSpacePoint.Y = (float)GestureDatabase.phiz.botLeftCorner.Y;
phizCameraSpacePoint.Z = (float)GestureDatabase.phiz.z;
phizColorSpacePoint = coordinateMapper.MapCameraPointToColorSpace(phizCameraSpacePoint);
phizLines.Add(new Point(phizColorSpacePoint.X / 4, phizColorSpacePoint.Y / 4));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment