Пример #1
0
		public EmbeddedImageGraphic(EmbeddedImageGraphic from)
			:
			base(from) // all is done here, since CopyFrom is virtual!
		{
		}
Пример #2
0
 public EmbeddedImageGraphic(EmbeddedImageGraphic from)
     :
     base(from) // all is done here, since CopyFrom is virtual!
 {
 }
Пример #3
0
		public void PasteObjectsFromClipboard()
		{
			GraphDocument gd = this.Doc;
			var dao = Current.Gui.OpenClipboardDataObject();

			if (dao.GetDataPresent("Altaxo.Graph.Graph3D.GraphObjectListAsXml"))
			{
				object obj = ClipboardSerialization.GetObjectFromClipboard("Altaxo.Graph.Graph3D.GraphObjectListAsXml");
				if (obj is ICollection)
				{
					ICollection list = (ICollection)obj;
					foreach (object item in list)
					{
						if (item is GraphicBase)
							this.ActiveLayer.GraphObjects.Add(item as GraphicBase);
						else if (item is Altaxo.Graph.Graph3D.Plot.IGPlotItem && ActiveLayer is XYZPlotLayer)
							((XYZPlotLayer)ActiveLayer).PlotItems.Add((Altaxo.Graph.Graph3D.Plot.IGPlotItem)item);
					}
				}
				return;
			}
			if (dao.GetDataPresent("Altaxo.Graph.Graph3D.GraphDocumentAsXml"))
			{
				Doc.PasteFromClipboardAsGraphStyle(true);
				return;
			}
			if (dao.GetDataPresent("Altaxo.Graph.Graph3D.GraphLayerAsXml"))
			{
				Doc.PasteFromClipboardAsNewLayer();
				return;
			}

			if (dao.ContainsFileDropList())
			{
				bool bSuccess = false;
				System.Collections.Specialized.StringCollection coll = dao.GetFileDropList();
				foreach (string filename in coll)
				{
					ImageProxy img;
					try
					{
						img = ImageProxy.FromFile(filename);
						if (img != null)
						{
							var size = this.ActiveLayer.Size / 2;

							PointD2D imgSize = img.GetImage().PhysicalDimension;

							double scale = Math.Min(size.X / imgSize.X, size.Y / imgSize.Y);
							imgSize = imgSize * scale;

							EmbeddedImageGraphic item = new EmbeddedImageGraphic(PointD3D.Empty, new VectorD3D(imgSize.X, imgSize.Y, 0), img);
							this.ActiveLayer.GraphObjects.Add(item);
							bSuccess = true;
							continue;
						}
					}
					catch (Exception)
					{
					}
				}
				if (bSuccess)
					return;
			}

			if (dao.GetDataPresent(typeof(System.Drawing.Imaging.Metafile)))
			{
				System.Drawing.Imaging.Metafile img = dao.GetData(typeof(System.Drawing.Imaging.Metafile)) as System.Drawing.Imaging.Metafile;
				if (img != null)
				{
					var size = (0.5 * this.ActiveLayer.Size).WithZ(0);
					EmbeddedImageGraphic item = new EmbeddedImageGraphic(PointD3D.Empty, size, ImageProxy.FromImage(img));
					this.ActiveLayer.GraphObjects.Add(item);
					return;
				}
			}
			if (dao.ContainsImage())
			{
				Image img = dao.GetImage();
				if (img != null)
				{
					var size = 0.5 * this.ActiveLayer.Size.WithZ(0);
					EmbeddedImageGraphic item = new EmbeddedImageGraphic(PointD3D.Empty, size, ImageProxy.FromImage(img));
					this.ActiveLayer.GraphObjects.Add(item);
					return;
				}
			}
		}