Example #1
0
        public override List <NamedIndexedList> ConsumeFiles(string parameters, params string[] files)
        {
            List <List <PointPositionsList> > filesPointsPositions = files.Select(file => CsvHelper.ParseFileToPointsPositions(file)).ToList();

            // here rescale to be relative
            filesPointsPositions = RescaleRelatively(filesPointsPositions);

            List <List <List <double> > > filesPointsDeltas = filesPointsPositions.Select(filePointPositions => CalculateDeltas(filePointPositions)).ToList();
            List <List <double> >         filesResults      = filesPointsDeltas.Select(pointsDeltas => pointsDeltas.Select(DeltasToResult).ToList()).ToList();

            return(files.Select(file => new NamedIndexedList(file))
                   .Select((fileWithValues, fileIndex) =>
            {
                fileWithValues.SetValuesAutoIndexed(filesResults[fileIndex]);
                return fileWithValues;
            }).ToList());
        }
Example #2
0
        public override List <NamedIndexedList> ConsumeFiles(string parameters, params string[] files)
        {
            List <List <PointPositionsList> > filesPointsPositions = files.Select(file => CsvHelper.ParseFileToPointsPositions(file)).ToList();
            List <List <List <double> > >     filesPointsDeltas    = filesPointsPositions.Select(filePointPositions => CalculateDeltas(filePointPositions)).ToList();

            timeDeltas = filesPointsPositions.Select(filePointPositions => CalculateTimeDeltas(filePointPositions)).ToList();
            List <List <double> > filesResults = filesPointsDeltas.Select((pointsDeltas, i) =>
            {
                currentFileNumber = i;
                return(pointsDeltas.Select(DeltasToResult).ToList());
            }).ToList();

            return(files.Select(file => new NamedIndexedList(file))
                   .Select((fileWithValues, fileIndex) =>
            {
                fileWithValues.SetValuesAutoIndexed(filesResults[fileIndex]);
                return fileWithValues;
            }).ToList());
        }
Example #3
0
        public override List <NamedIndexedList> ConsumeFiles(string parameters, params string[] files)
        {
            List <List <PointPositionsList> > filesPointsPositions = files.Select(file => CsvHelper.ParseFileToPointsPositions(file)).ToList();

            var result    = new List <List <string> >();
            var allPoints = RescaleRelatively(filesPointsPositions)[0];
            List <PointPositionsList.Position> pPositions;

            PointPositionsList.Position pos;
            for (var pointN = 0; pointN < allPoints.Count; ++pointN)
            {
                pPositions = allPoints[pointN].positions;
                for (var posN = 0; posN < pPositions.Count; ++posN)
                {
                    pos = pPositions[posN];
                    if (result.Count <= posN)
                    {
                        result.Add(new List <string> {
                            (1 + 100 * posN).ToString()
                        });
                    }
                    result[posN].Add(string.Format("{0} {1} {2} {3}", pointN, pos.X, pos.Y, pos.Z));
                }
            }
            CsvHelper.WriteCsv(files[0].Insert(files[0].Length - 4, "_rescaled"), null, result);
            // dirty hack to avoid further file creation
            throw new Exception("rescaling done");
        }