瀏覽代碼

removes set functions

Alexander Hendrich 10 年之前
父節點
當前提交
45280de4f1

+ 0 - 1
bbiwarg/InputHandler.cs

@@ -64,7 +64,6 @@ namespace bbiwarg
             touchTracker.TouchMove += touchEventVisualizer.touchMove;
             touchTracker.TouchUp += touchEventVisualizer.touchUp;
 
-
             if (Parameters.TuioEnabled)
             {
                 tuioCommunicator = new TuioCommunicator(Parameters.TuioIP.ToString(), Parameters.TuioPort);

+ 2 - 12
bbiwarg/Recognition/FingerRecognition/Finger.cs

@@ -22,8 +22,8 @@ namespace bbiwarg.Recognition.FingerRecognition
         public Vector2D Direction { get { return SliceTrail.FittedDirection; } }
         public LineSegment2D LineSegment { get { return SliceTrail.LineSegment; } }
         public FingerSliceTrail SliceTrail { get; private set; }
-        public Hand Hand { get; private set; }
-        public TouchEvent TouchEvent { get; private set; }
+        public Hand Hand { get; set; }
+        public TouchEvent TouchEvent { get; set; }
 
         public Finger(FingerSliceTrail sliceTrail)
             : base()
@@ -35,16 +35,6 @@ namespace bbiwarg.Recognition.FingerRecognition
             SliceTrail.reverse();
         }
 
-        public void setHand(Hand hand)
-        {
-            Hand = hand;
-        }
-
-        public void setTouchEvent(TouchEvent touchEvent)
-        {
-            TouchEvent = touchEvent;
-        }
-
         public Contour<Point> getContour(float margin) {
             return SliceTrail.getContour(margin);
         }

+ 5 - 10
bbiwarg/Recognition/HandRecognition/Hand.cs

@@ -27,8 +27,8 @@ namespace bbiwarg.Recognition.HandRecognition
         public Image<Gray, byte> Mask { get; private set; }
         public List<Finger> Fingers { get; private set; }
         public ConvexityDefect ThumbDefect { get; private set; }
-        public Palm Palm { get; private set; }
         public HandSide Side { get; private set; }
+        public Palm Palm { get; set; }
 
         public Hand(Image<Gray, byte> mask, Finger finger)
         {
@@ -47,16 +47,16 @@ namespace bbiwarg.Recognition.HandRecognition
         public void addFinger(Finger finger)
         {
             Fingers.Add(finger);
+            finger.Hand = this;
         }
 
         public void mergeWith(Hand mergeHand)
         {
             extendMask(mergeHand.Mask);
             Fingers.AddRange(mergeHand.Fingers);
-            foreach (Finger finger in Fingers)
-            {
-                finger.setHand(this);
-            }
+            foreach (Finger finger in mergeHand.Fingers)
+                finger.Hand = this;
+            
             findCentroids();
         }
 
@@ -101,11 +101,6 @@ namespace bbiwarg.Recognition.HandRecognition
             determineHandSide();
         }
 
-        public void setPalm(Palm palm)
-        {
-            Palm = palm;
-        }
-
         private bool isThumbOnly()
         {
             return (Fingers.Count == 1);

+ 0 - 2
bbiwarg/Recognition/HandRecognition/HandDetector.cs

@@ -64,7 +64,6 @@ namespace bbiwarg.Recognition.HandRecognition
                     if (hand.isInside(finger.HandPoint))
                     {
                         hand.addFinger(finger);
-                        finger.setHand(hand);
                         newHand = false;
                         break;
                     }
@@ -78,7 +77,6 @@ namespace bbiwarg.Recognition.HandRecognition
                     {
                         Hand hand = new Hand(handMask, finger);
                         Hands.Add(hand);
-                        finger.setHand(hand);
                     }
                 }
             }

+ 2 - 0
bbiwarg/Recognition/PalmRecognition/Palm.cs

@@ -27,6 +27,8 @@ namespace bbiwarg.Recognition.PalmRecognition
             FingersUpper = fingersUpper;
             FingersLower = fingersLower;
 
+            Hand.Palm = this;
+
             if (Hand.Side == HandSide.Left)
                 Quad = new Quadrangle(WristUpper, FingersUpper, FingersLower, WristLower);
             else

+ 0 - 1
bbiwarg/Recognition/PalmRecognition/PalmDetector.cs

@@ -83,7 +83,6 @@ namespace bbiwarg.Recognition.PalmRecognition
 
                 Palm palm = new Palm(palmHand, wristUpper, wristLower, fingersLower, fingersUpper);
                 Palms.Add(palm);
-                palmHand.setPalm(palm);
 
             }
         }

+ 0 - 1
bbiwarg/Recognition/TouchRecognition/TouchDetector.cs

@@ -55,7 +55,6 @@ namespace bbiwarg.Recognition.TouchRecognition
                         {
                             TouchEvent touchEvent = new TouchEvent(tipPointOutside, touchMask, finger, palm);
                             TouchEvents.Add(touchEvent);
-                            finger.setTouchEvent(touchEvent);
                         }
                     }
                 }

+ 2 - 0
bbiwarg/Recognition/TouchRecognition/TouchEvent.cs

@@ -28,6 +28,8 @@ namespace bbiwarg.Recognition.TouchRecognition
             TouchMask = touchMask;
             Finger = finger;
             Palm = palm;
+
+            finger.TouchEvent = this;
         }
 
         public float getTouchValue()