Пример #1
0
        public void initWaterfallSpectrumScreen(WaterfallSpectrumWin _root)
        {
            root = _root;

            sizeXLable   = GraphicsUtil.sizeText(Vector.Zero, _axesFont, 1.0, "100k", -1, 2, -1, 0, Vector.X).boundingDim();
            sizeYLable   = GraphicsUtil.sizeText(Vector.Zero, _axesFont, 1.0, "60.0", -1, 2, -1, 0, Vector.X).boundingDim();
            sizeColLable = GraphicsUtil.sizeText(Vector.Zero, _axesFont, 1.0, "-120.0", -1, 2, -1, 0, Vector.X).boundingDim();

            // Horizontal Grid
            gridF = new GridCalculator(0, 1e6, 10, 0.1, 2, 100, 20000, false,
                                       sizeXLable.x + 10, Width - 10, sizeXLable.x + 10);

            // Vertical Grid
            gridY = new GridCalculator(0, 100, 1, 1e-10, 1.1, 0, 30, false,
                                       Height - sizeXLable.y - 10, sizeColLable.y + colbarHeight + 10 + 10, sizeYLable.y + 10);

            // Color Grid
            gridCol = new GridCalculator(-200, 200, 1, 1e-10, 1.1, -120, 0, false,
                                         sizeColLable.x / 2 + 10, Width - sizeColLable.x / 2 - 10, sizeColLable.x + 10);

            ready = true;
        }
        public void CreateSampledMeasurements_Sp02IntegrationTest()
        {
            var gridCalculator = new GridCalculator(_configurationStorage);

            var firstMeasurementTime  = new DateTime(2017, 1, 3, 10, 1, 18);
            var secondMeasurementTime = new DateTime(2017, 1, 3, 10, 3, 43);
            var thirdMeasurementTime  = new DateTime(2017, 1, 3, 10, 5, 0);
            var fourthMeasurementTime = new DateTime(2017, 1, 3, 10, 5, 1);

            const double firstMeasurementValue  = 98.78d;
            const double secondMeasurementValue = 96.49d;
            const double thirdMeasurementValue  = 97.17d;
            const double fourthMeasurementValue = 95.08d;

            var firstMeasurement  = new Measurement(firstMeasurementTime, firstMeasurementValue, Spo2Type);
            var secondMeasurement = new Measurement(secondMeasurementTime, secondMeasurementValue, Spo2Type);
            var thirdMeasurement  = new Measurement(thirdMeasurementTime, thirdMeasurementValue, Spo2Type);
            var fourthMeasurement = new Measurement(fourthMeasurementTime, fourthMeasurementValue, Spo2Type);

            var measurements = new List <Measurement>()
            {
                firstMeasurement, secondMeasurement, thirdMeasurement, fourthMeasurement
            };

            var expectedFirstMeasurementTime  = gridCalculator.GetNextGridPoint(thirdMeasurementTime);
            var expectedSecondMeasurementTime = gridCalculator.GetNextGridPoint(fourthMeasurementTime);

            var expectedFirstMeasurement  = new Measurement(expectedFirstMeasurementTime, thirdMeasurementValue, Spo2Type);
            var expectedSecondMeasurement = new Measurement(expectedSecondMeasurementTime, fourthMeasurementValue, Spo2Type);

            var measurementAccumulator  = new MeasurementAccumulator(gridCalculator);
            var accumulatedMeasurements = measurementAccumulator.CreateSampledMeasurements(measurements);

            Assert.AreEqual(2, accumulatedMeasurements.Count());
            Assert.AreEqual(expectedFirstMeasurement, accumulatedMeasurements.ElementAt(0));
            Assert.AreEqual(expectedSecondMeasurement, accumulatedMeasurements.ElementAt(1));
        }
