public BitmapOverlay Copy(TourStop owner) { BitmapOverlay newBmpOverlay = new BitmapOverlay(); newBmpOverlay.Owner = owner; newBmpOverlay.filename = this.filename; newBmpOverlay.X = this.X; newBmpOverlay.Y = this.Y; newBmpOverlay.Width = this.Width; newBmpOverlay.Height = this.Height; newBmpOverlay.Color = this.Color; newBmpOverlay.Opacity = this.Opacity; newBmpOverlay.RotationAngle = this.RotationAngle; newBmpOverlay.Name = this.Name + " - Copy"; return newBmpOverlay; }
void pasteMenu_Click(object sender, EventArgs e) { Undo.Push(new UndoTourSlidelistChange(Language.GetLocalizedText(544, "Paste Object"), tour)); IDataObject dataObject = Clipboard.GetDataObject(); if (dataObject.GetDataPresent(Overlay.ClipboardFormat)) { // add try catch block string xml = dataObject.GetData(Overlay.ClipboardFormat) as string; System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.LoadXml(xml); ClearSelection(); System.Xml.XmlNode parent = doc["Overlays"]; foreach (XmlNode child in parent.ChildNodes) { Overlay copy = Overlay.FromXml(tour.CurrentTourStop, child); if (copy.AnimationTarget != null) { copy.Id = Guid.NewGuid().ToString(); copy.AnimationTarget.TargetID = copy.Id; tour.CurrentTourStop.AnimationTargets.Add(copy.AnimationTarget); } bool found = false; float maxX = 0; float maxY = 0; foreach (Overlay item in tour.CurrentTourStop.Overlays) { if (item.Id == copy.Id && item.GetType() == copy.GetType()) { found = true; if (maxY < item.Y || maxX < item.X) { maxX = item.X; maxY = item.Y; } } } if (found) { copy.X = maxX + 20; copy.Y = maxY + 20; } tour.CurrentTourStop.AddOverlay(copy); Focus = copy; selection.AddSelection(Focus); OverlayList.UpdateOverlayList(tour.CurrentTourStop, Selection); } } else if (UiTools.IsMetaFileAvailable()) { Image img = UiTools.GetMetafileFromClipboard(); if (img != null) { BitmapOverlay bmp = new BitmapOverlay( tour.CurrentTourStop, img); tour.CurrentTourStop.AddOverlay(bmp); bmp.X = contextPoint.X; bmp.Y = contextPoint.Y; Focus = bmp; selection.SetSelection(Focus); OverlayList.UpdateOverlayList(tour.CurrentTourStop, Selection); } } else if (Clipboard.ContainsText() && Clipboard.GetText().Length > 0) { TextObject temp = TextEditor.DefaultTextobject; temp.Text = Clipboard.GetText(); TextOverlay text = new TextOverlay( temp); //text.X = Earth3d.MainWindow.ClientRectangle.Width / 2; //text.Y = Earth3d.MainWindow.ClientRectangle.Height / 2; text.X = contextPoint.X; text.Y = contextPoint.Y; tour.CurrentTourStop.AddOverlay(text); Focus = text; selection.SetSelection(Focus); OverlayList.UpdateOverlayList(tour.CurrentTourStop, Selection); } else if (Clipboard.ContainsImage()) { Image img = Clipboard.GetImage(); BitmapOverlay bmp = new BitmapOverlay( tour.CurrentTourStop, img); tour.CurrentTourStop.AddOverlay(bmp); bmp.X = contextPoint.X; bmp.Y = contextPoint.Y; Focus = bmp; selection.SetSelection(Focus); OverlayList.UpdateOverlayList(tour.CurrentTourStop, Selection); } }
public bool AddPicture(string filename) { if (tour == null || tour.CurrentTourStop == null) { return false; } Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(546, "Insert Picture"), tour)); BitmapOverlay bmp = new BitmapOverlay(tour.CurrentTourStop, filename); bmp.X = 960; bmp.Y = 600; tour.CurrentTourStop.AddOverlay(bmp); OverlayList.UpdateOverlayList(tour.CurrentTourStop, Selection); return true; }
public BitmapOverlay Copy(TourStop owner) { var newBmpOverlay = new BitmapOverlay(); newBmpOverlay.Owner = owner; newBmpOverlay.filename = filename; newBmpOverlay.X = X; newBmpOverlay.Y = Y; newBmpOverlay.Width = Width; newBmpOverlay.Height = Height; newBmpOverlay.Color = Color; newBmpOverlay.Opacity = Opacity; newBmpOverlay.RotationAngle = RotationAngle; newBmpOverlay.Name = Name + " - Copy"; return newBmpOverlay; }