コード例 #1
0
        public static List <MeasurementGroup> GroupMeasurements(List <Measurement> measurements)
        {
            List <MeasurementGroup> groups = new List <MeasurementGroup>();
            bool assigned;

            foreach (var measurement in measurements)
            {
                assigned = false;
                foreach (var group in groups)
                {
                    if (measurement.Header.Name.Equals(group.Name) && MeasurementHelpers.CompareProperties(measurement.Properties, group))
                    {
                        group.Measurements.Add(measurement);
                        assigned = true;
                        break;
                    }
                }

                if (!assigned)
                {
                    groups.Add(new MeasurementGroup(measurement));
                }
            }
            return(groups);
        }
コード例 #2
0
        public Result FindAndRemoveFromGroups(List <MeasurementGroup> groups)
        {
            if (groups.Count == 0)
            {
                return(MeasurementToResult(null));
            }
            if (IncludeImageMode)
            {
                Properties.Add("Image Mode", "M mode");
            }

            var groupIndex = groups.FindIndex(g => g.Name.Equals(RawMeasurementName) && MeasurementHelpers.CompareProperties(Properties, g));

            if (groupIndex > -1)
            {
                var group = groups[groupIndex];
                groups.RemoveAt(groupIndex);

                return(MeasurementToResult(group.SelectMean()));
                //return NonMean ? MeasurementToResult(group.SelectNonMean()) : MeasurementToResult(group.SelectMean());
            }

            else
            {
                if (IncludeImageMode)
                {
                    Properties["Image Mode"] = "2D mode";
                    IncludeImageMode         = false;
                    return(FindAndRemoveFromGroups(groups));
                }
                return(MeasurementToResult(null));
            }
        }