private void DealWithMouseUpMove(PanelControl pan, MouseEventArgs e) { int tag = (int)pan.GPan.Tag; if (tag == 0) { if (CheckBoundaryMove(pan, e.X)) { return; } if (CheckMarkerMove(pan, e.X, e.Y)) { return; } } if (_graphParameters.CheckGraphTooltip) { if (_graphPanel.Gdata.NearGraph(pan, e.X, e.Y)) { _graphPanel.Gdata.ToolTipGraph(pan, _graphPanel.Gdata.LastNearString, e.X, e.Y); } } pan.GPan.ContextMenu = pan.ConMenu; pan.GPan.Cursor = Cursors.Cross; }
private bool CheckMarkerMove(PanelControl pan, int xPosition, int yPosition) { if (!_graphPanel.ShowBoundaries) { return(false); } _movingHorizontal = false; _markerMoveId = _graphBoundary.NearMarker(pan, xPosition); if (_markerMoveId == -1) { _markerMoveId = _graphBoundary.NearHMarker(pan, yPosition); if (_markerMoveId == -1) { return(false); } _movingHorizontal = true; } if (!_graphBoundary.CanMoveMarker) { return(true); } if (_movingHorizontal) { pan.GPan.Cursor = Cursors.SizeNS; } else { pan.GPan.Cursor = Cursors.SizeWE; } pan.GPan.ContextMenu = pan.MarkerConMenu; _graphParameters.LastMarkerMoveId = _markerMoveId; return(true); }
internal void MoveHMarker(PanelControl pan, int gid, int y) { if (!CanMoveMarker) { return; } if (gid == -1) { return; } var newY = _graphParameters.GetYFromScr(pan, y); if (_graphTabPanel.Cst.Graphs[gid].ObjectTag == null) { return; } if (_graphTabPanel.Cst.Graphs[gid].ObjectTag.TypeId == GraphManipulationType.GeneralMarker) { _graphTabPanel.Cst.Graphs[gid].DPts[0].Y = (float)newY; _graphPanel.RedrawAll(); return; } _graphPanel.RedrawAll(); }
internal int NearHMarker(PanelControl pan, int yPosition) { if (!CanMoveMarker) { return(-1); } if (_graphTabPanel.Cst.Graphs == null) { return(-1); } for (var i = 0; i < _graphTabPanel.Cst.Graphs.Length; i++) { if (_graphTabPanel.Cst.Graphs[i].GType != GraphType.MoveableMarker) { continue; } var y = Params.GetYScreenPoint(pan, _graphTabPanel.Cst.Graphs[i].DPts[0].Y); if (Math.Abs(y - yPosition) < 3) { return(i); } } return(-1); }
internal void MoveMarker(PanelControl pan, int gid, int x) { if (!CanMoveMarker) { return; } if (gid == -1) { return; } var newX = (x + pan.XOffset) / pan.XScale; if (_graphTabPanel.Cst.Graphs[gid].ObjectTag == null) { return; } if (_graphTabPanel.Cst.Graphs[gid].ObjectTag.TypeId == GraphManipulationType.GeneralMarker) { _graphTabPanel.Cst.Graphs[gid].DPts[0].X = (float)newX; _graphPanel.RedrawAll(); return; } _graphPanel.RedrawAll(); }
/// <summary> /// /// </summary> /// <param name="pan"></param> /// <param name="tag"></param> /// <param name="visible"></param> /// <returns></returns> public bool ResetAsubtag(PanelControl pan, int tag, bool visible) { if (pan.TagList == null) { return(false); } var asMaster = false; if (tag < 0) { tag = Math.Abs(tag); asMaster = true; } foreach (var t in pan.TagList.Where(t => t.Tag == tag)) { t.Master = asMaster; t.Visible = visible; t.CanBeVisible = visible; SetTickVisible(visible); SetVisibleTick(ref pan.ConMenu, tag); SetTickVisible(true); return(true); } return(false); }
/// <summary> /// /// </summary> /// <param name="pan"></param> /// <param name="tagV"></param> public void SetAsubtag(PanelControl pan, GraphControl tagV) { var cnt = 0; if (pan.TagList != null) { cnt = pan.TagList.Length; for (var i = 0; i < cnt; i++) { if (pan.TagList[i].Tag == tagV.Tag) { return; } } } Array.Resize(ref pan.TagList, cnt + 1); pan.TagList[cnt] = new GraphControl(tagV.Tag, tagV.Colour) { Highlight = tagV.Highlight }; SetTickVisible(true); SetVisibleTick(ref pan.ConMenu, pan.TagList[cnt].Tag); }
internal void FillBoundaries(PanelControl pan) { if (_graphTabPanel.Cst.Graphs == null) { return; } if (pan.TagList == null) { return; } var pp = new Pen(Color.Black); var hbr = new HatchBrush(HatchStyle.Percent50, Color.Wheat, Color.Transparent); foreach (var t in pan.TagList) { var gs = _graphPanel.GetGraphSurfaceFromTag(t.Tag); if (!IsGraphSurfaceBoundaryOk(gs)) { continue; } if (gs.ObjectTag.TypeId == GraphManipulationType.MeasurementMarker) { if (gs.ObjectTag.Values == null) { continue; } if (gs.ObjectTag.Values[0] < 0.0) { continue; } } pp.Color = t.Colour.Color; pp.Width = t.Highlight ? 2 : 1; for (var j = 0; j < gs.PtCount - 1; j += 2) { var xx1 = gs.DPts[j].X; var xx2 = gs.DPts[j + 1].X; var x1 = Params.GetXScreenPoint(pan, gs, xx1); int x2; if (xx2 > xx1) { x2 = Params.GetXScreenPoint(pan, gs, xx2); } else { x2 = Params.GetXScreenPoint(pan, gs, 360); pan.GrSurface.FillRectangle(hbr, x1, 0, x2 - x1, pan.GPan.Height); x1 = Params.GetXScreenPoint(pan, gs, 0); x2 = Params.GetXScreenPoint(pan, gs, xx2); } pan.GrSurface.FillRectangle(hbr, x1, 0, x2 - x1, pan.GPan.Height); } } }
private void DrawCursor(PanelControl pan, int x, int y) { _graphParameters.CursorY = y; _graphParameters.CursorX = x; _graphParameters.BoxBotX = x; _graphParameters.BoxBotY = y; _graphParameters.CursorPan = pan; _graphPanel.RefreshDrawing(pan); }
private void DownRightButton(PanelControl pan, MouseEventArgs e) { if (_graphParameters.BoundaryMoveId != -1) { return; } pan.XPanStart = e.X; pan.YPanStart = e.Y; _graphParameters.Panning = true; }
public void MoveBoundary(PanelControl pan, int gid, int pid, int x) { var ok = false; if (gid == -1 || pid == -1) { return; } if (_graphTabPanel.Cst.Graphs == null) { return; } var newX = (x + pan.XOffset) / pan.XScale; var found = false; for (var i = 0; i < _graphTabPanel.Cst.Graphs.Length; i++) { if (_graphTabPanel.Cst.Graphs[i].TagId != gid) { continue; } gid = i; found = true; break; } if (!found) { return; } if (_graphTabPanel.Cst.Graphs[gid].ObjectTag == null) { return; } if (_graphTabPanel.Cst.Graphs[gid].ObjectTag.TypeId == GraphManipulationType.WbWaferStartStop) { ok = MoveBowWafer(gid, newX); } else { _graphTabPanel.Cst.Graphs[gid].DPts[pid].X = (float)newX; } if (ok && BoundaryCallback != null) { var ev = new BoundaryEventArgs { BoundarySetId = _graphTabPanel.Cst.Graphs[gid].ObjectTag.MyId }; BoundaryCallback(this, ev); } _graphPanel.RedrawAll(); }
internal void FillLegend(PanelControl panelControl) { try { FillLegend2(panelControl); } catch { // ignored } }
private void SetCursorActive(PanelControl pan, bool active) { _graphParameters.CursorActive = active; if (!active) { _graphParameters.CrossX = 0; _graphParameters.CrossY = 0; _graphParameters.CursorY = 0; _graphParameters.CursorX = 0; } _graphPanel.RefreshDrawing(pan); }
private static void DrawLeftRightArrowHeads(PanelControl pan, Pen p, int y, int x1, int x2) { const int siz = 16; var sign = 1; if (x1 > x2) { sign = -1; } DrawArrowHead(pan, p, x1, y, siz * sign); DrawArrowHead(pan, p, x2, y, siz * sign * -1); }
private void DrawYAbove(PanelControl pan, double yStep, int yPosition, GraphSurface gs, double minValue, double maxValue) { double value = 0; double dyPos = yPosition; var checkValue = Math.Abs(minValue + (20.0 * maxValue)); do { dyPos = dyPos - yStep; value = value + maxValue; DrawYAxisBits(pan, (int)dyPos, gs, value, checkValue); } while (dyPos > 0); }
private void DealWithYMove(PanelControl pan, int y) { if (Math.Abs(_firstBoundaryY - y) > 5 || _alwaysMoveBoundary) { _graphParameters.PauseLiveData(true); _alwaysMoveBoundary = true; if (_markerMoveId != -1) { pan.GPan.ContextMenu = null; _graphBoundary.MoveHMarker(pan, _markerMoveId, y); } } }
/// <summary> /// /// </summary> /// <param name="pan"></param> /// <param name="id"></param> private void SetMasterGraph(ref PanelControl pan, int id) { if (pan.TagList == null) { return; } foreach (var t in pan.TagList) { t.Master = false; } pan.TagList[id].Master = true; _graphParameters.MasterCallBack(); }
private static void DrawArrowHead(PanelControl pan, Pen p, int x, int y, int dx) { var pts = new Point[4]; pts[0].X = x; pts[0].Y = y; pts[1].X = x + dx; pts[1].Y = y + 4; pts[2].X = pts[1].X; pts[2].Y = pts[1].Y - 8; pts[3].X = pts[0].X; pts[3].Y = pts[0].Y; pan.GrSurface.FillPolygon(p.Brush, pts); }
internal void UpdateLegend(PanelControl pan) { try { SuspendDrawing(this); EmptyLegend(); FillLegend(pan); UpdateMinMax(pan); } // ReSharper disable once EmptyGeneralCatchClause catch { } ResumeDrawing(this); }
private void DealWithMouseDownMove(PanelControl pan, MouseEventArgs e) { if (!e.Button.Equals(MouseButtons.Left)) { return; } if (_movingHorizontal) { DealWithYMove(pan, e.Y); } else { DealWithXMove(pan, e.X); } }
private void DrawYBelow(PanelControl pan, double yStep, int yPosition, GraphSurface gs, double minValue, double maxValue) { double dyPos = yPosition; var checkValue = Math.Abs(minValue + (20.0 * maxValue)); dyPos = dyPos - yStep; var value = maxValue; do { dyPos = dyPos + yStep; value = value - maxValue; DrawYAxisBits(pan, (int)dyPos, gs, value, checkValue); } while (dyPos < pan.GPan.Height); }
private void DealWithPanMove(PanelControl pan) { pan.XPan = _currentX - pan.XPanStart; pan.YPan = _currentY - pan.YPanStart; if (Math.Abs(pan.XPan) > 10 || Math.Abs(pan.YPan) > 10) { pan.GPan.ContextMenu = null; pan.GPan.Cursor = Cursors.NoMove2D; _graphPanel.RedrawAll(); } else { pan.XPan = 0; pan.YPan = 0; } }
/// <summary> /// /// </summary> /// <param name="pan"></param> /// <param name="gString"></param> /// <param name="x"></param> /// <param name="y"></param> public void ToolTipGraph(PanelControl pan, string gString, int x, int y) { x = pan.GPan.Left + x; y = pan.GPan.Top + y + 50; if (Math.Abs(x - _lastTx) < 5 && Math.Abs(y - _lastTy) < 5) { return; } _graphToolTip.BackColor = Color.LightGray; _graphToolTip.ForeColor = Color.Black; _graphToolTip.IsBalloon = false; _graphToolTip.Show(gString, _graphPanel, x, y, 2000); _lastTx = x; _lastTy = y; }
private void DrawBoundaryMarkers(GraphSurface gs, PanelControl pan, Pen pp, int y, ref int yOffset) { var f = new Font("timesnewroman", 8); for (var j = 0; j < gs.PtCount; j++) { var x = Params.GetXScreenPoint(pan, gs, gs.DPts[j].X); if (x > 0) { pan.GrSurface.DrawLine(pp, x, 0, x, pan.GPan.Height); } if (gs.DPts[j].Y > 0) { var yy = Params.GetYScreenPoint(pan, gs.DPts[j].Y); if (yy > 0) { pan.GrSurface.DrawLine(pp, 0, yy, pan.GPan.Width, yy); } } double val = gs.DPts[j].X; string valueString; if (val > 1000) { valueString = ((int)val).ToString(CultureInfo.InvariantCulture); } else { var str1 = Params.SetPlaces(val); valueString = val.ToString(str1); } if (_graphParameters.DrawBoundaryStrings) { var str = gs.Name + " " + valueString; pan.GrSurface.DrawString(str, f, pp.Brush, x + 1, y); } if (_graphParameters.ShowDifferenceMarkers) { DrawDifferenceMarkers(gs, pan, x, f, pp, ref yOffset); } } }
private void SetPanel(PanelControl pan) { pan.YAxisMin = (double)YAxisMin.Value; pan.YAxisMax = (double)YAxisMax.Value; if (YAxisAutoFixed.Checked) { pan.YAxisType = YAxisType.Auto; } else if (YAxisAutoFree.Checked) { pan.YAxisType = YAxisType.Free; } else if (YAXisFixedMinMax.Checked) { pan.YAxisType = YAxisType.MinMax; } _graphPanel.ResetY(pan); }
internal void UpdateMinMax(PanelControl pan) { _panelControl = pan; if (!Visible) { return; } SetUpdateCallBack d = DoTheUpdate; try { Invoke(d); } // ReSharper disable once EmptyGeneralCatchClause catch { } }
private void DealWithXMove(PanelControl pan, int x) { if (Math.Abs(_firstBoundaryX - x) > 5 || _alwaysMoveBoundary) { _graphParameters.PauseLiveData(true); _alwaysMoveBoundary = true; if (_graphParameters.BoundaryMoveId != -1) { pan.GPan.ContextMenu = null; _graphBoundary.MoveBoundary(pan, _graphParameters.BoundaryMoveId, _graphParameters.BoundaryIndexId, x); } else if (_markerMoveId != -1) { pan.GPan.ContextMenu = null; _graphBoundary.MoveMarker(pan, _markerMoveId, x); } } }
private static void DrawDifferenceMarkerSet(GraphSurface gs2, PanelControl pan, float refX, int x, Font f, Pen pp, ref int yOffset) { var typ = gs2.GType; if (!IsAnyMarkerOrBoundary(typ)) { return; } for (var n = 0; n < gs2.PtCount; n++) { var x2 = Params.GetXScreenPoint(pan, gs2, gs2.DPts[n].X); if ((!IsAnyMarker(typ) || x2 <= x) && typ != GraphType.Boundary) { continue; } var y = 30 + (yOffset * 12); pan.GrSurface.DrawLine(pp, x, y, x2, y); DrawLeftRightArrowHeads(pan, pp, y, x, x2); double val = gs2.DPts[n].X - refX; string valueString; if (val > 1000) { valueString = ((int)val).ToString(CultureInfo.InvariantCulture); } else { var str1 = Params.SetPlaces(val); valueString = val.ToString(str1); } if (x2 > x) { pan.GrSurface.DrawString(valueString, f, pp.Brush, x2 + 5, y - 5); } else { pan.GrSurface.DrawString(valueString, f, pp.Brush, x + 5, y - 5); } yOffset += 1; } }
private void DrawYAxisBits(PanelControl pan, int yPosition, GraphSurface gs, double value, double checkValue) { var f = new Font("timesnewroman", 10); if (_graphParameters.DrawTheGrid) { if (UseGreyGrid) { Pen p = new Pen(Color.DarkSlateBlue) { DashStyle = DashStyle.Dot }; pan.GrSurface.DrawLine(p, 0, yPosition, pan.GPan.Width, yPosition); } else { pan.GrSurface.DrawLine(Pens.Gainsboro, 0, yPosition, pan.GPan.Width, yPosition); } } if (!_graphParameters.DrawTheYAxis) { return; } var str = Params.GetValueString(checkValue, gs, value); var newPosition = yPosition + pan.GPan.Top + 2; var top = pan.GPan.Top + 2; var bot = top + pan.GPan.Height; if (newPosition >= bot || newPosition <= top) { return; } _graphTabPanel.Cst.GrSurface.DrawLine(Pens.Black, pan.GPan.Left - 5, newPosition, pan.GPan.Left, newPosition); if ((newPosition - 5) <= bot) { _graphTabPanel.Cst.GrSurface.DrawString(str, f, Brushes.Black, 15, newPosition - 7); } }
private bool CheckBoundaryMove(PanelControl pan, int xPosition) { if (!_graphPanel.ShowBoundaries) { return(false); } var typeId = GraphManipulationType.NotSet; _graphParameters.BoundaryMoveId = _graphBoundary.NearBoundary(pan, out var id, ref typeId, xPosition); _graphParameters.BoundaryIndexId = id; if (_graphParameters.BoundaryMoveId == -1) { return(false); } pan.GPan.Cursor = Cursors.SizeWE; pan.GPan.ContextMenu = typeId == GraphManipulationType.WbWaferStartStop ? pan.BoundaryConMenu : null; _graphParameters.LastBoundaryMoveId = _graphParameters.BoundaryMoveId; return(true); }