Пример #3
0
            public void redrawBitmap(ColorTable colorTable, GridCalculator gridF, GridCalculator gridY, GridCalculator gridCol)
            {
                int newWidth  = (int)Math.Floor(gridF.high - gridF.low + 0.5);
                int newHeight = (int)Math.Floor(gridY.low - gridY.high + 0.5);

                if ((newWidth != map.Width) || (newHeight != map.Height))
                {
                    newBitmap(newWidth, newHeight);
                }

                gridFMin           = gridF.min;
                gridFMax           = gridF.max;
                gridFLogScale      = gridF.logScale;
                gridColMin         = gridCol.min;
                gridColMax         = gridCol.max;
                colorTable.changed = false;

                // Clear Map
                System.Array.Clear(mapdata, 0, mapdata.Length);

                int y = map.Height - 1;
                int f = fill;
                int i = 0;

                while ((y >= 0) && (f > 0))
                {
                    WaterfallLine wfl = get(i);
                    if (wfl != null)
                    {
                        wfl.drawToMap(colorTable, gridF, gridCol, mapdata, y * mapstride, map.Width);
                    }
                    i++;
                    y--;
                    f--;
                }
                missingLines = 0;
            }
        public void CreateSampledMeasurements_ReturnsMultipleMeasurementsForMultipleSamplingPoints()
        {
            var gridCalculator = new GridCalculator(_configurationStorage);

            var firstMeasurementTime  = new DateTime(2018, 6, 25, 9, 21, 45);
            var secondMeasurementTime = new DateTime(2018, 6, 25, 9, 27, 12);
            var thirdMeasurementTime  = new DateTime(2018, 6, 25, 9, 57, 15);

            const double firstMeasurementValue  = 1d;
            const double secondMeasurementValue = 2d;
            const double thirdMeasurementValue  = 3d;

            var firstMeasurement  = new Measurement(firstMeasurementTime, firstMeasurementValue, HeartRateType);
            var secondMeasurement = new Measurement(secondMeasurementTime, secondMeasurementValue, HeartRateType);
            var thirdMeasurement  = new Measurement(thirdMeasurementTime, thirdMeasurementValue, HeartRateType);
            var measurements      = new List <Measurement>()
            {
                firstMeasurement, secondMeasurement, thirdMeasurement
            };

            var expectedFirstMeasurementTime  = gridCalculator.GetNextGridPoint(firstMeasurementTime);
            var expectedSecondMeasurementTime = gridCalculator.GetNextGridPoint(secondMeasurementTime);
            var expectedThirdMeasurementTime  = gridCalculator.GetNextGridPoint(thirdMeasurementTime);

            var expectedFirstMeasurement  = new Measurement(expectedFirstMeasurementTime, firstMeasurementValue, HeartRateType);
            var expectedSecondMeasurement = new Measurement(expectedSecondMeasurementTime, secondMeasurementValue, HeartRateType);
            var expectedThirdMeasurement  = new Measurement(expectedThirdMeasurementTime, thirdMeasurementValue, HeartRateType);

            var measurementAccumulator  = new MeasurementAccumulator(gridCalculator);
            var accumulatedMeasurements = measurementAccumulator.CreateSampledMeasurements(measurements);

            Assert.AreEqual(3, accumulatedMeasurements.Count());
            Assert.AreEqual(expectedFirstMeasurement, accumulatedMeasurements.ElementAt(0));
            Assert.AreEqual(expectedSecondMeasurement, accumulatedMeasurements.ElementAt(1));
            Assert.AreEqual(expectedThirdMeasurement, accumulatedMeasurements.ElementAt(2));
        }
Пример #5
0
        void Start()
        {
            int gridHalfSize = visuals.core.Grid.Size / 2;

            GridCalc = new GridCalculator(SCALE, gridHalfSize);
        }
 private void CalculateMonthSize()
 {
     MonthGridSize = GridCalculator.CalculateMonthGridSize(CellSize);
 }
Пример #7
0
            public void updateBitmap(ColorTable colortable, GridCalculator gridF, GridCalculator gridY, GridCalculator gridCol)
            {
                // Check whethter there is really something new
                if (missingLines == 0)
                {
                    return;
                }

                // Check whether complete redo is necessary
                Boolean redo      = false;
                int     newWidth  = (int)Math.Floor(gridF.high - gridF.low + 0.5);
                int     newHeight = (int)Math.Floor(gridY.low - gridY.high + 0.5);

                if ((newWidth != map.Width) || (newHeight != map.Height))
                {
                    redo = true;
                }
                if (colortable.changed)
                {
                    redo = true;
                }
                if ((gridF.min != gridFMin) || (gridF.max != gridFMax) || (gridF.logScale != gridFLogScale))
                {
                    redo = true;
                }
                if ((gridCol.min != gridColMin) || (gridCol.max != gridColMax))
                {
                    redo = true;
                }

                if (redo)
                {
                    redrawBitmap(colortable, gridF, gridY, gridCol);
                    return;
                }

                // Just an update
                // Shift Content
                Array.Copy(mapdata, missingLines * mapstride, mapdata, 0, (map.Height - missingLines) * mapstride);
                int y = map.Height - 1;
                int f = missingLines;
                int i = 0;

                while (f > 0)
                {
                    WaterfallLine wfl = get(i);
                    if (wfl != null)
                    {
                        wfl.drawToMap(colortable, gridF, gridCol, mapdata, y * mapstride, map.Width);
                    }
                    i++;
                    y--;
                    f--;
                }
                missingLines = 0;
            }
Пример #8
0
 private void CalculateYearGridValues()
 {
     YearGridHeight = GridCalculator.CalculateYearGridHeight(CellSize, RowCount);
     YearGridWidth  = GridCalculator.CalculateYearGridWidth(CellSize, ColumnCount);
 }