예제 #1
0
        private async Task ReadExcelSheet(SpreadsheetDocument doc, string workSheetId)
        {
            var workpart  = (doc.WorkbookPart.GetPartById(workSheetId) as WorksheetPart);
            var worksheet = workpart.Worksheet;

            if (workpart == null)
            {
                return;
            }

            var rows = worksheet.GetFirstChild <SheetData>().Descendants <Row>().Skip(5);

            //TODO: verificar se é pos ou extensão
            string courseColPos = string.Empty, courseName = string.Empty;

            var cellsTitle = worksheet.GetFirstChild <SheetData>()
                             .Descendants <Row>().ElementAt(2)
                             .Descendants <Cell>();

            courseName = FindCourseName(doc, cellsTitle);

            var dataPos = new DataPosition();
            var header  = rows.First().Descendants <Cell>();

            //Map data on sheet
            MapDataPosix(doc, dataPos, header);

            //Loop for all lines, each line a document will be created
            await ProcessData(doc, rows, courseName, dataPos);
        }
예제 #2
0
        public ExerciceEvaluation(ExerciceGeneric gen)
        {
            initdetextstop = new DataPosition(0, 0);

            this.TypeExercice = ExerciceTypes.Evaluation;
            this.BaseConfig   = gen.BaseConfig;
            this.BorneConfig  = gen.BorneConfig;
        }
예제 #3
0
        public ExerciceEvaluation(ExerciceBaseConfig baseConf, ExerciceBorneConfig borneConf, ThemeEvaluationModel theme)
            : base(baseConf, borneConf)
        {
            initdetextstop = new DataPosition(0, 0);

            ThemeEnfant       = theme;
            this.TypeExercice = ExerciceTypes.Evaluation;
        }
예제 #4
0
 private void MapDataPosix(SpreadsheetDocument doc, DataPosition dataPos, IEnumerable <Cell> header)
 {
     for (int i = 0; i < header.Count(); i++)
     {
         Cell celHeader = header.ElementAt(i);
         var  cellValue = doc.GetCellValue(celHeader);
         dataPos.GetDataPositions(cellValue, celHeader.CellReference.Value);
     }
 }
예제 #5
0
        private void Calculs(List <ExerciceEvaluation> exoEvalList, List <DataPosition> tempDataFilted, ref SingletonReeducation ValeurReeducation)
        {
            //Calculs
            tabVitMoy[cycleInfo]     = Ax_Vitesse.VitesseMoy(tempDataFilted, ref VitMax, 0.008); // Calc de la vitesse moyenne
            tabVitMax[cycleInfo]     = VitMax;
            tabJerkM[cycleInfo]      = Ax_Vitesse.JerkMet(tempDataFilted, VitMax, 0.008);        // Calc du Jerk
            tabResultDist[cycleInfo] = Ax_Position.Distance(tempDataFilted);                     // Calc de la distance réelle
            tabDoub[0] = tabResultDist[cycleInfo];

            double ampStrain = 0.0;
            double coordYMax = 0.0;

            if (exoEvalList[0].TypeEval == ExerciceEvalTypes.Mouvement)
            {
                ExerciceMouvement ef1 = (ExerciceMouvement)exoEvalList[0];
                if (ef1.TypeDroite == DroiteType.VerticalLong)                              //FreeAmplitude
                {
                    ampStrain = FreeAmplitude.CalAmpliFree(tempDataFilted, ref coordYMax);  // special aller/retour :p
                    tabCoordYMax[cycleInfo] = coordYMax;
                    tabStra[cycleInfo]      = Ax_Position.Straightness(ampStrain, tabDoub); // Calc de la Straightness
                }
                else if (ef1.TypeDroite == DroiteType.Vertical)
                {
                    ampStrain           = Target.CalAmpli(tempDataFilted);              // Calc de l'amplitude
                    tabStra[cycleInfo]  = Ax_Position.Straightness(ampStrain, tabDoub); // Calc de la Straightness
                    tabPresi[cycleInfo] = Target.PresciTarget(tempDataFilted);          // calc precision target droite
                }
            }
            else if (exoEvalList[0].TypeEval == ExerciceEvalTypes.Forme)
            {
                ExerciceForme ef = (ExerciceForme)exoEvalList[0];
                if (ef.TypeForme == FormeType.Cercle)
                {
                    DataPosition centre = new DataPosition(XCENTRE, YCENTRE); // 37.0 46.0
                    double       Rayon  = 4.0;
                    tabPresi[cycleInfo] = Circle.PreciCercle(tempDataFilted, centre, Rayon);
                }
                else
                {
                    DataPosition centre = new DataPosition(XCENTRE, YCENTRE);
                    double       longCot = 6.0, Orientation = 0.0;
                    tabPresi[cycleInfo] = Square.PreciCarre(tempDataFilted, centre, longCot, Orientation);
                }
            }

            tabSpeedMet[cycleInfo] = tabVitMoy[cycleInfo] / tabVitMax[cycleInfo];               // Calc de la Speed Metrique
            cycleInfo++;
        }
