/// <inheritdoc /> public override void Run(GraphController ctrl) { ctrl.EnsureValidityOfCurrentLayerNumber(); var currentLayerNumber = ctrl.CurrentLayerNumber; var plotLayer = ctrl.ActiveLayer as XYPlotLayer; if (null != plotLayer) { object o = ClipboardSerialization.GetObjectFromClipboard("Altaxo.Graph.Gdi.Plot.PlotItemCollection.AsXml"); // if at this point obj is a memory stream, you probably have forgotten the deserialization constructor of the class you expect to deserialize here if (o is PlotItemCollection coll) { if (PasteExclusively) { plotLayer.PlotItems.ClearPlotItems(); } foreach (IGPlotItem item in coll) // it is neccessary to add the items to the doc first, because otherwise they don't have names { var clonedItem = (IGPlotItem)item.Clone(); plotLayer.PlotItems.Add(clonedItem); // cloning neccessary because coll will be disposed afterwards, which would destroy all items } } } else { Current.Gui.ErrorMessageBox("'Can only paste plot content to an XYPlotLayer. Please select another layer.", "Operation not possible"); } }
public override void Run(GraphController ctrl) { ctrl.Doc.RootLayer.IsValidIndex(ctrl.CurrentLayerNumber, out var activeLayer); if (!(activeLayer is XYPlotLayer)) { return; } FunctionEvaluationScript script = null; // if (script == null) { script = new FunctionEvaluationScript(); } object[] args = new object[] { script, new ScriptExecutionHandler(EhScriptExecution) }; if (Current.Gui.ShowDialog(args, "Function script")) { ctrl.EnsureValidityOfCurrentLayerNumber(); script = (FunctionEvaluationScript)args[0]; var functItem = new XYFunctionPlotItem(new XYFunctionPlotData(script), new G2DPlotStyleCollection(LineScatterPlotStyleKind.Line, activeLayer.GetPropertyContext())); ((XYPlotLayer)activeLayer).PlotItems.Add(functItem); } }
public override void Run(GraphController ctrl) { ctrl.EnsureValidityOfCurrentLayerNumber(); var xylayer = ctrl.Doc.RootLayer.ElementAt(ctrl.CurrentLayerNumber) as XYPlotLayer; if (null != xylayer) { xylayer.PlotItems.Add(new XYFunctionPlotItem(new XYFunctionPlotData(new PolynomialFunction(new double[] { 0, 0, 1 })), new G2DPlotStyleCollection(LineScatterPlotStyleKind.Line, xylayer.GetPropertyContext()))); } }
public override void Run(GraphController ctrl) { ctrl.EnsureValidityOfCurrentLayerNumber(); var currentLayerNumber = ctrl.CurrentLayerNumber; if (currentLayerNumber.Count != 0) { ctrl.Doc.PasteFromClipboardAsNewLayerBeforeLayerNumber(ctrl.CurrentLayerNumber); } else { Current.Gui.ErrorMessageBox("'Can't paste before the root layer. Please select another layer.", "Operation not possible"); } }
public override void Run(GraphController ctrl) { ctrl.EnsureValidityOfCurrentLayerNumber(); var currentLayerNumber = ctrl.CurrentLayerNumber; if (currentLayerNumber.Count != 0) { ctrl.Doc.PasteFromClipboardAsNewLayerAfterLayerNumber(ctrl.CurrentLayerNumber); } else { Current.Gui.ErrorMessageBox("'Can't paste after the root layer. Please select another layer.", "Operation not possible"); } }
/// <inheritdoc /> public override void Run(GraphController ctrl) { ctrl.EnsureValidityOfCurrentLayerNumber(); var currentLayerNumber = ctrl.CurrentLayerNumber; var plotLayer = ctrl.ActiveLayer as XYPlotLayer; if (null != plotLayer) { var clonedItems = plotLayer.PlotItems.Clone(); ClipboardSerialization.PutObjectToClipboard("Altaxo.Graph.Gdi.Plot.PlotItemCollection.AsXml", clonedItems); } else { Current.Gui.ErrorMessageBox("'Can only copy plot content from an XYPlotLayer. Please select another layer.", "Operation not possible"); } }
public override void Run(GraphController ctrl) { ctrl.EnsureValidityOfCurrentLayerNumber(); var t1 = ctrl.ActiveLayer as XYPlotLayer; if (null != t1) { XYPlotLayerController.ShowDialog(t1); return; } var t2 = ctrl.ActiveLayer; if (null != t2) { HostLayerController.ShowDialog(t2); return; } }
public override void Run(GraphController ctrl) { ctrl.EnsureValidityOfCurrentLayerNumber(); ctrl.Doc.CopyToClipboardLayerAsNative(ctrl.CurrentLayerNumber); }
public override void Run(GraphController ctrl) { ctrl.EnsureValidityOfCurrentLayerNumber(); ctrl.Doc.DeleteLayer(ctrl.CurrentLayerNumber, true); }
public override void Run(GraphController ctrl) { ctrl.EnsureValidityOfCurrentLayerNumber(); ctrl.Doc.PasteFromClipboardAsTemplateForLayer(ctrl.CurrentLayerNumber); }
public override void Run(GraphController ctrl) { ctrl.EnsureValidityOfCurrentLayerNumber(); ctrl.Doc.ShowLayerDialog(ctrl.CurrentLayerNumber); }
public override void Run(GraphController ctrl) { ctrl.EnsureValidityOfCurrentLayerNumber(); var xylayer = ctrl.Doc.RootLayer.ElementAt(ctrl.CurrentLayerNumber) as XYPlotLayer; if (null != xylayer) xylayer.PlotItems.Add(new XYFunctionPlotItem(new XYFunctionPlotData(new PolynomialFunction(new double[] { 0, 0, 1 })), new G2DPlotStyleCollection(LineScatterPlotStyleKind.Line, xylayer.GetPropertyContext()))); }
public override void Run(GraphController ctrl) { HostLayer activeLayer; ctrl.Doc.RootLayer.IsValidIndex(ctrl.CurrentLayerNumber, out activeLayer); if (!(activeLayer is XYPlotLayer)) return; FunctionEvaluationScript script = null; // if (script == null) script = new FunctionEvaluationScript(); object[] args = new object[] { script, new ScriptExecutionHandler(this.EhScriptExecution) }; if (Current.Gui.ShowDialog(args, "Function script")) { ctrl.EnsureValidityOfCurrentLayerNumber(); script = (FunctionEvaluationScript)args[0]; XYFunctionPlotItem functItem = new XYFunctionPlotItem(new XYFunctionPlotData(script), new G2DPlotStyleCollection(LineScatterPlotStyleKind.Line, activeLayer.GetPropertyContext())); ((XYPlotLayer)activeLayer).PlotItems.Add(functItem); } }