protected override bool Receive(FigureProtocol.ShowCommand showCommand) { if (!Figures.ContainsKey(showCommand.FigureId)) { return(false); } Figure fig = Figures[showCommand.FigureId]; fig.Showed = true; foreach (Figure figure in Figures.Values) { if (!figure.Showed) { return(true); } } Execute(@" plt.ion() "); foreach (Figure figure in Figures.Values) { figure.Showed = false; } foreach (Curve curve in fig.Curves.Values) { curve.CachedTime = DateTime.Now; } return(true); }
protected virtual bool Receive(FigureProtocol.ShowCommand showCommand) { return(false); }
protected override bool Receive(FigureProtocol.ShowCommand showCommand) { return(true); }
public override void Check() { int rowNo = InPortList[0].RowNo; int colNo = InPortList[0].ColNo; FigureProtocol.FigureConfig figureConfig = new FigureProtocol.FigureConfig() { FigureId = publisher.Id, Title = varName, RowsCount = rowNo == 0 ? 1 : rowNo, ColumnsCount = colNo == 0 ? 1 : colNo }; publisher.Send(FigureProtocol.FigureConfigLabel, figureConfig); handle = Observation.CreateObservation(varName, rowNo, colNo); if (rowNo > 0 && colNo > 0) { for (int i = 0; i < rowNo; i++) { for (int j = 0; j < colNo; j++) { string observationName = $"{varName}({i}-{j})"; FigureProtocol.PlotConfig plotConfig = new FigureProtocol.PlotConfig() { FigureId = publisher.Id, RowNO = i, ColumnNO = j, XLabel = "time/s", YLabel = observationName }; publisher.Send(FigureProtocol.PlotConfigLabel, plotConfig); FigureProtocol.Curve curve = new FigureProtocol.Curve() { FigureId = publisher.Id, CurveHandle = i * colNo + j, RowNO = i, ColumnNO = j }; publisher.Send(FigureProtocol.CurveLabel, curve); } } } else { FigureProtocol.PlotConfig plotConfig = new FigureProtocol.PlotConfig() { FigureId = publisher.Id, RowNO = 0, ColumnNO = 0, XLabel = "time/s", YLabel = varName }; publisher.Send(FigureProtocol.PlotConfigLabel, plotConfig); FigureProtocol.Curve curve = new FigureProtocol.Curve() { FigureId = publisher.Id, CurveHandle = 0, RowNO = 0, ColumnNO = 0 }; publisher.Send(FigureProtocol.CurveLabel, curve); } FigureProtocol.ShowCommand showCommand = new FigureProtocol.ShowCommand() { FigureId = publisher.Id }; publisher.Send(FigureProtocol.ShowCommandLabel, showCommand); }