예제 #6
0
        public static double JerkMet(List <DataPosition> data, double peakV, double temps)
        {
            if (peakV != 0.0)
            {
                double[,] tabVit;
                List <DataPosition> dataVit = new List <DataPosition>();
                double[,] tabAcc;
                List <DataPosition> dataAcc = new List <DataPosition>();
                double[,] tabJerk;
                double SommeJerk = 0;


                tabVit = SommeTemps(data, temps);

                int nbrs_position = (tabVit.Length / 2);
                for (int i = 0; i < nbrs_position; i++)
                {
                    DataPosition dp = new DataPosition(tabVit[0, i], tabVit[1, i]);
                    dataVit.Add(dp);
                }
                tabAcc = SommeTemps(dataVit, temps);

                nbrs_position = (tabAcc.Length / 2);
                for (int i = 0; i < nbrs_position; i++)
                {
                    DataPosition dp = new DataPosition(tabAcc[0, i], tabAcc[1, i]);
                    dataAcc.Add(dp);
                }
                tabJerk = SommeTemps(dataAcc, temps);



                nbrs_position = (tabJerk.Length / 2);
                for (int i = 0; i < nbrs_position; i++)
                {
                    SommeJerk += Math.Sqrt(Math.Pow(Math.Abs(tabJerk[0, i]), 2) + Math.Pow(Math.Abs(tabJerk[1, i]), 2));
                }
                SommeJerk /= nbrs_position;

                return(SommeJerk / (peakV));     // vitesse peak
            }
            else
            {
                return(0.0);
            }
        }
예제 #7
0
        public ExerciceEvaluation(int cycleTot, double vitMoy, double[] tabVitMoy, double vitMax, double[] tabVitMax, double speedMet, double[] tabSpeedMet, double jerkMet, double[] tabJekMet)
        {
            initdetextstop = new DataPosition(0, 0);


            VitesseMoy    = vitMoy;
            EcartTypeVMoy = EcartType(tabVitMoy, cycleTot);
            VitesseMax    = vitMax;
            EcartTypeVMax = EcartType(tabVitMax, cycleTot);
            SpeedMetric   = speedMet;
            EcartTypeSM   = EcartType(tabSpeedMet, cycleTot);
            JerkMetric    = jerkMet;
            EcartTypeJM   = EcartType(tabJekMet, cycleTot);

            CVVitesseMoy  = returnCV(VitesseMoy, EcartTypeVMoy);
            CVVitesseMax  = returnCV(VitesseMax, EcartTypeVMax);
            CVSpeedMetric = returnCV(SpeedMetric, EcartTypeSM);
            CVJerkMetric  = returnCV(JerkMetric, EcartTypeJM);
        }
