public bool AddShape(string p, ShapeType shapeType) { if (tour == null || tour.CurrentTourStop == null) { return false; } //todo localize Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(548, "Insert Shape"), tour)); ShapeOverlay shape = new ShapeOverlay(tour.CurrentTourStop, shapeType); shape.Width = 200; shape.Height = 200; if (shapeType == ShapeType.Arrow) { shape.Height /= 2; } if (shapeType == ShapeType.Line) { shape.Height = 12; } shape.X = 960; shape.Y = 600; tour.CurrentTourStop.AddOverlay(shape); Focus = shape; selection.SetSelection(Focus); OverlayList.UpdateOverlayList(tour.CurrentTourStop, Selection); return true; }
public Overlay AddOverlay(Overlay ol) { if (tour == null || tour.CurrentTourStop == null) { return null; } if(ol.GetType() == typeof(ShapeOverlay)) { ShapeOverlay srcShapeOverlay = (ShapeOverlay)ol; if (srcShapeOverlay != null) { ShapeOverlay shape = new ShapeOverlay(tour.CurrentTourStop, srcShapeOverlay.ShapeType); shape.Width = srcShapeOverlay.Width; shape.Height = srcShapeOverlay.Height; shape.X = contextPoint.X; shape.Y = contextPoint.Y; shape.Color = srcShapeOverlay.Color; shape.RotationAngle = srcShapeOverlay.RotationAngle; if (ol.AnimationTarget != null) { shape.AnimationTarget = ol.AnimationTarget.Clone(shape); } tour.CurrentTourStop.AddOverlay(shape); return shape; } } else if (ol.GetType() == typeof(TextOverlay)) { TextOverlay srcTxtOverlay = (TextOverlay)ol; if (srcTxtOverlay != null) { TextOverlay text = new TextOverlay(srcTxtOverlay.TextObject); text.X = contextPoint.X; text.Y = contextPoint.Y; text.Color = srcTxtOverlay.Color; if (ol.AnimationTarget != null) { text.AnimationTarget = ol.AnimationTarget.Clone(text); } tour.CurrentTourStop.AddOverlay(text); return text; } } else if (ol.GetType() == typeof(BitmapOverlay)) { BitmapOverlay srcBmpOverlay = (BitmapOverlay)ol; if (srcBmpOverlay != null) { BitmapOverlay bitmap = srcBmpOverlay.Copy(tour.CurrentTourStop); bitmap.X = contextPoint.X; bitmap.Y = contextPoint.Y; if (ol.AnimationTarget != null) { bitmap.AnimationTarget = ol.AnimationTarget.Clone(bitmap); } tour.CurrentTourStop.AddOverlay(bitmap); return bitmap; } } else if (ol.GetType() == typeof(FlipbookOverlay)) { FlipbookOverlay srcFlipbookOverlay = (FlipbookOverlay)ol; if (srcFlipbookOverlay != null) { FlipbookOverlay bitmap = srcFlipbookOverlay.Copy(tour.CurrentTourStop); bitmap.X = contextPoint.X; bitmap.Y = contextPoint.Y; if (ol.AnimationTarget != null) { bitmap.AnimationTarget = ol.AnimationTarget.Clone(bitmap); } tour.CurrentTourStop.AddOverlay(bitmap); return bitmap; } } return null; }