コード例 #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");
            }
        }
コード例 #2
0
ファイル: GraphCommands.cs プロジェクト: olesar/Altaxo
        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);
            }
        }
コード例 #3
0
ファイル: GraphCommands.cs プロジェクト: olesar/Altaxo
        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())));
            }
        }
コード例 #4
0
ファイル: GraphLayerCommands.cs プロジェクト: Altaxo/Altaxo
		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");
			}
		}
コード例 #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");
            }
        }
コード例 #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");
            }
        }
コード例 #7
0
ファイル: GraphCommands.cs プロジェクト: olesar/Altaxo
        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;
            }
        }
コード例 #8
0
ファイル: GraphCommands.cs プロジェクト: Altaxo/Altaxo
		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;
			}
		}
コード例 #9
0
 public override void Run(GraphController ctrl)
 {
     ctrl.EnsureValidityOfCurrentLayerNumber();
     ctrl.Doc.CopyToClipboardLayerAsNative(ctrl.CurrentLayerNumber);
 }
コード例 #10
0
ファイル: GraphLayerCommands.cs プロジェクト: Altaxo/Altaxo
		public override void Run(GraphController ctrl)
		{
			ctrl.EnsureValidityOfCurrentLayerNumber();
			ctrl.Doc.DeleteLayer(ctrl.CurrentLayerNumber, true);
		}
コード例 #11
0
 public override void Run(GraphController ctrl)
 {
     ctrl.EnsureValidityOfCurrentLayerNumber();
     ctrl.Doc.DeleteLayer(ctrl.CurrentLayerNumber, true);
 }
コード例 #12
0
 public override void Run(GraphController ctrl)
 {
     ctrl.EnsureValidityOfCurrentLayerNumber();
     ctrl.Doc.PasteFromClipboardAsTemplateForLayer(ctrl.CurrentLayerNumber);
 }
コード例 #13
0
ファイル: GraphLayerCommands.cs プロジェクト: Altaxo/Altaxo
		public override void Run(GraphController ctrl)
		{
			ctrl.EnsureValidityOfCurrentLayerNumber();
			ctrl.Doc.CopyToClipboardLayerAsNative(ctrl.CurrentLayerNumber);
		}
コード例 #14
0
ファイル: GraphLayerCommands.cs プロジェクト: Altaxo/Altaxo
		public override void Run(GraphController ctrl)
		{
			ctrl.EnsureValidityOfCurrentLayerNumber();
			ctrl.Doc.ShowLayerDialog(ctrl.CurrentLayerNumber);
		}
コード例 #15
0
ファイル: GraphCommands.cs プロジェクト: Altaxo/Altaxo
		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())));
		}
コード例 #16
0
 public override void Run(GraphController ctrl)
 {
     ctrl.EnsureValidityOfCurrentLayerNumber();
     ctrl.Doc.ShowLayerDialog(ctrl.CurrentLayerNumber);
 }
コード例 #17
0
ファイル: GraphCommands.cs プロジェクト: Altaxo/Altaxo
		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);
			}
		}
コード例 #18
0
ファイル: GraphLayerCommands.cs プロジェクト: Altaxo/Altaxo
		public override void Run(GraphController ctrl)
		{
			ctrl.EnsureValidityOfCurrentLayerNumber();
			ctrl.Doc.PasteFromClipboardAsTemplateForLayer(ctrl.CurrentLayerNumber);
		}