예제 #8
0
        public static double CalAmpli(List <DataPosition> posi)
        {
            // TODO : Distance aussi en X !!!
            DataPosition depart = new DataPosition(posi.First().X, posi.First().Y);
            DataPosition best   = new DataPosition(posi.First().X, posi.First().Y);

            foreach (var dp in posi)
            {
                if (dp.Y < best.Y)
                {
                    best.Y = dp.Y;
                    best.X = dp.X;
                }

                //if (dp.X < best.X)
                //{
                //    best.X = dp.X;
                //}
            }
            return(DistancePythagorean(depart.X, depart.Y, best.X, best.Y));
        }
예제 #9
0
        public static double PresciTarget(List <DataPosition> posi)
        {
            // TODO : Distance aussi en X !!!
            double       distance = 0.0;
            DataPosition dt       = new DataPosition(posi.First().X, posi.First().Y);

            foreach (var el in posi)
            {
                if (el.Y < dt.Y)
                {
                    dt.Y = el.Y;
                }

                if (el.X < dt.X)
                {
                    dt.X = el.X;    // TODO : A CHANGER !
                }
            }
            distance = (DistancePythagorean(dt.X, dt.Y, 42.6, 44.2));
            return(distance);
        }
예제 #10
0
        ExtractFrontDocumentData(SpreadsheetDocument doc, IEnumerable <Cell> cells,
                                 string courseName, uint rowIndex, DataPosition data)
        {
            return(await Task.Factory.StartNew(() =>
            {
                var documentFront = new DataAccess.Storage.Models.Document();

                documentFront.StudentName = doc.GetCellValue(cells.FindCell(data.NameCol, rowIndex))?.Trim();
                documentFront.StudentDocument = doc.GetCellValue(cells.FindCell(data.DocumentCol, rowIndex))?.Trim();

                documentFront.Course = courseName;

                //Find by previus header founded
                documentFront.StartDate = doc.GetCellValue(cells.FindCell(data.StartDateCol, rowIndex))?.ParseDate();
                documentFront.EndDate = doc.GetCellValue(cells.FindCell(data.EndDateCol, rowIndex))?.ParseDate();
                documentFront.WorkLoad = doc.GetCellValue(cells.FindCell(data.WorkLoadCol, rowIndex));
                //TODO: criar enum para status
                documentFront.Status = "Aguardando processamento";
                //TODO: colocar data por extenso
                documentFront.DateOfIssue = DateTime.Now.ToString("dd/MM/yyyy") + ".";
                return documentFront;
            }));
        }
예제 #11
0
        public static double CalAmpliFree(List <DataPosition> posi, ref double coordYMax)
        {
            DataPosition Bas = new DataPosition(posi.First().X, posi.First().Y);
            //DataPosition Haut = new DataPosition(posi.First().X, posi.First().Y);
            double distanceTot = 0.0;

            foreach (var dp in posi)
            {
                //if (dp.Y > Haut.Y)
                //{
                //    Haut = dp;
                //}
                if (dp.Y < Bas.Y)
                {
                    Bas = dp;
                }
            }

            coordYMax    = posi.First().Y - Bas.Y;
            distanceTot  = DistancePythagorean(posi.First().X, posi.First().Y, Bas.X, Bas.Y);
            distanceTot += DistancePythagorean(Bas.X, Bas.Y, posi.Last().X, posi.Last().Y);
            return(distanceTot);
        }
예제 #12
0
        public static double PreciCercle(List <DataPosition> Posi, DataPosition CentreCercle, double RayonCercle)
        {
            double Preci = 0.0;
            List <DataPosition> PosiProj  = new List <DataPosition>();
            List <double>       ListeDist = new List <double>();

            for (int dp = 0; dp < Posi.Count; dp++)
            {
                double vccpc_X = Posi[dp].X - CentreCercle.X;
                double vccpc_Y = Posi[dp].Y - CentreCercle.Y;

                double alpha = RayonCercle / Math.Sqrt(Math.Pow(vccpc_X, 2) + Math.Pow(vccpc_Y, 2));

                PosiProj.Add(new DataPosition(CentreCercle.X + alpha * vccpc_X, CentreCercle.Y + alpha * vccpc_Y));

                ListeDist.Add(Math.Sqrt(Math.Pow((PosiProj[dp].X - Posi[dp].X), 2) + Math.Pow((PosiProj[dp].Y - Posi[dp].Y), 2)));
            }

            //m < Compteur (qui ici est 1)
            //for (int m = 0; m < 1; m++)
            //{
            //    double distance_moyenne_cycle = 0.0;
            //    int PointDep = 1;
            //    distance_moyenne_cycle = distance_moyenne_cycle + ListeDist[PointDep - 1];
            //    Preci += distance_moyenne_cycle;
            //}
            for (int m = 0; m < ListeDist.Count; m++)
            {
                //double distance_moyenne_cycle = 0.0;
                //int PointDep = 1;
                Preci += ListeDist[m];
                //Preci += distance_moyenne_cycle;
            }

            return(Preci / ListeDist.Count);
        }
