private void DrawDistances(SolidBrush brushFill, Color baseBrushFillColor, int alphaBackground, double opacity, Graphics canvas, IImageToViewportTransformer transformer, List <Point> points)
        {
            foreach (GenericPostureDistance distance in genericPosture.Distances)
            {
                if (!IsActive(distance.OptionGroup))
                {
                    continue;
                }

                PointF untransformedA = distance.Point1 >= 0 ? genericPosture.PointList[distance.Point1] : GetUntransformedComputedPoint(distance.Point1);
                PointF untransformedB = distance.Point2 >= 0 ? genericPosture.PointList[distance.Point2] : GetUntransformedComputedPoint(distance.Point2);
                string label          = CalibrationHelper.GetLengthText(untransformedA, untransformedB, true, true);

                if (!string.IsNullOrEmpty(distance.Symbol))
                {
                    label = string.Format("{0} = {1}", distance.Symbol, label);
                }

                PointF a = distance.Point1 >= 0 ? points[distance.Point1] : GetComputedPoint(distance.Point1, transformer);
                PointF b = distance.Point2 >= 0 ? points[distance.Point2] : GetComputedPoint(distance.Point2, transformer);

                brushFill.Color = distance.Color == Color.Transparent ? baseBrushFillColor : Color.FromArgb(alphaBackground, distance.Color);
                DrawDistanceText(a, b, label, canvas, opacity, transformer, brushFill);
            }

            brushFill.Color = baseBrushFillColor;
        }
Exemplo n.º 2
0
        private void InitializeValues()
        {
            bool calibrated = false;

            if (calibrationHelper.IsCalibrated && calibrationHelper.CalibratorType == CalibratorType.Line)
            {
                string text = calibrationHelper.GetLengthText(line.A, line.B, true, false);
                float  value;
                bool   parsed = float.TryParse(text, out value);
                if (parsed)
                {
                    nudMeasure.Value     = (decimal)value;
                    cbUnit.SelectedIndex = (int)calibrationHelper.LengthUnit;
                    cbAxis.SelectedIndex = (int)calibrationHelper.CalibrationAxis;
                    calibrated           = true;
                }
            }

            if (!calibrated)
            {
                nudMeasure.Value     = 100;
                cbUnit.SelectedIndex = (int)LengthUnit.Centimeters;
                cbAxis.SelectedIndex = (int)CalibrationAxis.LineHorizontal;
            }
        }
Exemplo n.º 3
0
        private string GetExtraDataText()
        {
            if (trackExtraData == TrackExtraData.None)
            {
                return("");
            }

            string displayText = "###";

            switch (trackExtraData)
            {
            case TrackExtraData.Name:
                displayText = name;
                break;

            case TrackExtraData.TotalDistance:
            default:
                PointF a = new PointF(points["a"].X, points["a"].Y);
                PointF b = new PointF(points["b"].X, points["b"].Y);
                displayText = CalibrationHelper.GetLengthText(a, b, true, true);
                break;
            }

            return(displayText);
        }
Exemplo n.º 4
0
        private string GetExtraDataText(long currentTimestamp)
        {
            if (trackExtraData == TrackExtraData.None)
            {
                return("");
            }

            string displayText = "###";

            switch (trackExtraData)
            {
            case TrackExtraData.Name:
                displayText = name;
                break;

            case TrackExtraData.TotalDistance:
                PointF o = CalibrationHelper.GetOrigin();
                displayText = CalibrationHelper.GetLengthText(o, points["0"], true, true);
                break;

            case TrackExtraData.Position:
            default:
                displayText = CalibrationHelper.GetPointText(points["0"], true, true, currentTimestamp);
                break;
            }

            return(displayText);
        }
Exemplo n.º 5
0
        private void InitializeValues()
        {
            if (calibrationHelper.IsCalibrated && calibrationHelper.CalibratorType == CalibratorType.Line)
            {
                string text = calibrationHelper.GetLengthText(line.A, line.B, true, false);
                tbMeasure.Text = text;

                cbUnit.SelectedIndex = (int)calibrationHelper.LengthUnit;
            }
            else
            {
                tbMeasure.Text       = "50";
                cbUnit.SelectedIndex = (int)LengthUnit.Centimeters;
            }
        }
Exemplo n.º 6
0
        public override void Draw(Graphics canvas, DistortionHelper distorter, IImageToViewportTransformer transformer, bool selected, long currentTimestamp)
        {
            double opacityFactor = infosFading.GetOpacityFactor(currentTimestamp);

            if (tracking)
            {
                opacityFactor = 1.0;
            }

            if (opacityFactor <= 0)
            {
                return;
            }

            Point start = transformer.Transform(points["a"]);
            Point end   = transformer.Transform(points["b"]);

            using (Pen penEdges = styleHelper.GetPen((int)(opacityFactor * 255), transformer.Scale))
            {
                if (distorter != null && distorter.Initialized)
                {
                    DrawDistorted(canvas, distorter, transformer, penEdges, start, end);
                }
                else
                {
                    DrawStraight(canvas, transformer, penEdges, start, end);
                }
            }

            if (ShowMeasurableInfo)
            {
                // Text of the measure. (The helpers knows the unit)
                PointF a = new PointF(points["a"].X, points["a"].Y);
                PointF b = new PointF(points["b"].X, points["b"].Y);
                labelMeasure.SetText(CalibrationHelper.GetLengthText(a, b, true, true));
                labelMeasure.Draw(canvas, transformer, opacityFactor);
            }
        }