Beispiel #1
0
        /// <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");
            }
        }
Beispiel #2
0
        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);
            }
        }
Beispiel #3
0
        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())));
            }
        }
Beispiel #4
0
		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");
			}
		}
Beispiel #5
0
        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");
            }
        }
Beispiel #6
0
        /// <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");
            }
        }
Beispiel #7
0
        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;
            }
        }
Beispiel #8
0
		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;
			}
		}
Beispiel #9
0
 public override void Run(GraphController ctrl)
 {
     ctrl.EnsureValidityOfCurrentLayerNumber();
     ctrl.Doc.CopyToClipboardLayerAsNative(ctrl.CurrentLayerNumber);
 }
Beispiel #10
0
		public override void Run(GraphController ctrl)
		{
			ctrl.EnsureValidityOfCurrentLayerNumber();
			ctrl.Doc.DeleteLayer(ctrl.CurrentLayerNumber, true);
		}
Beispiel #11
0
 public override void Run(GraphController ctrl)
 {
     ctrl.EnsureValidityOfCurrentLayerNumber();
     ctrl.Doc.DeleteLayer(ctrl.CurrentLayerNumber, true);
 }
Beispiel #12
0
 public override void Run(GraphController ctrl)
 {
     ctrl.EnsureValidityOfCurrentLayerNumber();
     ctrl.Doc.PasteFromClipboardAsTemplateForLayer(ctrl.CurrentLayerNumber);
 }
Beispiel #13
0
		public override void Run(GraphController ctrl)
		{
			ctrl.EnsureValidityOfCurrentLayerNumber();
			ctrl.Doc.CopyToClipboardLayerAsNative(ctrl.CurrentLayerNumber);
		}
Beispiel #14
0
		public override void Run(GraphController ctrl)
		{
			ctrl.EnsureValidityOfCurrentLayerNumber();
			ctrl.Doc.ShowLayerDialog(ctrl.CurrentLayerNumber);
		}
Beispiel #15
0
		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())));
		}
Beispiel #16
0
 public override void Run(GraphController ctrl)
 {
     ctrl.EnsureValidityOfCurrentLayerNumber();
     ctrl.Doc.ShowLayerDialog(ctrl.CurrentLayerNumber);
 }
Beispiel #17
0
		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);
			}
		}
Beispiel #18
0
		public override void Run(GraphController ctrl)
		{
			ctrl.EnsureValidityOfCurrentLayerNumber();
			ctrl.Doc.PasteFromClipboardAsTemplateForLayer(ctrl.CurrentLayerNumber);
		}