예제 #13
0
        private async Task ProcessData(SpreadsheetDocument doc, IEnumerable <Row> rows, string courseName, DataPosition dataPos)
        {
            foreach (Row row in rows.Skip(1))
            {
                var cells    = row.Descendants <Cell>();
                var document = await ExtractFrontDocumentData(doc, cells, courseName,
                                                              row.RowIndex.Value, dataPos);

                if (string.IsNullOrWhiteSpace(document.StudentName))
                {
                    continue;
                }
                log.Info($"Send data to queue: {document.StudentName}");

                await documentService.Insert(document);

                onRowRead(document);
            }
        }
예제 #14
0
        public static double PreciCarre(List <DataPosition> Posi, DataPosition CentreCarre, double LongCotCarre, double OrientCarre)
        {
            double Preci = 0.0;
            List <DataPosition> PosiProj = new List <DataPosition>();
            List <DataPosition> RefShape = new List <DataPosition>();
            List <double>       ListeDist = new List <double>();
            double posiProjTempX, posiProjTempY;


            double Ns = 5;

            for (int ind = 0; ind < Ns; ind++)
            {
                RefShape.Add(new DataPosition(CentreCarre.X + (LongCotCarre / 2.0) * (Math.Sin(OrientCarre + ind * Math.PI / 2.0) + Math.Cos(OrientCarre + ind * Math.PI / 2.0)), CentreCarre.Y + (LongCotCarre / 2.0) * (Math.Cos(OrientCarre + ind * Math.PI / 2.0) - Math.Sin(OrientCarre + ind * Math.PI / 2.0))));
            }

            for (int dp = 0; dp < Posi.Count; dp++)
            {
                ListeDist.Add(100.0);            // Initialisation

                for (int j = 0; j < Ns - 1; j++) // parcours de tous les segments de la trajectoire de référence
                {
                    // Calcul du point projeté
                    double vsipc_X = Posi[dp].X - RefShape[j].X;
                    double vsipc_Y = Posi[dp].Y - RefShape[j].Y;

                    double vsisf_X = RefShape[j + 1].X - RefShape[j].X;
                    double vsisf_Y = RefShape[j + 1].Y - RefShape[j].Y;

                    double alpha = (vsipc_X * vsisf_X + vsipc_Y * vsisf_Y) / Math.Sqrt(Math.Pow(vsisf_X, 2.0) + Math.Pow(vsisf_Y, 2.0));

                    if (alpha <= 0.0)
                    {
                        posiProjTempX = RefShape[j].X;
                        posiProjTempY = RefShape[j].Y;
                    }
                    else
                    {
                        if (alpha >= 1.0)
                        {
                            posiProjTempX = RefShape[j + 1].X;
                            posiProjTempY = RefShape[j + 1].Y;
                        }
                        else
                        {
                            posiProjTempX = RefShape[j].X + alpha * vsipc_X;
                            posiProjTempY = RefShape[j].Y + alpha * vsipc_Y;
                        }
                    }
                    double DistTemp = Math.Sqrt(Math.Pow((posiProjTempX - Posi[dp].X), 2.0) + Math.Pow((posiProjTempY - Posi[dp].Y), 2.0));
                    if (DistTemp < ListeDist[dp])   // Mise à jour du point projeté le plus proche de la distance correspondante
                    {
                        ListeDist[dp] = DistTemp;
                        PosiProj.Add(new DataPosition(posiProjTempX, posiProjTempY));
                    }
                }
            }

            //m < Compteur (qui ici est 1)
            //for (int m = 0; m < 1; m++)
            //{
            //    double distance_moyenne_cycle = 0;
            //    int PointDep = 1;
            //    distance_moyenne_cycle = distance_moyenne_cycle + ListeDist[PointDep - 1];
            //    Preci += distance_moyenne_cycle;
            //}
            for (int m = 0; m < ListeDist.Count; m++)
            {
                //double distance_moyenne_cycle = 0.0;
                //int PointDep = 1;
                Preci += ListeDist[m];
                //Preci += distance_moyenne_cycle;
            }

            return(Preci / ListeDist.Count);
        }
