예제 #1
0
        //Starting the recording of new points, if current points are drawn, they will still
        //be added to the list of points sent as it sends the entire list of drawn points
        //StartRecordPoints is a bool for the recording of points from the Myo armband input
        protected void recordPoints(object sender, EventArgs e)
        {
            string functionName = "";

            //Record button has already been pushed
            if (startRecordPoints == true)
            {
                startRecordPoints = false;
                count            += 1;
                Console.WriteLine("Recording: " + count);
                if (batchFunctionName.Text != "Recorded points function name")
                {
                    functionName = batchFunctionName.Text;
                }

                CustomFunctions.saveRecordedPoints(currentDrawnPoints, functionName);
                currentDrawnPoints.Clear();
                clearScreen(sender, e);
            }
            else
            {
                currentDrawnPoints.Clear();
                removeDotsFromScreen();
                startRecordPoints = true;
            }
        }
예제 #2
0
        //Loads in the data points as the current drawn points to visualize what data set
        //is being recognized
        protected void loadDataPoints(object sender, EventArgs e)
        {
            List <List <PointD> > pointsToDraw = CustomFunctions.loadPoints();

            Cairo.Context ctx;
            if (pointsToDraw == null)
            {
                return;
            }

            if (pointsToDraw.Count == 0)
            {
                return;
            }

            foreach (List <PointD> li in pointsToDraw)
            {
                foreach (PointD pt in li)
                {
                    using (ctx = Gdk.CairoHelper.Create(dArea.GdkWindow)) {
                        int R2 = 0;
                        int G2 = 0;

                        if (isRed)
                        {
                            R2 = 255;
                            G2 = 0;
                        }
                        else
                        {
                            R2 = 0;
                            G2 = 255;
                        }
                        ctx.SetSourceRGBA(R2, G2, 0, A);
                        ctx.Arc(pt.X, pt.Y, 1, 0, 2 * Math.PI);
                        ctx.StrokePreserve();
                        ctx.Fill();
                        ((IDisposable)ctx.GetTarget()).Dispose();
                        ((IDisposable)ctx).Dispose();
                    }
                }
            }
        }
예제 #3
0
        protected void batchRecognize(object sender, EventArgs e)
        {
            string functionName = "";
            List <Tuple <string, List <PointD> > > loadedPoints    = CustomFunctions.loadBatchPoints();
            List <Tuple <string, double> >         batchResultList = new List <Tuple <string, double> > ();

            foreach (Tuple <string, List <PointD> > resultTuple in loadedPoints)
            {
                Tuple <string, double> batchResultTuple = recognizer.findMatchingTemplate(resultTuple.Item2);
                batchResultList.Add(batchResultTuple);
            }

            if (batchFunctionName.Text != "Recorded points function name")
            {
                functionName = batchFunctionName.Text;
            }

            CustomFunctions.writeBatchTestingResult(batchResultList, batchFunctionName.Text);
            sBar.Pop(1);
            sBar.Push(1, "Batch recognition done, result in gesture folder.");
        }
예제 #4
0
 //Wrapper for opening the load gesture dialog
 protected void openGesture(object sender, EventArgs e)
 {
     CustomFunctions.openLoadDialogue();
 }
예제 #5
0
 //Wrapper to open the save dialog
 protected void createGesture(object sender, EventArgs e)
 {
     CustomFunctions.openSaveDialogue(currentDrawnPoints);
 }