public override void Draw(Graphics _canvas, CoordinateSystem _transformer, bool _bSelected, long _iCurrentTimestamp) { double fOpacityFactor = m_InfosFading.GetOpacityFactor(_iCurrentTimestamp); if (fOpacityFactor <= 0) { return; } int iAlpha = (int)(fOpacityFactor * 255); Point c = _transformer.Transform(m_Center); using (Pen p = m_StyleHelper.GetPen(iAlpha)) using (SolidBrush b = m_StyleHelper.GetBrush((int)(fOpacityFactor * m_iDefaultBackgroundAlpha))) { _canvas.DrawLine(p, c.X - m_iDefaultRadius, c.Y, c.X + m_iDefaultRadius, c.Y); _canvas.DrawLine(p, c.X, c.Y - m_iDefaultRadius, c.X, c.Y + m_iDefaultRadius); _canvas.FillEllipse(b, c.Box(m_iDefaultRadius + 1)); } if (m_bShowCoordinates) { m_LabelCoordinates.SetText(m_ParentMetadata.CalibrationHelper.GetPointText(m_Center, true)); m_LabelCoordinates.Draw(_canvas, _transformer, fOpacityFactor); } }
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; } int iAlpha = (int)(opacityFactor * 255); Point c = transformer.Transform(points["0"]); using (Pen p = styleHelper.GetPen(iAlpha)) using (SolidBrush b = styleHelper.GetBrush((int)(opacityFactor * defaultBackgroundAlpha))) { canvas.DrawLine(p, c.X - defaultRadius, c.Y, c.X + defaultRadius, c.Y); canvas.DrawLine(p, c.X, c.Y - defaultRadius, c.X, c.Y + defaultRadius); canvas.FillEllipse(b, c.Box(defaultRadius + 1)); } if (trackExtraData != TrackExtraData.None) { string text = GetExtraDataText(infosFading.ReferenceTimestamp); miniLabel.SetText(text); miniLabel.Draw(canvas, transformer, opacityFactor); } }
public override void Draw(Graphics canvas, DistortionHelper distorter, IImageToViewportTransformer transformer, bool selected, long currentTimestamp) { double opacityFactor = infosFading.GetOpacityTrackable(trackingTimestamps, currentTimestamp); if (opacityFactor <= 0) { return; } Point start = transformer.Transform(points["a"]); Point end = transformer.Transform(points["b"]); using (Pen penEdges = styleHelper.GetPen(opacityFactor, transformer.Scale)) using (Brush brush = styleHelper.GetBrush(opacityFactor)) { if (distorter != null && distorter.Initialized) { DrawDistorted(canvas, distorter, transformer, penEdges, brush, start, end); } else { DrawStraight(canvas, transformer, penEdges, brush, start, end); } } if (trackExtraData != TrackExtraData.None) { string text = GetExtraDataText(); miniLabel.SetText(text); miniLabel.Draw(canvas, transformer, opacityFactor); } }
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; } int iAlpha = (int)(opacityFactor * 255); Point c = transformer.Transform(points["0"]); using (Pen p = styleHelper.GetPen(iAlpha)) using (SolidBrush b = styleHelper.GetBrush((int)(opacityFactor * defaultBackgroundAlpha))) { canvas.DrawLine(p, c.X - defaultRadius, c.Y, c.X + defaultRadius, c.Y); canvas.DrawLine(p, c.X, c.Y - defaultRadius, c.X, c.Y + defaultRadius); canvas.FillEllipse(b, c.Box(defaultRadius + 1)); } if (ShowMeasurableInfo) { labelCoordinates.SetText(CalibrationHelper.GetPointText(new PointF(points["0"].X, points["0"].Y), true, true, infosFading.ReferenceTimestamp)); labelCoordinates.Draw(canvas, transformer, opacityFactor); } }
public override void Draw(Graphics _canvas, CoordinateSystem _transformer, bool _bSelected, long _iCurrentTimestamp) { double fOpacityFactor = m_InfosFading.GetOpacityFactor(_iCurrentTimestamp); if (fOpacityFactor <= 0) { return; } Quadrilateral quad = _transformer.Transform(m_Corners); using (m_PenEdges = m_StyleHelper.GetPen(fOpacityFactor, 1.0)) using (SolidBrush br = m_StyleHelper.GetBrush(fOpacityFactor)) { // Handlers foreach (Point p in quad) { _canvas.FillEllipse(br, p.Box(4)); } // Grid if (m_bValidPlane) { float[] homography = GetHomographyMatrix(quad.ToArray()); // Rows for (int iRow = 0; iRow <= m_iDivisions; iRow++) { float v = (float)iRow / m_iDivisions; PointF h1 = ProjectiveMapping(new PointF(0, v), homography); PointF h2 = ProjectiveMapping(new PointF(1, v), homography); _canvas.DrawLine(m_PenEdges, h1, h2); } // Columns for (int iCol = 0; iCol <= m_iDivisions; iCol++) { float h = (float)iCol / m_iDivisions; PointF h1 = ProjectiveMapping(new PointF(h, 0), homography); PointF h2 = ProjectiveMapping(new PointF(h, 1), homography); _canvas.DrawLine(m_PenEdges, h1, h2); } } else { // Non convex quadrilateral: only draw the borders _canvas.DrawLine(m_PenEdges, quad.A, quad.B); _canvas.DrawLine(m_PenEdges, quad.B, quad.C); _canvas.DrawLine(m_PenEdges, quad.C, quad.D); _canvas.DrawLine(m_PenEdges, quad.D, quad.A); } } }
public override void Draw(Graphics canvas, DistortionHelper distorter, IImageToViewportTransformer transformer, bool selected, long currentTimestamp) { double opacityFactor = infosFading.GetOpacityFactor(currentTimestamp); if (opacityFactor <= 0) { return; } List <Point> screenPoints = transformer.Transform(points); using (penEdges = styleHelper.GetPen(opacityFactor, 1.0)) using (SolidBrush br = styleHelper.GetBrush(opacityFactor)) { int rows = subdivisions + 1; int cols = rows; // Rows for (int i = 0; i < rows; i++) { int row = i; List <Point> line = new List <Point>(); for (int j = 0; j < cols; j++) { int index = row * cols + j; line.Add(screenPoints[index]); } canvas.DrawCurve(penEdges, line.ToArray()); } // Columns for (int i = 0; i < cols; i++) { int col = i; List <Point> line = new List <Point>(); for (int j = 0; j < rows; j++) { int index = j * cols + col; line.Add(screenPoints[index]); } canvas.DrawCurve(penEdges, line.ToArray()); } // Handles foreach (PointF p in screenPoints) { canvas.FillEllipse(br, p.Box(4)); } } }
public override void Draw(Graphics canvas, DistortionHelper distorter, IImageToViewportTransformer transformer, bool selected, long currentTimestamp) { double opacityFactor = infosFading.GetOpacityTrackable(trackingTimestamps, currentTimestamp); if (opacityFactor <= 0) { return; } QuadrilateralF quad = transformer.Transform(quadImage); bool drawEdgesOnly = !planeIsConvex || (!styleHelper.Perspective && !quadImage.IsAxisAlignedRectangle); using (penEdges = styleHelper.GetPen(opacityFactor, 1.0)) using (SolidBrush br = styleHelper.GetBrush(opacityFactor)) { foreach (PointF p in quad) { canvas.FillEllipse(br, p.Box(4)); } if (!drawEdgesOnly) { if (distorter != null && distorter.Initialized) { QuadrilateralF undistortedQuadImage = distorter.Undistort(quadImage); projectiveMapping.Update(quadPlane, undistortedQuadImage); } else { projectiveMapping.Update(quadPlane, quadImage); } DrawGrid(canvas, penEdges, projectiveMapping, distorter, transformer); } else { // Non convex quadrilateral or non rectangle 2d grid: only draw the edges. canvas.DrawLine(penEdges, quad.A, quad.B); canvas.DrawLine(penEdges, quad.B, quad.C); canvas.DrawLine(penEdges, quad.C, quad.D); canvas.DrawLine(penEdges, quad.D, quad.A); } } }
public override void Draw(Graphics canvas, DistortionHelper distorter, IImageToViewportTransformer transformer, bool selected, long currentTimestamp) { double opacityFactor = infosFading.GetOpacityFactor(currentTimestamp); if (opacityFactor <= 0) { return; } QuadrilateralF quad = transformer.Transform(quadImage); using (penEdges = styleHelper.GetPen(opacityFactor, 1.0)) using (SolidBrush br = styleHelper.GetBrush(opacityFactor)) { foreach (PointF p in quad) { canvas.FillEllipse(br, p.Box(4)); } if (planeIsConvex) { if (distorter != null && distorter.Initialized) { QuadrilateralF undistortedQuadImage = distorter.Undistort(quadImage); projectiveMapping.Update(quadPlane, undistortedQuadImage); } else { projectiveMapping.Update(quadPlane, quadImage); } //DrawDiagonals(canvas, penEdges, quadPlane, projectiveMapping, distorter, transformer); DrawGrid(canvas, penEdges, projectiveMapping, distorter, transformer); } else { // Non convex quadrilateral: only draw the edges. canvas.DrawLine(penEdges, quad.A, quad.B); canvas.DrawLine(penEdges, quad.B, quad.C); canvas.DrawLine(penEdges, quad.C, quad.D); canvas.DrawLine(penEdges, quad.D, quad.A); } } }