예제 #15
0
        private void EnregistrerCycle(PositionDataModel positions, ref SingletonReeducation ValeurReeducation, ref List <DataPosition> tempData)
        {
            if ((positions.PositionY / 100.0 < DETECT_CYCLE))
            {
                zzzTime = true;
            }

            if ((positions.PositionY / 100.0 >= DETECT_CYCLE) && (positions.PositionY / 100.0 > tempsMvtLongDroite.Y) && zzzTime == true)//En Cycle
            {
                _tabtempsMvtLongDroite.Add(new DataPosition(positions.PositionX / 100.0, positions.PositionY / 100.0));
                if (zzzIndex == false)
                {
                    tab10Index[0, CountCycle] = tempData.Count - 1;   // enregistrement index debut
                    zzzIndex = true;
                }
                cycleActif = true;
            }
            else if ((positions.PositionY / 100.0 < DETECT_CYCLE) && (positions.PositionY / 100.0 < tempsMvtLongDroite.Y) && cycleActif == true)//Fin de cycle
            {
                if (_tabtempsMvtLongDroite.Count != 0)
                {
                    DataPosition min = new DataPosition();
                    min.X = _tabtempsMvtLongDroite[0].X;
                    min.Y = _tabtempsMvtLongDroite[0].Y;

                    if (carreCycle == false)
                    {
                        for (int i = 0; i < _tabtempsMvtLongDroite.Count; i++)
                        {
                            if (_tabtempsMvtLongDroite[i].Y > min.Y)
                            {
                                min.X = _tabtempsMvtLongDroite[i].X;
                                min.Y = _tabtempsMvtLongDroite[i].Y;
                            }
                        }
                    }

                    _tabtempsMvtLongDroite.Clear();                 // clear tableau de detection de fin de cycle
                    tab10Index[1, CountCycle] = tempData.Count - 1; // enregistrement index fin
                    tab10Index[2, CountCycle] = min.X;              // enregistrement index fin
                    tab10Index[3, CountCycle] = min.Y;              // enregistrement index fin

                    zzzIndex = false;

                    CountCycle++;                            // incrementation compteur de cycle
                    Messenger.Default.Send(CountCycle, "CompteurCycle");
                    if (CountCycle >= 10)                    // TODO : ici pour changer
                    {
                        ValeurReeducation.StartStop = false; // activer le post traitement des données
                        longdroitetrou = false;
                        cycleTot       = CountCycle;
                        Messenger.Default.Send(CountCycle, "CompteurCycle");
                        CountCycle = 0; // RAZ du compteur de cycle
                        Messenger.Default.Send(CountCycle, "CompteurCycle");
                        for (int i = 0; i < tempData.Count; i++)
                        {
                            postTempData.Add(new DataPosition(tempData[i].X, tempData[i].Y));
                        }
                    }
                    cycleActif = false;
                }
            }
            longdroitetrou       = false;
            tempsMvtLongDroite.X = positions.PositionX / 100.0;
            tempsMvtLongDroite.Y = positions.PositionY / 100.0;
        }
예제 #16
0
 public ExerciceEvaluation()
 {
     initdetextstop = new DataPosition(0, 0);
 }